From d4af87ceb3e72ab391fef0e03ccebeffa3af9e71 Mon Sep 17 00:00:00 2001 From: Flanks255 <32142731+Flanks255@users.noreply.github.com> Date: Sun, 26 Nov 2023 16:10:19 -0600 Subject: [PATCH] Misc fixes --- .../mod/blocks/BlockLaserRelay.java | 16 +++----- .../mod/blocks/render/RenderLaserRelay.java | 4 +- .../mod/entity/EntityWorm.java | 38 +++++++++++++++++-- .../mod/event/ClientEvents.java | 8 ++-- .../mod/items/ItemGrowthRing.java | 3 +- .../mod/items/ItemMagnetRing.java | 3 +- .../mod/tile/TileEntityLaserRelayFluids.java | 2 +- .../assets/actuallyadditions/lang/en_us.json | 24 ++++++------ 8 files changed, 60 insertions(+), 38 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java index 591e913b3..713bbb6ec 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java @@ -17,17 +17,16 @@ import de.ellpeck.actuallyadditions.api.laser.Network; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock; import de.ellpeck.actuallyadditions.mod.config.CommonConfig; -import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles; import de.ellpeck.actuallyadditions.mod.items.ItemLaserRelayUpgrade; import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench; import de.ellpeck.actuallyadditions.mod.tile.*; import de.ellpeck.actuallyadditions.mod.util.StackUtil; -import de.ellpeck.actuallyadditions.mod.util.StringUtil; import io.netty.util.internal.ConcurrentSet; import net.minecraft.block.BlockState; import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; @@ -65,11 +64,6 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements public BlockLaserRelay(Type type) { super(ActuallyBlocks.defaultPickProps(0)); this.type = type; - - // TODO: [port] add back once I know what it does. - // if (this.type.ordinal() == 0) { - // MinecraftForge.EVENT_BUS.register(this); - // } } // @SubscribeEvent @@ -105,7 +99,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements if (StackUtil.isValid(stack)) { if (stack.getItem() instanceof ItemLaserWrench) { return ActionResultType.FAIL; - } else if (stack.getItem() == ConfigValues.itemCompassConfigurator) { + } else if (stack.getItem() == CommonConfig.Other.relayConfigureItem) { if (!world.isClientSide) { relay.onCompassAction(player); @@ -192,7 +186,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements if (minecraft.level != null) { boolean wearing = ItemEngineerGoggles.isWearing(player); if (wearing || StackUtil.isValid(stack)) { - boolean compass = stack.getItem() == ConfigValues.itemCompassConfigurator; + boolean compass = stack.getItem() == CommonConfig.Other.relayConfigureItem; if (wearing || compass || stack.getItem() instanceof ItemLaserWrench) { TileEntity tile = minecraft.level.getBlockEntity(pos); if (tile instanceof TileEntityLaserRelay) { @@ -205,10 +199,10 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements if (compass) { expl = relay.getCompassDisplayString(); } else { - expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".laserRelay.mode.noCompasss", StringUtil.localize(CommonConfig.Other.relayConfigureItem.getDescriptionId() + ".name")); + expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + I18n.get("info." + ActuallyAdditions.MODID + ".laserRelay.mode.noCompasss", I18n.get(CommonConfig.Other.relayConfigureItem.getDescriptionId())); } - StringUtil.drawSplitString(minecraft.font, expl, resolution.getGuiScaledWidth() / 2 + 5, resolution.getGuiScaledHeight() / 2 + 15, Integer.MAX_VALUE, 0xFFFFFF, true); + minecraft.font.draw(matrices, expl, resolution.getGuiScaledWidth() / 2f + 5, resolution.getGuiScaledHeight() / 2f + 15, 0xFFFFFF); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java index bfe150fd2..c4932ffd7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/render/RenderLaserRelay.java @@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.blocks.render; import com.mojang.blaze3d.matrix.MatrixStack; import de.ellpeck.actuallyadditions.api.laser.IConnectionPair; import de.ellpeck.actuallyadditions.api.laser.LaserType; -import de.ellpeck.actuallyadditions.mod.config.ConfigValues; +import de.ellpeck.actuallyadditions.mod.config.CommonConfig; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles; import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench; @@ -64,7 +64,7 @@ public class RenderLaserRelay extends TileEntityRenderer { } ItemStack hand = player.getMainHandItem(); - if (hasGoggles || StackUtil.isValid(hand) && (hand.getItem() == ConfigValues.itemCompassConfigurator || hand.getItem() instanceof ItemLaserWrench) || "themattabase".equals(player.getName().getString())) { + if (hasGoggles || StackUtil.isValid(hand) && (hand.getItem() == CommonConfig.Other.relayConfigureItem || hand.getItem() instanceof ItemLaserWrench) || "themattabase".equals(player.getName().getString())) { matrices.pushPose(); Direction direction = state.hasProperty(BlockStateProperties.FACING) ? state.getValue(BlockStateProperties.FACING) : Direction.UP; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java index b716a3559..f4b1f57c1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/entity/EntityWorm.java @@ -11,23 +11,24 @@ package de.ellpeck.actuallyadditions.mod.entity; import de.ellpeck.actuallyadditions.mod.config.CommonConfig; -import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.DefaultFarmerBehavior; import net.minecraft.block.*; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.IPacket; -import net.minecraft.network.play.server.SSpawnObjectPacket; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; +import net.minecraftforge.common.FarmlandWaterManager; import net.minecraftforge.common.IPlantable; +import net.minecraftforge.common.ticket.AABBTicket; import net.minecraftforge.fml.network.NetworkHooks; public class EntityWorm extends Entity { public int timer; + private AABBTicket waterTicket; public EntityWorm(EntityType type, World world) { super(type, world); @@ -47,6 +48,35 @@ public class EntityWorm extends Entity { } } + @Override + public void remove() { + if (waterTicket != null) + waterTicket.invalidate(); + + super.remove(); + } + + @Override + protected void removeAfterChangingDimensions() { + if (waterTicket != null) + waterTicket.invalidate(); + + super.removeAfterChangingDimensions(); + } + + @Override + public void setPos(double pX, double pY, double pZ) { + super.setPos(pX, pY, pZ); + + if (level.isClientSide) + return; + + if (waterTicket != null) + waterTicket.invalidate(); + + waterTicket = FarmlandWaterManager.addAABBTicket(level, new AxisAlignedBB(getX() - 2, getY() - 1.5, getZ() - 2, getX() + 2, getY(), getZ() + 2)); + } + @Override public boolean canUpdate() { return true; @@ -68,7 +98,7 @@ public class EntityWorm extends Entity { if (canWormify(this.level, pos, state)) { boolean isFarmland = block instanceof FarmlandBlock; - if (!isFarmland || state.getValue(FarmlandBlock.MOISTURE) < 7) { +/* if (!isFarmland || state.getValue(FarmlandBlock.MOISTURE) < 7) { if (isMiddlePose || this.level.random.nextFloat() >= 0.45F) { if (!isFarmland) { @@ -81,7 +111,7 @@ public class EntityWorm extends Entity { this.level.setBlock(pos, state.setValue(FarmlandBlock.MOISTURE, 7), 2); } } - } + }*/ if (isFarmland && this.level.random.nextFloat() >= 0.95F) { BlockPos plant = pos.above(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java index 9ab26e482..7686af06c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java @@ -14,7 +14,6 @@ import com.mojang.blaze3d.platform.GlStateManager; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay; import de.ellpeck.actuallyadditions.mod.config.CommonConfig; -import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.data.WorldData; import de.ellpeck.actuallyadditions.mod.inventory.gui.EnergyDisplay; import de.ellpeck.actuallyadditions.mod.tile.IEnergyDisplay; @@ -24,6 +23,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -197,10 +197,10 @@ public class ClientEvents { font.drawShadow(event.getMatrixStack(), strg, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 5, 0xFFFFFF); String expl; - if (StackUtil.isValid(stack) && stack.getItem() == CommonConfig.Other.redstoneConfigureItem.asItem()) { - expl = TextFormatting.GREEN + StringUtil.localize("info." + ActuallyAdditions.MODID + ".redstoneMode.validItem"); + if (!stack.isEmpty() && stack.getItem() == CommonConfig.Other.redstoneConfigureItem) { + expl = TextFormatting.GREEN + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode.validItem"); } else { - expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + StringUtil.localizeFormatted("info." + ActuallyAdditions.MODID + ".redstoneMode.invalidItem", StringUtil.localize(CommonConfig.Other.redstoneConfigureItem.asItem().getDescriptionId())); + expl = TextFormatting.GRAY.toString() + TextFormatting.ITALIC + I18n.get("info." + ActuallyAdditions.MODID + ".redstoneMode.invalidItem", I18n.get(CommonConfig.Other.redstoneConfigureItem.asItem().getDescriptionId())); } font.drawShadow(event.getMatrixStack(), expl, event.getWindow().getGuiScaledWidth() / 2f + 5, event.getWindow().getGuiScaledHeight() / 2f + 15, 0xFFFFFF); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java index 2a0eb22ca..2154d9ed3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java @@ -72,8 +72,7 @@ public class ItemGrowthRing extends ItemEnergy { BlockPos pos = blocks.get(world.random.nextInt(blocks.size())); BlockState state = world.getBlockState(pos); - Block block = state.getBlock(); - block.tick(world.getBlockState(pos), (ServerWorld) world, pos, world.random); + state.randomTick((ServerWorld) world, pos, world.random); //Show Particles if Metadata changed BlockState newState = world.getBlockState(pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java index fe7a82789..4da45e4ee 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java @@ -48,11 +48,10 @@ public class ItemMagnetRing extends ItemEnergy { List items = world.getEntitiesOfClass(ItemEntity.class, new AxisAlignedBB(entity.getX() - range, entity.getY() - range, entity.getZ() - range, entity.getX() + range, entity.getY() + range, entity.getZ() + range)); if (!items.isEmpty()) { for (ItemEntity item : items) { - // TODO: [port] check this data is being saved on the time if (item.getPersistentData().getBoolean("PreventRemoteMovement")) { continue; } - if (item.isAlive() && !item.hasPickUpDelay()) { + if (item.isAlive() && !item.hasPickUpDelay()) { // TODO config int energyForItem = 50 * item.getItem().getCount(); if (this.getEnergyStored(stack) >= energyForItem) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java index 9db32ee1c..7e2056941 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelayFluids.java @@ -200,7 +200,7 @@ public class TileEntityLaserRelayFluids extends TileEntityLaserRelay { } } } - + //TODO dont send the entire tank at once, gg if (totalReceiverAmount > 0 && !relaysThatWork.isEmpty()) { int amountPer = stack.getAmount() / totalReceiverAmount <= 0 ? stack.getAmount() / totalReceiverAmount diff --git a/src/main/resources/assets/actuallyadditions/lang/en_us.json b/src/main/resources/assets/actuallyadditions/lang/en_us.json index b134beaf4..70ffe6858 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_us.json +++ b/src/main/resources/assets/actuallyadditions/lang/en_us.json @@ -284,13 +284,13 @@ "item.actuallyadditions.quadruple_battery": "Quadruple Battery", "item.actuallyadditions.quintuple_battery": "Quintuple Battery", "item.actuallyadditions.ring_of_growth": "Ring of Growth (wip)", - "item.actuallyadditions.ring_of_magnetizing": "Ring of Magnetizing (wip)", + "item.actuallyadditions.ring_of_magnetizing": "Ring of Magnetizing", "item.actuallyadditions.canola_oil_bucket": "Canola Oil Bucket", "item.actuallyadditions.refined_canola_oil_bucket": "Refined Canola Oil Bucket", "item.actuallyadditions.crystallized_oil_bucket": "Crystallized Oil Bucket", "item.actuallyadditions.empowered_oil_bucket": "Empowered Oil Bucket", "item.actuallyadditions.wings_of_the_bats": "Wings Of The Bats (wip)", - "item.actuallyadditions.bats_wing": "Bat's Wing (wip)", + "item.actuallyadditions.bats_wing": "Bat's Wing", "item.actuallyadditions.wooden_aiot": "Wooden AIOT (wip)", "item.actuallyadditions.stone_aiot": "Stone AIOT (wip)", "item.actuallyadditions.iron_aiot": "Iron AIOT (wip)", @@ -298,7 +298,7 @@ "item.actuallyadditions.diamond_aiot": "Diamond AIOT (wip)", "item.actuallyadditions.netherite_aiot": "Netherite AIOT (wip)", "item.actuallyadditions.phantom_connector": "Phantom Connector (wip)", - "item.actuallyadditions.empty_cup": "Empty Cup (wip)", + "item.actuallyadditions.empty_cup": "Empty Cup", "item.actuallyadditions.coffee_cup": "Cup with Coffee (wip)", "item.actuallyadditions.coffee_seeds": "Coffee Seeds", "item.actuallyadditions.coffee_beans": "Coffee Beans (wip)", @@ -319,14 +319,14 @@ "item.actuallyadditions.knife_blade": "Knife Blade (wip)", "item.actuallyadditions.knife_handle": "Knife Handle (wip)", "item.actuallyadditions.black_quartz": "Black Quartz (wip)", - "item.actuallyadditions.ring": "Ring (wip)", + "item.actuallyadditions.ring": "Ring", "item.actuallyadditions.ring.storage": "Blaze Stored (wip)", "item.actuallyadditions.teleport_staff": "Teleport Staff", "item.actuallyadditions.leaf_blower": "Leaf Blower", "item.actuallyadditions.advanced_leaf_blower": "Advanced Leaf Blower", "item.actuallyadditions.crafter_on_a_stick": "Crafting Table On A Stick", - "item.actuallyadditions.basic_coil": "Basic Coil (wip)", - "item.actuallyadditions.advanced_coil": "Advanced Coil (wip)", + "item.actuallyadditions.basic_coil": "Basic Coil", + "item.actuallyadditions.advanced_coil": "Advanced Coil", "item.actuallyadditions.potion_ring": "Ring of (wip)", "item.actuallyadditions.potion_ring_advanced": "Advanced Ring of (wip)", "item.actuallyadditions.solidified_experience": "Solidified Experience (wip)", @@ -390,12 +390,12 @@ "item.actuallyadditions.engineers_goggles": "Engineer's Goggles", "item.actuallyadditions.engineers_goggles_advanced": "Engineer's Infrared Goggles", "item.actuallyadditions.laser_upgrade_range": "Laser Relay Modifier: Range (wip)", - "item.actuallyadditions.restonia_crystal_shard": "Red Crystal Shard (wip)", - "item.actuallyadditions.palis_crystal_shard": "Blue Crystal Shard (wip)", - "item.actuallyadditions.diamatine_crystal_shard": "Light Blue Crystal Shard (wip)", - "item.actuallyadditions.void_crystal_shard": "Black Crystal Shard (wip)", - "item.actuallyadditions.emeradic_crystal_shard": "Green Crystal Shard (wip)", - "item.actuallyadditions.enori_crystal_shard": "White Crystal Shard (wip)", + "item.actuallyadditions.restonia_crystal_shard": "Red Crystal Shard", + "item.actuallyadditions.palis_crystal_shard": "Blue Crystal Shard", + "item.actuallyadditions.diamatine_crystal_shard": "Light Blue Crystal Shard", + "item.actuallyadditions.void_crystal_shard": "Black Crystal Shard", + "item.actuallyadditions.emeradic_crystal_shard": "Green Crystal Shard", + "item.actuallyadditions.enori_crystal_shard": "White Crystal Shard", "_comment": "Tooltips", "tooltip.actuallyadditions.onSuffix.desc": "On", "tooltip.actuallyadditions.phantom.connected.desc": "",