Misc fixes

This commit is contained in:
Flanks255 2023-11-26 16:10:19 -06:00
parent 1fb8b80ee4
commit d4af87ceb3
8 changed files with 60 additions and 38 deletions

View file

@ -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);
}
}
}

View file

@ -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<TileEntityLaserRelay> {
}
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;

View file

@ -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();

View file

@ -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);
}

View file

@ -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);

View file

@ -48,11 +48,10 @@ public class ItemMagnetRing extends ItemEnergy {
List<ItemEntity> 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) {

View file

@ -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

View file

@ -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": "<Block connected!>",