From 9bff016ba46fd75d7198da3eacba2e32ddf9c8ca Mon Sep 17 00:00:00 2001 From: grimmauld Date: Sat, 10 Oct 2020 17:54:17 +0200 Subject: [PATCH 1/4] Depot comparing --- .../logistics/block/depot/DepotBlock.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotBlock.java index c29347c7c..fb3895718 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotBlock.java @@ -9,6 +9,7 @@ import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; @@ -28,6 +29,11 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import net.minecraftforge.items.ItemStackHandler; +import javax.annotation.ParametersAreNonnullByDefault; + + +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault public class DepotBlock extends Block implements ITE { public DepotBlock(Properties p_i48440_1_) { @@ -130,4 +136,18 @@ public class DepotBlock extends Block implements ITE { itemEntity.remove(); } + @Override + public boolean hasComparatorInputOverride(BlockState state) { + return true; + } + + @Override + public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) { + try { + return ItemHelper.calcRedstoneFromInventory(getTileEntity(worldIn, pos).itemHandler); + } catch (TileEntityException ignored) { + } + return 0; + } + } From cb135df64976d926e5ac67a2d7c6e4c5b02f493f Mon Sep 17 00:00:00 2001 From: grimmauld Date: Sat, 10 Oct 2020 18:13:40 +0200 Subject: [PATCH 2/4] Configurable hunger games --- .../content/contraptions/components/crank/HandCrankBlock.java | 3 ++- .../java/com/simibubi/create/foundation/config/CKinetics.java | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankBlock.java index 7ed95683a..01c590b28 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankBlock.java @@ -6,6 +6,7 @@ import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock; import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.config.AllConfigs; import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; @@ -61,7 +62,7 @@ public class HandCrankBlock extends DirectionalKineticBlock implements ITE te.turn(player.isSneaking())); - player.addExhaustion(getRotationSpeed()/100.f); + player.addExhaustion(getRotationSpeed() * AllConfigs.SERVER.kinetics.crankHungerMultiplier.getF()); return ActionResultType.SUCCESS; } diff --git a/src/main/java/com/simibubi/create/foundation/config/CKinetics.java b/src/main/java/com/simibubi/create/foundation/config/CKinetics.java index 31a728123..fad878c1e 100644 --- a/src/main/java/com/simibubi/create/foundation/config/CKinetics.java +++ b/src/main/java/com/simibubi/create/foundation/config/CKinetics.java @@ -21,6 +21,9 @@ public class CKinetics extends ConfigBase { public ConfigInt generatingFanSpeed = i(16, 0, "generatingFanSpeed", Comments.rpm, Comments.generatingFanSpeed); public ConfigInt inWorldProcessingTime = i(150, 0, "inWorldProcessingTime", Comments.inWorldProcessingTime); + public ConfigGroup crank = group(0, "handCrank", "Hand Crank & Valve Handles"); + public ConfigFloat crankHungerMultiplier = f(.01f, 0, 1, "crankHungerMultiplier", Comments.crankHungerMultiplier); + public ConfigGroup contraptions = group(0, "contraptions", "Moving Contraptions"); public ConfigInt maxBlocksMoved = i(2048, 1, "maxBlocksMoved", Comments.maxBlocksMoved); public ConfigInt maxChassisRange = i(16, 1, "maxChassisRange", Comments.maxChassisRange); @@ -55,6 +58,7 @@ public class CKinetics extends ConfigBase { static String fanRotationArgmax = "Rotation speed at which the maximum stats of fans are reached."; static String generatingFanSpeed = "Rotation speed generated by a vertical fan above fire."; static String inWorldProcessingTime = "Game ticks required for a Fan-based processing recipe to take effect."; + static String crankHungerMultiplier = "multiplier used for calculating exhaustion from speed when a crank is turned."; static String maxBlocksMoved = "Maximum amount of blocks in a structure movable by Pistons, Bearings or other means."; static String maxChassisRange = "Maximum value of a chassis attachment range."; static String maxPistonPoles = "Maximum amount of extension poles behind a Mechanical Piston."; From 850297f77738d0471b80db936ec69c9d57a39999 Mon Sep 17 00:00:00 2001 From: grimmauld Date: Sat, 10 Oct 2020 18:16:28 +0200 Subject: [PATCH 3/4] Switch valve handles back to crank shapes as those fit better to the new model --- src/main/java/com/simibubi/create/AllShapes.java | 2 -- .../contraptions/components/crank/ValveHandleBlock.java | 5 ----- 2 files changed, 7 deletions(-) diff --git a/src/main/java/com/simibubi/create/AllShapes.java b/src/main/java/com/simibubi/create/AllShapes.java index f8b275fe1..232a0e9d6 100644 --- a/src/main/java/com/simibubi/create/AllShapes.java +++ b/src/main/java/com/simibubi/create/AllShapes.java @@ -47,8 +47,6 @@ public class AllShapes { .forDirectional(), CRANK = shape(5, 0, 5, 11, 6, 11).add(1, 3, 1, 15, 8, 15) .forDirectional(), - VALVE_HANDLE = shape(1, 0, 1, 15, 5, 15) - .forDirectional(), CART_ASSEMBLER = shape(0, 12, 0, 16, 16, 16).add(-2, 0, 1, 18, 14, 15) .forHorizontalAxis(), STOCKPILE_SWITCH = shape(0, 0, 0, 16, 2, 16).add(1, 0, 1, 15, 16, 15) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crank/ValveHandleBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/crank/ValveHandleBlock.java index e93a929eb..7484ed1eb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crank/ValveHandleBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crank/ValveHandleBlock.java @@ -33,11 +33,6 @@ public class ValveHandleBlock extends HandCrankBlock { super.fillItemGroup(group, p_149666_2_); } - @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return AllShapes.VALVE_HANDLE.get(state.get(FACING)); - } - @Override @OnlyIn(Dist.CLIENT) public AllBlockPartials getRenderedHandle() { From 474d21de9aaab596f451cb07b143c0f4255963d5 Mon Sep 17 00:00:00 2001 From: grimmauld Date: Sat, 10 Oct 2020 18:23:56 +0200 Subject: [PATCH 4/4] clean up some unused imports --- .../contraptions/components/crank/ValveHandleBlock.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crank/ValveHandleBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/crank/ValveHandleBlock.java index 7484ed1eb..2bc864ccc 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crank/ValveHandleBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crank/ValveHandleBlock.java @@ -1,17 +1,10 @@ package com.simibubi.create.content.contraptions.components.crank; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.AllShapes; -import mcp.MethodsReturnNonnullByDefault; -import net.minecraft.block.BlockState; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.world.IBlockReader; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn;