Skip to content

Commit

Permalink
Casting a very big shadow (API)
Browse files Browse the repository at this point in the history
BlockEntities and World package were intentionally excluded due to other prs in the works.
  • Loading branch information
i509VCB committed Feb 2, 2020
1 parent 98dbb2b commit 5437586
Show file tree
Hide file tree
Showing 32 changed files with 154 additions and 178 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public ImmutableFallingBlockData getFallingBlockData() {
@Override
public String toString() {
return MoreObjects.toStringHelper("FallingBlockDamageSource")
.add("Name", this.getDamageType())
.add("Name", this.shadow$getDamageType())
.add("Key", this.getType().getKey())
.add("FallingBlock", this.getSource().toString())
.add("Data", this.getFallingBlockData())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public abstract class CriterionProgressMixin_API implements org.spongepowered.ap

@Shadow @Final private AdvancementProgress advancementProgress;
@Shadow @Nullable private Date obtained;

@Shadow public abstract void reset();
@Shadow public abstract void shadow$reset();

@Override
public AdvancementCriterion getCriterion() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ public abstract class DisplayInfoMixin_API implements TreeLayoutElement, org.spo
@Shadow @Final private boolean showToast;
@Shadow private float x;
@Shadow private float y;

@Shadow public abstract boolean shadow$shouldAnnounceToChat();

@Shadow public abstract boolean shadow$isHidden();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ public abstract class EnchantmentMixin_API implements EnchantmentType {

@Shadow protected String name;
@Shadow @Final private net.minecraft.enchantment.Enchantment.Rarity rarity;
@Shadow public abstract int getMinLevel();
@Shadow public abstract int getMaxLevel();
@Shadow public abstract int getMinEnchantability(int level);
@Shadow public abstract int getMaxEnchantability(int level);
@Shadow protected abstract boolean canApplyTogether(net.minecraft.enchantment.Enchantment ench);
@Shadow public abstract int shadow$getMinLevel();
@Shadow public abstract int shadow$getMaxLevel();
@Shadow public abstract int shadow$getMinEnchantability(int level);
@Shadow public abstract int shadow$getMaxEnchantability(int level);
@Shadow protected abstract boolean shadow$canApplyTogether(net.minecraft.enchantment.Enchantment ench);
@Shadow public abstract String shadow$getName();
@Shadow public abstract boolean isTreasureEnchantment();
@Shadow public abstract boolean shadow$isTreasureEnchantment();
@Shadow public abstract boolean shadow$isCurse();

@Shadow @Final public static SimpleRegistry<ResourceLocation, Enchantment> REGISTRY;
Expand All @@ -80,22 +80,22 @@ public int getWeight() {

@Override
public int getMinimumLevel() {
return this.getMinLevel();
return this.shadow$getMinLevel();
}

@Override
public int getMaximumLevel() {
return this.getMaxLevel();
return this.shadow$getMaxLevel();
}

@Override
public int getMinimumEnchantabilityForLevel(int level) {
return this.getMinEnchantability(level);
return this.shadow$getMinEnchantability(level);
}

@Override
public int getMaximumEnchantabilityForLevel(int level) {
return this.getMaxEnchantability(level);
return this.shadow$getMaxEnchantability(level);
}

@Override
Expand All @@ -110,7 +110,7 @@ public boolean canBeAppliedToStack(ItemStack stack) {

@Override
public boolean isCompatibleWith(EnchantmentType ench) {
return this.canApplyTogether((net.minecraft.enchantment.Enchantment) ench);
return this.shadow$canApplyTogether((net.minecraft.enchantment.Enchantment) ench);
}

@Intrinsic
Expand All @@ -125,7 +125,7 @@ public Translation getTranslation() {

@Override
public boolean isTreasure() {
return this.isTreasureEnchantment();
return this.shadow$isTreasureEnchantment();
}

@Intrinsic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,16 @@ public abstract class EntityMixin_API implements org.spongepowered.api.entity.En
@Shadow public DimensionType dimension;
@Shadow protected UUID entityUniqueID;
@Shadow public boolean removed;
@Shadow public abstract void setPosition(double x, double y, double z);
@Shadow public abstract void setDead();
@Shadow public abstract int getAir();
@Shadow public abstract void setAir(int air);
@Shadow public abstract UUID getUniqueID();
@Shadow public abstract void setFire(int seconds);
@Shadow public abstract CompoundNBT writeToNBT(CompoundNBT compound);
@Shadow public abstract boolean attackEntityFrom(DamageSource source, float amount);
@Shadow public abstract int getEntityId();
@Shadow public abstract void playSound(SoundEvent soundIn, float volume, float pitch);
@Shadow public abstract void shadow$setPosition(double x, double y, double z);
@Shadow public abstract void shadow$setDead();
@Shadow public abstract int shadow$getAir();
@Shadow public abstract void shadow$setAir(int air);
@Shadow public abstract UUID shadow$getUniqueID();
@Shadow public abstract void shadow$setFire(int seconds);
@Shadow public abstract CompoundNBT shadow$writeToNBT(CompoundNBT compound);
@Shadow public abstract boolean shadow$attackEntityFrom(DamageSource source, float amount);
@Shadow public abstract int shadow$getEntityId();
@Shadow public abstract void shadow$playSound(SoundEvent soundIn, float volume, float pitch);
@Shadow protected abstract void shadow$setRotation(float yaw, float pitch);
@Shadow protected abstract AxisAlignedBB shadow$getBoundingBox();
@Shadow @Nullable public abstract MinecraftServer shadow$getServer();
Expand Down Expand Up @@ -248,7 +248,7 @@ public boolean setLocation(Location location) {
((Entity) (Object) this).rotationPitch);
((ServerPlayNetHandlerBridge) player.connection).bridge$setLastMoveLocation(null); // Set last move to teleport target
} else {
this.setPosition(location.getPosition().getX(), location.getPosition().getY(), location.getPosition().getZ());
this.shadow$setPosition(location.getPosition().getX(), location.getPosition().getY(), location.getPosition().getZ());
}

if (isTeleporting || isChangingDimension) {
Expand Down Expand Up @@ -434,7 +434,7 @@ public boolean damage(final double damage, final org.spongepowered.api.event.cau
return false;
}
// Causes at this point should already be pushed from plugins before this point with the cause system.
return this.attackEntityFrom((DamageSource) damageSource, (float) damage);
return this.shadow$attackEntityFrom((DamageSource) damageSource, (float) damage);
}

@Override
Expand Down Expand Up @@ -466,7 +466,7 @@ public int getContentVersion() {
public DataContainer toContainer() {
final Transform<World> transform = this.getTransform();
final CompoundNBT compound = new CompoundNBT();
this.writeToNBT(compound);
this.shadow$writeToNBT(compound);
Constants.NBT.filterSpongeCustomData(compound); // We must filter the custom data so it isn't stored twice
final DataContainer unsafeNbt = NbtTranslator.getInstance().translateFrom(compound);
final DataContainer container = DataContainer.createNew()
Expand Down Expand Up @@ -514,7 +514,7 @@ public org.spongepowered.api.entity.Entity copy() {
}
try {
final CompoundNBT compound = new CompoundNBT();
this.writeToNBT(compound);
this.shadow$writeToNBT(compound);
final Entity entity = EntityList.createEntityByIDFromName(new ResourceLocation(this.entityType.getId()), this.world);
compound.putUniqueId(Constants.UUID, entity.getUniqueID());
entity.read(compound);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public abstract class LivingEntityMixin_API extends EntityMixin_API implements L

@Override
public Text getTeamRepresentation() {
return Text.of(this.getUniqueID().toString());
return Text.of(this.shadow$getUniqueID().toString());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
@Mixin(PhaseManager.class)
public abstract class PhaseManagerMixin_API implements DragonPhaseManager {

@Shadow public abstract void setPhase(PhaseType<?> phaseIn);
@Shadow private IPhase phase;
@Shadow public abstract void shadow$setPhase(PhaseType<?> phaseIn);

@Override
public DragonPhase getPhase() {
Expand All @@ -46,7 +46,7 @@ public DragonPhase getPhase() {

@Override
public DragonPhase setPhase(DragonPhaseType phase) {
this.setPhase((PhaseType<?>) phase);
this.shadow$setPhase((PhaseType<?>) phase);
return (DragonPhase) this.phase;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,20 @@
package org.spongepowered.common.mixin.api.mcp.entity.item;

import net.minecraft.entity.item.EnderCrystalEntity;
import net.minecraft.util.math.BlockPos;
import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.explosive.EnderCrystal;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.common.bridge.entity.item.EnderCrystalEntityBridge;
import org.spongepowered.common.mixin.api.mcp.entity.EntityMixin_API;

import javax.annotation.Nullable;
import java.util.Set;

@Mixin(EnderCrystalEntity.class)
public abstract class EnderCrystalEntityMixin_API extends EntityMixin_API implements EnderCrystal {

@Override
public void detonate() {
this.setDead();
this.shadow$setDead();
((EnderCrystalEntityBridge) this).bridge$ThrowEventWithDetonation(this.world, null, this.posX, this.posY, this.posZ, true, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public abstract class FireworkRocketEntityMixin_API extends EntityMixin_API impl
@Shadow private int fireworkAge;
@Shadow private int lifetime;

@Shadow public abstract void onUpdate();
@Shadow public abstract void shadow$func_213893_k();

@Override
public void detonate() {
this.fireworkAge = this.lifetime + 1;
this.onUpdate();
this.shadow$func_213893_k();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
package org.spongepowered.common.mixin.api.mcp.entity.item;

import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.TNTEntity;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.explosive.fused.PrimedTNT;
Expand All @@ -34,18 +33,15 @@

import java.util.Set;

import javax.annotation.Nullable;

@Mixin(TNTEntity.class)
public abstract class TNTEntityMixin_API extends EntityMixin_API implements PrimedTNT {

@Shadow @Nullable private LivingEntity tntPlacedBy;
@Shadow private void explode() { }
@Shadow private void shadow$explode() { }

@Override
public void detonate() {
this.setDead();
this.explode();
this.shadow$setDead();
this.shadow$explode();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
public abstract class TNTMinecartEntityMixin_API extends AbstractMinecartEntityMixin_API implements TNTMinecart {

@Shadow private int minecartTNTFuse;
@Shadow public abstract void ignite();
@Shadow public abstract void shadow$ignite();

@Override
public void detonate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
@Mixin(AbstractVillagerEntity.class)
public abstract class AbstractVillagerEntityMixin_API extends AgeableEntityMixin_API implements Trader {

@Shadow public abstract boolean shadow$hasCustomer();
@Shadow public abstract void shadow$setCustomer(PlayerEntity player);
@Shadow public abstract PlayerEntity shadow$getCustomer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
@Mixin(CreeperEntity.class)
public abstract class CreeperEntityMixin_API extends MonsterEntityMixin_API implements Creeper {

@Shadow private void explode() { } // explode
@Shadow private void shadow$explode() { } // explode

@Override
public void detonate() {
this.explode();
this.shadow$explode();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,12 @@
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.living.animal.Parrot;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

import java.util.Set;

@Mixin(ParrotEntity.class)
public abstract class ParrotEntityMixin_API extends TameableEntityMixin_API implements Parrot {

@Shadow public abstract int getVariant();

@Override
protected Set<Value.Immutable<?>> api$getVanillaValues() {
final Set<Value.Immutable<?>> values = super.api$getVanillaValues();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,12 @@
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.living.animal.horse.llama.Llama;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

import java.util.Set;

@Mixin(LlamaEntity.class)
public abstract class LlamaEntityMixin_API extends AbstractChestedHorseEntityMixin_API implements Llama {

@Shadow public abstract int getStrength();
@Shadow public abstract int getVariant();
@Shadow public abstract void setVariant(int p_190710_1_);

@Override
protected Set<Value.Immutable<?>> api$getVanillaValues() {
final Set<Value.Immutable<?>> values = super.api$getVanillaValues();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public abstract class PlayerEntityMixin_API extends LivingEntityMixin_API {

@Shadow public Container openContainer;
@Shadow public float experience;
@Shadow public PlayerAbilities capabilities;
@Shadow public PlayerAbilities abilities;
@Shadow public PlayerInventory inventory;
@Shadow protected EnderChestInventory enderChest;
@Shadow protected EnderChestInventory enterChestInventory;
@Shadow public abstract String shadow$getName();
@Shadow @Nullable public abstract Team getTeam();
@Shadow @Nullable public abstract Team shadow$getTeam();
@Shadow public abstract CooldownTracker shadow$getCooldownTracker();

final boolean impl$isFake = SpongeImplHooks.isFakePlayer((PlayerEntity) (Object) this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public abstract class FireballEntityMixin_API extends AbstractFireballEntityMixi
@Override
public void detonate() {
((FireballEntityBridge) this).bridge$throwExplosionEventAndExplode(this.world, null, this.posX, this.posY, this.posZ, this.explosionPower, true, true);
this.setDead();
this.shadow$setDead();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public abstract class WitherSkullEntityMixin_API extends DamagingProjectileEntit
@Override
public void detonate() {
((WitherSkullEntityBridge) this).bridge$CreateAndProcessExplosionEvent(this.world, (WitherSkullEntity) (Object) this, this.posX, this.posY, this.posZ, 0, false, true);
this.setDead();
this.shadow$setDead();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
@Mixin(Item.class)
public abstract class ItemMixin_API implements ItemType {

@Shadow public abstract int getItemStackLimit();
@Shadow public abstract String getTranslationKey();
@Shadow public abstract int shadow$getMaxStackSize();
@Shadow public abstract String shadow$getTranslationKey();
@Shadow private Item containerItem;

@Nullable protected BlockType blockType = null;
Expand Down Expand Up @@ -76,12 +76,12 @@ public String getName() {

@Override
public Translation getTranslation() {
return new SpongeTranslation(this.getTranslationKey() + ".name");
return new SpongeTranslation(this.shadow$getTranslationKey() + ".name");
}

@Override
public int getMaxStackQuantity() {
return this.getItemStackLimit();
return this.shadow$getMaxStackSize();
}

@Override
Expand Down
Loading

0 comments on commit 5437586

Please sign in to comment.