1.16 port

This commit is contained in:
yueh
2020-07-22 16:44:42 +02:00
parent 662dbca3e1
commit 56ecda5173
225 changed files with 1214 additions and 969 deletions
@@ -116,34 +116,35 @@ public class EncodedPatternItem extends AEBaseItem {
return;
}
stack.setDisplayName(GuiText.InvalidPattern.textComponent().applyTextStyle(TextFormatting.RED));
stack.setDisplayName(GuiText.InvalidPattern.textComponent().deepCopy().func_240701_a_(TextFormatting.RED));
InvalidPatternHelper invalid = new InvalidPatternHelper(stack);
final ITextComponent label = (invalid.isCraftable() ? GuiText.Crafts.textComponent()
: GuiText.Creates.textComponent()).appendText(": ");
final ITextComponent and = new StringTextComponent(" ").appendSibling(GuiText.And.textComponent())
.appendText(" ");
final ITextComponent with = GuiText.With.textComponent().appendText(": ");
: GuiText.Creates.textComponent()).deepCopy().func_240702_b_(": ");
final ITextComponent and = new StringTextComponent(" ").deepCopy()
.func_230529_a_(GuiText.And.textComponent()).deepCopy().func_240702_b_(" ");
final ITextComponent with = GuiText.With.textComponent().deepCopy().func_240702_b_(": ");
boolean first = true;
for (final InvalidPatternHelper.PatternIngredient output : invalid.getOutputs()) {
lines.add((first ? label : and).deepCopy().appendSibling(output.getFormattedToolTip()));
lines.add((first ? label : and).deepCopy().func_230529_a_(output.getFormattedToolTip()));
first = false;
}
first = true;
for (final InvalidPatternHelper.PatternIngredient input : invalid.getInputs()) {
lines.add((first ? with : and).deepCopy().appendSibling(input.getFormattedToolTip()));
lines.add((first ? with : and).deepCopy().func_230529_a_(input.getFormattedToolTip()));
first = false;
}
if (invalid.isCraftable()) {
final ITextComponent substitutionLabel = GuiText.Substitute.textComponent().appendText(" ");
final ITextComponent substitutionLabel = GuiText.Substitute.textComponent().deepCopy()
.func_240702_b_(" ");
final ITextComponent canSubstitute = invalid.canSubstitute() ? GuiText.Yes.textComponent()
: GuiText.No.textComponent();
lines.add(substitutionLabel.appendSibling(canSubstitute));
lines.add(substitutionLabel.deepCopy().func_230529_a_(canSubstitute));
}
return;
@@ -160,10 +161,10 @@ public class EncodedPatternItem extends AEBaseItem {
final Collection<IAEItemStack> out = details.getOutputs();
final ITextComponent label = (isCrafting ? GuiText.Crafts.textComponent() : GuiText.Creates.textComponent())
.appendText(": ");
final ITextComponent and = new StringTextComponent(" ").appendSibling(GuiText.And.textComponent())
.appendText(" ");
final ITextComponent with = GuiText.With.textComponent().appendText(": ");
.deepCopy().func_240702_b_(": ");
final ITextComponent and = new StringTextComponent(" ").deepCopy().func_230529_a_(GuiText.And.textComponent())
.func_240702_b_(" ");
final ITextComponent with = GuiText.With.textComponent().deepCopy().func_240702_b_(": ");
boolean first = true;
for (final IAEItemStack anOut : out) {
@@ -171,8 +172,8 @@ public class EncodedPatternItem extends AEBaseItem {
continue;
}
lines.add((first ? label : and).deepCopy().appendText(anOut.getStackSize() + "x ")
.appendSibling(Platform.getItemDisplayName(anOut)));
lines.add((first ? label : and).deepCopy().func_240702_b_(anOut.getStackSize() + "x ")
.func_230529_a_(Platform.getItemDisplayName(anOut)));
first = false;
}
@@ -182,16 +183,16 @@ public class EncodedPatternItem extends AEBaseItem {
continue;
}
lines.add((first ? with : and).deepCopy().appendText(anIn.getStackSize() + "x ")
.appendSibling(Platform.getItemDisplayName(anIn)));
lines.add((first ? with : and).deepCopy().func_240702_b_(anIn.getStackSize() + "x ")
.func_230529_a_(Platform.getItemDisplayName(anIn)));
first = false;
}
if (isCrafting) {
final ITextComponent substitutionLabel = GuiText.Substitute.textComponent().appendText(" ");
final ITextComponent substitutionLabel = GuiText.Substitute.textComponent().deepCopy().func_240702_b_(" ");
final ITextComponent canSubstitute = substitute ? GuiText.Yes.textComponent() : GuiText.No.textComponent();
lines.add(substitutionLabel.appendSibling(canSubstitute));
lines.add(substitutionLabel.deepCopy().func_230529_a_(canSubstitute));
}
}
@@ -32,7 +32,7 @@ import net.minecraft.item.ItemUseContext;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.Tag;
import net.minecraft.tags.ITag;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
@@ -105,7 +105,7 @@ public class FacadeItem extends AEBaseItem implements IFacadeItem, IAlphaPassIte
BlockState blockState = block.getDefaultState();
final boolean areTileEntitiesEnabled = AEConfig.instance().isFeatureEnabled(AEFeature.TILE_ENTITY_FACADES);
Tag<Block> whitelistTag = BlockTags.getCollection().getOrCreate(TAG_WHITELISTED);
ITag<Block> whitelistTag = BlockTags.getCollection().getOrCreate(TAG_WHITELISTED);
final boolean isWhiteListed = block.isIn(whitelistTag);
final boolean isModel = blockState.getRenderType() == BlockRenderType.MODEL;
@@ -28,8 +28,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.DimensionType;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -30,6 +30,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
@@ -61,7 +62,7 @@ public class BiometricCardItem extends AEBaseItem implements IBiometricCard {
}
@Override
public boolean itemInteractionForEntity(ItemStack is, final PlayerEntity player, final LivingEntity target,
public ActionResultType itemInteractionForEntity(ItemStack is, final PlayerEntity player, final LivingEntity target,
final Hand hand) {
if (target instanceof PlayerEntity && !player.isCrouching()) {
if (player.isCreative()) {
@@ -69,15 +70,15 @@ public class BiometricCardItem extends AEBaseItem implements IBiometricCard {
}
this.encode(is, (PlayerEntity) target);
player.swingArm(hand);
return true;
return ActionResultType.SUCCESS;
}
return false;
return ActionResultType.PASS;
}
@Override
public ITextComponent getDisplayName(final ItemStack is) {
final GameProfile username = this.getProfile(is);
return username != null ? super.getDisplayName(is).appendText(" - " + username.getName())
return username != null ? super.getDisplayName(is).deepCopy().func_240702_b_(" - " + username.getName())
: super.getDisplayName(is);
}
@@ -166,7 +167,8 @@ public class BiometricCardItem extends AEBaseItem implements IBiometricCard {
if (msg == null) {
msg = new TranslationTextComponent(sp.getTranslatedName());
} else {
msg = msg.appendText(", ").appendSibling(new TranslationTextComponent(sp.getTranslatedName()));
msg = msg.deepCopy().func_240702_b_(", ")
.func_230529_a_(new TranslationTextComponent(sp.getTranslatedName()));
}
}
lines.add(msg);
@@ -145,19 +145,19 @@ public class MemoryCardItem extends AEBaseItem implements IMemoryCard {
switch (msg) {
case SETTINGS_CLEARED:
player.sendMessage(PlayerMessages.SettingCleared.get());
player.sendMessage(PlayerMessages.SettingCleared.get(), player.getUniqueID());
break;
case INVALID_MACHINE:
player.sendMessage(PlayerMessages.InvalidMachine.get());
player.sendMessage(PlayerMessages.InvalidMachine.get(), player.getUniqueID());
break;
case SETTINGS_LOADED:
player.sendMessage(PlayerMessages.LoadedSettings.get());
player.sendMessage(PlayerMessages.LoadedSettings.get(), player.getUniqueID());
break;
case SETTINGS_SAVED:
player.sendMessage(PlayerMessages.SavedSettings.get());
player.sendMessage(PlayerMessages.SavedSettings.get(), player.getUniqueID());
break;
case SETTINGS_RESET:
player.sendMessage(PlayerMessages.ResetSettings.get());
player.sendMessage(PlayerMessages.ResetSettings.get(), player.getUniqueID());
break;
default:
}
@@ -36,9 +36,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.item.SnowballItem;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.state.IProperty;
import net.minecraft.state.Property;
import net.minecraft.tags.ITag;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
@@ -205,7 +205,7 @@ public class ColorApplicatorItem extends AEBasePoweredItem
extra = new TranslationTextComponent(selected.translationKey);
}
return super.getDisplayName(is).appendText(" - ").appendSibling(extra);
return super.getDisplayName(is).deepCopy().func_240702_b_(" - ").func_230529_a_(extra);
}
public AEColor getActiveColor(final ItemStack tol) {
@@ -226,7 +226,7 @@ public class ColorApplicatorItem extends AEBasePoweredItem
return ipb.getColor();
} else {
for (Map.Entry<ResourceLocation, AEColor> entry : TAG_TO_COLOR.entrySet()) {
Tag<Item> tag = ItemTags.getCollection().get(entry.getKey());
ITag<Item> tag = ItemTags.getCollection().get(entry.getKey());
if (tag != null && paintBall.getItem().isIn(tag)) {
return entry.getValue();
}
@@ -326,7 +326,7 @@ public class ColorApplicatorItem extends AEBasePoweredItem
Block recolored = BlockRecolorer.recolor(blk, newColor);
if (recolored != blk) {
BlockState newState = recolored.getDefaultState();
for (IProperty<?> prop : newState.getProperties()) {
for (Property<?> prop : newState.func_235904_r_()) {
newState = copyProp(state, newState, prop);
}
@@ -341,8 +341,8 @@ public class ColorApplicatorItem extends AEBasePoweredItem
}
private static <T extends Comparable<T>> BlockState copyProp(BlockState oldState, BlockState newState,
IProperty<T> prop) {
if (newState.has(prop)) {
Property<T> prop) {
if (newState.func_235901_b_(prop)) {
return newState.with(prop, oldState.get(prop));
}
return newState;
@@ -44,7 +44,7 @@ import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
@@ -143,9 +143,9 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
final LookDirection dir = Platform.getPlayerRay(p, 32);
final Vec3d rayFrom = dir.getA();
final Vec3d rayTo = dir.getB();
final Vec3d direction = rayTo.subtract(rayFrom);
final Vector3d rayFrom = dir.getA();
final Vector3d rayTo = dir.getB();
final Vector3d direction = rayTo.subtract(rayFrom);
direction.normalize();
final double d0 = rayFrom.x;
@@ -174,14 +174,14 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
return new ActionResult<>(ActionResultType.FAIL, p.getHeldItem(hand));
}
private void shootPaintBalls(final ItemStack type, final World w, final PlayerEntity p, final Vec3d Vec3d,
final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2) {
final AxisAlignedBB bb = new AxisAlignedBB(Math.min(Vec3d.x, Vec3d1.x), Math.min(Vec3d.y, Vec3d1.y),
Math.min(Vec3d.z, Vec3d1.z), Math.max(Vec3d.x, Vec3d1.x), Math.max(Vec3d.y, Vec3d1.y),
Math.max(Vec3d.z, Vec3d1.z)).grow(16, 16, 16);
private void shootPaintBalls(final ItemStack type, final World w, final PlayerEntity p, final Vector3d Vector3d,
final Vector3d Vector3d1, final Vector3d direction, final double d0, final double d1, final double d2) {
final AxisAlignedBB bb = new AxisAlignedBB(Math.min(Vector3d.x, Vector3d1.x), Math.min(Vector3d.y, Vector3d1.y),
Math.min(Vector3d.z, Vector3d1.z), Math.max(Vector3d.x, Vector3d1.x), Math.max(Vector3d.y, Vector3d1.y),
Math.max(Vector3d.z, Vector3d1.z)).grow(16, 16, 16);
Entity entity = null;
Vec3d entityIntersection = null;
Vector3d entityIntersection = null;
final List list = w.getEntitiesWithinAABBExcludingEntity(p, bb);
double closest = 9999999.0D;
@@ -197,10 +197,10 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
final float f1 = 0.3F;
final AxisAlignedBB boundingBox = entity1.getBoundingBox().grow(f1, f1, f1);
final Vec3d intersection = boundingBox.rayTrace(Vec3d, Vec3d1).orElse(null);
final Vector3d intersection = boundingBox.rayTrace(Vector3d, Vector3d1).orElse(null);
if (intersection != null) {
final double nd = Vec3d.squareDistanceTo(intersection);
final double nd = Vector3d.squareDistanceTo(intersection);
if (nd < closest) {
entity = entity1;
@@ -211,11 +211,11 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
}
}
RayTraceContext rayTraceContext = new RayTraceContext(Vec3d, Vec3d1, RayTraceContext.BlockMode.COLLIDER,
RayTraceContext rayTraceContext = new RayTraceContext(Vector3d, Vector3d1, RayTraceContext.BlockMode.COLLIDER,
RayTraceContext.FluidMode.NONE, p);
RayTraceResult pos = w.rayTraceBlocks(rayTraceContext);
final Vec3d vec = new Vec3d(d0, d1, d2);
final Vector3d vec = new Vector3d(d0, d1, d2);
if (entity != null && pos.getType() != RayTraceResult.Type.MISS
&& pos.getHitVec().squareDistanceTo(vec) > closest) {
pos = new EntityRayTraceResult(entity, entityIntersection);
@@ -271,25 +271,25 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
final TileEntity te = w.getTileEntity(hitPos);
if (te instanceof PaintSplotchesTileEntity) {
final Vec3d hp = pos.getHitVec().subtract(hitPos.getX(), hitPos.getY(), hitPos.getZ());
final Vector3d hp = pos.getHitVec().subtract(hitPos.getX(), hitPos.getY(), hitPos.getZ());
((PaintSplotchesTileEntity) te).addBlot(type, side.getOpposite(), hp);
}
}
}
}
private void standardAmmo(float penetration, final World w, final PlayerEntity p, final Vec3d Vec3d,
final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2) {
private void standardAmmo(float penetration, final World w, final PlayerEntity p, final Vector3d Vector3d,
final Vector3d Vector3d1, final Vector3d direction, final double d0, final double d1, final double d2) {
boolean hasDestroyed = true;
while (penetration > 0 && hasDestroyed) {
hasDestroyed = false;
final AxisAlignedBB bb = new AxisAlignedBB(Math.min(Vec3d.x, Vec3d1.x), Math.min(Vec3d.y, Vec3d1.y),
Math.min(Vec3d.z, Vec3d1.z), Math.max(Vec3d.x, Vec3d1.x), Math.max(Vec3d.y, Vec3d1.y),
Math.max(Vec3d.z, Vec3d1.z)).grow(16, 16, 16);
final AxisAlignedBB bb = new AxisAlignedBB(Math.min(Vector3d.x, Vector3d1.x), Math.min(Vector3d.y, Vector3d1.y),
Math.min(Vector3d.z, Vector3d1.z), Math.max(Vector3d.x, Vector3d1.x), Math.max(Vector3d.y, Vector3d1.y),
Math.max(Vector3d.z, Vector3d1.z)).grow(16, 16, 16);
Entity entity = null;
Vec3d entityIntersection = null;
Vector3d entityIntersection = null;
final List list = w.getEntitiesWithinAABBExcludingEntity(p, bb);
double closest = 9999999.0D;
@@ -306,10 +306,10 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
final float f1 = 0.3F;
final AxisAlignedBB boundingBox = entity1.getBoundingBox().grow(f1, f1, f1);
final Vec3d intersection = boundingBox.rayTrace(Vec3d, Vec3d1).orElse(null);
final Vector3d intersection = boundingBox.rayTrace(Vector3d, Vector3d1).orElse(null);
if (intersection != null) {
final double nd = Vec3d.squareDistanceTo(intersection);
final double nd = Vector3d.squareDistanceTo(intersection);
if (nd < closest) {
entity = entity1;
@@ -321,9 +321,9 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
}
}
RayTraceContext rayTraceContext = new RayTraceContext(Vec3d, Vec3d1, RayTraceContext.BlockMode.COLLIDER,
RayTraceContext rayTraceContext = new RayTraceContext(Vector3d, Vector3d1, RayTraceContext.BlockMode.COLLIDER,
RayTraceContext.FluidMode.NONE, p);
final Vec3d vec = new Vec3d(d0, d1, d2);
final Vector3d vec = new Vector3d(d0, d1, d2);
RayTraceResult pos = w.rayTraceBlocks(rayTraceContext);
if (entity != null && pos.getType() != RayTraceResult.Type.MISS
&& pos.getHitVec().squareDistanceTo(vec) > closest) {
@@ -353,8 +353,8 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
final LivingEntity el = (LivingEntity) entityHit;
penetration -= dmg;
el.knockBack(p, 0, -direction.x, -direction.z);
// el.knockBack( p, 0, Vec3d.x,
// Vec3d.z );
// el.knockBack( p, 0, Vector3d.x,
// Vector3d.z );
el.attackEntityFrom(dmgSrc, dmg);
if (!el.isAlive()) {
hasDestroyed = true;
@@ -30,7 +30,7 @@ public class QuartzHoeItem extends HoeItem {
private final AEFeature type;
public QuartzHoeItem(Item.Properties props, final AEFeature type) {
super(ItemTier.IRON, -1.0F, props);
super(ItemTier.IRON, -2, -1.0F, props);
this.type = type;
}