From ca5b9b4fb953fee41c8e6185642337d4d8ad882d Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sat, 8 May 2021 18:37:30 +0200 Subject: [PATCH] Bugs and things - Recipes for the diving gear - Idle Windmill Bearings now attach their structure when moved as part of another contraption - Fixed pumps not updating transfer speed when directly between containers - Fixed Multiblock Fluid tanks showing inconsistent information on their goggle overlay - Creative Fluid tanks no longer show a goggle overlay - Fixed Funnels and other interfaces not updating properly when affected chunks are unloaded and reloaded - Fixed tooltips rendering behind item icon in the filter screens --- src/generated/resources/.cache/cache | 6 +++ .../crafting/appliances/copper_backtank.json | 32 +++++++++++++ .../crafting/appliances/diving_boots.json | 32 +++++++++++++ .../crafting/appliances/diving_helmet.json | 32 +++++++++++++ .../crafting/appliances/copper_backtank.json | 22 +++++++++ .../crafting/appliances/diving_boots.json | 19 ++++++++ .../crafting/appliances/diving_helmet.json | 18 +++++++ .../structureMovement/Contraption.java | 47 ++++++++++++------- .../contraptions/fluids/PumpTileEntity.java | 5 ++ .../tank/CreativeFluidTankTileEntity.java | 7 +++ .../fluids/tank/FluidTankTileEntity.java | 7 ++- .../item/filter/AbstractFilterScreen.java | 2 +- .../data/recipe/StandardRecipeGen.java | 21 +++++++++ .../inventory/InvManipulationBehaviour.java | 2 +- 14 files changed, 231 insertions(+), 21 deletions(-) create mode 100644 src/generated/resources/data/create/advancements/recipes/create.base/crafting/appliances/copper_backtank.json create mode 100644 src/generated/resources/data/create/advancements/recipes/create.base/crafting/appliances/diving_boots.json create mode 100644 src/generated/resources/data/create/advancements/recipes/create.base/crafting/appliances/diving_helmet.json create mode 100644 src/generated/resources/data/create/recipes/crafting/appliances/copper_backtank.json create mode 100644 src/generated/resources/data/create/recipes/crafting/appliances/diving_boots.json create mode 100644 src/generated/resources/data/create/recipes/crafting/appliances/diving_helmet.json diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 7b69af6c4..7f62cb3f8 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -1773,6 +1773,9 @@ c33e122c534a7a134f69faa36446ce7564d8a705 data/create/advancements/recipes/buildi c368cadffa9177fefb9e92ff4453b40bc8dd670d data/create/advancements/recipes/create.base/blasting/copper_ingot_from_ore.json 8fffce2a5c5dd88d52e3b006fa92fb18cf2f1571 data/create/advancements/recipes/create.base/blasting/zinc_ingot_from_crushed.json 4bb60ef5e186f12a9d52e61319db8c78300c64ab data/create/advancements/recipes/create.base/blasting/zinc_ingot_from_ore.json +d1d8cf6e1c95b7d99bf873fa6fee033103f995fd data/create/advancements/recipes/create.base/crafting/appliances/copper_backtank.json +46c04e685ab345a80598176f7ac68a044a76cd76 data/create/advancements/recipes/create.base/crafting/appliances/diving_boots.json +5f06b7dcf2af11f30c2e10ade4ac3fd172bc04df data/create/advancements/recipes/create.base/crafting/appliances/diving_helmet.json dd487f98c411f1ff22cb7fc208b8cc24b27deb2f data/create/advancements/recipes/create.base/crafting/appliances/dough.json 51cdcf168087f47e4458eed7543d227da1ee5ca0 data/create/advancements/recipes/create.base/crafting/appliances/tree_fertilizer.json d531f87f425d199aee4777a588c1cd6cab6f5173 data/create/advancements/recipes/create.base/crafting/curiosities/minecart_coupling.json @@ -2842,6 +2845,9 @@ f7879d404d7a848d818278b4e788f285a9087e63 data/create/recipes/compacting/blaze_ca 27c23592d8fec03072a04544d3598ca9b1c798ff data/create/recipes/compacting/chocolate.json 7b2ef15dd28d1d8a450ea49a82dfb361d1adde4c data/create/recipes/compacting/diorite_from_flint.json 7657603e95ccf83dd0d4b104635db66e531d092a data/create/recipes/compacting/granite_from_flint.json +30030b15caa11b3a7c0104adb62fe74e8c7c0df1 data/create/recipes/crafting/appliances/copper_backtank.json +9ad82ac5ce02654b7af7f1a570a6b2c01e140da3 data/create/recipes/crafting/appliances/diving_boots.json +813081c6421b34e161ec44e8e470994c282f76be data/create/recipes/crafting/appliances/diving_helmet.json 19526da3a59fc136654ff1bc93c0251581f397a9 data/create/recipes/crafting/appliances/dough.json 7b5f863dda3d05a79cb85943a178eba0bd8a7dc7 data/create/recipes/crafting/appliances/slime_ball.json b159ba84428eee6ef6e23df1766f2a18f2c8a63e data/create/recipes/crafting/appliances/tree_fertilizer.json diff --git a/src/generated/resources/data/create/advancements/recipes/create.base/crafting/appliances/copper_backtank.json b/src/generated/resources/data/create/advancements/recipes/create.base/crafting/appliances/copper_backtank.json new file mode 100644 index 000000000..cec124115 --- /dev/null +++ b/src/generated/resources/data/create/advancements/recipes/create.base/crafting/appliances/copper_backtank.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "create:crafting/appliances/copper_backtank" + ] + }, + "criteria": { + "has_item": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "tag": "forge:ingots/copper" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "create:crafting/appliances/copper_backtank" + } + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/create/advancements/recipes/create.base/crafting/appliances/diving_boots.json b/src/generated/resources/data/create/advancements/recipes/create.base/crafting/appliances/diving_boots.json new file mode 100644 index 000000000..1151c46ef --- /dev/null +++ b/src/generated/resources/data/create/advancements/recipes/create.base/crafting/appliances/diving_boots.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "create:crafting/appliances/diving_boots" + ] + }, + "criteria": { + "has_item": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "tag": "forge:ingots/copper" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "create:crafting/appliances/diving_boots" + } + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/create/advancements/recipes/create.base/crafting/appliances/diving_helmet.json b/src/generated/resources/data/create/advancements/recipes/create.base/crafting/appliances/diving_helmet.json new file mode 100644 index 000000000..91f879caa --- /dev/null +++ b/src/generated/resources/data/create/advancements/recipes/create.base/crafting/appliances/diving_helmet.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "create:crafting/appliances/diving_helmet" + ] + }, + "criteria": { + "has_item": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "tag": "forge:ingots/copper" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "create:crafting/appliances/diving_helmet" + } + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/create/recipes/crafting/appliances/copper_backtank.json b/src/generated/resources/data/create/recipes/crafting/appliances/copper_backtank.json new file mode 100644 index 000000000..a99c83f9d --- /dev/null +++ b/src/generated/resources/data/create/recipes/crafting/appliances/copper_backtank.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "AGA", + "PPP", + " P " + ], + "key": { + "G": { + "item": "create:shaft" + }, + "A": { + "item": "create:andesite_alloy" + }, + "P": { + "tag": "forge:ingots/copper" + } + }, + "result": { + "item": "create:copper_backtank" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/create/recipes/crafting/appliances/diving_boots.json b/src/generated/resources/data/create/recipes/crafting/appliances/diving_boots.json new file mode 100644 index 000000000..790d1fd91 --- /dev/null +++ b/src/generated/resources/data/create/recipes/crafting/appliances/diving_boots.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "P P", + "P P", + "G G" + ], + "key": { + "G": { + "item": "create:andesite_alloy" + }, + "P": { + "tag": "forge:ingots/copper" + } + }, + "result": { + "item": "create:diving_boots" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/create/recipes/crafting/appliances/diving_helmet.json b/src/generated/resources/data/create/recipes/crafting/appliances/diving_helmet.json new file mode 100644 index 000000000..ebc49ae69 --- /dev/null +++ b/src/generated/resources/data/create/recipes/crafting/appliances/diving_helmet.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "PPP", + "PGP" + ], + "key": { + "G": { + "tag": "forge:glass" + }, + "P": { + "tag": "forge:ingots/copper" + } + }, + "result": { + "item": "create:diving_helmet" + } +} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java index 63d400304..f7c07d10d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java @@ -33,6 +33,7 @@ import com.simibubi.create.content.contraptions.components.actors.SeatBlock; import com.simibubi.create.content.contraptions.components.actors.SeatEntity; import com.simibubi.create.content.contraptions.components.structureMovement.bearing.MechanicalBearingBlock; import com.simibubi.create.content.contraptions.components.structureMovement.bearing.StabilizedContraption; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.WindmillBearingBlock; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.AbstractChassisBlock; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.ChassisTileEntity; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.StickerBlock; @@ -342,6 +343,10 @@ public abstract class Contraption { // Bearings potentially create stabilized sub-contraptions if (AllBlocks.MECHANICAL_BEARING.has(state)) moveBearing(pos, frontier, visited, state); + + // WM Bearings attach their structure when moved + if (AllBlocks.WINDMILL_BEARING.has(state)) + moveWindmillBearing(pos, frontier, visited, state); // Seats transfer their passenger to the contraption if (state.getBlock() instanceof SeatBlock) @@ -497,6 +502,13 @@ public abstract class Contraption { } } + private void moveWindmillBearing(BlockPos pos, Queue frontier, Set visited, BlockState state) { + Direction facing = state.get(WindmillBearingBlock.FACING); + BlockPos offset = pos.offset(facing); + if (!visited.contains(offset)) + frontier.add(offset); + } + private void moveBearing(BlockPos pos, Queue frontier, Set visited, BlockState state) { Direction facing = state.get(MechanicalBearingBlock.FACING); if (!canBeStabilized(facing, pos.subtract(anchor))) { @@ -701,8 +713,8 @@ public abstract class Contraption { c -> seatMapping.put(NBTUtil.readUniqueId(NBTHelper.getINBT(c, "Id")), c.getInt("Seat"))); stabilizedSubContraptions.clear(); - NBTHelper.iterateCompoundList(nbt.getList("SubContraptions", NBT.TAG_COMPOUND), c -> stabilizedSubContraptions - .put(c.getUniqueId("Id"), BlockFace.fromNBT(c.getCompound("Location")))); + NBTHelper.iterateCompoundList(nbt.getList("SubContraptions", NBT.TAG_COMPOUND), + c -> stabilizedSubContraptions.put(c.getUniqueId("Id"), BlockFace.fromNBT(c.getCompound("Location")))); storage.clear(); NBTHelper.iterateCompoundList(nbt.getList("Storage", NBT.TAG_COMPOUND), c -> storage @@ -831,7 +843,9 @@ public abstract class Contraption { private CompoundNBT writeBlocksCompound() { CompoundNBT compound = new CompoundNBT(); - HashMapPalette palette = new HashMapPalette<>(GameData.getBlockStateIDMap(), 16, (i, s) -> {throw new IllegalStateException("Palette Map index exceeded maximum");}, NBTUtil::readBlockState, NBTUtil::writeBlockState); + HashMapPalette palette = new HashMapPalette<>(GameData.getBlockStateIDMap(), 16, (i, s) -> { + throw new IllegalStateException("Palette Map index exceeded maximum"); + }, NBTUtil::readBlockState, NBTUtil::writeBlockState); ListNBT blockList = new ListNBT(); for (BlockInfo block : this.blocks.values()) { @@ -857,7 +871,9 @@ public abstract class Contraption { ListNBT blockList; if (usePalettedDeserialization) { CompoundNBT c = ((CompoundNBT) compound); - palette = new HashMapPalette<>(GameData.getBlockStateIDMap(), 16, (i, s) -> {throw new IllegalStateException("Palette Map index exceeded maximum");}, NBTUtil::readBlockState, NBTUtil::writeBlockState); + palette = new HashMapPalette<>(GameData.getBlockStateIDMap(), 16, (i, s) -> { + throw new IllegalStateException("Palette Map index exceeded maximum"); + }, NBTUtil::readBlockState, NBTUtil::writeBlockState); palette.read(c.getList("Palette", 10)); blockList = c.getList("BlockList", 10); @@ -906,19 +922,15 @@ public abstract class Contraption { } private static BlockInfo readBlockInfo(CompoundNBT blockListEntry, HashMapPalette palette) { - return new BlockInfo( - BlockPos.fromLong(blockListEntry.getLong("Pos")), - Objects.requireNonNull(palette.get(blockListEntry.getInt("State"))), - blockListEntry.contains("Data") ? blockListEntry.getCompound("Data") : null - ); + return new BlockInfo(BlockPos.fromLong(blockListEntry.getLong("Pos")), + Objects.requireNonNull(palette.get(blockListEntry.getInt("State"))), + blockListEntry.contains("Data") ? blockListEntry.getCompound("Data") : null); } private static BlockInfo legacyReadBlockInfo(CompoundNBT blockListEntry) { - return new BlockInfo( - NBTUtil.readBlockPos(blockListEntry.getCompound("Pos")), - NBTUtil.readBlockState(blockListEntry.getCompound("Block")), - blockListEntry.contains("Data") ? blockListEntry.getCompound("Data") : null - ); + return new BlockInfo(NBTUtil.readBlockPos(blockListEntry.getCompound("Pos")), + NBTUtil.readBlockState(blockListEntry.getCompound("Block")), + blockListEntry.contains("Data") ? blockListEntry.getCompound("Data") : null); } public void removeBlocksFromWorld(World world, BlockPos offset) { @@ -999,8 +1011,7 @@ public abstract class Contraption { } if (state.getBlock() instanceof IWaterLoggable && state.contains(BlockStateProperties.WATERLOGGED)) { FluidState FluidState = world.getFluidState(targetPos); - state = state.with(BlockStateProperties.WATERLOGGED, - FluidState.getFluid() == Fluids.WATER); + state = state.with(BlockStateProperties.WATERLOGGED, FluidState.getFluid() == Fluids.WATER); } world.destroyBlock(targetPos, true); @@ -1232,8 +1243,8 @@ public abstract class Contraption { float distSq = a * a + b * b; - - if (distSq > maxDistSq) maxDistSq = distSq; + if (distSq > maxDistSq) + maxDistSq = distSq; } return maxDistSq; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java index 62630d7ec..77dd51c68 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java @@ -103,6 +103,11 @@ public class PumpTileEntity extends KineticTileEntity { BlockPos backPos = pos.offset(getFront().getOpposite()); FluidPropagator.propagateChangedPipe(world, frontPos, world.getBlockState(frontPos)); FluidPropagator.propagateChangedPipe(world, backPos, world.getBlockState(backPos)); + + FluidTransportBehaviour behaviour = getBehaviour(FluidTransportBehaviour.TYPE); + if (behaviour != null) + behaviour.wipePressure(); + sidesToUpdate.forEach(MutableBoolean::setTrue); } protected void distributePressureTo(Direction side) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/CreativeFluidTankTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/CreativeFluidTankTileEntity.java index dfa661558..e5bf6f58a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/CreativeFluidTankTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/CreativeFluidTankTileEntity.java @@ -1,10 +1,12 @@ package com.simibubi.create.content.contraptions.fluids.tank; +import java.util.List; import java.util.function.Consumer; import com.simibubi.create.foundation.fluid.SmartFluidTank; import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.text.ITextComponent; import net.minecraftforge.fluids.FluidStack; public class CreativeFluidTankTileEntity extends FluidTankTileEntity { @@ -17,6 +19,11 @@ public class CreativeFluidTankTileEntity extends FluidTankTileEntity { protected SmartFluidTank createInventory() { return new CreativeSmartFluidTank(getCapacityMultiplier(), this::onFluidStackChanged); } + + @Override + public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { + return false; + } public static class CreativeSmartFluidTank extends SmartFluidTank { diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java index 3501c84f3..ccb7403ba 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java @@ -141,6 +141,8 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI FluidTankTileEntity tankAt = FluidTankConnectivityHandler.anyTankAt(world, pos); if (tankAt == null) continue; + world.updateComparatorOutputLevel(pos, tankAt.getBlockState() + .getBlock()); if (tankAt.luminosity == actualLuminosity) continue; tankAt.setLuminosity(actualLuminosity); @@ -315,8 +317,11 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI @Override public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { + FluidTankTileEntity controllerTE = getControllerTE(); + if (controllerTE == null) + return false; return containedFluidTooltip(tooltip, isPlayerSneaking, - getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)); + controllerTE.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java index 79cefef17..bade51cb0 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java @@ -69,7 +69,7 @@ public abstract class AbstractFilterScreen ex textRenderer.draw(ms, I18n.format(container.filterItem.getTranslationKey()), x + 15, y + 3, 0xdedede); GuiGameElement.of(container.filterItem) - .at(x + background.width, guiTop + background.height - 60) + .at(x + background.width, guiTop + background.height - 60, -200) .scale(5) .render(ms); diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java index f36289322..4f6998cc9 100644 --- a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java @@ -948,6 +948,27 @@ public class StandardRecipeGen extends CreateRecipeProvider { .viaShapeless(b -> b.addIngredient(AllItems.WHEAT_FLOUR.get()) .addIngredient(Items.WATER_BUCKET)), + DIVING_HELMET = create(AllItems.DIVING_HELMET).unlockedByTag(I::copper) + .viaShaped(b -> b.key('G', Tags.Items.GLASS) + .key('P', I.copper()) + .patternLine("PPP") + .patternLine("PGP")), + + COPPER_BACKTANK = create(AllItems.COPPER_BACKTANK).unlockedByTag(I::copper) + .viaShaped(b -> b.key('G', I.shaft()) + .key('A', I.andesite()) + .key('P', I.copper()) + .patternLine("AGA") + .patternLine("PPP") + .patternLine(" P ")), + + DIVING_BOOTS = create(AllItems.DIVING_BOOTS).unlockedByTag(I::copper) + .viaShaped(b -> b.key('G', I.andesite()) + .key('P', I.copper()) + .patternLine("P P") + .patternLine("P P") + .patternLine("G G")), + SLIME_BALL = create(() -> Items.SLIME_BALL).unlockedBy(AllItems.DOUGH::get) .viaShapeless(b -> b.addIngredient(AllItems.DOUGH.get()) .addIngredient(Tags.Items.DYES_LIME)), diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/inventory/InvManipulationBehaviour.java b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/inventory/InvManipulationBehaviour.java index 54336ccdc..eac304882 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/inventory/InvManipulationBehaviour.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/inventory/InvManipulationBehaviour.java @@ -160,7 +160,7 @@ public class InvManipulationBehaviour extends TileEntityBehaviour { @Override public void tick() { super.tick(); - if (findNewNextTick) { + if (findNewNextTick || getWorld().getGameTime() % 64 == 0) { findNewNextTick = false; findNewCapability(); }