Place, Use, Take and Poke

- Added the Deployer
- Deployer uses items or an empty hand to activate blocks
- Deployer uses items' inert click behaviour
This commit is contained in:
simibubi 2020-01-23 22:23:00 +01:00
parent 7b4d17daab
commit d563abcbdf
24 changed files with 1531 additions and 2 deletions

View file

@ -28,6 +28,7 @@ import com.simibubi.create.modules.contraptions.components.contraptions.piston.P
import com.simibubi.create.modules.contraptions.components.crafter.MechanicalCrafterBlock; import com.simibubi.create.modules.contraptions.components.crafter.MechanicalCrafterBlock;
import com.simibubi.create.modules.contraptions.components.crusher.CrushingWheelBlock; import com.simibubi.create.modules.contraptions.components.crusher.CrushingWheelBlock;
import com.simibubi.create.modules.contraptions.components.crusher.CrushingWheelControllerBlock; import com.simibubi.create.modules.contraptions.components.crusher.CrushingWheelControllerBlock;
import com.simibubi.create.modules.contraptions.components.deployer.DeployerBlock;
import com.simibubi.create.modules.contraptions.components.fan.EncasedFanBlock; import com.simibubi.create.modules.contraptions.components.fan.EncasedFanBlock;
import com.simibubi.create.modules.contraptions.components.mixer.MechanicalMixerBlock; import com.simibubi.create.modules.contraptions.components.mixer.MechanicalMixerBlock;
import com.simibubi.create.modules.contraptions.components.motor.MotorBlock; import com.simibubi.create.modules.contraptions.components.motor.MotorBlock;
@ -136,6 +137,11 @@ public enum AllBlocks {
MECHANICAL_MIXER_POLE(new RenderUtilityBlock()), MECHANICAL_MIXER_POLE(new RenderUtilityBlock()),
MECHANICAL_MIXER_HEAD(new RenderUtilityBlock()), MECHANICAL_MIXER_HEAD(new RenderUtilityBlock()),
BASIN(new BasinBlock()), BASIN(new BasinBlock()),
DEPLOYER(new DeployerBlock()),
DEPLOYER_POLE(new RenderUtilityBlock()),
DEPLOYER_HAND_POINTING(new RenderUtilityBlock()),
DEPLOYER_HAND_PUNCHING(new RenderUtilityBlock()),
DEPLOYER_HAND_HOLDING(new RenderUtilityBlock()),
MECHANICAL_CRAFTER(new MechanicalCrafterBlock()), MECHANICAL_CRAFTER(new MechanicalCrafterBlock()),
MECHANICAL_CRAFTER_LID(new RenderUtilityBlock()), MECHANICAL_CRAFTER_LID(new RenderUtilityBlock()),
MECHANICAL_CRAFTER_ARROW(new RenderUtilityBlock()), MECHANICAL_CRAFTER_ARROW(new RenderUtilityBlock()),

View file

@ -18,6 +18,8 @@ import com.simibubi.create.modules.contraptions.components.crafter.MechanicalCra
import com.simibubi.create.modules.contraptions.components.crafter.MechanicalCrafterTileEntityRenderer; import com.simibubi.create.modules.contraptions.components.crafter.MechanicalCrafterTileEntityRenderer;
import com.simibubi.create.modules.contraptions.components.crusher.CrushingWheelControllerTileEntity; import com.simibubi.create.modules.contraptions.components.crusher.CrushingWheelControllerTileEntity;
import com.simibubi.create.modules.contraptions.components.crusher.CrushingWheelTileEntity; import com.simibubi.create.modules.contraptions.components.crusher.CrushingWheelTileEntity;
import com.simibubi.create.modules.contraptions.components.deployer.DeployerTileEntity;
import com.simibubi.create.modules.contraptions.components.deployer.DeployerTileEntityRenderer;
import com.simibubi.create.modules.contraptions.components.fan.EncasedFanTileEntity; import com.simibubi.create.modules.contraptions.components.fan.EncasedFanTileEntity;
import com.simibubi.create.modules.contraptions.components.fan.EncasedFanTileEntityRenderer; import com.simibubi.create.modules.contraptions.components.fan.EncasedFanTileEntityRenderer;
import com.simibubi.create.modules.contraptions.components.mixer.MechanicalMixerTileEntity; import com.simibubi.create.modules.contraptions.components.mixer.MechanicalMixerTileEntity;
@ -119,6 +121,7 @@ public enum AllTileEntities {
WATER_WHEEL(WaterWheelTileEntity::new, AllBlocks.WATER_WHEEL), WATER_WHEEL(WaterWheelTileEntity::new, AllBlocks.WATER_WHEEL),
MECHANICAL_PRESS(MechanicalPressTileEntity::new, AllBlocks.MECHANICAL_PRESS), MECHANICAL_PRESS(MechanicalPressTileEntity::new, AllBlocks.MECHANICAL_PRESS),
MECHANICAL_MIXER(MechanicalMixerTileEntity::new, AllBlocks.MECHANICAL_MIXER), MECHANICAL_MIXER(MechanicalMixerTileEntity::new, AllBlocks.MECHANICAL_MIXER),
DEPLOYER(DeployerTileEntity::new, AllBlocks.DEPLOYER),
BASIN(BasinTileEntity::new, AllBlocks.BASIN), BASIN(BasinTileEntity::new, AllBlocks.BASIN),
MECHANICAL_CRAFTER(MechanicalCrafterTileEntity::new, AllBlocks.MECHANICAL_CRAFTER), MECHANICAL_CRAFTER(MechanicalCrafterTileEntity::new, AllBlocks.MECHANICAL_CRAFTER),
SPEED_GAUGE(SpeedGaugeTileEntity::new, AllBlocks.SPEED_GAUGE), SPEED_GAUGE(SpeedGaugeTileEntity::new, AllBlocks.SPEED_GAUGE),
@ -207,6 +210,7 @@ public enum AllTileEntities {
bind(SpeedGaugeTileEntity.class, new GaugeTileEntityRenderer(GaugeBlock.Type.SPEED)); bind(SpeedGaugeTileEntity.class, new GaugeTileEntityRenderer(GaugeBlock.Type.SPEED));
bind(StressGaugeTileEntity.class, new GaugeTileEntityRenderer(GaugeBlock.Type.STRESS)); bind(StressGaugeTileEntity.class, new GaugeTileEntityRenderer(GaugeBlock.Type.STRESS));
bind(BasinTileEntity.class, new BasinTileEntityRenderer()); bind(BasinTileEntity.class, new BasinTileEntityRenderer());
bind(DeployerTileEntity.class, new DeployerTileEntityRenderer());
bind(RedstoneLinkTileEntity.class, new SmartTileEntityRenderer<>()); bind(RedstoneLinkTileEntity.class, new SmartTileEntityRenderer<>());
bind(ExtractorTileEntity.class, new SmartTileEntityRenderer<>()); bind(ExtractorTileEntity.class, new SmartTileEntityRenderer<>());

View file

@ -4,7 +4,7 @@ import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.foundation.behaviour.ValueBox.ItemValueBox; import com.simibubi.create.foundation.behaviour.ValueBox.ItemValueBox;
import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.TessellatorHelper; import com.simibubi.create.foundation.utility.TessellatorHelper;
import com.simibubi.create.modules.contraptions.relays.elementary.CogWheelBlock; import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
import com.simibubi.create.modules.logistics.item.filter.FilterItem; import com.simibubi.create.modules.logistics.item.filter.FilterItem;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -101,7 +101,7 @@ public class ValueBoxRenderer {
return NUDGE; return NUDGE;
if (item instanceof BlockItem) { if (item instanceof BlockItem) {
Block block = ((BlockItem) item).getBlock(); Block block = ((BlockItem) item).getBlock();
if (block instanceof CogWheelBlock) if (block instanceof ShaftBlock)
return NUDGE; return NUDGE;
if (block instanceof FenceBlock) if (block instanceof FenceBlock)
return NUDGE; return NUDGE;

View file

@ -0,0 +1,20 @@
package com.simibubi.create.foundation.utility;
public class NBTHelper {
public static <T extends Enum<?>> T readEnum(String name, Class<T> enumClass) {
T[] enumConstants = enumClass.getEnumConstants();
if (enumConstants == null)
throw new IllegalArgumentException("Non-Enum class passed to readEnum(): " + enumClass.getName());
for (T t : enumConstants) {
if (t.name().equals(name))
return t;
}
return enumConstants[0];
}
public static <T extends Enum<?>> String writeEnum(T enumConstant) {
return enumConstant.name();
}
}

View file

@ -0,0 +1,94 @@
package com.simibubi.create.modules.contraptions.components.deployer;
import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.utility.AllShapes;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.modules.contraptions.base.DirectionalAxisKineticBlock;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
public class DeployerBlock extends DirectionalAxisKineticBlock implements IWithTileEntity<DeployerTileEntity> {
public DeployerBlock() {
super(Properties.from(Blocks.ANDESITE));
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new DeployerTileEntity();
}
@Override
protected boolean hasStaticPart() {
return true;
}
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return AllShapes.SHORT_CASING_12_VOXEL.get(state.get(FACING));
}
@Override
public ActionResultType onWrenched(BlockState state, ItemUseContext context) {
if (context.getFace() == state.get(FACING)) {
if (!context.getWorld().isRemote)
withTileEntityDo(context.getWorld(), context.getPos(), DeployerTileEntity::changeMode);
return ActionResultType.SUCCESS;
}
return super.onWrenched(state, context);
}
@Override
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn,
BlockRayTraceResult hit) {
if (hit.getFace() == state.get(FACING)) {
if (!worldIn.isRemote)
withTileEntityDo(worldIn, pos, te -> {
ItemStack heldItemMainhand = te.player.getHeldItemMainhand();
if (heldItemMainhand.isEmpty())
return;
player.inventory.placeItemBackInInventory(worldIn, heldItemMainhand);
te.player.setHeldItem(Hand.MAIN_HAND, ItemStack.EMPTY);
});
return true;
}
return false;
}
public static Vec3d getFilterSlotPosition(BlockState state) {
Direction facing = state.get(FACING);
Vec3d vec = VecHelper.voxelSpace(8f, 13.5f, 11.5f);
float yRot = AngleHelper.horizontalAngle(facing);
float zRot = facing == Direction.UP ? 270 : facing == Direction.DOWN ? 90 : 0;
vec = VecHelper.rotateCentered(vec, yRot, Axis.Y);
vec = VecHelper.rotateCentered(vec, zRot, Axis.Z);
return vec;
}
public static Vec3d getFilterSlotOrientation(BlockState state) {
Direction facing = state.get(FACING);
float yRot = AngleHelper.horizontalAngle(facing) + 180;
float zRot = facing == Direction.UP ? 90 : facing == Direction.DOWN ? 270 : 0;
return new Vec3d(0, yRot, zRot);
}
}

View file

@ -0,0 +1,51 @@
package com.simibubi.create.modules.contraptions.components.deployer;
import java.util.OptionalInt;
import java.util.UUID;
import com.mojang.authlib.GameProfile;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.network.IPacket;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.PacketDirection;
import net.minecraft.network.play.ServerPlayNetHandler;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.util.FakePlayer;
public class DeployerFakePlayer extends FakePlayer {
private static final NetworkManager NETWORK_MANAGER = new NetworkManager(PacketDirection.CLIENTBOUND);
public static final GameProfile DEPLOYER_PROFILE = new GameProfile(
UUID.fromString("9e2faded-cafe-4ec2-c314-dad129ae971d"), "Deployer");
public DeployerFakePlayer(ServerWorld world) {
super(world, DEPLOYER_PROFILE);
connection = new FakePlayNetHandler(world.getServer(), this);
}
@Override
public OptionalInt openContainer(INamedContainerProvider container) {
return OptionalInt.empty();
}
private static class FakePlayNetHandler extends ServerPlayNetHandler {
public FakePlayNetHandler(MinecraftServer server, ServerPlayerEntity playerIn) {
super(server, NETWORK_MANAGER, playerIn);
}
@Override
public void sendPacket(IPacket<?> packetIn) {
}
@Override
public void sendPacket(IPacket<?> packetIn,
GenericFutureListener<? extends Future<? super Void>> futureListeners) {
}
}
}

View file

@ -0,0 +1,354 @@
package com.simibubi.create.modules.contraptions.components.deployer;
import static com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock.FACING;
import static net.minecraftforge.eventbus.api.Event.Result.DENY;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.foundation.behaviour.base.TileEntityBehaviour;
import com.simibubi.create.foundation.behaviour.filtering.FilteringBehaviour;
import com.simibubi.create.foundation.behaviour.filtering.FilteringBehaviour.SlotPositioning;
import com.simibubi.create.foundation.behaviour.inventory.ExtractingBehaviour;
import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.NBTHelper;
import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import net.minecraft.block.BlockState;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.BlockItem;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceContext.BlockMode;
import net.minecraft.util.math.RayTraceContext.FluidMode;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper;
public class DeployerTileEntity extends KineticTileEntity {
private static final List<Pair<BlockPos, Direction>> EXTRACTING_LOCATIONS = Arrays.asList(Direction.values())
.stream().map(d -> Pair.of(BlockPos.ZERO.offset(d), d.getOpposite())).collect(Collectors.toList());
private FilteringBehaviour filtering;
private ExtractingBehaviour extracting;
protected State state;
protected Mode mode;
protected ItemStack heldItem = ItemStack.EMPTY;
protected DeployerFakePlayer player;
protected int timer;
protected float reach;
private List<ItemStack> overflowItems = new ArrayList<>();
enum State {
WAITING, EXPANDING, RETRACTING, DUMPING;
}
enum Mode {
PUNCH, USE
}
public DeployerTileEntity() {
super(AllTileEntities.DEPLOYER.type);
state = State.WAITING;
mode = Mode.USE;
heldItem = ItemStack.EMPTY;
}
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
super.addBehaviours(behaviours);
filtering = new FilteringBehaviour(this).withSlotPositioning(
new SlotPositioning(DeployerBlock::getFilterSlotPosition, DeployerBlock::getFilterSlotOrientation)
.scale(.4f));
extracting = new ExtractingBehaviour(this, this::getExtractingLocations, this::onExtract);
behaviours.add(filtering);
behaviours.add(extracting);
}
@Override
public void initialize() {
super.initialize();
if (!world.isRemote)
player = new DeployerFakePlayer((ServerWorld) world);
}
protected void onExtract(ItemStack stack) {
player.setHeldItem(Hand.MAIN_HAND, stack.copy());
sendData();
markDirty();
}
protected List<Pair<BlockPos, Direction>> getExtractingLocations() {
return EXTRACTING_LOCATIONS;
}
protected int getTimerSpeed() {
return (int) (getSpeed() == 0 ? 0 : MathHelper.clamp(Math.abs(getSpeed()) / 4, 1, 512));
}
@Override
public void tick() {
super.tick();
if (getSpeed() == 0)
return;
if (timer > 0) {
timer -= getTimerSpeed();
return;
}
if (world.isRemote)
return;
if (state == State.WAITING) {
if (!overflowItems.isEmpty()) {
tryDisposeOfItems();
if (!overflowItems.isEmpty())
timer = getTimerSpeed() * 10;
return;
}
if (!filtering.test(player.getHeldItemMainhand())) {
if (!player.getHeldItemMainhand().isEmpty()) {
overflowItems.add(player.getHeldItemMainhand());
player.setHeldItem(Hand.MAIN_HAND, ItemStack.EMPTY);
sendData();
return;
}
extracting.extract(1);
if (!filtering.test(player.getHeldItemMainhand()))
timer = getTimerSpeed() * 10;
return;
}
if (filtering.getFilter().isEmpty() && player.getHeldItemMainhand().isEmpty())
extracting.extract(1);
if (player.getHeldItemMainhand().getItem() instanceof BlockItem) {
if (!world.getBlockState(pos.offset(getBlockState().get(FACING), 2)).getMaterial().isReplaceable()) {
timer = getTimerSpeed() * 10;
return;
}
}
state = State.EXPANDING;
Vec3d movementVector = getMovementVector();
Vec3d rayOrigin = VecHelper.getCenterOf(pos).add(movementVector.scale(3 / 2f));
Vec3d rayTarget = VecHelper.getCenterOf(pos).add(movementVector.scale(5 / 2f));
RayTraceContext rayTraceContext = new RayTraceContext(rayOrigin, rayTarget, BlockMode.OUTLINE,
FluidMode.SOURCE_ONLY, player);
BlockRayTraceResult result = world.rayTraceBlocks(rayTraceContext);
reach = (float) (.5f + Math.min(result.getHitVec().subtract(rayOrigin).length(), .75f));
timer = 1000;
sendData();
return;
}
if (state == State.EXPANDING) {
activate();
state = State.RETRACTING;
timer = 1000;
sendData();
return;
}
if (state == State.RETRACTING) {
state = State.WAITING;
timer = 500;
returnAndDeposit();
sendData();
return;
}
}
protected void activate() {
Vec3d movementVector = getMovementVector();
Direction direction = getBlockState().get(FACING);
player.rotationYaw = AngleHelper.horizontalAngle(direction);
player.rotationPitch = direction == Direction.UP ? -90 : direction == Direction.DOWN ? 90 : 0;
BlockPos clicked = pos.offset(direction, 2);
ItemStack stack = player.getHeldItemMainhand();
List<LivingEntity> entities = world.getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(clicked));
if (!entities.isEmpty()) {
stack.interactWithEntity(player, entities.get(world.rand.nextInt(entities.size())), Hand.MAIN_HAND);
return;
}
Vec3d rayOrigin = VecHelper.getCenterOf(pos).add(movementVector.scale(3 / 2f + 1 / 64f));
Vec3d rayTarget = VecHelper.getCenterOf(pos).add(movementVector.scale(5 / 2f - 1 / 64f));
RayTraceContext rayTraceContext = new RayTraceContext(rayOrigin, rayTarget, BlockMode.OUTLINE,
FluidMode.SOURCE_ONLY, player);
BlockRayTraceResult result = world.rayTraceBlocks(rayTraceContext);
ItemUseContext itemusecontext = new ItemUseContext(player, Hand.MAIN_HAND, result);
RightClickBlock event = ForgeHooks.onRightClickBlock(player, Hand.MAIN_HAND, clicked, direction.getOpposite());
if (event.getUseItem() != DENY) {
ActionResultType actionresult = stack.onItemUseFirst(itemusecontext);
if (actionresult != ActionResultType.PASS)
return;
player.setHeldItem(Hand.MAIN_HAND, stack.onItemUseFinish(world, player));
}
BlockState clickedState = world.getBlockState(clicked);
boolean holdingSomething = !player.getHeldItemMainhand().isEmpty();
boolean flag1 = !(player.isSneaking() && holdingSomething)
|| (stack.doesSneakBypassUse(world, clicked, player));
if (event.getUseBlock() != DENY && flag1
&& clickedState.onBlockActivated(world, player, Hand.MAIN_HAND, result))
return;
if (stack.isEmpty())
return;
if (event.getUseItem() == DENY)
return;
if (stack.getItem() instanceof BlockItem
&& !clickedState.isReplaceable(new BlockItemUseContext(itemusecontext)))
return;
ActionResultType onItemUse = stack.onItemUse(itemusecontext);
if (onItemUse == ActionResultType.SUCCESS)
return;
stack.getItem().onItemRightClick(world, player, Hand.MAIN_HAND);
}
protected void returnAndDeposit() {
PlayerInventory inv = player.inventory;
for (List<ItemStack> list : Arrays.asList(inv.armorInventory, inv.offHandInventory, inv.mainInventory)) {
for (int i = 0; i < list.size(); ++i) {
ItemStack itemstack = list.get(i);
if (itemstack.isEmpty())
continue;
if (list == inv.mainInventory && i == inv.currentItem && filtering.test(itemstack))
if (itemstack.getCount() == 1)
continue;
itemstack = insert(itemstack, false);
if (!itemstack.isEmpty())
ItemHelper.addToList(itemstack, overflowItems);
list.set(i, ItemStack.EMPTY);
}
}
heldItem = player.getHeldItemMainhand();
}
protected void tryDisposeOfItems() {
for (Iterator<ItemStack> iterator = overflowItems.iterator(); iterator.hasNext();) {
ItemStack itemStack = iterator.next();
itemStack = insert(itemStack, false);
if (itemStack.isEmpty())
iterator.remove();
}
}
protected ItemStack insert(ItemStack stack, boolean simulate) {
for (IItemHandler inv : extracting.getInventories()) {
stack = ItemHandlerHelper.insertItemStacked(inv, stack, simulate);
if (stack.isEmpty())
break;
}
return stack;
}
protected Vec3d getMovementVector() {
if (!AllBlocks.DEPLOYER.typeOf(getBlockState()))
return Vec3d.ZERO;
return new Vec3d(getBlockState().get(FACING).getDirectionVec());
}
@Override
public void read(CompoundNBT compound) {
state = NBTHelper.readEnum(compound.getString("State"), State.class);
mode = NBTHelper.readEnum(compound.getString("Mode"), Mode.class);
timer = compound.getInt("Timer");
super.read(compound);
}
@Override
public CompoundNBT write(CompoundNBT compound) {
compound.putString("Mode", NBTHelper.writeEnum(mode));
compound.putString("State", NBTHelper.writeEnum(state));
compound.putInt("Timer", timer);
return super.write(compound);
}
@Override
public CompoundNBT writeToClient(CompoundNBT compound) {
compound.putFloat("Reach", reach);
if (player != null)
compound.put("HeldItem", player.getHeldItemMainhand().serializeNBT());
return super.writeToClient(compound);
}
@Override
public void readClientUpdate(CompoundNBT tag) {
reach = tag.getFloat("Reach");
if (tag.contains("HeldItem"))
heldItem = ItemStack.read(tag.getCompound("HeldItem"));
super.readClientUpdate(tag);
}
@Override
public boolean hasFastRenderer() {
return false;
}
@Override
public void remove() {
super.remove();
player = null;
}
public AllBlocks getHandPose() {
return mode == Mode.PUNCH ? AllBlocks.DEPLOYER_HAND_PUNCHING
: heldItem.isEmpty() ? AllBlocks.DEPLOYER_HAND_POINTING : AllBlocks.DEPLOYER_HAND_HOLDING;
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return super.getRenderBoundingBox().grow(3);
}
public void changeMode() {
eject();
mode = mode == Mode.PUNCH ? Mode.USE : Mode.PUNCH;
markDirty();
sendData();
}
protected void eject() {
}
}

View file

@ -0,0 +1,127 @@
package com.simibubi.create.modules.contraptions.components.deployer;
import static com.simibubi.create.modules.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE;
import static com.simibubi.create.modules.contraptions.base.DirectionalKineticBlock.FACING;
import static net.minecraft.state.properties.BlockStateProperties.AXIS;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.behaviour.filtering.FilteringRenderer;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import com.simibubi.create.foundation.utility.TessellatorHelper;
import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
import com.simibubi.create.modules.contraptions.components.deployer.DeployerTileEntity.Mode;
import com.simibubi.create.modules.contraptions.components.deployer.DeployerTileEntity.State;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
@SuppressWarnings("deprecation")
public class DeployerTileEntityRenderer extends TileEntityRenderer<DeployerTileEntity> {
@Override
public void render(DeployerTileEntity te, double x, double y, double z, float partialTicks, int destroyStage) {
if (!AllBlocks.DEPLOYER.typeOf(te.getBlockState()))
return;
renderItem(te, x, y, z, partialTicks);
FilteringRenderer.renderOnTileEntity(te, x, y, z, partialTicks, destroyStage);
renderComponents(te, x, y, z, partialTicks);
}
protected void renderItem(DeployerTileEntity te, double x, double y, double z, float partialTicks) {
BlockState deployerState = te.getBlockState();
Vec3d offset = getHandOffset(te, partialTicks, deployerState).add(VecHelper.getCenterOf(BlockPos.ZERO));
GlStateManager.pushMatrix();
GlStateManager.translated(offset.x + x, offset.y + y, offset.z + z);
Direction facing = deployerState.get(FACING);
float yRot = AngleHelper.horizontalAngle(facing) + 180;
float zRot = facing == Direction.UP ? 90 : facing == Direction.DOWN ? 270 : 0;
GlStateManager.rotatef(yRot, 0, 1, 0);
GlStateManager.rotatef(zRot, 1, 0, 0);
GlStateManager.translated(0, 0, -11 / 16f);
float scale = .5f;
GlStateManager.scaled(scale, scale, scale);
TransformType transform = te.mode == Mode.PUNCH ? TransformType.FIRST_PERSON_RIGHT_HAND : TransformType.FIXED;
Minecraft.getInstance().getItemRenderer().renderItem(te.heldItem, transform);
GlStateManager.popMatrix();
}
protected void renderComponents(DeployerTileEntity te, double x, double y, double z, float partialTicks) {
TessellatorHelper.prepareFastRender();
TessellatorHelper.begin(DefaultVertexFormats.BLOCK);
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
KineticTileEntityRenderer.renderRotatingKineticBlock(te, getWorld(), getRenderedBlockState(te), x, y, z,
buffer);
BlockState blockState = te.getBlockState();
BlockPos pos = te.getPos();
SuperByteBuffer pole = renderAndTransform(AllBlocks.DEPLOYER_POLE, blockState, pos, true);
SuperByteBuffer hand = renderAndTransform(te.getHandPose(), blockState, pos, false);
Vec3d offset = getHandOffset(te, partialTicks, blockState);
pole.translate(x + offset.x, y + offset.y, z + offset.z).renderInto(buffer);
hand.translate(x + offset.x, y + offset.y, z + offset.z).renderInto(buffer);
TessellatorHelper.draw();
}
protected Vec3d getHandOffset(DeployerTileEntity te, float partialTicks, BlockState blockState) {
float progress = 0;
if (te.state == State.EXPANDING)
progress = 1 - (te.timer - partialTicks * te.getTimerSpeed()) / 1000f;
if (te.state == State.RETRACTING)
progress = (te.timer - partialTicks * te.getTimerSpeed()) / 1000f;
float handLength = te.getHandPose() == AllBlocks.DEPLOYER_HAND_POINTING ? 0
: te.getHandPose() == AllBlocks.DEPLOYER_HAND_HOLDING ? 4 / 16f : 3 / 16f;
float distance = Math.min(MathHelper.clamp(progress, 0, 1) * (te.reach + handLength), 21/16f);
Vec3d offset = new Vec3d(blockState.get(FACING).getDirectionVec()).scale(distance);
return offset;
}
protected BlockState getRenderedBlockState(KineticTileEntity te) {
BlockState state = te.getBlockState();
if (!AllBlocks.DEPLOYER.typeOf(state))
return Blocks.AIR.getDefaultState();
return AllBlocks.SHAFT.block.getDefaultState().with(AXIS, ((IRotate) state.getBlock()).getRotationAxis(state));
}
private SuperByteBuffer renderAndTransform(AllBlocks renderBlock, BlockState deployerState, BlockPos pos,
boolean axisDirectionMatters) {
SuperByteBuffer buffer = CreateClient.bufferCache.renderGenericBlockModel(renderBlock.getDefault());
Direction facing = deployerState.get(FACING);
float zRotFirst = axisDirectionMatters
&& (deployerState.get(AXIS_ALONG_FIRST_COORDINATE) ^ facing.getAxis() == Axis.Z) ? 90 : 0;
float yRot = AngleHelper.horizontalAngle(facing);
float zRot = facing == Direction.UP ? 270 : facing == Direction.DOWN ? 90 : 0;
buffer.rotateCentered(Axis.Z, (float) ((zRotFirst) / 180 * Math.PI));
buffer.rotateCentered(Axis.Y, (float) ((yRot) / 180 * Math.PI));
buffer.rotateCentered(Axis.Z, (float) ((zRot) / 180 * Math.PI));
buffer.light(deployerState.getPackedLightmapCoords(getWorld(), pos));
return buffer;
}
}

View file

@ -0,0 +1,18 @@
{
"forge_marker": 1,
"variants": {
"facing=east,axis_along_first=false": { "model": "create:block/deployer/horizontal", "x": 0, "y": 270 },
"facing=west,axis_along_first=false": { "model": "create:block/deployer/horizontal", "x": 0, "y": 90 },
"facing=up,axis_along_first=false": { "model": "create:block/deployer/horizontal", "x": 90, "y": 90 },
"facing=down,axis_along_first=false": { "model": "create:block/deployer/horizontal", "x": 270, "y": 90 },
"facing=south,axis_along_first=false": { "model": "create:block/deployer/vertical", "x": 0, "y": 0 },
"facing=north,axis_along_first=false": { "model": "create:block/deployer/vertical", "x": 0, "y": 180 },
"facing=east,axis_along_first=true": { "model": "create:block/deployer/vertical", "x": 0, "y": 270 },
"facing=west,axis_along_first=true": { "model": "create:block/deployer/vertical", "x": 0, "y": 90 },
"facing=up,axis_along_first=true": { "model": "create:block/deployer/horizontal", "x": 90, "y": 0 },
"facing=down,axis_along_first=true": { "model": "create:block/deployer/horizontal", "x": 270, "y": 0 },
"facing=south,axis_along_first=true": { "model": "create:block/deployer/horizontal", "x": 0, "y": 0 },
"facing=north,axis_along_first=true": { "model": "create:block/deployer/horizontal", "x": 0, "y": 180 }
}
}

View file

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "create:block/deployer/hand_holding" }
}
}

View file

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "create:block/deployer/hand_pointing" }
}
}

View file

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "create:block/deployer/hand_punching" }
}
}

View file

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "create:block/deployer/pole" }
}
}

View file

@ -92,6 +92,7 @@
"block.create.water_wheel": "Water Wheel", "block.create.water_wheel": "Water Wheel",
"block.create.mechanical_press": "Mechanical Press", "block.create.mechanical_press": "Mechanical Press",
"block.create.mechanical_mixer": "Mechanical Mixer", "block.create.mechanical_mixer": "Mechanical Mixer",
"block.create.deployer": "Deployer",
"block.create.basin": "Basin", "block.create.basin": "Basin",
"block.create.mechanical_crafter": "Mechanical Crafter", "block.create.mechanical_crafter": "Mechanical Crafter",
"block.create.speed_gauge": "Speedometer", "block.create.speed_gauge": "Speedometer",

View file

@ -0,0 +1,131 @@
{
"credit": "Made with Blockbench",
"parent": "create:item/placement_handgun",
"ambientocclusion": false,
"textures": {
"18": "create:block/deployer",
"particle": "create:block/gearbox_top",
"mechanical_press_head": "create:block/mechanical_press_head",
"mechanical_press_pole": "create:block/mechanical_press_pole"
},
"elements": [
{
"name": "Cap",
"from": [5, 5, 12],
"to": [11, 11, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, -1]},
"faces": {
"north": {"uv": [10, 6, 16, 12], "texture": "#mechanical_press_pole"},
"east": {"uv": [0, 14, 6, 16], "rotation": 90, "texture": "#mechanical_press_pole"},
"south": {"uv": [10, 6, 16, 12], "texture": "#mechanical_press_pole"},
"west": {"uv": [0, 14, 6, 16], "rotation": 90, "texture": "#mechanical_press_pole"},
"up": {"uv": [0, 14, 6, 16], "texture": "#mechanical_press_pole"},
"down": {"uv": [0, 14, 6, 16], "rotation": 180, "texture": "#mechanical_press_pole"}
}
},
{
"from": [6, 6, 14],
"to": [10, 9, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 7, 5]},
"faces": {
"north": {"uv": [0, 0, 4, 3], "texture": "#mechanical_press_head"},
"east": {"uv": [0, 0, 2, 3], "texture": "#mechanical_press_head"},
"south": {"uv": [0, 0, 4, 3], "texture": "#mechanical_press_head"},
"west": {"uv": [0, 0, 2, 3], "texture": "#mechanical_press_head"},
"up": {"uv": [0, 0, 2, 4], "rotation": 270, "texture": "#mechanical_press_head"},
"down": {"uv": [0, 0, 2, 4], "rotation": 90, "texture": "#mechanical_press_head"}
}
},
{
"from": [5, 7, 15],
"to": [11, 11, 18],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 9, 5]},
"faces": {
"north": {"uv": [6, 1, 10, 7], "rotation": 90, "texture": "#18"},
"east": {"uv": [1, 4, 4, 8], "texture": "#18"},
"south": {"uv": [6, 1, 10, 7], "rotation": 90, "texture": "#18"},
"west": {"uv": [1, 4, 4, 8], "texture": "#18"},
"up": {"uv": [1, 2, 4, 8], "rotation": 270, "texture": "#18"},
"down": {"uv": [1, 2, 4, 8], "rotation": 90, "texture": "#18"}
}
},
{
"from": [11, 6, 16],
"to": [13, 8, 19],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 9, 5]},
"faces": {
"north": {"uv": [0, 0, 2, 2], "texture": "#18"},
"east": {"uv": [0, 2, 2, 5], "rotation": 90, "texture": "#18"},
"south": {"uv": [0, 0, 2, 2], "texture": "#18"},
"west": {"uv": [0, 2, 2, 5], "rotation": 90, "texture": "#18"},
"up": {"uv": [0, 2, 2, 5], "texture": "#18"},
"down": {"uv": [0, 2, 2, 5], "rotation": 180, "texture": "#18"}
}
},
{
"from": [5, 5, 15],
"to": [11, 7, 18],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 9, 5]},
"faces": {
"north": {"uv": [0, 1, 2, 7], "rotation": 90, "texture": "#18"},
"east": {"uv": [1, 4, 4, 6], "texture": "#18"},
"south": {"uv": [0, 1, 2, 7], "rotation": 90, "texture": "#18"},
"west": {"uv": [1, 4, 4, 6], "texture": "#18"},
"up": {"uv": [1, 2, 4, 8], "rotation": 270, "texture": "#18"},
"down": {"uv": [1, 2, 4, 8], "rotation": 90, "texture": "#18"}
}
},
{
"from": [7, 11, 16],
"to": [9, 13, 20],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 4]},
"faces": {
"north": {"uv": [0, 0, 2, 2], "texture": "#18"},
"east": {"uv": [1, 4, 5, 6], "texture": "#18"},
"south": {"uv": [0, 0, 2, 2], "texture": "#18"},
"west": {"uv": [1, 4, 5, 6], "texture": "#18"},
"up": {"uv": [0, 3, 2, 7], "texture": "#18"},
"down": {"uv": [0, 3, 2, 7], "texture": "#18"}
}
},
{
"from": [9, 11, 16],
"to": [11, 13, 21],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 4]},
"faces": {
"north": {"uv": [0, 0, 2, 2], "texture": "#18"},
"east": {"uv": [0, 2, 2, 7], "rotation": 90, "texture": "#18"},
"south": {"uv": [0, 0, 2, 2], "texture": "#18"},
"west": {"uv": [1, 4, 6, 6], "texture": "#18"},
"up": {"uv": [0, 2, 2, 7], "texture": "#18"},
"down": {"uv": [0, 3, 2, 8], "texture": "#18"}
}
},
{
"from": [5, 11, 16],
"to": [7, 13, 20],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 4]},
"faces": {
"north": {"uv": [0, 0, 2, 2], "texture": "#18"},
"east": {"uv": [1, 4, 5, 6], "texture": "#18"},
"south": {"uv": [0, 0, 2, 2], "texture": "#18"},
"west": {"uv": [0, 3, 2, 7], "rotation": 90, "texture": "#18"},
"up": {"uv": [0, 3, 2, 7], "texture": "#18"},
"down": {"uv": [0, 3, 2, 7], "texture": "#18"}
}
}
],
"groups": [
{
"name": "head",
"origin": [8, 8, 8],
"children": [0,
{
"name": "Open",
"origin": [8, 8, 8],
"children": [1, 2, 3, 4, 5, 6, 7]
}
]
}
]
}

View file

@ -0,0 +1,118 @@
{
"credit": "Made with Blockbench",
"parent": "create:item/placement_handgun",
"ambientocclusion": false,
"textures": {
"18": "create:block/deployer",
"particle": "create:block/gearbox_top",
"mechanical_press_head": "create:block/mechanical_press_head",
"mechanical_press_pole": "create:block/mechanical_press_pole"
},
"elements": [
{
"name": "Cap",
"from": [5, 5, 12],
"to": [11, 11, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, -1]},
"faces": {
"north": {"uv": [10, 6, 16, 12], "texture": "#mechanical_press_pole"},
"east": {"uv": [0, 14, 6, 16], "rotation": 90, "texture": "#mechanical_press_pole"},
"south": {"uv": [10, 6, 16, 12], "texture": "#mechanical_press_pole"},
"west": {"uv": [0, 14, 6, 16], "rotation": 90, "texture": "#mechanical_press_pole"},
"up": {"uv": [0, 14, 6, 16], "texture": "#mechanical_press_pole"},
"down": {"uv": [0, 14, 6, 16], "rotation": 180, "texture": "#mechanical_press_pole"}
}
},
{
"from": [4, 5, 17],
"to": [6, 10, 21],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 5]},
"faces": {
"north": {"uv": [0, 8, 2, 13], "texture": "#18"},
"east": {"uv": [0, 0, 4, 5], "texture": "#18"},
"south": {"uv": [0, 1, 2, 6], "texture": "#18"},
"west": {"uv": [0, 8, 4, 13], "texture": "#18"},
"up": {"uv": [0, 0, 2, 4], "texture": "#18"},
"down": {"uv": [0, 4, 2, 8], "texture": "#18"}
}
},
{
"from": [6, 5, 17],
"to": [8, 10, 21],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 5]},
"faces": {
"north": {"uv": [0, 8, 2, 13], "texture": "#18"},
"east": {"uv": [4, 8, 0, 13], "texture": "#18"},
"south": {"uv": [0, 1, 2, 6], "texture": "#18"},
"west": {"uv": [0, 8, 4, 13], "texture": "#18"},
"up": {"uv": [0, 0, 2, 4], "texture": "#18"},
"down": {"uv": [0, 4, 2, 8], "texture": "#18"}
}
},
{
"from": [6, 6, 14],
"to": [10, 9, 18],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 7, 5]},
"faces": {
"north": {"uv": [0, 0, 4, 3], "texture": "#mechanical_press_head"},
"east": {"uv": [0, 0, 4, 3], "texture": "#mechanical_press_head"},
"south": {"uv": [0, 0, 4, 3], "texture": "#mechanical_press_head"},
"west": {"uv": [0, 0, 4, 3], "texture": "#mechanical_press_head"},
"up": {"uv": [0, 0, 4, 4], "rotation": 270, "texture": "#mechanical_press_head"},
"down": {"uv": [0, 0, 4, 4], "rotation": 90, "texture": "#mechanical_press_head"}
}
},
{
"from": [8, 8, 19],
"to": [10, 10, 25],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 5]},
"faces": {
"north": {"uv": [0, 0, 2, 2], "texture": "#18"},
"east": {"uv": [2, 3, 4, 9], "rotation": 270, "texture": "#18"},
"south": {"uv": [0, 1, 2, 3], "texture": "#18"},
"west": {"uv": [4, 2, 6, 8], "rotation": 90, "texture": "#18"},
"up": {"uv": [0, 0, 2, 6], "texture": "#18"},
"down": {"uv": [0, 3, 2, 9], "texture": "#18"}
}
},
{
"from": [8, 7, 17],
"to": [12, 10, 19],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 5]},
"faces": {
"north": {"uv": [0, 0, 4, 3], "texture": "#18"},
"east": {"uv": [0, 1, 2, 4], "rotation": 180, "texture": "#18"},
"south": {"uv": [0, 8, 3, 12], "rotation": 270, "texture": "#18"},
"west": {"uv": [0, 0, 2, 3], "texture": "#18"},
"up": {"uv": [2, 0, 0, 4], "rotation": 270, "texture": "#18"},
"down": {"uv": [0, 2, 2, 6], "rotation": 270, "texture": "#18"}
}
},
{
"from": [5, 7, 15],
"to": [11, 10, 17],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 5]},
"faces": {
"north": {"uv": [0, 2, 3, 8], "rotation": 270, "texture": "#18"},
"east": {"uv": [1, 4, 3, 7], "texture": "#18"},
"south": {"uv": [0, 0, 6, 3], "texture": "#18"},
"west": {"uv": [1, 4, 3, 7], "texture": "#18"},
"up": {"uv": [1, 2, 3, 8], "rotation": 270, "texture": "#18"},
"down": {"uv": [1, 2, 3, 8], "rotation": 90, "texture": "#18"}
}
}
],
"groups": [
{
"name": "head",
"origin": [8, 8, 8],
"children": [0,
{
"name": "Pointing",
"origin": [8, 8, 8],
"children": [1, 2, 3, 4, 5, 6]
}
]
}
]
}

View file

@ -0,0 +1,130 @@
{
"credit": "Made with Blockbench",
"parent": "create:item/placement_handgun",
"ambientocclusion": false,
"textures": {
"18": "create:block/deployer",
"particle": "create:block/gearbox_top",
"mechanical_press_head": "create:block/mechanical_press_head",
"mechanical_press_pole": "create:block/mechanical_press_pole"
},
"elements": [
{
"name": "Cap",
"from": [5, 5, 12],
"to": [11, 11, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, -1]},
"faces": {
"north": {"uv": [10, 6, 16, 12], "texture": "#mechanical_press_pole"},
"east": {"uv": [0, 14, 6, 16], "rotation": 90, "texture": "#mechanical_press_pole"},
"south": {"uv": [10, 6, 16, 12], "texture": "#mechanical_press_pole"},
"west": {"uv": [0, 14, 6, 16], "rotation": 90, "texture": "#mechanical_press_pole"},
"up": {"uv": [0, 14, 6, 16], "texture": "#mechanical_press_pole"},
"down": {"uv": [0, 14, 6, 16], "rotation": 180, "texture": "#mechanical_press_pole"}
}
},
{
"from": [6, 6, 14],
"to": [10, 9, 17],
"faces": {
"north": {"uv": [0, 0, 4, 3], "texture": "#mechanical_press_head"},
"east": {"uv": [0, 0, 3, 3], "texture": "#mechanical_press_head"},
"south": {"uv": [0, 0, 4, 3], "texture": "#mechanical_press_head"},
"west": {"uv": [0, 0, 3, 3], "texture": "#mechanical_press_head"},
"up": {"uv": [0, 0, 3, 4], "rotation": 270, "texture": "#mechanical_press_head"},
"down": {"uv": [0, 0, 3, 4], "rotation": 90, "texture": "#mechanical_press_head"}
}
},
{
"from": [5, 5, 16],
"to": [9, 7, 20],
"rotation": {"angle": 0, "axis": "x", "origin": [7, 8, 7]},
"faces": {
"north": {"uv": [0, 8, 2, 12], "rotation": 90, "texture": "#18"},
"east": {"uv": [0, 4, 2, 8], "rotation": 270, "texture": "#18"},
"south": {"uv": [0, 1, 2, 5], "rotation": 270, "texture": "#18"},
"west": {"uv": [0, 0, 2, 4], "rotation": 270, "texture": "#18"},
"up": {"uv": [0, 0, 4, 4], "rotation": 270, "texture": "#18"},
"down": {"uv": [0, 8, 4, 12], "rotation": 270, "texture": "#18"}
}
},
{
"from": [5, 7, 17],
"to": [9, 9, 21],
"rotation": {"angle": 0, "axis": "x", "origin": [7, 8, 7]},
"faces": {
"north": {"uv": [0, 8, 2, 12], "rotation": 90, "texture": "#18"},
"east": {"uv": [0, 4, 2, 8], "rotation": 270, "texture": "#18"},
"south": {"uv": [0, 1, 2, 5], "rotation": 270, "texture": "#18"},
"west": {"uv": [0, 0, 2, 4], "rotation": 270, "texture": "#18"},
"up": {"uv": [0, 8, 4, 12], "rotation": 270, "texture": "#18"},
"down": {"uv": [0, 8, 4, 12], "rotation": 270, "texture": "#18"}
}
},
{
"from": [5, 9, 17],
"to": [10, 11, 21],
"rotation": {"angle": 0, "axis": "x", "origin": [7, 8, 7]},
"faces": {
"north": {"uv": [0, 8, 2, 13], "rotation": 90, "texture": "#18"},
"east": {"uv": [0, 4, 2, 8], "rotation": 270, "texture": "#18"},
"south": {"uv": [0, 1, 2, 6], "rotation": 270, "texture": "#18"},
"west": {"uv": [0, 0, 2, 4], "rotation": 270, "texture": "#18"},
"up": {"uv": [0, 8, 4, 13], "rotation": 90, "texture": "#18"},
"down": {"uv": [0, 8, 4, 13], "rotation": 270, "texture": "#18"}
}
},
{
"from": [8, 6, 17],
"to": [11, 10, 19],
"rotation": {"angle": 0, "axis": "x", "origin": [7, 8, 8]},
"faces": {
"north": {"uv": [0, 0, 4, 3], "rotation": 90, "texture": "#18"},
"east": {"uv": [0, 0, 2, 4], "texture": "#18"},
"south": {"uv": [0, 4, 3, 8], "rotation": 180, "texture": "#18"},
"west": {"uv": [0, 0, 2, 4], "rotation": 180, "texture": "#18"},
"up": {"uv": [0, 0, 2, 3], "rotation": 90, "texture": "#18"},
"down": {"uv": [0, 0, 2, 3], "rotation": 270, "texture": "#18"}
}
},
{
"from": [9, 8, 16],
"to": [11, 10, 17],
"rotation": {"angle": 0, "axis": "x", "origin": [7, 8, 8]},
"faces": {
"north": {"uv": [0, 2, 2, 4], "rotation": 90, "texture": "#18"},
"east": {"uv": [0, 3, 2, 4], "rotation": 90, "texture": "#18"},
"south": {"uv": [0, 8, 2, 10], "rotation": 180, "texture": "#18"},
"west": {"uv": [0, 0, 1, 2], "rotation": 180, "texture": "#18"},
"up": {"uv": [0, 0, 1, 2], "rotation": 90, "texture": "#18"},
"down": {"uv": [0, 0, 1, 2], "rotation": 270, "texture": "#18"}
}
},
{
"from": [5, 7, 15],
"to": [9, 10, 17],
"rotation": {"angle": 0, "axis": "x", "origin": [7, 8, 8]},
"faces": {
"north": {"uv": [0, 3, 4, 6], "texture": "#18"},
"east": {"uv": [1, 2, 3, 5], "texture": "#18"},
"south": {"uv": [0, 0, 3, 4], "rotation": 270, "texture": "#18"},
"west": {"uv": [0, 2, 2, 5], "texture": "#18"},
"up": {"uv": [0, 0, 2, 4], "rotation": 90, "texture": "#18"},
"down": {"uv": [1, 4, 3, 8], "rotation": 270, "texture": "#18"}
}
}
],
"groups": [
{
"name": "head",
"origin": [8, 8, 8],
"children": [0,
{
"name": "Item",
"origin": [8, 8, 8],
"children": [1, 2, 3, 4, 5, 6, 7]
}
]
}
]
}

View file

@ -0,0 +1,70 @@
{
"credit": "Made with Blockbench",
"parent": "create:item/placement_handgun",
"ambientocclusion": false,
"textures": {
"6": "create:block/piston_bottom",
"7": "create:block/piston_inner",
"particle": "create:block/gearbox_top",
"gearbox_top": "create:block/gearbox_top",
"gearbox": "create:block/gearbox",
"andesite_casing_short": "create:block/andesite_casing_short"
},
"elements": [
{
"name": "Bottom",
"from": [0, 0, 0],
"to": [16, 16, 2],
"faces": {
"north": {"uv": [0, 0, 16, 16], "rotation": 270, "texture": "#6"},
"east": {"uv": [0, 14, 16, 16], "rotation": 270, "texture": "#gearbox_top"},
"south": {"uv": [0, 0, 16, 16], "rotation": 270, "texture": "#gearbox_top"},
"west": {"uv": [0, 14, 16, 16], "rotation": 90, "texture": "#gearbox_top"},
"up": {"uv": [0, 14, 16, 16], "rotation": 180, "texture": "#andesite_casing_short"},
"down": {"uv": [0, 14, 16, 16], "texture": "#andesite_casing_short"}
}
},
{
"name": "Inner",
"from": [1, 2, 2],
"to": [15, 14, 12],
"faces": {
"north": {"uv": [0, 0, 12, 14], "rotation": 270, "texture": "#gearbox"},
"east": {"uv": [2, 4, 14, 14], "rotation": 270, "texture": "#gearbox"},
"south": {"uv": [2, 1, 14, 15], "rotation": 90, "texture": "#7"},
"west": {"uv": [2, 4, 14, 14], "rotation": 90, "texture": "#gearbox"}
}
},
{
"name": "Side",
"from": [0, 0, 2],
"to": [16, 2, 12],
"faces": {
"east": {"uv": [0, 2, 2, 12], "rotation": 270, "texture": "#gearbox_top"},
"south": {"uv": [0, 0, 16, 2], "texture": "#andesite_casing_short"},
"west": {"uv": [14, 0, 16, 10], "rotation": 90, "texture": "#gearbox_top"},
"up": {"uv": [0, 0, 16, 10], "rotation": 180, "texture": "#gearbox_top"},
"down": {"uv": [0, 4, 16, 14], "texture": "#andesite_casing_short"}
}
},
{
"name": "Side2",
"from": [0, 14, 2],
"to": [16, 16, 12],
"faces": {
"east": {"uv": [14, 2, 16, 12], "rotation": 270, "texture": "#gearbox_top"},
"south": {"uv": [0, 0, 16, 2], "rotation": 180, "texture": "#andesite_casing_short"},
"west": {"uv": [0, 0, 2, 10], "rotation": 90, "texture": "#gearbox_top"},
"up": {"uv": [0, 4, 16, 14], "rotation": 180, "texture": "#andesite_casing_short"},
"down": {"uv": [0, 0, 16, 10], "texture": "#gearbox_top"}
}
}
],
"groups": [
{
"name": "body",
"origin": [8, 8, 8],
"children": [0, 1, 2, 3]
}
]
}

View file

@ -0,0 +1,271 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"ambientocclusion": false,
"textures": {
"0": "create:block/axis",
"1": "create:block/axis_top",
"6": "create:block/piston_bottom",
"7": "create:block/piston_inner",
"18": "create:block/deployer",
"gearbox_top": "create:block/gearbox_top",
"gearbox": "create:block/gearbox",
"andesite_casing_short": "create:block/andesite_casing_short",
"mechanical_press_pole": "create:block/mechanical_press_pole",
"mechanical_press_head": "create:block/mechanical_press_head",
"particle": "create:block/axis"
},
"elements": [
{
"name": "Bottom",
"from": [0, 0, 0],
"to": [16, 16, 2],
"faces": {
"north": {"uv": [0, 0, 16, 16], "rotation": 90, "texture": "#6"},
"east": {"uv": [0, 14, 16, 16], "rotation": 270, "texture": "#andesite_casing_short"},
"south": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#gearbox_top"},
"west": {"uv": [0, 14, 16, 16], "rotation": 90, "texture": "#andesite_casing_short"},
"up": {"uv": [0, 14, 16, 16], "rotation": 180, "texture": "#gearbox_top"},
"down": {"uv": [0, 14, 16, 16], "texture": "#gearbox_top"}
}
},
{
"name": "Inner",
"from": [2, 1, 2],
"to": [14, 15, 12],
"faces": {
"north": {"uv": [0, 0, 12, 14], "texture": "#gearbox"},
"south": {"uv": [2, 1, 14, 15], "texture": "#7"},
"up": {"uv": [2, 4, 14, 14], "rotation": 180, "texture": "#gearbox"},
"down": {"uv": [2, 4, 14, 14], "texture": "#gearbox"}
}
},
{
"name": "Side",
"from": [14, 0, 2],
"to": [16, 16, 12],
"faces": {
"east": {"uv": [0, 4, 16, 14], "rotation": 270, "texture": "#andesite_casing_short"},
"south": {"uv": [0, 0, 16, 2], "rotation": 270, "texture": "#andesite_casing_short"},
"west": {"uv": [0, 0, 16, 10], "rotation": 90, "texture": "#gearbox_top"},
"up": {"uv": [0, 2, 2, 12], "rotation": 180, "texture": "#gearbox_top"},
"down": {"uv": [14, 0, 16, 10], "texture": "#gearbox_top"}
}
},
{
"name": "Side2",
"from": [0, 0, 2],
"to": [2, 16, 12],
"faces": {
"east": {"uv": [0, 0, 16, 10], "rotation": 270, "texture": "#gearbox_top"},
"south": {"uv": [0, 0, 16, 2], "rotation": 90, "texture": "#andesite_casing_short"},
"west": {"uv": [0, 4, 16, 14], "rotation": 90, "texture": "#andesite_casing_short"},
"up": {"uv": [14, 2, 16, 12], "rotation": 180, "texture": "#gearbox_top"},
"down": {"uv": [0, 0, 2, 10], "texture": "#gearbox_top"}
}
},
{
"name": "Pole1Core",
"from": [6, 6, 4],
"to": [10, 10, 12],
"rotation": {"angle": 0, "axis": "z", "origin": [8, 8, 10]},
"faces": {
"east": {"uv": [1, 6, 5, 14], "rotation": 90, "texture": "#mechanical_press_pole"},
"west": {"uv": [1, 6, 5, 14], "rotation": 270, "texture": "#mechanical_press_pole"},
"up": {"uv": [1, 6, 5, 14], "texture": "#mechanical_press_pole"},
"down": {"uv": [6, 6, 10, 14], "rotation": 180, "texture": "#mechanical_press_pole"}
}
},
{
"name": "Pole2Core",
"from": [6, 6, -9],
"to": [10, 10, 4],
"rotation": {"angle": 0, "axis": "z", "origin": [8, 8, 10]},
"faces": {
"north": {"uv": [11, 6, 15, 10], "rotation": 270, "texture": "#mechanical_press_pole"},
"east": {"uv": [1, 0, 5, 13], "rotation": 90, "texture": "#mechanical_press_pole"},
"west": {"uv": [1, 0, 5, 13], "rotation": 270, "texture": "#mechanical_press_pole"},
"up": {"uv": [1, 0, 5, 13], "texture": "#mechanical_press_pole"},
"down": {"uv": [1, 0, 5, 13], "rotation": 180, "texture": "#mechanical_press_pole"}
}
},
{
"name": "Cap",
"from": [5, 5, 12],
"to": [11, 11, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, -1]},
"faces": {
"north": {"uv": [10, 6, 16, 12], "texture": "#mechanical_press_pole"},
"east": {"uv": [0, 14, 6, 16], "rotation": 90, "texture": "#mechanical_press_pole"},
"south": {"uv": [10, 6, 16, 12], "texture": "#mechanical_press_pole"},
"west": {"uv": [0, 14, 6, 16], "rotation": 90, "texture": "#mechanical_press_pole"},
"up": {"uv": [0, 14, 6, 16], "texture": "#mechanical_press_pole"},
"down": {"uv": [0, 14, 6, 16], "rotation": 180, "texture": "#mechanical_press_pole"}
}
},
{
"from": [4, 5, 17],
"to": [6, 10, 21],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 5]},
"faces": {
"north": {"uv": [0, 8, 2, 13], "texture": "#18"},
"east": {"uv": [0, 0, 4, 5], "texture": "#18"},
"south": {"uv": [0, 1, 2, 6], "texture": "#18"},
"west": {"uv": [0, 8, 4, 13], "texture": "#18"},
"up": {"uv": [0, 0, 2, 4], "texture": "#18"},
"down": {"uv": [0, 4, 2, 8], "texture": "#18"}
}
},
{
"from": [6, 5, 17],
"to": [8, 10, 21],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 5]},
"faces": {
"north": {"uv": [0, 8, 2, 13], "texture": "#18"},
"east": {"uv": [4, 8, 0, 13], "texture": "#18"},
"south": {"uv": [0, 1, 2, 6], "texture": "#18"},
"west": {"uv": [0, 8, 4, 13], "texture": "#18"},
"up": {"uv": [0, 0, 2, 4], "texture": "#18"},
"down": {"uv": [0, 4, 2, 8], "texture": "#18"}
}
},
{
"from": [6, 6, 14],
"to": [10, 9, 18],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 7, 5]},
"faces": {
"north": {"uv": [0, 0, 4, 3], "texture": "#mechanical_press_head"},
"east": {"uv": [0, 0, 4, 3], "texture": "#mechanical_press_head"},
"south": {"uv": [0, 0, 4, 3], "texture": "#mechanical_press_head"},
"west": {"uv": [0, 0, 4, 3], "texture": "#mechanical_press_head"},
"up": {"uv": [0, 0, 4, 4], "rotation": 270, "texture": "#mechanical_press_head"},
"down": {"uv": [0, 0, 4, 4], "rotation": 90, "texture": "#mechanical_press_head"}
}
},
{
"from": [8, 8, 19],
"to": [10, 10, 25],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 5]},
"faces": {
"north": {"uv": [0, 0, 2, 2], "texture": "#18"},
"east": {"uv": [2, 3, 4, 9], "rotation": 270, "texture": "#18"},
"south": {"uv": [0, 1, 2, 3], "texture": "#18"},
"west": {"uv": [4, 2, 6, 8], "rotation": 90, "texture": "#18"},
"up": {"uv": [0, 0, 2, 6], "texture": "#18"},
"down": {"uv": [0, 3, 2, 9], "texture": "#18"}
}
},
{
"from": [8, 7, 17],
"to": [12, 10, 19],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 5]},
"faces": {
"north": {"uv": [0, 0, 4, 3], "texture": "#18"},
"east": {"uv": [0, 1, 2, 4], "rotation": 180, "texture": "#18"},
"south": {"uv": [0, 8, 3, 12], "rotation": 270, "texture": "#18"},
"west": {"uv": [0, 0, 2, 3], "texture": "#18"},
"up": {"uv": [2, 0, 0, 4], "rotation": 270, "texture": "#18"},
"down": {"uv": [0, 2, 2, 6], "rotation": 270, "texture": "#18"}
}
},
{
"from": [5, 7, 15],
"to": [11, 10, 17],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 5]},
"faces": {
"north": {"uv": [0, 2, 3, 8], "rotation": 270, "texture": "#18"},
"east": {"uv": [1, 4, 3, 7], "texture": "#18"},
"south": {"uv": [0, 0, 6, 3], "texture": "#18"},
"west": {"uv": [1, 4, 3, 7], "texture": "#18"},
"up": {"uv": [1, 2, 3, 8], "rotation": 270, "texture": "#18"},
"down": {"uv": [1, 2, 3, 8], "rotation": 90, "texture": "#18"}
}
},
{
"name": "Axis",
"from": [6, 0, 6],
"to": [10, 16, 10],
"shade": false,
"faces": {
"north": {"uv": [6, 0, 10, 16], "texture": "#0"},
"east": {"uv": [6, 0, 10, 16], "texture": "#0"},
"south": {"uv": [6, 0, 10, 16], "texture": "#0"},
"west": {"uv": [6, 0, 10, 16], "texture": "#0"},
"up": {"uv": [6, 6, 10, 10], "texture": "#1"},
"down": {"uv": [6, 6, 10, 10], "texture": "#1"}
}
}
],
"display": {
"thirdperson_righthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"thirdperson_lefthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"firstperson_righthand": {
"rotation": [0, 45, 0],
"scale": [0.4, 0.4, 0.4]
},
"firstperson_lefthand": {
"rotation": [0, 225, 0],
"scale": [0.4, 0.4, 0.4]
},
"ground": {
"translation": [0, 3, 0],
"scale": [0.25, 0.25, 0.25]
},
"gui": {
"rotation": [30, 45, 0],
"scale": [0.625, 0.625, 0.625]
},
"fixed": {
"rotation": [0, 180, 0],
"scale": [0.5, 0.5, 0.5]
}
},
"groups": [
{
"name": "body",
"origin": [8, 8, 8],
"children": [0, 1, 2, 3]
},
{
"name": "pole",
"origin": [8, 8, 8],
"children": [
{
"name": "head",
"origin": [8, 8, 8],
"children": [4, 5]
}
]
},
{
"name": "hand_pointing",
"origin": [8, 8, 8],
"children": [
{
"name": "head",
"origin": [8, 8, 8],
"children": [6,
{
"name": "Pointing",
"origin": [8, 8, 8],
"children": [7, 8, 9, 10, 11, 12]
}
]
}
]
},
{
"name": "shaft",
"origin": [8, 8, 8],
"children": [13]
}
]
}

View file

@ -0,0 +1,42 @@
{
"credit": "Made with Blockbench",
"parent": "create:item/placement_handgun",
"ambientocclusion": false,
"textures": {
"mechanical_press_pole": "create:block/mechanical_press_pole"
},
"elements": [
{
"name": "Pole1Core",
"from": [6, 6, 4],
"to": [10, 10, 12],
"rotation": {"angle": 0, "axis": "z", "origin": [8, 8, 10]},
"faces": {
"east": {"uv": [1, 6, 5, 14], "rotation": 90, "texture": "#mechanical_press_pole"},
"west": {"uv": [1, 6, 5, 14], "rotation": 270, "texture": "#mechanical_press_pole"},
"up": {"uv": [1, 6, 5, 14], "texture": "#mechanical_press_pole"},
"down": {"uv": [6, 6, 10, 14], "rotation": 180, "texture": "#mechanical_press_pole"}
}
},
{
"name": "Pole2Core",
"from": [6, 6, -9],
"to": [10, 10, 4],
"rotation": {"angle": 0, "axis": "z", "origin": [8, 8, 10]},
"faces": {
"north": {"uv": [11, 6, 15, 10], "rotation": 270, "texture": "#mechanical_press_pole"},
"east": {"uv": [1, 0, 5, 13], "rotation": 90, "texture": "#mechanical_press_pole"},
"west": {"uv": [1, 0, 5, 13], "rotation": 270, "texture": "#mechanical_press_pole"},
"up": {"uv": [1, 0, 5, 13], "texture": "#mechanical_press_pole"},
"down": {"uv": [1, 0, 5, 13], "rotation": 180, "texture": "#mechanical_press_pole"}
}
}
],
"groups": [
{
"name": "head",
"origin": [8, 8, 8],
"children": [0, 1]
}
]
}

View file

@ -0,0 +1,69 @@
{
"credit": "Made with Blockbench",
"parent": "create:item/placement_handgun",
"ambientocclusion": false,
"textures": {
"6": "create:block/piston_bottom",
"7": "create:block/piston_inner",
"gearbox_top": "create:block/gearbox_top",
"gearbox": "create:block/gearbox",
"andesite_casing_short": "create:block/andesite_casing_short"
},
"elements": [
{
"name": "Bottom",
"from": [0, 0, 0],
"to": [16, 16, 2],
"faces": {
"north": {"uv": [0, 0, 16, 16], "rotation": 90, "texture": "#6"},
"east": {"uv": [0, 14, 16, 16], "rotation": 270, "texture": "#andesite_casing_short"},
"south": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#gearbox_top"},
"west": {"uv": [0, 14, 16, 16], "rotation": 90, "texture": "#andesite_casing_short"},
"up": {"uv": [0, 14, 16, 16], "rotation": 180, "texture": "#gearbox_top"},
"down": {"uv": [0, 14, 16, 16], "texture": "#gearbox_top"}
}
},
{
"name": "Inner",
"from": [2, 1, 2],
"to": [14, 15, 12],
"faces": {
"north": {"uv": [0, 0, 12, 14], "texture": "#gearbox"},
"south": {"uv": [2, 1, 14, 15], "texture": "#7"},
"up": {"uv": [2, 4, 14, 14], "rotation": 180, "texture": "#gearbox"},
"down": {"uv": [2, 4, 14, 14], "texture": "#gearbox"}
}
},
{
"name": "Side",
"from": [14, 0, 2],
"to": [16, 16, 12],
"faces": {
"east": {"uv": [0, 4, 16, 14], "rotation": 270, "texture": "#andesite_casing_short"},
"south": {"uv": [0, 0, 16, 2], "rotation": 270, "texture": "#andesite_casing_short"},
"west": {"uv": [0, 0, 16, 10], "rotation": 90, "texture": "#gearbox_top"},
"up": {"uv": [0, 2, 2, 12], "rotation": 180, "texture": "#gearbox_top"},
"down": {"uv": [14, 0, 16, 10], "texture": "#gearbox_top"}
}
},
{
"name": "Side2",
"from": [0, 0, 2],
"to": [2, 16, 12],
"faces": {
"east": {"uv": [0, 0, 16, 10], "rotation": 270, "texture": "#gearbox_top"},
"south": {"uv": [0, 0, 16, 2], "rotation": 90, "texture": "#andesite_casing_short"},
"west": {"uv": [0, 4, 16, 14], "rotation": 90, "texture": "#andesite_casing_short"},
"up": {"uv": [14, 2, 16, 12], "rotation": 180, "texture": "#gearbox_top"},
"down": {"uv": [0, 0, 2, 10], "texture": "#gearbox_top"}
}
}
],
"groups": [
{
"name": "body",
"origin": [8, 8, 8],
"children": [0, 1, 2, 3]
}
]
}

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/deployer/item"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 542 B

After

Width:  |  Height:  |  Size: 622 B