mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-16 23:11:40 +01:00
Minor refactors & Generic blockzapper
- Finished builder pattern refactor in AllShapes - Generalized some blockzapper code for its upcoming cousin
This commit is contained in:
parent
b8eb35e5c5
commit
5d2bbc930b
26 changed files with 364 additions and 146 deletions
|
@ -13,10 +13,10 @@ import com.simibubi.create.modules.contraptions.relays.gearbox.VerticalGearboxIt
|
||||||
import com.simibubi.create.modules.curiosities.ChromaticCompoundCubeItem;
|
import com.simibubi.create.modules.curiosities.ChromaticCompoundCubeItem;
|
||||||
import com.simibubi.create.modules.curiosities.RefinedRadianceItem;
|
import com.simibubi.create.modules.curiosities.RefinedRadianceItem;
|
||||||
import com.simibubi.create.modules.curiosities.ShadowSteelItem;
|
import com.simibubi.create.modules.curiosities.ShadowSteelItem;
|
||||||
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem;
|
|
||||||
import com.simibubi.create.modules.curiosities.deforester.DeforesterItem;
|
import com.simibubi.create.modules.curiosities.deforester.DeforesterItem;
|
||||||
import com.simibubi.create.modules.curiosities.symmetry.SymmetryWandItem;
|
import com.simibubi.create.modules.curiosities.symmetry.SymmetryWandItem;
|
||||||
import com.simibubi.create.modules.curiosities.tools.SandPaperItem;
|
import com.simibubi.create.modules.curiosities.tools.SandPaperItem;
|
||||||
|
import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem;
|
||||||
import com.simibubi.create.modules.gardens.TreeFertilizerItem;
|
import com.simibubi.create.modules.gardens.TreeFertilizerItem;
|
||||||
import com.simibubi.create.modules.logistics.item.filter.FilterItem;
|
import com.simibubi.create.modules.logistics.item.filter.FilterItem;
|
||||||
import com.simibubi.create.modules.schematics.item.SchematicAndQuillItem;
|
import com.simibubi.create.modules.schematics.item.SchematicAndQuillItem;
|
||||||
|
|
|
@ -11,8 +11,8 @@ import com.simibubi.create.foundation.packet.NbtPacket;
|
||||||
import com.simibubi.create.foundation.packet.SimplePacketBase;
|
import com.simibubi.create.foundation.packet.SimplePacketBase;
|
||||||
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
|
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
|
||||||
import com.simibubi.create.modules.contraptions.components.contraptions.ContraptionStallPacket;
|
import com.simibubi.create.modules.contraptions.components.contraptions.ContraptionStallPacket;
|
||||||
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperBeamPacket;
|
|
||||||
import com.simibubi.create.modules.curiosities.symmetry.SymmetryEffectPacket;
|
import com.simibubi.create.modules.curiosities.symmetry.SymmetryEffectPacket;
|
||||||
|
import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperBeamPacket;
|
||||||
import com.simibubi.create.modules.logistics.item.filter.FilterScreenPacket;
|
import com.simibubi.create.modules.logistics.item.filter.FilterScreenPacket;
|
||||||
import com.simibubi.create.modules.logistics.packet.ConfigureFlexcratePacket;
|
import com.simibubi.create.modules.logistics.packet.ConfigureFlexcratePacket;
|
||||||
import com.simibubi.create.modules.logistics.packet.ConfigureStockswitchPacket;
|
import com.simibubi.create.modules.logistics.packet.ConfigureStockswitchPacket;
|
||||||
|
|
|
@ -13,8 +13,8 @@ import com.simibubi.create.modules.contraptions.components.saw.CuttingRecipe;
|
||||||
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipe;
|
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipe;
|
||||||
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipeSerializer;
|
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipeSerializer;
|
||||||
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipeSerializer.IRecipeFactory;
|
import com.simibubi.create.modules.contraptions.processing.ProcessingRecipeSerializer.IRecipeFactory;
|
||||||
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperUpgradeRecipe;
|
|
||||||
import com.simibubi.create.modules.curiosities.tools.SandPaperPolishingRecipe;
|
import com.simibubi.create.modules.curiosities.tools.SandPaperPolishingRecipe;
|
||||||
|
import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperUpgradeRecipe;
|
||||||
|
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import com.simibubi.create.compat.jei.DoubleItemIcon;
|
||||||
import com.simibubi.create.compat.jei.ScreenResourceWrapper;
|
import com.simibubi.create.compat.jei.ScreenResourceWrapper;
|
||||||
import com.simibubi.create.foundation.gui.ScreenElementRenderer;
|
import com.simibubi.create.foundation.gui.ScreenElementRenderer;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperUpgradeRecipe;
|
import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperUpgradeRecipe;
|
||||||
|
|
||||||
import mezz.jei.api.constants.VanillaTypes;
|
import mezz.jei.api.constants.VanillaTypes;
|
||||||
import mezz.jei.api.gui.IRecipeLayout;
|
import mezz.jei.api.gui.IRecipeLayout;
|
||||||
|
|
|
@ -3,12 +3,13 @@ package com.simibubi.create.config;
|
||||||
public class CCuriosities extends ConfigBase {
|
public class CCuriosities extends ConfigBase {
|
||||||
|
|
||||||
public ConfigInt maxSymmetryWandRange = i(50, 10, "maxSymmetryWandRange", Comments.symmetryRange);
|
public ConfigInt maxSymmetryWandRange = i(50, 10, "maxSymmetryWandRange", Comments.symmetryRange);
|
||||||
public ConfigInt lightSourceCountForRefinedRadiance =
|
public ConfigInt zapperUndoLogLength = i(10, 0, "zapperUndoLogLength", Comments.zapperUndoLogLength);
|
||||||
i(10, 1, "lightSourceCountForRefinedRadiance", Comments.refinedRadiance);
|
public ConfigInt lightSourceCountForRefinedRadiance = i(10, 1, "lightSourceCountForRefinedRadiance",
|
||||||
public ConfigBool allowGlassPanesInPartialBlocks =
|
Comments.refinedRadiance);
|
||||||
b(true, "allowGlassPanesInPartialBlocks", Comments.windowsInBlocks);
|
public ConfigBool allowGlassPanesInPartialBlocks = b(true, "allowGlassPanesInPartialBlocks",
|
||||||
public ConfigBool enableRefinedRadianceRecipe =
|
Comments.windowsInBlocks);
|
||||||
b(true, "enableRefinedRadianceRecipe", Comments.refinedRadianceRecipe);
|
public ConfigBool enableRefinedRadianceRecipe = b(true, "enableRefinedRadianceRecipe",
|
||||||
|
Comments.refinedRadianceRecipe);
|
||||||
public ConfigBool enableShadowSteelRecipe = b(true, "enableShadowSteelRecipe", Comments.shadowSteelRecipe);
|
public ConfigBool enableShadowSteelRecipe = b(true, "enableShadowSteelRecipe", Comments.shadowSteelRecipe);
|
||||||
public ConfigBool enableSandPaperToolPolishing = b(true, "enableSandPaperToolPolishing", Comments.sandPaperOnTools);
|
public ConfigBool enableSandPaperToolPolishing = b(true, "enableSandPaperToolPolishing", Comments.sandPaperOnTools);
|
||||||
public ConfigFloat cocoaLogGrowthSpeed = f(20, 0, 100, "cocoaLogGrowthSpeed", Comments.cocoa);
|
public ConfigFloat cocoaLogGrowthSpeed = f(20, 0, 100, "cocoaLogGrowthSpeed", Comments.cocoa);
|
||||||
|
@ -20,13 +21,13 @@ public class CCuriosities extends ConfigBase {
|
||||||
|
|
||||||
private static class Comments {
|
private static class Comments {
|
||||||
static String symmetryRange = "The Maximum Distance to an active mirror for the symmetry wand to trigger.";
|
static String symmetryRange = "The Maximum Distance to an active mirror for the symmetry wand to trigger.";
|
||||||
static String refinedRadiance =
|
static String refinedRadiance = "The amount of Light sources destroyed before Chromatic Compound turns into Refined Radiance.";
|
||||||
"The amount of Light sources destroyed before Chromatic Compound turns into Refined Radiance.";
|
|
||||||
static String refinedRadianceRecipe = "Allow the standard Refined Radiance recipes.";
|
static String refinedRadianceRecipe = "Allow the standard Refined Radiance recipes.";
|
||||||
static String shadowSteelRecipe = "Allow the standard Shadow Steel recipe.";
|
static String shadowSteelRecipe = "Allow the standard Shadow Steel recipe.";
|
||||||
static String sandPaperOnTools = "Enable the tool repairing mechanic involving sand paper.";
|
static String sandPaperOnTools = "Enable the tool repairing mechanic involving sand paper.";
|
||||||
static String windowsInBlocks = "Allow Glass Panes to be put inside Blocks like Stairs, Slabs, Fences etc.";
|
static String windowsInBlocks = "Allow Glass Panes to be put inside Blocks like Stairs, Slabs, Fences etc.";
|
||||||
static String cocoa = "% of random Ticks causing a Cocoa log to grow.";
|
static String cocoa = "% of random Ticks causing a Cocoa log to grow.";
|
||||||
|
static String zapperUndoLogLength = "The maximum amount of operations, a blockzapper can remember for undoing. (0 to disable undo)";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.simibubi.create.foundation.utility;
|
package com.simibubi.create.foundation.utility;
|
||||||
|
|
||||||
import static net.minecraft.block.Block.makeCuboidShape;
|
|
||||||
import static net.minecraft.util.Direction.EAST;
|
import static net.minecraft.util.Direction.EAST;
|
||||||
import static net.minecraft.util.Direction.SOUTH;
|
import static net.minecraft.util.Direction.SOUTH;
|
||||||
import static net.minecraft.util.Direction.UP;
|
import static net.minecraft.util.Direction.UP;
|
||||||
|
@ -22,9 +21,9 @@ public class AllShapes {
|
||||||
// Independent Shapers
|
// Independent Shapers
|
||||||
public static final VoxelShaper
|
public static final VoxelShaper
|
||||||
|
|
||||||
SHORT_CASING_14_VOXEL = shape(0, 0, 0, 16, 14, 16).forDirectional(),
|
CASING_14PX = shape(0, 0, 0, 16, 14, 16).forDirectional(),
|
||||||
SHORT_CASING_12_VOXEL = shape(0, 0, 0, 16, 12, 16).forDirectional(),
|
CASING_12PX = shape(0, 0, 0, 16, 12, 16).forDirectional(),
|
||||||
SHORT_CASING_11_VOXEL = shape(0, 0, 0, 16, 11, 16).forDirectional(),
|
CASING_11PX = shape(0, 0, 0, 16, 11, 16).forDirectional(),
|
||||||
MOTOR_BLOCK = shape(0, 3, 3, 16, 13, 13).forHorizontal(EAST),
|
MOTOR_BLOCK = shape(0, 3, 3, 16, 13, 13).forHorizontal(EAST),
|
||||||
FOUR_VOXEL_POLE = shape(6, 0, 6, 10, 16, 10).forAxis(),
|
FOUR_VOXEL_POLE = shape(6, 0, 6, 10, 16, 10).forAxis(),
|
||||||
SIX_VOXEL_POLE = shape(5, 0, 5, 11, 16, 11).forAxis(),
|
SIX_VOXEL_POLE = shape(5, 0, 5, 11, 16, 11).forAxis(),
|
||||||
|
@ -39,30 +38,10 @@ public class AllShapes {
|
||||||
PULLEY = shape(0, 0, 0, 16, 16, 2).add(1, 1, 2, 15, 15, 14).add(0, 0, 14, 16, 16, 16).forHorizontalAxis(),
|
PULLEY = shape(0, 0, 0, 16, 16, 2).add(1, 1, 2, 15, 15, 14).add(0, 0, 14, 16, 16, 16).forHorizontalAxis(),
|
||||||
SPEED_CONTROLLER = shape(0, 0, 0, 16, 2, 16).add(1, 1, 1, 15, 15, 15).erase(0, 8, 5, 16, 16, 11)
|
SPEED_CONTROLLER = shape(0, 0, 0, 16, 2, 16).add(1, 1, 1, 15, 15, 15).erase(0, 8, 5, 16, 16, 11)
|
||||||
.add(2, 9, 2, 14, 14, 14).erase(6, 11, 0, 10, 16, 16).forHorizontalAxis(),
|
.add(2, 9, 2, 14, 14, 14).erase(6, 11, 0, 10, 16, 16).forHorizontalAxis(),
|
||||||
HARVESTER_BASE = shape(0, 2, 0, 16, 14, 3).forDirectional(SOUTH)
|
HARVESTER_BASE = shape(0, 2, 0, 16, 14, 3).forDirectional(SOUTH),
|
||||||
|
NOZZLE = shape(2, 0, 2, 14, 14, 14).add(1, 13, 1, 15, 15, 15).erase(3, 13, 3, 13, 15, 13).forDirectional(),
|
||||||
;
|
CRANK = shape(5, 0, 5, 11, 6, 11).add(1, 3, 1, 15, 8, 15).forDirectional(),
|
||||||
|
CART_ASSEMBLER = shape(VoxelShapes.fullCube()).add(-2, 0, 1, 18, 13, 15).forHorizontalAxis()
|
||||||
// Internally Shared Shapes (TODO: Use builder pattern)
|
|
||||||
private static final VoxelShape
|
|
||||||
|
|
||||||
CART_ASSEMBLER_SHAPE = VoxelShapes.or(VoxelShapes.fullCube(), makeCuboidShape(-2, 0, 1, 18, 13, 15)),
|
|
||||||
MECHANICAL_PISTON_HEAD_SHAPE_UP = Blocks.PISTON_HEAD.getStateContainer().getBaseState()
|
|
||||||
.with(DirectionalBlock.FACING, UP).with(PistonHeadBlock.SHORT, true).getShape(null, null),
|
|
||||||
MECHANICAL_PISTON_EXTENDED_SHAPE_UP = VoxelShapes.or(SHORT_CASING_12_VOXEL.get(UP),
|
|
||||||
FOUR_VOXEL_POLE.get(Direction.Axis.Y)),
|
|
||||||
SMALL_GEAR_SHAPE = makeCuboidShape(2, 6, 2, 14, 10, 14),
|
|
||||||
LARGE_GEAR_SHAPE = makeCuboidShape(0, 6, 0, 16, 10, 16),
|
|
||||||
VERTICAL_TABLET_SHAPE_SOUTH = makeCuboidShape(3, 1, -1, 13, 15, 3),
|
|
||||||
SQUARE_TABLET_SHAPE_SOUTH = makeCuboidShape(2, 2, -1, 14, 14, 3),
|
|
||||||
LOGISTICS_TABLE_SLOPE_SOUTH = VoxelShapes.or(makeCuboidShape(0, 10D, 15, 16, 14, 10.667),
|
|
||||||
makeCuboidShape(0, 12, 10.667, 16, 16, 6.333), makeCuboidShape(0, 14, 6.333, 16, 18, 2)),
|
|
||||||
SCHEMATICS_TABLE_SLOPE_SOUTH = VoxelShapes.or(makeCuboidShape(0, 10, 16, 16, 14, 11),
|
|
||||||
makeCuboidShape(0, 12, 11, 16, 16, 6), makeCuboidShape(0, 14, 6, 16, 18, 1)),
|
|
||||||
NOZZLE_SHAPE_UP = VoxelShapes.or(makeCuboidShape(2, 0, 2, 14, 14, 14),
|
|
||||||
VoxelShapes.combine(makeCuboidShape(1, 13, 1, 15, 15, 15), makeCuboidShape(3, 13, 3, 13, 15, 13),
|
|
||||||
IBooleanFunction.ONLY_FIRST)),
|
|
||||||
CRANK_SHAPE_UP = VoxelShapes.or(makeCuboidShape(5, 0, 5, 11, 6, 11), makeCuboidShape(1, 3, 1, 15, 8, 15))
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -82,25 +61,33 @@ public class AllShapes {
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
// Advanced Shapers (TODO: Use builder pattern)
|
// Internally Shared Shapes
|
||||||
|
private static final VoxelShape
|
||||||
|
|
||||||
|
PISTON_HEAD = Blocks.PISTON_HEAD.getDefaultState().with(DirectionalBlock.FACING, UP)
|
||||||
|
.with(PistonHeadBlock.SHORT, true).getShape(null, null),
|
||||||
|
PISTON_EXTENDED = shape(CASING_12PX.get(UP)).add(FOUR_VOXEL_POLE.get(Axis.Y)).build(),
|
||||||
|
SMALL_GEAR_SHAPE = cuboid(2, 6, 2, 14, 10, 14), LARGE_GEAR_SHAPE = cuboid(0, 6, 0, 16, 10, 16),
|
||||||
|
VERTICAL_TABLET_SHAPE = cuboid(3, 1, -1, 13, 15, 3), SQUARE_TABLET_SHAPE = cuboid(2, 2, -1, 14, 14, 3),
|
||||||
|
LOGISTICS_TABLE_SLOPE = shape(0, 10, 15, 16, 14, 10.667).add(0, 12, 10.667, 16, 16, 6.333)
|
||||||
|
.add(0, 14, 6.333, 16, 18, 2).build(),
|
||||||
|
SCHEMATICS_TABLE_SLOPE = shape(0, 10, 16, 16, 14, 11).add(0, 12, 11, 16, 16, 6).add(0, 14, 6, 16, 18, 1)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
// More Shapers
|
||||||
public static final VoxelShaper
|
public static final VoxelShaper
|
||||||
|
|
||||||
NOZZLE = VoxelShaper.forDirectional(NOZZLE_SHAPE_UP, UP), CRANK = VoxelShaper.forDirectional(CRANK_SHAPE_UP, UP),
|
MECHANICAL_PISTON_HEAD = shape(PISTON_HEAD).forDirectional(), MECHANICAL_PISTON = CASING_12PX,
|
||||||
CART_ASSEMBLER = VoxelShaper.forHorizontalAxis(CART_ASSEMBLER_SHAPE, Axis.Z),
|
MECHANICAL_PISTON_EXTENDED = shape(PISTON_EXTENDED).forDirectional(),
|
||||||
MECHANICAL_PISTON_HEAD = VoxelShaper.forDirectional(MECHANICAL_PISTON_HEAD_SHAPE_UP, UP),
|
SMALL_GEAR = shape(SMALL_GEAR_SHAPE).add(SIX_VOXEL_POLE.get(Axis.Y)).forAxis(),
|
||||||
MECHANICAL_PISTON = SHORT_CASING_12_VOXEL,
|
LARGE_GEAR = shape(LARGE_GEAR_SHAPE).add(SIX_VOXEL_POLE.get(Axis.Y)).forAxis(),
|
||||||
MECHANICAL_PISTON_EXTENDED = VoxelShaper.forDirectional(MECHANICAL_PISTON_EXTENDED_SHAPE_UP, UP),
|
LOGISTICAL_CONTROLLER = shape(SQUARE_TABLET_SHAPE).forDirectional(SOUTH),
|
||||||
SMALL_GEAR = VoxelShaper.forAxis(VoxelShapes.or(SMALL_GEAR_SHAPE, SIX_VOXEL_POLE.get(Direction.Axis.Y)),
|
REDSTONE_BRIDGE = shape(VERTICAL_TABLET_SHAPE).forDirectional(SOUTH)
|
||||||
Direction.Axis.Y),
|
|
||||||
LARGE_GEAR = VoxelShaper.forAxis(VoxelShapes.or(LARGE_GEAR_SHAPE, SIX_VOXEL_POLE.get(Direction.Axis.Y)),
|
|
||||||
Direction.Axis.Y),
|
|
||||||
LOGISTICAL_CONTROLLER = VoxelShaper.forDirectional(SQUARE_TABLET_SHAPE_SOUTH, SOUTH),
|
|
||||||
REDSTONE_BRIDGE = VoxelShaper.forHorizontal(VERTICAL_TABLET_SHAPE_SOUTH, SOUTH)
|
|
||||||
.withVerticalShapes(LOGISTICAL_CONTROLLER.get(UP)),
|
.withVerticalShapes(LOGISTICAL_CONTROLLER.get(UP)),
|
||||||
LOGISTICS_TABLE = VoxelShaper.forHorizontal(VoxelShapes.or(TABLE_POLE_SHAPE, LOGISTICS_TABLE_SLOPE_SOUTH),
|
LOGISTICS_TABLE = shape(TABLE_POLE_SHAPE).add(LOGISTICS_TABLE_SLOPE).forHorizontal(SOUTH),
|
||||||
SOUTH),
|
SCHEMATICS_TABLE = shape(TABLE_POLE_SHAPE).add(SCHEMATICS_TABLE_SLOPE).forDirectional(SOUTH)
|
||||||
SCHEMATICS_TABLE = VoxelShaper
|
|
||||||
.forDirectional(VoxelShapes.or(TABLE_POLE_SHAPE, SCHEMATICS_TABLE_SLOPE_SOUTH), SOUTH)
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class DrillBlock extends DirectionalKineticBlock implements IPortableBloc
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||||
return AllShapes.SHORT_CASING_12_VOXEL.get(state.get(FACING));
|
return AllShapes.CASING_12PX.get(state.get(FACING));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class DeployerBlock extends DirectionalAxisKineticBlock
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||||
return AllShapes.SHORT_CASING_12_VOXEL.get(state.get(FACING));
|
return AllShapes.CASING_12PX.get(state.get(FACING));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,7 +23,6 @@ import net.minecraft.world.IWorldReader;
|
||||||
public class MechanicalMixerBlock extends KineticBlock
|
public class MechanicalMixerBlock extends KineticBlock
|
||||||
implements IWithTileEntity<MechanicalMixerTileEntity>, IHaveCustomBlockItem {
|
implements IWithTileEntity<MechanicalMixerTileEntity>, IHaveCustomBlockItem {
|
||||||
|
|
||||||
|
|
||||||
public MechanicalMixerBlock() {
|
public MechanicalMixerBlock() {
|
||||||
super(Properties.from(Blocks.ANDESITE));
|
super(Properties.from(Blocks.ANDESITE));
|
||||||
}
|
}
|
||||||
|
@ -46,7 +45,7 @@ public class MechanicalMixerBlock extends KineticBlock
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||||
if (context.getEntity() instanceof PlayerEntity)
|
if (context.getEntity() instanceof PlayerEntity)
|
||||||
return AllShapes.SHORT_CASING_14_VOXEL.get(Direction.DOWN);
|
return AllShapes.CASING_14PX.get(Direction.DOWN);
|
||||||
|
|
||||||
return AllShapes.MECHANICAL_PROCESSOR_SHAPE;
|
return AllShapes.MECHANICAL_PROCESSOR_SHAPE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class MechanicalPressBlock extends HorizontalKineticBlock
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||||
if (context.getEntity() instanceof PlayerEntity)
|
if (context.getEntity() instanceof PlayerEntity)
|
||||||
return AllShapes.SHORT_CASING_14_VOXEL.get(Direction.DOWN);
|
return AllShapes.CASING_14PX.get(Direction.DOWN);
|
||||||
|
|
||||||
return AllShapes.MECHANICAL_PROCESSOR_SHAPE;
|
return AllShapes.MECHANICAL_PROCESSOR_SHAPE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class SawBlock extends DirectionalAxisKineticBlock implements IWithTileEn
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||||
return AllShapes.SHORT_CASING_12_VOXEL.get(state.get(FACING));
|
return AllShapes.CASING_12PX.get(state.get(FACING));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -181,16 +181,16 @@ public class BeltShapes {
|
||||||
return VoxelShapes.empty();
|
return VoxelShapes.empty();
|
||||||
|
|
||||||
if (slope == Slope.HORIZONTAL) {
|
if (slope == Slope.HORIZONTAL) {
|
||||||
return AllShapes.SHORT_CASING_11_VOXEL.get(Direction.UP);
|
return AllShapes.CASING_11PX.get(Direction.UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (part == Part.MIDDLE || part == Part.PULLEY)
|
if (part == Part.MIDDLE || part == Part.PULLEY)
|
||||||
return PARTIAL_CASING.get(slope == Slope.UPWARD ? facing : facing.getOpposite());
|
return PARTIAL_CASING.get(slope == Slope.UPWARD ? facing : facing.getOpposite());
|
||||||
|
|
||||||
if (part == Part.START)
|
if (part == Part.START)
|
||||||
return slope == Slope.UPWARD ? AllShapes.SHORT_CASING_11_VOXEL.get(Direction.UP) : PARTIAL_CASING.get(facing.getOpposite());
|
return slope == Slope.UPWARD ? AllShapes.CASING_11PX.get(Direction.UP) : PARTIAL_CASING.get(facing.getOpposite());
|
||||||
if (part == Part.END)
|
if (part == Part.END)
|
||||||
return slope == Slope.DOWNWARD ? AllShapes.SHORT_CASING_11_VOXEL.get(Direction.UP) : PARTIAL_CASING.get(facing);
|
return slope == Slope.DOWNWARD ? AllShapes.CASING_11PX.get(Direction.UP) : PARTIAL_CASING.get(facing);
|
||||||
|
|
||||||
//something went wrong
|
//something went wrong
|
||||||
return VoxelShapes.fullCube();
|
return VoxelShapes.fullCube();
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.simibubi.create.modules.curiosities.zapper;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.simibubi.create.config.AllConfigs;
|
||||||
|
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
|
||||||
|
|
||||||
|
public class ZapLog {
|
||||||
|
|
||||||
|
private World activeWorld;
|
||||||
|
private List<List<BlockInfo>> log = new LinkedList<>();
|
||||||
|
private int redoIndex;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Undo and redo operations applied by tools what information is necessary?
|
||||||
|
*
|
||||||
|
* For survival mode: does undo have the required blocks
|
||||||
|
*
|
||||||
|
* For creative mode: what data did removed TEs have
|
||||||
|
*
|
||||||
|
* When undo: remove added blocks (added -> air) replace replaced blocks (added
|
||||||
|
* -> before) add removed blocks (air -> before)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void record(World world, List<BlockPos> positions) {
|
||||||
|
if (maxLogLength() == 0)
|
||||||
|
return;
|
||||||
|
if (world != activeWorld)
|
||||||
|
log.clear();
|
||||||
|
activeWorld = world;
|
||||||
|
|
||||||
|
List<BlockInfo> blocks = positions.stream().map(pos -> {
|
||||||
|
TileEntity tileEntity = world.getTileEntity(pos);
|
||||||
|
return new BlockInfo(pos, world.getBlockState(pos), tileEntity == null ? null : tileEntity.serializeNBT());
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
log.add(0, blocks);
|
||||||
|
redoIndex = 0;
|
||||||
|
|
||||||
|
if (maxLogLength() < log.size())
|
||||||
|
log.remove(log.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Integer maxLogLength() {
|
||||||
|
return AllConfigs.SERVER.curiosities.zapperUndoLogLength.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void undo() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void redo() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.simibubi.create.modules.curiosities.zapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.item.ItemDescription;
|
||||||
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.ItemUseContext;
|
||||||
|
import net.minecraft.item.Rarity;
|
||||||
|
import net.minecraft.item.UseAction;
|
||||||
|
import net.minecraft.nbt.NBTUtil;
|
||||||
|
import net.minecraft.util.ActionResultType;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
|
public abstract class ZapperItem extends Item {
|
||||||
|
|
||||||
|
public ZapperItem(Properties properties) {
|
||||||
|
super(properties.maxStackSize(1).rarity(Rarity.UNCOMMON));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
||||||
|
if (stack.hasTag() && stack.getTag().contains("BlockUsed")) {
|
||||||
|
String usedblock = NBTUtil.readBlockState(stack.getTag().getCompound("BlockUsed")).getBlock()
|
||||||
|
.getTranslationKey();
|
||||||
|
ItemDescription.add(tooltip, TextFormatting.DARK_GRAY + Lang.translate("blockzapper.usingBlock",
|
||||||
|
TextFormatting.GRAY + new TranslationTextComponent(usedblock).getFormattedText()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActionResultType onItemUse(ItemUseContext context) {
|
||||||
|
// Shift -> open GUI
|
||||||
|
if (context.isPlacerSneaking()) {
|
||||||
|
if (context.getWorld().isRemote) {
|
||||||
|
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
|
||||||
|
openHandgunGUI(context.getItem(), context.getHand() == Hand.OFF_HAND);
|
||||||
|
});
|
||||||
|
applyCooldown(context.getPlayer(), context.getItem(), false);
|
||||||
|
}
|
||||||
|
return ActionResultType.SUCCESS;
|
||||||
|
}
|
||||||
|
return super.onItemUse(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
protected abstract void openHandgunGUI(ItemStack item, boolean b);
|
||||||
|
|
||||||
|
protected abstract int getCooldownDelay(ItemStack item);
|
||||||
|
|
||||||
|
protected void applyCooldown(PlayerEntity playerIn, ItemStack item, boolean dual) {
|
||||||
|
int delay = getCooldownDelay(item);
|
||||||
|
playerIn.getCooldownTracker().setCooldown(item.getItem(), dual ? delay * 2 / 3 : delay);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPlayerBreakBlockWhileHolding(BlockState state, World worldIn, BlockPos pos, PlayerEntity player) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UseAction getUseAction(ItemStack stack) {
|
||||||
|
return UseAction.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
package com.simibubi.create.modules.curiosities.blockzapper;
|
package com.simibubi.create.modules.curiosities.zapper.blockzapper;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.packet.SimplePacketBase;
|
import com.simibubi.create.foundation.packet.SimplePacketBase;
|
||||||
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperHandler.LaserBeam;
|
import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperHandler.LaserBeam;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.simibubi.create.modules.curiosities.blockzapper;
|
package com.simibubi.create.modules.curiosities.zapper.blockzapper;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.simibubi.create.modules.curiosities.blockzapper;
|
package com.simibubi.create.modules.curiosities.zapper.blockzapper;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
@ -20,6 +20,7 @@ import com.simibubi.create.foundation.item.ItemDescription.Palette;
|
||||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||||
|
import com.simibubi.create.modules.curiosities.zapper.ZapperItem;
|
||||||
|
|
||||||
import net.minecraft.advancements.CriteriaTriggers;
|
import net.minecraft.advancements.CriteriaTriggers;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -33,12 +34,8 @@ import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.fluid.IFluidState;
|
import net.minecraft.fluid.IFluidState;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ItemUseContext;
|
|
||||||
import net.minecraft.item.Rarity;
|
|
||||||
import net.minecraft.item.UseAction;
|
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.nbt.NBTUtil;
|
import net.minecraft.nbt.NBTUtil;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
|
@ -60,7 +57,6 @@ import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.util.text.TranslationTextComponent;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
@ -70,7 +66,11 @@ import net.minecraftforge.event.ForgeEventFactory;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
import net.minecraftforge.fml.network.PacketDistributor;
|
import net.minecraftforge.fml.network.PacketDistributor;
|
||||||
|
|
||||||
public class BlockzapperItem extends Item implements IHaveCustomItemModel {
|
public class BlockzapperItem extends ZapperItem implements IHaveCustomItemModel {
|
||||||
|
|
||||||
|
public BlockzapperItem(Properties properties) {
|
||||||
|
super(properties);
|
||||||
|
}
|
||||||
|
|
||||||
public static enum ComponentTier {
|
public static enum ComponentTier {
|
||||||
None(TextFormatting.DARK_GRAY), Brass(TextFormatting.GOLD), Chromatic(TextFormatting.LIGHT_PURPLE),
|
None(TextFormatting.DARK_GRAY), Brass(TextFormatting.GOLD), Chromatic(TextFormatting.LIGHT_PURPLE),
|
||||||
|
@ -89,29 +89,10 @@ public class BlockzapperItem extends Item implements IHaveCustomItemModel {
|
||||||
Body, Amplifier, Accelerator, Retriever, Scope
|
Body, Amplifier, Accelerator, Retriever, Scope
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockzapperItem(Properties properties) {
|
|
||||||
super(properties.maxStackSize(1).rarity(Rarity.UNCOMMON));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canPlayerBreakBlockWhileHolding(BlockState state, World worldIn, BlockPos pos, PlayerEntity player) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UseAction getUseAction(ItemStack stack) {
|
|
||||||
return UseAction.NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
||||||
if (stack.hasTag() && stack.getTag().contains("BlockUsed")) {
|
super.addInformation(stack, worldIn, tooltip, flagIn);
|
||||||
String usedblock = NBTUtil.readBlockState(stack.getTag().getCompound("BlockUsed")).getBlock()
|
|
||||||
.getTranslationKey();
|
|
||||||
ItemDescription.add(tooltip, TextFormatting.DARK_GRAY + Lang.translate("blockzapper.usingBlock",
|
|
||||||
TextFormatting.GRAY + new TranslationTextComponent(usedblock).getFormattedText()));
|
|
||||||
}
|
|
||||||
Palette palette = Palette.Purple;
|
Palette palette = Palette.Purple;
|
||||||
if (Screen.hasShiftDown()) {
|
if (Screen.hasShiftDown()) {
|
||||||
ItemDescription.add(tooltip, palette.color + Lang.translate("blockzapper.componentUpgrades"));
|
ItemDescription.add(tooltip, palette.color + Lang.translate("blockzapper.componentUpgrades"));
|
||||||
|
@ -144,21 +125,6 @@ public class BlockzapperItem extends Item implements IHaveCustomItemModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ActionResultType onItemUse(ItemUseContext context) {
|
|
||||||
// Shift -> open GUI
|
|
||||||
if (context.isPlacerSneaking()) {
|
|
||||||
if (context.getWorld().isRemote) {
|
|
||||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
|
|
||||||
openHandgunGUI(context.getItem(), context.getHand() == Hand.OFF_HAND);
|
|
||||||
});
|
|
||||||
applyCooldown(context.getPlayer(), context.getItem(), false);
|
|
||||||
}
|
|
||||||
return ActionResultType.SUCCESS;
|
|
||||||
}
|
|
||||||
return super.onItemUse(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
|
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
|
||||||
ItemStack item = player.getHeldItem(hand);
|
ItemStack item = player.getHeldItem(hand);
|
||||||
|
@ -381,8 +347,9 @@ public class BlockzapperItem extends Item implements IHaveCustomItemModel {
|
||||||
return slotChanged || !AllItems.PLACEMENT_HANDGUN.typeOf(newStack) || differentBlock;
|
return slotChanged || !AllItems.PLACEMENT_HANDGUN.typeOf(newStack) || differentBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
private void openHandgunGUI(ItemStack handgun, boolean offhand) {
|
protected void openHandgunGUI(ItemStack handgun, boolean offhand) {
|
||||||
ScreenOpener.open(new BlockzapperScreen(handgun, offhand));
|
ScreenOpener.open(new BlockzapperScreen(handgun, offhand));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,7 +470,8 @@ public class BlockzapperItem extends Item implements IHaveCustomItemModel {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getCooldownDelay(ItemStack stack) {
|
@Override
|
||||||
|
protected int getCooldownDelay(ItemStack stack) {
|
||||||
ComponentTier tier = getTier(Components.Accelerator, stack);
|
ComponentTier tier = getTier(Components.Accelerator, stack);
|
||||||
if (tier == ComponentTier.None)
|
if (tier == ComponentTier.None)
|
||||||
return 10;
|
return 10;
|
||||||
|
@ -576,11 +544,6 @@ public class BlockzapperItem extends Item implements IHaveCustomItemModel {
|
||||||
Block.spawnAsEntity(worldIn, placed, stack);
|
Block.spawnAsEntity(worldIn, placed, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void applyCooldown(PlayerEntity playerIn, ItemStack item, boolean dual) {
|
|
||||||
playerIn.getCooldownTracker().setCooldown(item.getItem(),
|
|
||||||
dual ? getCooldownDelay(item) * 2 / 3 : getCooldownDelay(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ComponentTier getTier(Components component, ItemStack stack) {
|
public static ComponentTier getTier(Components component, ItemStack stack) {
|
||||||
if (!stack.hasTag() || !stack.getTag().contains(component.name()))
|
if (!stack.hasTag() || !stack.getTag().contains(component.name()))
|
||||||
stack.getOrCreateTag().putString(component.name(), ComponentTier.None.name());
|
stack.getOrCreateTag().putString(component.name(), ComponentTier.None.name());
|
|
@ -1,16 +1,16 @@
|
||||||
package com.simibubi.create.modules.curiosities.blockzapper;
|
package com.simibubi.create.modules.curiosities.zapper.blockzapper;
|
||||||
|
|
||||||
import static com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.Components.Accelerator;
|
import static com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.Components.Accelerator;
|
||||||
import static com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.Components.Amplifier;
|
import static com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.Components.Amplifier;
|
||||||
import static com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.Components.Body;
|
import static com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.Components.Body;
|
||||||
import static com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.Components.Retriever;
|
import static com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.Components.Retriever;
|
||||||
import static com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.Components.Scope;
|
import static com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.Components.Scope;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GLX;
|
import com.mojang.blaze3d.platform.GLX;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.ComponentTier;
|
import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.ComponentTier;
|
||||||
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.Components;
|
import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.Components;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.FourWayBlock;
|
import net.minecraft.block.FourWayBlock;
|
|
@ -1,10 +1,10 @@
|
||||||
package com.simibubi.create.modules.curiosities.blockzapper;
|
package com.simibubi.create.modules.curiosities.zapper.blockzapper;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.block.render.CustomRenderedItemModel;
|
import com.simibubi.create.foundation.block.render.CustomRenderedItemModel;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.ComponentTier;
|
import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.ComponentTier;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.model.IBakedModel;
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
|
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.simibubi.create.modules.curiosities.blockzapper;
|
package com.simibubi.create.modules.curiosities.zapper.blockzapper;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
|
@ -1,10 +1,10 @@
|
||||||
package com.simibubi.create.modules.curiosities.blockzapper;
|
package com.simibubi.create.modules.curiosities.zapper.blockzapper;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.AllRecipes;
|
import com.simibubi.create.AllRecipes;
|
||||||
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.ComponentTier;
|
import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.ComponentTier;
|
||||||
import com.simibubi.create.modules.curiosities.blockzapper.BlockzapperItem.Components;
|
import com.simibubi.create.modules.curiosities.zapper.blockzapper.BlockzapperItem.Components;
|
||||||
|
|
||||||
import net.minecraft.inventory.CraftingInventory;
|
import net.minecraft.inventory.CraftingInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.simibubi.create.modules.curiosities.blockzapper;
|
package com.simibubi.create.modules.curiosities.zapper.blockzapper;
|
||||||
|
|
||||||
import com.simibubi.create.ScreenResources;
|
import com.simibubi.create.ScreenResources;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.simibubi.create.modules.curiosities.zapper.terrainzapper;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
|
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||||
|
|
||||||
|
public class CylinderBrush {
|
||||||
|
|
||||||
|
public static final int MAX_RADIUS = 6;
|
||||||
|
public static final int MAX_HEIGHT = 6;
|
||||||
|
private Map<Pair<Integer, Integer>, Pair<List<BlockPos>, VoxelShape>> cachedBrushes;
|
||||||
|
|
||||||
|
public CylinderBrush() {
|
||||||
|
cachedBrushes = new HashMap<>();
|
||||||
|
VoxelShape fullCube = VoxelShapes.fullCube();
|
||||||
|
|
||||||
|
for (int i = 0; i <= MAX_RADIUS; i++) {
|
||||||
|
int radius = i;
|
||||||
|
VoxelShape shape = VoxelShapes.empty();
|
||||||
|
List<BlockPos> positions = BlockPos.getAllInBox(BlockPos.ZERO.add(-i, 0, -i), BlockPos.ZERO.add(i, 0, i))
|
||||||
|
.filter(p -> p.withinDistance(BlockPos.ZERO, radius)).collect(Collectors.toList());
|
||||||
|
for (BlockPos p : positions)
|
||||||
|
shape = VoxelShapes.or(shape, fullCube.withOffset(p.getX(), p.getY(), p.getZ()));
|
||||||
|
for (int h = 0; h <= MAX_HEIGHT; h++) {
|
||||||
|
VoxelShape stackedShape = shape.simplify();
|
||||||
|
for (int layer = 0; layer <= layer; i++)
|
||||||
|
stackedShape = VoxelShapes.or(stackedShape, shape.withOffset(0, layer - h / 2, 0));
|
||||||
|
cachedBrushes.put(Pair.of(i, h), Pair.of(positions, stackedShape.simplify()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public VoxelShape getSelectionBox(int radius, int height) {
|
||||||
|
return get(radius, height).getRight();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BlockPos> getIncludedPositions(int radius, int height) {
|
||||||
|
return get(radius, height).getLeft();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Pair<List<BlockPos>, VoxelShape> get(int radius, int height) {
|
||||||
|
return cachedBrushes.get(Pair.of(Integer.valueOf(radius), Integer.valueOf(height)));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.simibubi.create.modules.curiosities.zapper.terrainzapper;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
|
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||||
|
|
||||||
|
public class SphereBrush {
|
||||||
|
|
||||||
|
public static final int MAX_RADIUS = 6;
|
||||||
|
private Map<Integer, Pair<List<BlockPos>, VoxelShape>> cachedBrushes;
|
||||||
|
|
||||||
|
public SphereBrush() {
|
||||||
|
cachedBrushes = new HashMap<>();
|
||||||
|
for (int i = 0; i <= MAX_RADIUS; i++) {
|
||||||
|
int radius = i;
|
||||||
|
VoxelShape shape = VoxelShapes.empty();
|
||||||
|
List<BlockPos> positions = BlockPos.getAllInBox(BlockPos.ZERO.add(-i, -i, -i), BlockPos.ZERO.add(i, i, i))
|
||||||
|
.filter(p -> p.withinDistance(BlockPos.ZERO, radius)).collect(Collectors.toList());
|
||||||
|
VoxelShape fullCube = VoxelShapes.fullCube();
|
||||||
|
for (BlockPos p : positions)
|
||||||
|
shape = VoxelShapes.or(shape, fullCube.withOffset(p.getX(), p.getY(), p.getZ()));
|
||||||
|
shape = shape.simplify();
|
||||||
|
cachedBrushes.put(i, Pair.of(positions, shape));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public VoxelShape getSelectionBox(int size) {
|
||||||
|
return get(size).getRight();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BlockPos> getIncludedPositions(int size) {
|
||||||
|
return get(size).getLeft();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Pair<List<BlockPos>, VoxelShape> get(int size) {
|
||||||
|
return cachedBrushes.get(Integer.valueOf(size));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.simibubi.create.modules.curiosities.zapper.terrainzapper;
|
||||||
|
|
||||||
|
import com.simibubi.create.modules.curiosities.zapper.ZapperItem;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class TerrainZapperItem extends ZapperItem {
|
||||||
|
|
||||||
|
public TerrainZapperItem(Properties properties) {
|
||||||
|
super(properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void openHandgunGUI(ItemStack item, boolean b) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getCooldownDelay(ItemStack item) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -741,7 +741,7 @@
|
||||||
"block.create.encased_shaft.tooltip.summary": "_Relays_ _Rotation_ in a straight line. Suitable for propagating Rotation through Walls.",
|
"block.create.encased_shaft.tooltip.summary": "_Relays_ _Rotation_ in a straight line. Suitable for propagating Rotation through Walls.",
|
||||||
|
|
||||||
"block.create.gearbox.tooltip": "GEARBOX",
|
"block.create.gearbox.tooltip": "GEARBOX",
|
||||||
"block.create.gearbox.tooltip.summary": "_Relays_ _Rotation_ to _Four_ _directions._ Reverses straight connections.",
|
"block.create.gearbox.tooltip.summary": "_Relays_ _Rotation_ in _four_ _directions._ Reverses straight connections.",
|
||||||
|
|
||||||
"block.create.gearshift.tooltip": "GEARSHIFT",
|
"block.create.gearshift.tooltip": "GEARSHIFT",
|
||||||
"block.create.gearshift.tooltip.summary": "A controllable _rotation_ _switch_ for connected shafts.",
|
"block.create.gearshift.tooltip.summary": "A controllable _rotation_ _switch_ for connected shafts.",
|
||||||
|
@ -784,7 +784,7 @@
|
||||||
"item.create.wrench.tooltip.control2": "R-Click while Sneaking",
|
"item.create.wrench.tooltip.control2": "R-Click while Sneaking",
|
||||||
"item.create.wrench.tooltip.action2": "_Disassembles_ _Kinetic_ _components_ and places them back in _your_ _inventory._",
|
"item.create.wrench.tooltip.action2": "_Disassembles_ _Kinetic_ _components_ and places them back in _your_ _inventory._",
|
||||||
|
|
||||||
"block.create.creative_motor.tooltip": "MOTOR",
|
"block.create.creative_motor.tooltip": "CREATIVE MOTOR",
|
||||||
"block.create.creative_motor.tooltip.summary": "A configurable source of _Rotational_ _Force_",
|
"block.create.creative_motor.tooltip.summary": "A configurable source of _Rotational_ _Force_",
|
||||||
|
|
||||||
"block.create.water_wheel.tooltip": "WATER WHEEL",
|
"block.create.water_wheel.tooltip": "WATER WHEEL",
|
||||||
|
@ -859,12 +859,12 @@
|
||||||
"block.create.flywheel.tooltip.behaviour1": "Provides _Rotational_ _Force_ to a connected contraption based on the generators strength and speed.",
|
"block.create.flywheel.tooltip.behaviour1": "Provides _Rotational_ _Force_ to a connected contraption based on the generators strength and speed.",
|
||||||
|
|
||||||
"block.create.mechanical_piston.tooltip": "MECHANICAL PISTON",
|
"block.create.mechanical_piston.tooltip": "MECHANICAL PISTON",
|
||||||
"block.create.mechanical_piston.tooltip.summary": "A more advanced version of the _Piston,_ using _Rotational_ _Force_ to precisely move attached structures. _Piston_ _Extension_ _Poles_ at the rear define the _Range_ of this Device. Without extensions, the piston will not move. Use _Translation_ _Chassis_ to move more than a single line of blocks.",
|
"block.create.mechanical_piston.tooltip.summary": "A more advanced version of the _Piston,_ using _Rotational_ _Force_ to precisely move attached structures. _Piston_ _Extension_ _Poles_ at the rear define the _Range_ of this Device. Without extensions, the piston will not move. Use _Chassis_ to move more than a single line of blocks.",
|
||||||
"block.create.mechanical_piston.tooltip.condition1": "When Rotated",
|
"block.create.mechanical_piston.tooltip.condition1": "When Rotated",
|
||||||
"block.create.mechanical_piston.tooltip.behaviour1": "Starts moving the attached structure. Speed and direction correlate to the incoming Rotation Speed.",
|
"block.create.mechanical_piston.tooltip.behaviour1": "Starts moving the attached structure. Speed and direction correlate to the incoming Rotation Speed.",
|
||||||
|
|
||||||
"block.create.sticky_mechanical_piston.tooltip": "STICKY MECHANICAL PISTON",
|
"block.create.sticky_mechanical_piston.tooltip": "STICKY MECHANICAL PISTON",
|
||||||
"block.create.sticky_mechanical_piston.tooltip.summary": "A more advanced version of the _Sticky_ _Piston,_ using _Rotational_ _Force_ to precisely move attached structures. _Piston_ _Extension_ _Poles_ at the rear define the _Range_ of this Device. Without extensions, the piston will not move. Use _Translation_ _Chassis_ to move more than a single line of blocks.",
|
"block.create.sticky_mechanical_piston.tooltip.summary": "A more advanced version of the _Sticky_ _Piston,_ using _Rotational_ _Force_ to precisely move attached structures. _Piston_ _Extension_ _Poles_ at the rear define the _Range_ of this Device. Without extensions, the piston will not move. Use _Chassis_ to move more than a single line of blocks.",
|
||||||
"block.create.sticky_mechanical_piston.tooltip.condition1": "When Rotated",
|
"block.create.sticky_mechanical_piston.tooltip.condition1": "When Rotated",
|
||||||
"block.create.sticky_mechanical_piston.tooltip.behaviour1": "Starts moving the attached structure. Speed and direction correlate to the incoming Rotation Speed.",
|
"block.create.sticky_mechanical_piston.tooltip.behaviour1": "Starts moving the attached structure. Speed and direction correlate to the incoming Rotation Speed.",
|
||||||
|
|
||||||
|
@ -881,18 +881,22 @@
|
||||||
"block.create.mechanical_bearing.tooltip.behaviour2": "Starts providing _Rotational_ _Force_ from rotating its attached structure. The Structure has to include suitable _Sail_ _Blocks_ (Currently any Wool Block).",
|
"block.create.mechanical_bearing.tooltip.behaviour2": "Starts providing _Rotational_ _Force_ from rotating its attached structure. The Structure has to include suitable _Sail_ _Blocks_ (Currently any Wool Block).",
|
||||||
|
|
||||||
"block.create.translation_chassis.tooltip": "TRANSLATION CHASSIS",
|
"block.create.translation_chassis.tooltip": "TRANSLATION CHASSIS",
|
||||||
"block.create.translation_chassis.tooltip.summary": "A configurable base for Structures moved by a _Mechanical_ _Piston._ These Blocks have to form the first Layer of blocks in front of the Piston.",
|
"block.create.translation_chassis.tooltip.summary": "A configurable base block connecting structures for movement.",
|
||||||
"block.create.translation_chassis.tooltip.condition1": "When Moved by Mechanical Piston",
|
"block.create.translation_chassis.tooltip.condition1": "When Moved",
|
||||||
"block.create.translation_chassis.tooltip.behaviour1": "_Moves_ all _attached_ _Chassis_ with the same orientation, and attached Blocks in front of it. When the Piston retracts, blocks will only be pulled if the chassis' face is _Sticky_ (See [Ctrl]).",
|
"block.create.translation_chassis.tooltip.behaviour1": "_Moves_ all _attached_ _Chassis_ with the same orientation, and a column of Blocks within its range. Blocks will only be pulled if the chassis' face is _Sticky_ (See [Ctrl]).",
|
||||||
|
"block.create.translation_chassis.tooltip.condition2": "With Wrench",
|
||||||
|
"block.create.translation_chassis.tooltip.behaviour2": "Configure the _range_ for this chassis block. Hold CTRL to modify the range of all attached chassis blocks as well.",
|
||||||
"block.create.translation_chassis.tooltip.control1": "When R-Clicked with Slime Ball",
|
"block.create.translation_chassis.tooltip.control1": "When R-Clicked with Slime Ball",
|
||||||
"block.create.translation_chassis.tooltip.action1": "Makes the clicked face _Sticky._ When the piston retracts, the chassis will _pull_ _back_ all attached Blocks in its column and within the configured Range.",
|
"block.create.translation_chassis.tooltip.action1": "Makes the clicked face _Sticky._ When moved, the chassis will _pull_ attached Blocks, regardless of the direcion of its movement.",
|
||||||
|
|
||||||
"block.create.rotation_chassis.tooltip": "ROTATION CHASSIS",
|
"block.create.rotation_chassis.tooltip": "ROTATION CHASSIS",
|
||||||
"block.create.rotation_chassis.tooltip.summary": "Required for rotating structures with the _Mechanical_ _Bearing._ ",
|
"block.create.rotation_chassis.tooltip.summary": "A configurable base block connecting structures for movement.",
|
||||||
"block.create.rotation_chassis.tooltip.condition1": "When Rotated by Bearing",
|
"block.create.rotation_chassis.tooltip.condition1": "When Moved",
|
||||||
"block.create.rotation_chassis.tooltip.behaviour1": "_Rotates_ all blocks attached to _Sticky_ sides (See [Ctrl]) within the configured range around itself. _Transmits_ the rotation to further attached Rotation Chassis.",
|
"block.create.rotation_chassis.tooltip.behaviour1": "_Moves_ all _attached_ _Chassis_ in a column, and a cylinder of blocks around itself. Blocks around it are only moved when they are within range and attached to a sticky side (See [Ctrl]).",
|
||||||
|
"block.create.rotation_chassis.tooltip.condition2": "With Wrench",
|
||||||
|
"block.create.rotation_chassis.tooltip.behaviour2": "Configure the _range_ for this chassis block. Hold CTRL to modify the range of all attached chassis blocks as well.",
|
||||||
"block.create.rotation_chassis.tooltip.control1": "When R-Clicked with Slime Ball",
|
"block.create.rotation_chassis.tooltip.control1": "When R-Clicked with Slime Ball",
|
||||||
"block.create.rotation_chassis.tooltip.action1": "Makes the clicked face _Sticky._ When the Chassis rotates, all blocks attached to this side will be rotated with it.",
|
"block.create.rotation_chassis.tooltip.action1": "Makes the clicked face _Sticky._ When the Chassis gets moved, all blocks attached to this side will be moved with it.",
|
||||||
|
|
||||||
"block.create.drill.tooltip": "MECHANICAL DRILL",
|
"block.create.drill.tooltip": "MECHANICAL DRILL",
|
||||||
"block.create.drill.tooltip.summary": "A mechanical device suitable for _breaking_ _blocks._",
|
"block.create.drill.tooltip.summary": "A mechanical device suitable for _breaking_ _blocks._",
|
||||||
|
|
Loading…
Reference in a new issue