Compiles again.

This commit is contained in:
Sebastian Hartte
2020-07-27 23:50:28 +02:00
parent 56ecda5173
commit 84e6aaa122
136 changed files with 1004 additions and 1108 deletions
@@ -29,6 +29,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemModelsProperties;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.IItemProvider;
@@ -71,7 +72,7 @@ public class CrystalSeedItem extends AEBaseItem implements IGrowableCrystal {
super(properties);
this.grownItem = Preconditions.checkNotNull(grownItem);
// Expose the growth of the seed to the model system
addPropertyOverride(new ResourceLocation("appliedenergistics2:growth"),
ItemModelsProperties.func_239418_a_(this, new ResourceLocation("appliedenergistics2:growth"),
(is, w, p) -> getGrowthTicks(is) / (float) GROWTH_TICKS_REQUIRED);
}
@@ -106,7 +107,7 @@ public class CrystalSeedItem extends AEBaseItem implements IGrowableCrystal {
@OnlyIn(Dist.CLIENT)
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
final ITooltipFlag advancedTooltips) {
lines.add(ButtonToolTips.DoesntDespawn.getTranslationKey());
lines.add(ButtonToolTips.DoesntDespawn.text());
lines.add(getGrowthTooltipItem(stack));
super.addInformation(stack, world, lines, advancedTooltips);
@@ -116,15 +116,15 @@ public class EncodedPatternItem extends AEBaseItem {
return;
}
stack.setDisplayName(GuiText.InvalidPattern.textComponent().deepCopy().func_240701_a_(TextFormatting.RED));
stack.setDisplayName(GuiText.InvalidPattern.text().deepCopy().func_240701_a_(TextFormatting.RED));
InvalidPatternHelper invalid = new InvalidPatternHelper(stack);
final ITextComponent label = (invalid.isCraftable() ? GuiText.Crafts.textComponent()
: GuiText.Creates.textComponent()).deepCopy().func_240702_b_(": ");
final ITextComponent label = (invalid.isCraftable() ? GuiText.Crafts.text()
: GuiText.Creates.text()).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_(": ");
.func_230529_a_(GuiText.And.text()).deepCopy().func_240702_b_(" ");
final ITextComponent with = GuiText.With.text().deepCopy().func_240702_b_(": ");
boolean first = true;
for (final InvalidPatternHelper.PatternIngredient output : invalid.getOutputs()) {
@@ -139,10 +139,10 @@ public class EncodedPatternItem extends AEBaseItem {
}
if (invalid.isCraftable()) {
final ITextComponent substitutionLabel = GuiText.Substitute.textComponent().deepCopy()
final ITextComponent substitutionLabel = GuiText.Substitute.text().deepCopy()
.func_240702_b_(" ");
final ITextComponent canSubstitute = invalid.canSubstitute() ? GuiText.Yes.textComponent()
: GuiText.No.textComponent();
final ITextComponent canSubstitute = invalid.canSubstitute() ? GuiText.Yes.text()
: GuiText.No.text();
lines.add(substitutionLabel.deepCopy().func_230529_a_(canSubstitute));
}
@@ -160,11 +160,11 @@ public class EncodedPatternItem extends AEBaseItem {
final Collection<IAEItemStack> in = details.getInputs();
final Collection<IAEItemStack> out = details.getOutputs();
final ITextComponent label = (isCrafting ? GuiText.Crafts.textComponent() : GuiText.Creates.textComponent())
final ITextComponent label = (isCrafting ? GuiText.Crafts.text() : GuiText.Creates.text())
.deepCopy().func_240702_b_(": ");
final ITextComponent and = new StringTextComponent(" ").deepCopy().func_230529_a_(GuiText.And.textComponent())
final ITextComponent and = new StringTextComponent(" ").deepCopy().func_230529_a_(GuiText.And.text())
.func_240702_b_(" ");
final ITextComponent with = GuiText.With.textComponent().deepCopy().func_240702_b_(": ");
final ITextComponent with = GuiText.With.text().deepCopy().func_240702_b_(": ");
boolean first = true;
for (final IAEItemStack anOut : out) {
@@ -189,8 +189,8 @@ public class EncodedPatternItem extends AEBaseItem {
}
if (isCrafting) {
final ITextComponent substitutionLabel = GuiText.Substitute.textComponent().deepCopy().func_240702_b_(" ");
final ITextComponent canSubstitute = substitute ? GuiText.Yes.textComponent() : GuiText.No.textComponent();
final ITextComponent substitutionLabel = GuiText.Substitute.text().deepCopy().func_240702_b_(" ");
final ITextComponent canSubstitute = substitute ? GuiText.Yes.text() : GuiText.No.text();
lines.add(substitutionLabel.deepCopy().func_230529_a_(canSubstitute));
}
@@ -77,7 +77,7 @@ public class FacadeItem extends AEBaseItem implements IFacadeItem, IAlphaPassIte
try {
final ItemStack in = this.getTextureItem(is);
if (!in.isEmpty()) {
return super.getDisplayName(is).deepCopy().appendText(" - ").appendSibling(in.getDisplayName());
return super.getDisplayName(is).deepCopy().func_240702_b_(" - ").func_230529_a_(in.getDisplayName());
}
} catch (final Throwable ignored) {
@@ -23,13 +23,16 @@ import java.util.List;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.RegistryKey;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
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.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -57,17 +60,17 @@ public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorag
@Override
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines,
final ITooltipFlag advancedTooltips) {
final DimensionType dimType = this.getStoredDimension(stack);
if (dimType == null) {
lines.add(GuiText.Unformatted.textComponent().applyTextStyle(TextFormatting.ITALIC));
lines.add(GuiText.SpatialCapacity.textComponent(maxRegion, maxRegion, maxRegion));
final RegistryKey<World> worldId = this.getStoredDimension(stack);
if (worldId == null) {
lines.add(GuiText.Unformatted.text().deepCopy().func_240699_a_(TextFormatting.ITALIC));
lines.add(GuiText.SpatialCapacity.text(maxRegion, maxRegion, maxRegion));
} else {
SpatialDimensionManager.INSTANCE.addCellDimensionTooltip(dimType, lines);
SpatialDimensionManager.INSTANCE.addCellDimensionTooltip(worldId, lines);
}
if (advancedTooltips.isAdvanced()) {
if (dimType != null && dimType.getRegistryName() != null) {
lines.add(new StringTextComponent("Dimension: " + dimType.getRegistryName()));
if (worldId != null && worldId.func_240901_a_() != null) {
lines.add(new StringTextComponent("Dimension: " + worldId.func_240901_a_()));
}
}
}
@@ -83,12 +86,12 @@ public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorag
}
@Override
public DimensionType getStoredDimension(final ItemStack is) {
public RegistryKey<World> getStoredDimension(final ItemStack is) {
final CompoundNBT c = is.getTag();
if (c != null && c.contains(TAG_DIMENSION_ID)) {
try {
ResourceLocation dimTypeId = new ResourceLocation(c.getString(TAG_DIMENSION_ID));
return DimensionType.byName(dimTypeId);
ResourceLocation worldId = new ResourceLocation(c.getString(TAG_DIMENSION_ID));
return RegistryKey.func_240903_a_(Registry.WORLD_KEY, worldId);
} catch (Exception e) {
AELog.warn("Failed to retrieve storage cell dimension.", e);
}
@@ -97,8 +100,8 @@ public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorag
}
@Override
public TransitionResult doSpatialTransition(final ItemStack is, final World w, final WorldCoord min,
final WorldCoord max, int playerId) {
public TransitionResult doSpatialTransition(final ItemStack is, final ServerWorld w, final WorldCoord min,
final WorldCoord max, int playerId) {
final int targetX = max.x - min.x - 1;
final int targetY = max.y - min.y - 1;
final int targetZ = max.z - min.z - 1;
@@ -108,27 +111,27 @@ public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorag
ISpatialDimension manager = SpatialDimensionManager.INSTANCE;
DimensionType storedDim = this.getStoredDimension(is);
if (storedDim == null) {
storedDim = manager.createNewCellDimension(targetSize);
RegistryKey<World> worldId = this.getStoredDimension(is);
if (worldId == null || manager.getWorld(worldId) == null) {
worldId = manager.createNewCellDimension(targetSize);
}
if (storedDim == null) {
if (worldId == null) {
// Failed to create the dimension
return new TransitionResult(false, 0);
}
try {
if (manager.isCellDimension(storedDim)) {
World cellWorld = manager.getWorld(storedDim);
if (manager.isCellDimension(worldId)) {
ServerWorld cellWorld = manager.getWorld(worldId);
BlockPos scale = manager.getCellDimensionSize(storedDim);
BlockPos scale = manager.getCellDimensionSize(worldId);
if (scale.equals(targetSize)) {
if (targetX <= maxSize && targetY <= maxSize && targetZ <= maxSize) {
BlockPos offset = manager.getCellDimensionOrigin(storedDim);
BlockPos offset = manager.getCellDimensionOrigin(worldId);
this.setStoredDimension(is, storedDim);
this.setStoredDimension(is, worldId);
StorageHelper.getInstance().swapRegions(w, min.x + 1, min.y + 1, min.z + 1, cellWorld,
offset.getX(), offset.getY(), offset.getZ(), targetX - 1, targetY - 1, targetZ - 1);
@@ -139,14 +142,14 @@ public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorag
return new TransitionResult(false, 0);
} finally {
// clean up newly created dimensions that failed transfer
if (manager.isCellDimension(storedDim) && this.getStoredDimension(is) == null) {
manager.deleteCellDimension(storedDim);
if (manager.isCellDimension(worldId) && this.getStoredDimension(is) == null) {
manager.deleteCellDimension(worldId);
}
}
}
private void setStoredDimension(final ItemStack is, DimensionType dim) {
private void setStoredDimension(final ItemStack is, RegistryKey<World> worldId) {
final CompoundNBT c = is.getOrCreateTag();
c.putString(TAG_DIMENSION_ID, dim.getRegistryName().toString());
c.putString(TAG_DIMENSION_ID, worldId.func_240901_a_().toString());
}
}
@@ -29,6 +29,7 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.Util;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
@@ -145,19 +146,19 @@ public class MemoryCardItem extends AEBaseItem implements IMemoryCard {
switch (msg) {
case SETTINGS_CLEARED:
player.sendMessage(PlayerMessages.SettingCleared.get(), player.getUniqueID());
player.sendMessage(PlayerMessages.SettingCleared.get(), Util.DUMMY_UUID);
break;
case INVALID_MACHINE:
player.sendMessage(PlayerMessages.InvalidMachine.get(), player.getUniqueID());
player.sendMessage(PlayerMessages.InvalidMachine.get(), Util.DUMMY_UUID);
break;
case SETTINGS_LOADED:
player.sendMessage(PlayerMessages.LoadedSettings.get(), player.getUniqueID());
player.sendMessage(PlayerMessages.LoadedSettings.get(), Util.DUMMY_UUID);
break;
case SETTINGS_SAVED:
player.sendMessage(PlayerMessages.SavedSettings.get(), player.getUniqueID());
player.sendMessage(PlayerMessages.SavedSettings.get(), Util.DUMMY_UUID);
break;
case SETTINGS_RESET:
player.sendMessage(PlayerMessages.ResetSettings.get(), player.getUniqueID());
player.sendMessage(PlayerMessages.ResetSettings.get(), Util.DUMMY_UUID);
break;
default:
}
@@ -32,6 +32,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemModelsProperties;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.item.SnowballItem;
@@ -106,7 +107,7 @@ public class ColorApplicatorItem extends AEBasePoweredItem
public ColorApplicatorItem(Item.Properties props) {
super(AEConfig.instance().getColorApplicatorBattery(), props);
addPropertyOverride(new ResourceLocation(AppEng.MOD_ID, "colored"), (itemStack, world, entity) -> {
ItemModelsProperties.func_239418_a_(this, new ResourceLocation(AppEng.MOD_ID, "colored"), (itemStack, world, entity) -> {
// If the stack has no color, don't use the colored model since the impact of
// calling getColor for every quad is extremely high, if the stack tries to
// re-search its
@@ -197,7 +198,7 @@ public class ColorApplicatorItem extends AEBasePoweredItem
@Override
public ITextComponent getDisplayName(final ItemStack is) {
ITextComponent extra = GuiText.Empty.textComponent();
ITextComponent extra = GuiText.Empty.text();
final AEColor selected = this.getActiveColor(is);
@@ -320,7 +321,7 @@ public class ColorApplicatorItem extends AEBasePoweredItem
}
private boolean recolourBlock(final Block blk, final Direction side, final World w, final BlockPos pos,
final AEColor newColor, @Nullable final PlayerEntity p) {
final AEColor newColor, @Nullable final PlayerEntity p) {
final BlockState state = w.getBlockState(pos);
Block recolored = BlockRecolorer.recolor(blk, newColor);
@@ -333,11 +334,22 @@ public class ColorApplicatorItem extends AEBasePoweredItem
return w.setBlockState(pos, newState);
}
TileEntity be = w.getTileEntity(pos);
if (be instanceof IColorableTile) {
IColorableTile ct = (IColorableTile) be;
AEColor c = ct.getColor();
if (c != newColor) {
ct.recolourBlock(side, newColor, null);
return true;
}
return false;
}
if (blk instanceof CableBusBlock && p != null) {
return ((CableBusBlock) blk).recolorBlock(w, pos, side, newColor.dye, p);
}
return blk.recolorBlock(state, w, pos, side, newColor.dye);
return false;
}
private static <T extends Comparable<T>> BlockState copyProp(BlockState oldState, BlockState newState,
@@ -38,6 +38,7 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.Direction;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.Hand;
import net.minecraft.util.Util;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -165,7 +166,7 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
}
} else {
if (Platform.isServer()) {
p.sendMessage(PlayerMessages.AmmoDepleted.get());
p.sendMessage(PlayerMessages.AmmoDepleted.get(), Util.DUMMY_UUID);
}
return new ActionResult<>(ActionResultType.SUCCESS, p.getHeldItem(hand));
}
@@ -352,7 +353,7 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
if (entityHit instanceof LivingEntity) {
final LivingEntity el = (LivingEntity) entityHit;
penetration -= dmg;
el.knockBack(p, 0, -direction.x, -direction.z);
el.applyKnockback(0, -direction.x, -direction.z);
// el.knockBack( p, 0, Vector3d.x,
// Vector3d.z );
el.attackEntityFrom(dmgSrc, dmg);
@@ -71,9 +71,9 @@ public class WirelessTerminalItem extends AEBasePoweredItem implements IWireless
final String encKey = tag.getString("encryptionKey");
if (encKey == null || encKey.isEmpty()) {
lines.add(GuiText.Unlinked.textComponent());
lines.add(GuiText.Unlinked.text());
} else {
lines.add(GuiText.Linked.textComponent());
lines.add(GuiText.Linked.text());
}
}
} else {
@@ -67,10 +67,10 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
final double percent = internalCurrentPower / internalMaxPower;
lines.add(GuiText.StoredEnergy.textComponent()
.appendText(':' + MessageFormat.format(" {0,number,#} ", internalCurrentPower))
.appendSibling(new TranslationTextComponent(PowerUnits.AE.unlocalizedName))
.appendText(" - " + MessageFormat.format(" {0,number,#.##%} ", percent)));
lines.add(GuiText.StoredEnergy.text().deepCopy()
.func_240702_b_(':' + MessageFormat.format(" {0,number,#} ", internalCurrentPower))
.func_230529_a_(PowerUnits.AE.textComponent())
.func_240702_b_(" - " + MessageFormat.format(" {0,number,#.##%} ", percent)));
}
@Override