Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement all missing entities and remove overrides on default impl data values. [1.14] #2468

Merged
merged 1 commit into from
Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion SpongeAPI
Submodule SpongeAPI updated 87 files
+91 −6 src/main/java/org/spongepowered/api/data/Keys.java
+18 −18 src/main/java/org/spongepowered/api/data/persistence/DataTranslators.java
+2 −2 src/main/java/org/spongepowered/api/data/type/ParrotTypes.java
+11 −11 src/main/java/org/spongepowered/api/entity/AreaEffectCloud.java
+8 −1 src/main/java/org/spongepowered/api/entity/Entity.java
+1 −1 src/main/java/org/spongepowered/api/entity/ExperienceOrb.java
+7 −7 src/main/java/org/spongepowered/api/entity/FallingBlock.java
+1 −11 src/main/java/org/spongepowered/api/entity/Item.java
+0 −9 src/main/java/org/spongepowered/api/entity/Tamer.java
+2 −2 src/main/java/org/spongepowered/api/entity/explosive/EnderCrystal.java
+1 −1 src/main/java/org/spongepowered/api/entity/explosive/Explosive.java
+2 −2 src/main/java/org/spongepowered/api/entity/explosive/fused/FusedExplosive.java
+1 −1 src/main/java/org/spongepowered/api/entity/explosive/fused/PrimedTNT.java
+1 −1 src/main/java/org/spongepowered/api/entity/hanging/Hanging.java
+1 −1 src/main/java/org/spongepowered/api/entity/hanging/LeashKnot.java
+1 −1 src/main/java/org/spongepowered/api/entity/hanging/Painting.java
+2 −2 src/main/java/org/spongepowered/api/entity/living/Ageable.java
+2 −2 src/main/java/org/spongepowered/api/entity/living/Agent.java
+6 −6 src/main/java/org/spongepowered/api/entity/living/ArmorStand.java
+2 −3 src/main/java/org/spongepowered/api/entity/living/ComplexLiving.java
+2 −3 src/main/java/org/spongepowered/api/entity/living/ComplexLivingPart.java
+4 −4 src/main/java/org/spongepowered/api/entity/living/Humanoid.java
+10 −8 src/main/java/org/spongepowered/api/entity/living/Living.java
+10 −21 src/main/java/org/spongepowered/api/entity/living/animal/Animal.java
+33 −16 src/main/java/org/spongepowered/api/entity/living/animal/Cat.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/animal/Chicken.java
+10 −10 src/main/java/org/spongepowered/api/entity/living/animal/Fox.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/animal/Ocelot.java
+40 −63 src/main/java/org/spongepowered/api/entity/living/animal/Panda.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/animal/Parrot.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/animal/Pig.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/animal/PolarBear.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/animal/Rabbit.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/animal/Sheep.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/animal/Sittable.java
+1 −10 src/main/java/org/spongepowered/api/entity/living/animal/TameableAnimal.java
+11 −0 src/main/java/org/spongepowered/api/entity/living/animal/Wolf.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/animal/cow/Mooshroom.java
+2 −2 src/main/java/org/spongepowered/api/entity/living/animal/horse/Horse.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/animal/horse/PackHorse.java
+2 −2 src/main/java/org/spongepowered/api/entity/living/animal/horse/llama/Llama.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/animal/horse/llama/TraderLlama.java
+2 −2 src/main/java/org/spongepowered/api/entity/living/aquatic/Dolphin.java
+3 −3 src/main/java/org/spongepowered/api/entity/living/aquatic/fish/school/TropicalFish.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/golem/IronGolem.java
+2 −2 src/main/java/org/spongepowered/api/entity/living/golem/Shulker.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/monster/Blaze.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/monster/Creeper.java
+9 −0 src/main/java/org/spongepowered/api/entity/living/monster/Enderman.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/monster/Endermite.java
+3 −3 src/main/java/org/spongepowered/api/entity/living/monster/Patroller.java
+6 −11 src/main/java/org/spongepowered/api/entity/living/monster/Phantom.java
+6 −10 src/main/java/org/spongepowered/api/entity/living/monster/boss/Boss.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/monster/boss/Wither.java
+2 −6 src/main/java/org/spongepowered/api/entity/living/monster/boss/dragon/EnderDragon.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/monster/boss/dragon/EnderDragonPart.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/monster/guardian/Guardian.java
+7 −13 src/main/java/org/spongepowered/api/entity/living/monster/raider/Raider.java
+31 −27 src/main/java/org/spongepowered/api/entity/living/monster/raider/Ravager.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/monster/raider/illager/Pillager.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/monster/raider/illager/Vindicator.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/monster/raider/illager/spellcaster/Evoker.java
+3 −10 src/main/java/org/spongepowered/api/entity/living/monster/raider/illager/spellcaster/Spellcaster.java
+2 −2 src/main/java/org/spongepowered/api/entity/living/monster/slime/Slime.java
+2 −2 src/main/java/org/spongepowered/api/entity/living/monster/spider/Spider.java
+1 −1 src/main/java/org/spongepowered/api/entity/living/monster/zombie/ZombiePigman.java
+2 −2 src/main/java/org/spongepowered/api/entity/living/monster/zombie/ZombieVillager.java
+4 −4 src/main/java/org/spongepowered/api/entity/living/player/Player.java
+26 −0 src/main/java/org/spongepowered/api/entity/living/player/client/package-info.java
+26 −0 src/main/java/org/spongepowered/api/entity/living/player/server/package-info.java
+2 −2 src/main/java/org/spongepowered/api/entity/living/trader/Villager.java
+2 −2 src/main/java/org/spongepowered/api/entity/projectile/DamagingProjectile.java
+2 −2 src/main/java/org/spongepowered/api/entity/projectile/EntityTargetingProjectile.java
+1 −1 src/main/java/org/spongepowered/api/entity/projectile/EyeOfEnder.java
+1 −1 src/main/java/org/spongepowered/api/entity/projectile/FishingBobber.java
+1 −1 src/main/java/org/spongepowered/api/entity/projectile/Potion.java
+7 −17 src/main/java/org/spongepowered/api/entity/projectile/Projectile.java
+1 −1 src/main/java/org/spongepowered/api/entity/projectile/ShulkerBullet.java
+13 −13 src/main/java/org/spongepowered/api/entity/vehicle/Boat.java
+1 −10 src/main/java/org/spongepowered/api/entity/vehicle/minecart/BlockOccupiedMinecart.java
+1 −1 src/main/java/org/spongepowered/api/entity/vehicle/minecart/FurnaceMinecart.java
+6 −6 src/main/java/org/spongepowered/api/entity/vehicle/minecart/MinecartEntity.java
+2 −2 src/main/java/org/spongepowered/api/entity/weather/WeatherEffect.java
+2 −1 src/main/java/org/spongepowered/api/event/entity/living/trader/VillagerEvent.java
+49 −49 src/main/java/org/spongepowered/api/statistic/Statistics.java
+1 −1 src/main/java/org/spongepowered/api/text/format/TextFormat.java
+1 −1 src/main/java/org/spongepowered/api/text/format/TextStyle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.accessor.entity.passive;
i509VCB marked this conversation as resolved.
Show resolved Hide resolved

import net.minecraft.entity.passive.FoxEntity;
import net.minecraft.network.datasync.DataParameter;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

import java.util.Optional;
import java.util.UUID;

@Mixin(FoxEntity.class)
public interface FoxEntityAccessor {

@Accessor("TRUSTED_UUID_SECONDARY") static DataParameter<Optional<UUID>> accessor$getTrustedUuidSecondary() {
throw new IllegalStateException("Untransformed Accessor!");
}

@Accessor("TRUSTED_UUID_MAIN") static DataParameter<Optional<UUID>> accessor$getTrustedUuidMain() {
throw new IllegalStateException("Untransformed Accessor!");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,48 +25,23 @@
package org.spongepowered.common.mixin.api.mcp.entity;

import net.minecraft.entity.AgeableEntity;
import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.manipulator.mutable.entity.AgeableData;
import org.spongepowered.api.data.value.BoundedValue;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.living.Ageable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.common.data.manipulator.mutable.entity.SpongeAgeableData;
import org.spongepowered.common.data.value.SpongeValueFactory;
import org.spongepowered.common.data.value.mutable.SpongeValue;
import org.spongepowered.common.util.Constants;

import java.util.Set;

@Mixin(AgeableEntity.class)
public abstract class AgeableEntityMixin_API extends CreatureEntityMixin_API implements Ageable {

@Shadow public abstract void setScaleForAge(boolean child);
@Shadow public abstract boolean shadow$isChild();

@Shadow public abstract int getGrowingAge();

@Override
public void setScaleForAge() {
this.setScaleForAge(this.shadow$isChild());
}
protected Set<Value.Immutable<?>> api$getVanillaValues() {
final Set<Value.Immutable<?>> values = super.api$getVanillaValues();

@Override
public AgeableData getAgeData() {
return new SpongeAgeableData(this.getGrowingAge(), this.shadow$isChild());
}
values.add(this.age().asImmutable());
values.add(this.adult().asImmutable());

@Override
public BoundedValue.Mutable<Integer> age() {
return SpongeValueFactory.boundedBuilder(Keys.AGEABLE_AGE)
.minimum(Constants.Entity.Ageable.CHILD)
.maximum(Integer.MAX_VALUE)
.defaultValue(Constants.Entity.Ageable.ADULT)
.actualValue(this.getGrowingAge())
.build()
;
return values;
}

@Override
public org.spongepowered.api.data.value.Value.Mutable<Boolean> adult() {
return new SpongeValue<>(Keys.IS_ADULT, true, this.shadow$isChild());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,154 +27,40 @@
import net.minecraft.entity.AreaEffectCloudEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.potion.Potion;
import net.minecraft.util.EnumParticleTypes;
import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.manipulator.mutable.entity.AreaEffectCloudData;
import org.spongepowered.api.effect.particle.ParticleType;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.effect.particle.ParticleTypes;
import org.spongepowered.api.effect.potion.PotionEffect;
import org.spongepowered.api.entity.AreaEffectCloud;
import org.spongepowered.api.util.Color;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.common.data.manipulator.mutable.entity.SpongeAreaEffectData;
import org.spongepowered.common.data.value.SpongeValueFactory;
import org.spongepowered.common.data.value.mutable.SpongeListValue;
import org.spongepowered.common.data.value.mutable.SpongeValue;

import java.util.List;
import java.util.Set;
import java.util.UUID;

@SuppressWarnings("unchecked")
@Mixin(AreaEffectCloudEntity.class)
public abstract class AreaEffectCloudEntityMixin_API extends EntityMixin_API implements AreaEffectCloud {

@Shadow private Potion potion;
@Shadow @Final private List<net.minecraft.potion.EffectInstance> effects;
@Shadow private int duration;
@Shadow private int waitTime;
@Shadow private int reapplicationDelay;
@Shadow private boolean colorSet;
@Shadow private int durationOnUse;
@Shadow private float radiusOnUse;
@Shadow private float radiusPerTick;
@Shadow private LivingEntity owner;
@Shadow private UUID ownerUniqueId;

@Shadow public abstract float getRadius();
@Shadow public abstract int getColor();
@Shadow public abstract EnumParticleTypes getParticle();

@Override
public AreaEffectCloudData getAreaEffectCloudData() {
return new SpongeAreaEffectData(Color.ofRgb(this.getColor()),
this.getRadius(),
ParticleTypes.MOB_SPELL,
this.duration,
this.waitTime,
this.radiusOnUse,
this.radiusPerTick,
this.durationOnUse,
this.reapplicationDelay,
(List<PotionEffect>) (List<?>) this.effects,
this.ticksExisted
);
}

@Override
public Mutable<Color> color() {
return new SpongeValue<>(Keys.AREA_EFFECT_CLOUD_COLOR, Color.WHITE, Color.ofRgb(this.getColor()));
}

@Override
public org.spongepowered.api.data.value.BoundedValue.Mutable<Double> radius() {
return SpongeValueFactory.boundedBuilder(Keys.AREA_EFFECT_CLOUD_RADIUS)
.minimum(0D)
.maximum((double) Float.MAX_VALUE)
.defaultValue(0.5D)
.actualValue((double) this.getRadius())
.build();
}

@Override
public Mutable<ParticleType> particleType() {
return new SpongeValue<>(Keys.AREA_EFFECT_CLOUD_PARTICLE_EFFECT, ParticleTypes.MOB_SPELL, ParticleTypes.MOB_SPELL);
}

@Override
public org.spongepowered.api.data.value.BoundedValue.Mutable<Integer> duration() {
return SpongeValueFactory.boundedBuilder(Keys.AREA_EFFECT_CLOUD_DURATION)
.minimum(Integer.MIN_VALUE)
.maximum(Integer.MAX_VALUE)
.defaultValue(600)
.actualValue(this.duration)
.build();
}

@Override
public org.spongepowered.api.data.value.BoundedValue.Mutable<Integer> waitTime() {
return SpongeValueFactory.boundedBuilder(Keys.AREA_EFFECT_CLOUD_WAIT_TIME)
.minimum(0)
.maximum(Integer.MAX_VALUE)
.defaultValue(20)
.actualValue(this.waitTime)
.build();
}

@Override
public org.spongepowered.api.data.value.BoundedValue.Mutable<Double> radiusOnUse() {
return SpongeValueFactory.boundedBuilder(Keys.AREA_EFFECT_CLOUD_RADIUS_ON_USE)
.minimum(0.0D)
.maximum((double) Float.MAX_VALUE)
.defaultValue(0.0D)
.actualValue((double) this.radiusOnUse)
.build();
}

@Override
public org.spongepowered.api.data.value.BoundedValue.Mutable<Double> radiusPerTick() {
return SpongeValueFactory.boundedBuilder(Keys.AREA_EFFECT_CLOUD_RADIUS_PER_TICK)
.minimum(0.0D)
.maximum((double) Float.MAX_VALUE)
.defaultValue(0.0D)
.actualValue((double) this.radiusPerTick)
.build();
}

@Override
public org.spongepowered.api.data.value.BoundedValue.Mutable<Integer> durationOnUse() {
return SpongeValueFactory.boundedBuilder(Keys.AREA_EFFECT_CLOUD_DURATION_ON_USE)
.minimum(0)
.maximum(Integer.MAX_VALUE)
.defaultValue(0)
.actualValue(this.durationOnUse)
.build();
}

@Override
public org.spongepowered.api.data.value.BoundedValue.Mutable<Integer> applicationDelay() {
return SpongeValueFactory.boundedBuilder(Keys.AREA_EFFECT_CLOUD_DURATION_ON_USE)
.minimum(0)
.maximum(Integer.MAX_VALUE)
.defaultValue(0)
.actualValue(this.reapplicationDelay)
.build();
}

@Override
public org.spongepowered.api.data.value.ListValue.Mutable<PotionEffect> effects() {
return new SpongeListValue<>(Keys.POTION_EFFECTS, (List<PotionEffect>) (List<?>) this.effects);
}

@Override
public org.spongepowered.api.data.value.BoundedValue.Mutable<Integer> age() {
return SpongeValueFactory.boundedBuilder(Keys.AREA_EFFECT_CLOUD_AGE)
.defaultValue(0)
.minimum(0)
.maximum(Integer.MAX_VALUE)
.actualValue(this.ticksExisted)
.build();
protected Set<Value.Immutable<?>> api$getVanillaValues() {
final Set<Value.Immutable<?>> values = super.api$getVanillaValues();

values.add(this.color().asImmutable());
values.add(this.radius().asImmutable());
values.add(this.particleEffect().asImmutable());
values.add(this.duration().asImmutable());
values.add(this.waitTime().asImmutable());
values.add(this.radiusOnUse().asImmutable());
values.add(this.radiusPerTick().asImmutable());
values.add(this.durationOnUse().asImmutable());
values.add(this.applicationDelay().asImmutable());
values.add(this.effects().asImmutable());
values.add(this.age().asImmutable());

return values;
}

}