diff --git a/build.gradle b/build.gradle index f30dc6846..5f1c00098 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' -version = 'mc1.14.4_v0.2.2a' +version = 'mc1.14.4_v0.2.2b' group = 'com.simibubi.create' archivesBaseName = 'create' diff --git a/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java b/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java index ef4d62a29..01b32ab0e 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/KineticNetwork.java @@ -38,12 +38,12 @@ public class KineticNetwork { return; if (te.isSource()) { unloadedCapacity -= lastCapacity * getStressMultiplierForSpeed(te.getGeneratedSpeed()); - float addedStressCapacity = te.getAddedStressCapacity(); + float addedStressCapacity = te.calculateAddedStressCapacity(); sources.put(te, addedStressCapacity); } unloadedStress -= lastStress * getStressMultiplierForSpeed(te.getTheoreticalSpeed()); - float stressApplied = te.getStressApplied(); + float stressApplied = te.calculateStressApplied(); members.put(te, stressApplied); unloadedMembers--; @@ -59,8 +59,8 @@ public class KineticNetwork { if (members.containsKey(te)) return; if (te.isSource()) - sources.put(te, te.getAddedStressCapacity()); - members.put(te, te.getStressApplied()); + sources.put(te, te.calculateAddedStressCapacity()); + members.put(te, te.calculateStressApplied()); te.updateFromNetwork(currentCapacity, currentStress, getSize()); te.networkDirty = true; } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/GeneratingKineticTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/base/GeneratingKineticTileEntity.java index 52f45be3a..e83403818 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/GeneratingKineticTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/GeneratingKineticTileEntity.java @@ -55,7 +55,7 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity { public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { boolean added = super.addToGoggleTooltip(tooltip, isPlayerSneaking); - float stressBase = getAddedStressCapacity(); + float stressBase = calculateAddedStressCapacity(); if (stressBase != 0 && IRotate.StressImpact.isEnabled()) { tooltip.add(spacing + Lang.translate("gui.goggles.generator_stats")); tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("tooltip.capacityProvided")); @@ -97,8 +97,8 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity { if (hasNetwork() && speed != 0) { KineticNetwork network = getOrCreateNetwork(); - notifyStressCapacityChange(getAddedStressCapacity()); - getOrCreateNetwork().updateStressFor(this, getStressApplied()); + notifyStressCapacityChange(calculateAddedStressCapacity()); + getOrCreateNetwork().updateStressFor(this, calculateStressApplied()); network.updateStress(); } @@ -112,7 +112,7 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity { if (speed == 0) { if (hasSource()) { notifyStressCapacityChange(0); - getOrCreateNetwork().updateStressFor(this, getStressApplied()); + getOrCreateNetwork().updateStressFor(this, calculateStressApplied()); return; } detachKinetics(); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java index 583088575..de3df92b2 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntity.java @@ -139,20 +139,22 @@ public abstract class KineticTileEntity extends SmartTileEntity } } - public float getAddedStressCapacity() { + public float calculateAddedStressCapacity() { Map> capacityMap = AllConfigs.SERVER.kinetics.stressValues.capacities; ResourceLocation path = getBlockState().getBlock().getRegistryName(); - if (!capacityMap.containsKey(path)) - return 0; - return capacityMap.get(path).get().floatValue(); + + float capacity = capacityMap.containsKey(path) ? capacityMap.get(path).get().floatValue() : 0; + this.lastCapacityProvided = capacity; + return capacity; } - public float getStressApplied() { + public float calculateStressApplied() { Map> stressEntries = AllConfigs.SERVER.kinetics.stressValues.impacts; ResourceLocation path = getBlockState().getBlock().getRegistryName(); - if (!stressEntries.containsKey(path)) - return 1; - return stressEntries.get(path).get().floatValue(); + + float impact = stressEntries.containsKey(path) ? stressEntries.get(path).get().floatValue() : 1; + this.lastStressApplied = impact; + return impact; } public void onSpeedChanged(float previousSpeed) { @@ -186,13 +188,11 @@ public abstract class KineticTileEntity extends SmartTileEntity networkTag.putFloat("Stress", stress); networkTag.putFloat("Capacity", capacity); networkTag.putInt("Size", networkSize); - - float stressApplied = getStressApplied(); - float addedStressCapacity = getAddedStressCapacity(); - if (stressApplied != 0) - networkTag.putFloat("AddedStress", stressApplied); - if (addedStressCapacity != 0) - networkTag.putFloat("AddedCapacity", addedStressCapacity); + + if (lastStressApplied != 0) + networkTag.putFloat("AddedStress", lastStressApplied); + if (lastCapacityProvided != 0) + networkTag.putFloat("AddedCapacity", lastCapacityProvided); compound.put("Network", networkTag); } @@ -203,7 +203,6 @@ public abstract class KineticTileEntity extends SmartTileEntity @Override public void read(CompoundNBT compound) { speed = compound.getFloat("Speed"); - source = null; network = null; overStressed = false; @@ -392,9 +391,9 @@ public abstract class KineticTileEntity extends SmartTileEntity @Override public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { boolean added = false; - float stressAtBase = getStressApplied(); + float stressAtBase = calculateStressApplied(); - if (getStressApplied() != 0 && StressImpact.isEnabled()) { + if (calculateStressApplied() != 0 && StressImpact.isEnabled()) { tooltip.add(spacing + Lang.translate("gui.goggles.kinetic_stats")); tooltip.add(spacing + TextFormatting.GRAY + Lang.translate("tooltip.stressImpact")); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/StorageInterfaceMovement.java b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/StorageInterfaceMovement.java index 45815f0a2..d647423c1 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/actors/StorageInterfaceMovement.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/actors/StorageInterfaceMovement.java @@ -102,8 +102,8 @@ public class StorageInterfaceMovement extends MovementBehaviour { extracting.withAmountThreshold(stack -> { ItemStack tester = stack.copy(); - tester.setCount(64); - return 64 - ItemHandlerHelper.insertItemStacked(inv, stack, true).getCount(); + tester.setCount(tester.getMaxStackSize()); + return stack.getCount() - ItemHandlerHelper.insertItemStacked(inv, stack, true).getCount(); }); extracting.setCallback(stack -> { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/bearing/MechanicalBearingTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/bearing/MechanicalBearingTileEntity.java index 9e2b96ef6..d962824b6 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/bearing/MechanicalBearingTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/contraptions/bearing/MechanicalBearingTileEntity.java @@ -52,13 +52,13 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp } @Override - public float getAddedStressCapacity() { - return isWindmill ? super.getAddedStressCapacity() : 0; + public float calculateAddedStressCapacity() { + return isWindmill ? super.calculateAddedStressCapacity() : 0; } @Override - public float getStressApplied() { - return isWindmill ? 0 : super.getStressApplied(); + public float calculateStressApplied() { + return isWindmill ? 0 : super.calculateStressApplied(); } public void neighbourChanged() { diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/crusher/CrushingWheelControllerTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/components/crusher/CrushingWheelControllerTileEntity.java index 9f2feb3af..0d3270d72 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/crusher/CrushingWheelControllerTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/crusher/CrushingWheelControllerTileEntity.java @@ -204,7 +204,7 @@ public class CrushingWheelControllerTileEntity extends SyncedTileEntity implemen @Override public CompoundNBT write(CompoundNBT compound) { - if (hasEntity() && !isFrozen()) + if (hasEntity()) compound.put("Entity", NBTUtil.writeUniqueId(entityUUID)); compound.put("Inventory", inventory.serializeNBT()); compound.putFloat("Speed", crushingspeed); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/fan/EncasedFanTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/components/fan/EncasedFanTileEntity.java index 3ec6a244d..699d23817 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/fan/EncasedFanTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/fan/EncasedFanTileEntity.java @@ -45,13 +45,13 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity { } @Override - public float getAddedStressCapacity() { - return isGenerator ? super.getAddedStressCapacity() : 0; + public float calculateAddedStressCapacity() { + return isGenerator ? super.calculateAddedStressCapacity() : 0; } @Override - public float getStressApplied() { - return isGenerator ? 0 : super.getStressApplied(); + public float calculateStressApplied() { + return isGenerator ? 0 : super.calculateStressApplied(); } @Override diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/fan/NozzleTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/components/fan/NozzleTileEntity.java index 318159cfa..23d67634d 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/fan/NozzleTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/fan/NozzleTileEntity.java @@ -158,8 +158,21 @@ public class NozzleTileEntity extends SmartTileEntity { pushingEntities.add(entity); } - if (!pushing && pushingEntities.size() > 512 && !world.isRemote) - world.createExplosion(null, center.x, center.y, center.z, 6, Mode.BREAK); + for (Iterator iterator = pushingEntities.iterator(); iterator.hasNext();) { + Entity entity = iterator.next(); + if (entity.isAlive()) + continue; + iterator.remove(); + } + + if (!pushing && pushingEntities.size() > 256 && !world.isRemote) { + world.createExplosion(null, center.x, center.y, center.z, 2, Mode.NONE); + for (Iterator iterator = pushingEntities.iterator(); iterator.hasNext();) { + Entity entity = iterator.next(); + entity.remove(); + iterator.remove(); + } + } } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/flywheel/FlywheelTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/components/flywheel/FlywheelTileEntity.java index 8ee1418b0..d7f320305 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/flywheel/FlywheelTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/flywheel/FlywheelTileEntity.java @@ -43,7 +43,7 @@ public class FlywheelTileEntity extends GeneratingKineticTileEntity { } @Override - public float getAddedStressCapacity() { + public float calculateAddedStressCapacity() { return generatedCapacity; } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java index f4a4e47ce..1ea746fde 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/sequencer/SequencedGearshiftBlock.java @@ -10,6 +10,7 @@ import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItemUseContext; @@ -86,7 +87,8 @@ public class SequencedGearshiftBlock extends HorizontalAxisKineticBlock implemen return false; } - DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> withTileEntityDo(worldIn, pos, this::displayScreen)); + if (player instanceof ClientPlayerEntity) + DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> withTileEntityDo(worldIn, pos, this::displayScreen)); return true; } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntity.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntity.java index ca05863a0..1842a17d2 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltTileEntity.java @@ -56,7 +56,7 @@ public class BeltTileEntity extends KineticTileEntity { protected BeltInventory inventory; protected LazyOptional itemHandler; - private CompoundNBT trackerUpdateTag; + public CompoundNBT trackerUpdateTag; public BeltTileEntity() { super(AllTileEntities.BELT.type); @@ -115,10 +115,10 @@ public class BeltTileEntity extends KineticTileEntity { } @Override - public float getStressApplied() { + public float calculateStressApplied() { if (!isController()) return 0; - return super.getStressApplied(); + return super.calculateStressApplied(); } @Override diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/transport/BeltInventory.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/transport/BeltInventory.java index a130346cf..ff56a36f9 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/transport/BeltInventory.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/transport/BeltInventory.java @@ -125,7 +125,11 @@ public class BeltInventory { if (segmentBefore != -1 && current.locked) { BeltTileEntity beltSegment = BeltHelper.getBeltAtSegment(belt, segmentBefore); if (beltSegment != null) { - + + // wait in case belt isnt initialized yet + if (current.locked && beltSegment.trackerUpdateTag != null) + continue; + current.locked = false; List attachments = beltSegment.attachmentTracker.attachments; for (BeltAttachmentState attachmentState : attachments) { diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java b/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java index ec193205e..fd021a1e5 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/StockswitchBlock.java @@ -8,6 +8,7 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.HorizontalBlock; import net.minecraft.block.material.PushReaction; +import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.IntegerProperty; @@ -87,7 +88,8 @@ public class StockswitchBlock extends HorizontalBlock implements ITE () -> withTileEntityDo(worldIn, pos, this::displayScreen)); + if (player instanceof ClientPlayerEntity) + DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> withTileEntityDo(worldIn, pos, this::displayScreen)); return true; } diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateTileEntity.java b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateTileEntity.java index 7a80adbd0..7de4030b2 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateTileEntity.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/inventories/FlexcrateTileEntity.java @@ -162,20 +162,16 @@ public class FlexcrateTileEntity extends SyncedTileEntity implements INamedConta @Override public CompoundNBT write(CompoundNBT compound) { - if (!isSecondaryCrate()) { - compound.putBoolean("Main", true); - compound.putInt("AllowedAmount", allowedAmount); - compound.put("Inventory", inventory.serializeNBT()); - } + compound.putBoolean("Main", true); + compound.putInt("AllowedAmount", allowedAmount); + compound.put("Inventory", inventory.serializeNBT()); return super.write(compound); } @Override public void read(CompoundNBT compound) { - if (compound.contains("Main")) { - allowedAmount = compound.getInt("AllowedAmount"); - inventory.deserializeNBT(compound.getCompound("Inventory")); - } + allowedAmount = compound.getInt("AllowedAmount"); + inventory.deserializeNBT(compound.getCompound("Inventory")); super.read(compound); } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index d3f742686..9815734b1 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -4,7 +4,7 @@ loaderVersion="[28,)" [[mods]] modId="create" -version="mc1.14-0.2.2a" +version="mc1.14-0.2.2b" displayName="Create" #updateJSONURL="" authors="simibubi" diff --git a/src/main/resources/assets/create/lang/en_us.json b/src/main/resources/assets/create/lang/en_us.json index d48040e46..290ce4c0b 100644 --- a/src/main/resources/assets/create/lang/en_us.json +++ b/src/main/resources/assets/create/lang/en_us.json @@ -635,7 +635,7 @@ "advancement.create:polished_rose_quartz.desc": "Polish Rose Quartz until you can see through it.", "advancement.create:sand_paper_secret": "9001 Grit Sand Paper", "advancement.create:sand_paper_secret.desc": "Use your Sand Paper to sand some Sand Paper.", - "advancement.create:press": "'Bonk!' ", + "advancement.create:press": "'Bonk!'", "advancement.create:press.desc": "Make a Mechanical Press and use it to create some Plates.", "advancement.create:mixer": "Mixin' it Up", "advancement.create:mixer.desc": "Create a Mechanical Mixer.",