Scrollable Pulse Repeaters
- Kinetic blocks can now be harvested by axes and pickaxes - Shafts have less obnoxious placement behaviour - Fixed belts not dropping casings and shafts when broken - Fixed belt tunnels not synchronizing properly - Fixed blockzapper rendering strangely when no block is selected - Funnels can now directly insert items that players activate it with - Flexpeater -> Adjustable Repeater - Added the Adjustable Pulse Repeater
|
@ -189,6 +189,7 @@ public enum AllBlocks {
|
|||
ENTITY_DETECTOR(new BeltObserverBlock()),
|
||||
PULSE_REPEATER(new PulseRepeaterBlock()),
|
||||
FLEXPEATER(new FlexpeaterBlock()),
|
||||
FLEXPULSEPEATER(new FlexpeaterBlock()),
|
||||
FLEXPEATER_INDICATOR(new RenderUtilityBlock()),
|
||||
|
||||
__CURIOSITIES__(),
|
||||
|
|
|
@ -56,6 +56,7 @@ import com.simibubi.create.modules.logistics.block.StockswitchTileEntity;
|
|||
import com.simibubi.create.modules.logistics.block.belts.BeltObserverTileEntity;
|
||||
import com.simibubi.create.modules.logistics.block.belts.BeltObserverTileEntityRenderer;
|
||||
import com.simibubi.create.modules.logistics.block.belts.FunnelTileEntity;
|
||||
import com.simibubi.create.modules.logistics.block.diodes.FlexPulsepeaterTileEntity;
|
||||
import com.simibubi.create.modules.logistics.block.diodes.FlexpeaterTileEntity;
|
||||
import com.simibubi.create.modules.logistics.block.diodes.FlexpeaterTileEntityRenderer;
|
||||
import com.simibubi.create.modules.logistics.block.extractor.ExtractorTileEntity;
|
||||
|
@ -129,6 +130,7 @@ public enum AllTileEntities {
|
|||
BELT_FUNNEL(FunnelTileEntity::new, AllBlocks.BELT_FUNNEL, AllBlocks.VERTICAL_FUNNEL),
|
||||
ENTITY_DETECTOR(BeltObserverTileEntity::new, AllBlocks.ENTITY_DETECTOR),
|
||||
FLEXPEATER(FlexpeaterTileEntity::new, AllBlocks.FLEXPEATER),
|
||||
FLEXPULSEPEATER(FlexPulsepeaterTileEntity::new, AllBlocks.FLEXPULSEPEATER),
|
||||
|
||||
// Curiosities
|
||||
WINDOW_IN_A_BLOCK(WindowInABlockTileEntity::new, AllBlocks.WINDOW_IN_A_BLOCK),
|
||||
|
|
|
@ -9,6 +9,9 @@ import com.simibubi.create.foundation.block.connected.StandardCTBehaviour;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class CasingBlock extends Block implements IHaveConnectedTextures {
|
||||
|
@ -20,9 +23,23 @@ public class CasingBlock extends Block implements IHaveConnectedTextures {
|
|||
this.textureFrom = textureFrom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToolType getHarvestTool(BlockState state) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) {
|
||||
for (ToolType toolType : player.getHeldItemMainhand().getToolTypes()) {
|
||||
if (isToolEffective(state, toolType))
|
||||
return true;
|
||||
}
|
||||
return super.canHarvestBlock(state, world, pos, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isToolEffective(BlockState state, ToolType tool) {
|
||||
return tool == ToolType.PICKAXE || tool == ToolType.AXE;
|
||||
return tool == ToolType.AXE || tool == ToolType.PICKAXE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,6 +4,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -35,6 +36,7 @@ public class WrenchItem extends Item {
|
|||
Block.getDrops(state, (ServerWorld) world, pos, world.getTileEntity(pos)).forEach(itemStack -> {
|
||||
player.inventory.placeItemBackInInventory(world, itemStack);
|
||||
});
|
||||
state.spawnAdditionalDrops(world, pos, ItemStack.EMPTY);
|
||||
world.destroyBlock(pos, false);
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.PushReaction;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
|
@ -16,6 +17,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public abstract class KineticBlock extends Block implements IRotate {
|
||||
|
||||
|
@ -24,6 +26,25 @@ public abstract class KineticBlock extends Block implements IRotate {
|
|||
public KineticBlock(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToolType getHarvestTool(BlockState state) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) {
|
||||
for (ToolType toolType : player.getHeldItemMainhand().getToolTypes()) {
|
||||
if (isToolEffective(state, toolType))
|
||||
return true;
|
||||
}
|
||||
return super.canHarvestBlock(state, world, pos, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isToolEffective(BlockState state, ToolType tool) {
|
||||
return tool == ToolType.AXE || tool == ToolType.PICKAXE;
|
||||
}
|
||||
|
||||
// IRotate
|
||||
|
||||
|
|
|
@ -66,7 +66,11 @@ public abstract class RotatedPillarKineticBlock extends KineticBlock {
|
|||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
return this.getDefaultState().with(AXIS, context.getFace().getAxis());
|
||||
Axis preferredAxis = getPreferredAxis(context);
|
||||
if (preferredAxis != null)
|
||||
return this.getDefaultState().with(AXIS, preferredAxis);
|
||||
return this.getDefaultState().with(AXIS, context.isPlacerSneaking() ? context.getFace().getAxis()
|
||||
: context.getNearestLookingDirection().getAxis());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -86,6 +86,31 @@ public class BeltBlock extends HorizontalKineticBlock implements IHaveNoBlockIte
|
|||
return state.get(CASING) ? Material.WOOD : Material.WOOL;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, net.minecraft.world.storage.loot.LootContext.Builder builder) {
|
||||
List<ItemStack> drops = super.getDrops(state, builder);
|
||||
if (state.get(CASING))
|
||||
drops.addAll(AllBlocks.BRASS_CASING.getDefault()
|
||||
.getDrops(builder));
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnAdditionalDrops(BlockState state, World worldIn, BlockPos pos, ItemStack stack) {
|
||||
withTileEntityDo(worldIn, pos, te -> {
|
||||
if (worldIn.isRemote)
|
||||
return;
|
||||
if (te.hasPulley())
|
||||
Block.spawnDrops(AllBlocks.SHAFT.get().getDefaultState(), worldIn, pos);
|
||||
if (te.isController()) {
|
||||
BeltInventory inv = te.getInventory();
|
||||
for (TransportedItemStack s : inv.items)
|
||||
inv.eject(s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(BlockState state, IBlockReader world, BlockPos pos, Direction face) {
|
||||
return false;
|
||||
|
@ -304,22 +329,6 @@ public class BeltBlock extends HorizontalKineticBlock implements IHaveNoBlockIte
|
|||
return state.get(CASING) && layer == getRenderLayer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World worldIn, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
withTileEntityDo(worldIn, pos, te -> {
|
||||
if (worldIn.isRemote)
|
||||
return;
|
||||
if (te.hasPulley() && (player == null || !player.isCreative()))
|
||||
Block.spawnDrops(AllBlocks.SHAFT.get().getDefaultState(), worldIn, pos);
|
||||
if (te.isController()) {
|
||||
BeltInventory inv = te.getInventory();
|
||||
for (TransportedItemStack stack : inv.items)
|
||||
inv.eject(stack);
|
||||
}
|
||||
});
|
||||
super.onBlockHarvested(worldIn, pos, state, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
if (worldIn.isRemote)
|
||||
|
@ -361,6 +370,8 @@ public class BeltBlock extends HorizontalKineticBlock implements IHaveNoBlockIte
|
|||
te.setSource(null);
|
||||
te.remove();
|
||||
|
||||
if (destroyedBlock.get(CASING))
|
||||
Block.spawnAsEntity(worldIn, toDestroy, new ItemStack(AllBlocks.BRASS_CASING.get()));
|
||||
if (te.hasPulley())
|
||||
worldIn.setBlockState(toDestroy, AllBlocks.SHAFT.get().getDefaultState()
|
||||
.with(BlockStateProperties.AXIS, getRotationAxis(destroyedBlock)), 3);
|
||||
|
|
|
@ -145,7 +145,7 @@ public class BeltInventory {
|
|||
}
|
||||
|
||||
// Belt tunnels
|
||||
if (!onClient) {
|
||||
{
|
||||
int seg1 = (int) current.beltPosition;
|
||||
int seg2 = (int) nextOffset;
|
||||
if (!beltMovementPositive && nextOffset == 0)
|
||||
|
@ -154,8 +154,10 @@ public class BeltInventory {
|
|||
if (stuckAtTunnel(seg2, current.stack, movementFacing)) {
|
||||
continue;
|
||||
}
|
||||
flapTunnel(seg1, movementFacing, false);
|
||||
flapTunnel(seg2, movementFacing.getOpposite(), true);
|
||||
if (!onClient) {
|
||||
flapTunnel(seg1, movementFacing, false);
|
||||
flapTunnel(seg2, movementFacing.getOpposite(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,10 +265,8 @@ public class BeltInventory {
|
|||
if (te == null || !(te instanceof BeltTunnelTileEntity))
|
||||
return false;
|
||||
|
||||
Direction flapFacing = movementDirection;
|
||||
if (flapFacing.getAxis() == Axis.X)
|
||||
flapFacing = flapFacing.getOpposite();
|
||||
|
||||
Direction flapFacing = movementDirection.getOpposite();
|
||||
|
||||
BeltTunnelTileEntity tunnel = (BeltTunnelTileEntity) te;
|
||||
if (!tunnel.flaps.containsKey(flapFacing))
|
||||
return false;
|
||||
|
|
|
@ -102,6 +102,7 @@ public class BeltTunnelTileEntity extends SyncedTileEntity implements ITickableT
|
|||
syncedFlaps.remove(face);
|
||||
else
|
||||
syncedFlaps.put(face, ItemStack.EMPTY);
|
||||
|
||||
markDirty();
|
||||
sendData();
|
||||
return true;
|
||||
|
|
|
@ -21,6 +21,7 @@ import net.minecraft.client.renderer.entity.PlayerRenderer;
|
|||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.HandSide;
|
||||
|
@ -90,20 +91,6 @@ public class BlockzapperHandler {
|
|||
return barrelPos;
|
||||
}
|
||||
|
||||
// @SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
// public static void onBlockBroken(BreakEvent event) {
|
||||
// PlayerEntity player = event.getPlayer();
|
||||
// if (player == null)
|
||||
// return;
|
||||
// if (!AllItems.PLACEMENT_HANDGUN.typeOf(player.getHeldItemMainhand()))
|
||||
// return;
|
||||
//
|
||||
// if (event.getState().isNormalCube(player.world, event.getPos())) {
|
||||
// player.getHeldItemMainhand().getTag().put("BlockUsed", NBTUtil.writeBlockState(event.getState()));
|
||||
// }
|
||||
// event.setCanceled(true);
|
||||
// }
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onClientTick(ClientTickEvent event) {
|
||||
if (event.phase == Phase.START)
|
||||
|
@ -185,73 +172,77 @@ public class BlockzapperHandler {
|
|||
|
||||
@SubscribeEvent
|
||||
public static void onRenderPlayerHand(RenderSpecificHandEvent event) {
|
||||
if (AllItems.PLACEMENT_HANDGUN.typeOf(event.getItemStack())) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
boolean rightHand = event.getHand() == Hand.MAIN_HAND ^ mc.player.getPrimaryHand() == HandSide.LEFT;
|
||||
ItemStack heldItem = event.getItemStack();
|
||||
if (!AllItems.PLACEMENT_HANDGUN.typeOf(heldItem))
|
||||
return;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
boolean idle = !heldItem.getOrCreateTag().contains("BlockUsed");
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
boolean rightHand = event.getHand() == Hand.MAIN_HAND ^ mc.player.getPrimaryHand() == HandSide.LEFT;
|
||||
|
||||
float recoil = rightHand
|
||||
? MathHelper.lerp(event.getPartialTicks(), lastRightHandAnimation, rightHandAnimation)
|
||||
: MathHelper.lerp(event.getPartialTicks(), lastLeftHandAnimation, leftHandAnimation);
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
float equipProgress = event.getEquipProgress();
|
||||
float recoil = rightHand ? MathHelper.lerp(event.getPartialTicks(), lastRightHandAnimation, rightHandAnimation)
|
||||
: MathHelper.lerp(event.getPartialTicks(), lastLeftHandAnimation, leftHandAnimation);
|
||||
|
||||
if (rightHand && (rightHandAnimation > .01f || dontReequipRight))
|
||||
equipProgress = 0;
|
||||
if (!rightHand && (leftHandAnimation > .01f || dontReequipLeft))
|
||||
equipProgress = 0;
|
||||
float equipProgress = event.getEquipProgress();
|
||||
|
||||
// Render arm
|
||||
float f = rightHand ? 1.0F : -1.0F;
|
||||
float f1 = MathHelper.sqrt(event.getSwingProgress());
|
||||
float f2 = -0.3F * MathHelper.sin(f1 * (float) Math.PI);
|
||||
float f3 = 0.4F * MathHelper.sin(f1 * ((float) Math.PI * 2F));
|
||||
float f4 = -0.4F * MathHelper.sin(event.getSwingProgress() * (float) Math.PI);
|
||||
GlStateManager.translatef(f * (f2 + 0.64000005F - .1f), f3 + -0.4F + equipProgress * -0.6F,
|
||||
f4 + -0.71999997F + .3f + recoil);
|
||||
GlStateManager.rotatef(f * 75.0F, 0.0F, 1.0F, 0.0F);
|
||||
float f5 = MathHelper.sin(event.getSwingProgress() * event.getSwingProgress() * (float) Math.PI);
|
||||
float f6 = MathHelper.sin(f1 * (float) Math.PI);
|
||||
GlStateManager.rotatef(f * f6 * 70.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotatef(f * f5 * -20.0F, 0.0F, 0.0F, 1.0F);
|
||||
AbstractClientPlayerEntity abstractclientplayerentity = mc.player;
|
||||
mc.getTextureManager().bindTexture(abstractclientplayerentity.getLocationSkin());
|
||||
GlStateManager.translatef(f * -1.0F, 3.6F, 3.5F);
|
||||
GlStateManager.rotatef(f * 120.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.rotatef(200.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotatef(f * -135.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.translatef(f * 5.6F, 0.0F, 0.0F);
|
||||
GlStateManager.rotatef(f * 40.0F, 0.0F, 1.0F, 0.0F);
|
||||
PlayerRenderer playerrenderer = mc.getRenderManager().getRenderer(abstractclientplayerentity);
|
||||
GlStateManager.disableCull();
|
||||
if (rightHand) {
|
||||
playerrenderer.renderRightArm(abstractclientplayerentity);
|
||||
} else {
|
||||
playerrenderer.renderLeftArm(abstractclientplayerentity);
|
||||
}
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.popMatrix();
|
||||
if (rightHand && (rightHandAnimation > .01f || dontReequipRight))
|
||||
equipProgress = 0;
|
||||
if (!rightHand && (leftHandAnimation > .01f || dontReequipLeft))
|
||||
equipProgress = 0;
|
||||
if (idle)
|
||||
equipProgress = 1 - event.getEquipProgress();
|
||||
|
||||
// Render gun
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(f * (f2 + 0.64000005F - .1f), f3 + -0.4F + equipProgress * -0.6F,
|
||||
f4 + -0.71999997F - 0.1f + recoil);
|
||||
GlStateManager.rotatef(f * f6 * 70.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotatef(f * f5 * -20.0F, 0.0F, 0.0F, 1.0F);
|
||||
|
||||
GlStateManager.translatef(f * -0.1f, 0.1f, -0.4f);
|
||||
GlStateManager.rotatef(f * 5.0F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
FirstPersonRenderer firstPersonRenderer = mc.getFirstPersonRenderer();
|
||||
firstPersonRenderer.renderItemSide(mc.player, event.getItemStack(),
|
||||
rightHand ? ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND
|
||||
: ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND,
|
||||
!rightHand);
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
event.setCanceled(true);
|
||||
// Render arm
|
||||
float f = rightHand ? 1.0F : -1.0F;
|
||||
float f1 = MathHelper.sqrt(event.getSwingProgress());
|
||||
float f2 = -0.3F * MathHelper.sin(f1 * (float) Math.PI);
|
||||
float f3 = 0.4F * MathHelper.sin(f1 * ((float) Math.PI * 2F));
|
||||
float f4 = -0.4F * MathHelper.sin(event.getSwingProgress() * (float) Math.PI);
|
||||
GlStateManager.translatef(f * (f2 + 0.64000005F - .1f), f3 + -0.4F + equipProgress * -0.6F,
|
||||
f4 + -0.71999997F + .3f + recoil);
|
||||
GlStateManager.rotatef(f * 75.0F, 0.0F, 1.0F, 0.0F);
|
||||
float f5 = MathHelper.sin(event.getSwingProgress() * event.getSwingProgress() * (float) Math.PI);
|
||||
float f6 = MathHelper.sin(f1 * (float) Math.PI);
|
||||
GlStateManager.rotatef(f * f6 * 70.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotatef(f * f5 * -20.0F, 0.0F, 0.0F, 1.0F);
|
||||
AbstractClientPlayerEntity abstractclientplayerentity = mc.player;
|
||||
mc.getTextureManager().bindTexture(abstractclientplayerentity.getLocationSkin());
|
||||
GlStateManager.translatef(f * -1.0F, 3.6F, 3.5F);
|
||||
GlStateManager.rotatef(f * 120.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.rotatef(200.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotatef(f * -135.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.translatef(f * 5.6F, 0.0F, 0.0F);
|
||||
GlStateManager.rotatef(f * 40.0F, 0.0F, 1.0F, 0.0F);
|
||||
PlayerRenderer playerrenderer = mc.getRenderManager().getRenderer(abstractclientplayerentity);
|
||||
GlStateManager.disableCull();
|
||||
if (rightHand) {
|
||||
playerrenderer.renderRightArm(abstractclientplayerentity);
|
||||
} else {
|
||||
playerrenderer.renderLeftArm(abstractclientplayerentity);
|
||||
}
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
// Render gun
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(f * (f2 + 0.64000005F - .1f), f3 + -0.4F + equipProgress * -0.6F,
|
||||
f4 + -0.71999997F - 0.1f + recoil);
|
||||
GlStateManager.rotatef(f * f6 * 70.0F, 0.0F, 1.0F, 0.0F);
|
||||
GlStateManager.rotatef(f * f5 * -20.0F, 0.0F, 0.0F, 1.0F);
|
||||
|
||||
GlStateManager.translatef(f * -0.1f, 0.1f, -0.4f);
|
||||
GlStateManager.rotatef(f * 5.0F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
FirstPersonRenderer firstPersonRenderer = mc.getFirstPersonRenderer();
|
||||
firstPersonRenderer.renderItemSide(mc.player, heldItem,
|
||||
rightHand ? ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND
|
||||
: ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND,
|
||||
!rightHand);
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
public static void dontAnimateItem(Hand hand) {
|
||||
|
|
|
@ -16,13 +16,16 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.StateContainer.Builder;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
@ -170,6 +173,24 @@ public class FunnelBlock extends AttachedLogisticalBlock implements IBeltAttachm
|
|||
return process(te, transported, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn,
|
||||
BlockRayTraceResult hit) {
|
||||
|
||||
if (hit.getFace() == getBlockFacing(state).getOpposite()) {
|
||||
if (!worldIn.isRemote)
|
||||
withTileEntityDo(worldIn, pos, te -> {
|
||||
ItemStack heldItem = player.getHeldItem(handIn).copy();
|
||||
ItemStack remainder = te.tryToInsert(heldItem);
|
||||
if (!ItemStack.areItemStacksEqual(remainder, heldItem))
|
||||
player.setHeldItem(handIn, remainder);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean process(BeltTileEntity belt, TransportedItemStack transported, BeltAttachmentState state) {
|
||||
TileEntity te = belt.getWorld().getTileEntity(state.attachmentPos);
|
||||
if (te == null || !(te instanceof FunnelTileEntity))
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package com.simibubi.create.modules.logistics.block.diodes;
|
||||
|
||||
import static com.simibubi.create.modules.logistics.block.diodes.FlexpeaterBlock.POWERING;
|
||||
import static net.minecraft.block.RedstoneDiodeBlock.POWERED;
|
||||
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
|
||||
public class FlexPulsepeaterTileEntity extends FlexpeaterTileEntity {
|
||||
|
||||
public FlexPulsepeaterTileEntity() {
|
||||
super(AllTileEntities.FLEXPULSEPEATER.type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
updateConfigurableValue();
|
||||
|
||||
boolean powered = getBlockState().get(POWERED);
|
||||
boolean powering = getBlockState().get(POWERING);
|
||||
boolean atMax = state >= maxState;
|
||||
boolean isReset = state == 0;
|
||||
|
||||
if (!charging && powered && !atMax)
|
||||
charging = true;
|
||||
|
||||
if (charging && atMax) {
|
||||
if (powering) {
|
||||
world.setBlockState(pos, getBlockState().with(POWERING, false));
|
||||
charging = false;
|
||||
return;
|
||||
}
|
||||
if (!powering && !world.isRemote)
|
||||
world.setBlockState(pos, getBlockState().with(POWERING, true));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!charging && powered)
|
||||
return;
|
||||
|
||||
if (!charging && !isReset) {
|
||||
if (!world.isRemote)
|
||||
world.setBlockState(pos, getBlockState().with(POWERING, false));
|
||||
state = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
state += charging ? 1 : 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.simibubi.create.modules.logistics.block.diodes;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.block.IHaveScrollableValue;
|
||||
import com.simibubi.create.foundation.block.IWithTileEntity;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
@ -41,7 +42,7 @@ public class FlexpeaterBlock extends RedstoneDiodeBlock
|
|||
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
return new FlexpeaterTileEntity();
|
||||
return AllBlocks.FLEXPEATER.get() == this ? new FlexpeaterTileEntity() : new FlexPulsepeaterTileEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.simibubi.create.foundation.block.SyncedTileEntity;
|
|||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class FlexpeaterTileEntity extends SyncedTileEntity implements ITickableTileEntity {
|
||||
|
@ -21,7 +22,11 @@ public class FlexpeaterTileEntity extends SyncedTileEntity implements ITickableT
|
|||
public boolean forceClientState;
|
||||
|
||||
public FlexpeaterTileEntity() {
|
||||
super(AllTileEntities.FLEXPEATER.type);
|
||||
this(AllTileEntities.FLEXPEATER.type);
|
||||
}
|
||||
|
||||
protected FlexpeaterTileEntity(TileEntityType<?> type) {
|
||||
super(type);
|
||||
lastModified = -1;
|
||||
maxState = newMaxState = 1;
|
||||
}
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"variants": {
|
||||
"powered=false,powering=false,facing=north": { "model": "create:block/flexpeater", "y": 180 },
|
||||
"powered=false,powering=false,facing=east": { "model": "create:block/flexpeater", "y": 270 },
|
||||
"powered=false,powering=false,facing=south": { "model": "create:block/flexpeater", "y": 0 },
|
||||
"powered=false,powering=false,facing=west": { "model": "create:block/flexpeater", "y": 90 },
|
||||
"powered=false,powering=false,facing=north": { "model": "create:block/repeaters/flexpeater", "y": 180 },
|
||||
"powered=false,powering=false,facing=east": { "model": "create:block/repeaters/flexpeater", "y": 270 },
|
||||
"powered=false,powering=false,facing=south": { "model": "create:block/repeaters/flexpeater", "y": 0 },
|
||||
"powered=false,powering=false,facing=west": { "model": "create:block/repeaters/flexpeater", "y": 90 },
|
||||
|
||||
"powered=true,powering=false,facing=north": { "model": "create:block/flexpeater_powered", "y": 180 },
|
||||
"powered=true,powering=false,facing=east": { "model": "create:block/flexpeater_powered", "y": 270 },
|
||||
"powered=true,powering=false,facing=south": { "model": "create:block/flexpeater_powered", "y": 0 },
|
||||
"powered=true,powering=false,facing=west": { "model": "create:block/flexpeater_powered", "y": 90 },
|
||||
"powered=true,powering=false,facing=north": { "model": "create:block/repeaters/flexpeater_powered", "y": 180 },
|
||||
"powered=true,powering=false,facing=east": { "model": "create:block/repeaters/flexpeater_powered", "y": 270 },
|
||||
"powered=true,powering=false,facing=south": { "model": "create:block/repeaters/flexpeater_powered", "y": 0 },
|
||||
"powered=true,powering=false,facing=west": { "model": "create:block/repeaters/flexpeater_powered", "y": 90 },
|
||||
|
||||
"powered=false,powering=true,facing=north": { "model": "create:block/flexpeater_powering", "y": 180 },
|
||||
"powered=false,powering=true,facing=east": { "model": "create:block/flexpeater_powering", "y": 270 },
|
||||
"powered=false,powering=true,facing=south": { "model": "create:block/flexpeater_powering", "y": 0 },
|
||||
"powered=false,powering=true,facing=west": { "model": "create:block/flexpeater_powering", "y": 90 },
|
||||
"powered=false,powering=true,facing=north": { "model": "create:block/repeaters/flexpeater_powering", "y": 180 },
|
||||
"powered=false,powering=true,facing=east": { "model": "create:block/repeaters/flexpeater_powering", "y": 270 },
|
||||
"powered=false,powering=true,facing=south": { "model": "create:block/repeaters/flexpeater_powering", "y": 0 },
|
||||
"powered=false,powering=true,facing=west": { "model": "create:block/repeaters/flexpeater_powering", "y": 90 },
|
||||
|
||||
"powered=true,powering=true,facing=north": { "model": "create:block/flexpeater_powered_powering", "y": 180 },
|
||||
"powered=true,powering=true,facing=east": { "model": "create:block/flexpeater_powered_powering", "y": 270 },
|
||||
"powered=true,powering=true,facing=south": { "model": "create:block/flexpeater_powered_powering", "y": 0 },
|
||||
"powered=true,powering=true,facing=west": { "model": "create:block/flexpeater_powered_powering", "y": 90 }
|
||||
"powered=true,powering=true,facing=north": { "model": "create:block/repeaters/flexpeater_powered_powering", "y": 180 },
|
||||
"powered=true,powering=true,facing=east": { "model": "create:block/repeaters/flexpeater_powered_powering", "y": 270 },
|
||||
"powered=true,powering=true,facing=south": { "model": "create:block/repeaters/flexpeater_powered_powering", "y": 0 },
|
||||
"powered=true,powering=true,facing=west": { "model": "create:block/repeaters/flexpeater_powered_powering", "y": 90 }
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"variants": {
|
||||
"": { "model": "create:block/flexpeater_indicator" }
|
||||
"": { "model": "create:block/repeaters/flexpeater_indicator" }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"variants": {
|
||||
"powered=false,powering=false,facing=north": { "model": "create:block/repeaters/flexpulsepeater", "y": 180 },
|
||||
"powered=false,powering=false,facing=east": { "model": "create:block/repeaters/flexpulsepeater", "y": 270 },
|
||||
"powered=false,powering=false,facing=south": { "model": "create:block/repeaters/flexpulsepeater", "y": 0 },
|
||||
"powered=false,powering=false,facing=west": { "model": "create:block/repeaters/flexpulsepeater", "y": 90 },
|
||||
|
||||
"powered=true,powering=false,facing=north": { "model": "create:block/repeaters/flexpulsepeater_powered", "y": 180 },
|
||||
"powered=true,powering=false,facing=east": { "model": "create:block/repeaters/flexpulsepeater_powered", "y": 270 },
|
||||
"powered=true,powering=false,facing=south": { "model": "create:block/repeaters/flexpulsepeater_powered", "y": 0 },
|
||||
"powered=true,powering=false,facing=west": { "model": "create:block/repeaters/flexpulsepeater_powered", "y": 90 },
|
||||
|
||||
"powered=false,powering=true,facing=north": { "model": "create:block/repeaters/flexpulsepeater_powering", "y": 180 },
|
||||
"powered=false,powering=true,facing=east": { "model": "create:block/repeaters/flexpulsepeater_powering", "y": 270 },
|
||||
"powered=false,powering=true,facing=south": { "model": "create:block/repeaters/flexpulsepeater_powering", "y": 0 },
|
||||
"powered=false,powering=true,facing=west": { "model": "create:block/repeaters/flexpulsepeater_powering", "y": 90 },
|
||||
|
||||
"powered=true,powering=true,facing=north": { "model": "create:block/repeaters/flexpulsepeater_powered_powering", "y": 180 },
|
||||
"powered=true,powering=true,facing=east": { "model": "create:block/repeaters/flexpulsepeater_powered_powering", "y": 270 },
|
||||
"powered=true,powering=true,facing=south": { "model": "create:block/repeaters/flexpulsepeater_powered_powering", "y": 0 },
|
||||
"powered=true,powering=true,facing=west": { "model": "create:block/repeaters/flexpulsepeater_powered_powering", "y": 90 }
|
||||
}
|
||||
}
|
|
@ -122,7 +122,8 @@
|
|||
"block.create.transposer": "Transposer",
|
||||
"block.create.linked_transposer": "Linked Transposer",
|
||||
"block.create.pulse_repeater": "Pulse Repeater",
|
||||
"block.create.flexpeater": "FlexPeater",
|
||||
"block.create.flexpulsepeater": "Adjustable Pulse Repeater",
|
||||
"block.create.flexpeater": "Adjustable Repeater",
|
||||
"block.create.entity_detector": "Belt Observer",
|
||||
"block.create.logistical_casing": "Logistical Casing",
|
||||
"block.create.logistical_controller": "Logistical Controller",
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"flexpeater_off": "create:block/flexpeater_off",
|
||||
"torch": "minecraft:block/redstone_torch_off",
|
||||
"smooth_stone": "minecraft:block/smooth_stone",
|
||||
"particle": "create:block/flexpeater_off"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "Top",
|
||||
"from": [ 5, 2.1, 5 ],
|
||||
"to": [ 11, 3.1, 11 ],
|
||||
"faces": {
|
||||
"north": { "texture": "#flexpeater_off", "uv": [ 5, 5, 11, 6 ], "rotation": 180 },
|
||||
"east": { "texture": "#flexpeater_off", "uv": [ 10, 5, 11, 11 ], "rotation": 90 },
|
||||
"south": { "texture": "#flexpeater_off", "uv": [ 5, 10, 11, 11 ] },
|
||||
"west": { "texture": "#flexpeater_off", "uv": [ 5, 11, 6, 5 ], "rotation": 90 },
|
||||
"up": { "texture": "#flexpeater_off", "uv": [ 5, 5, 11, 11 ] }
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "circuit",
|
||||
"from": [ 0, 0, 0 ],
|
||||
"to": [ 16, 2, 16 ],
|
||||
"faces": {
|
||||
"north": { "texture": "#smooth_stone", "uv": [ 0, 0, 16, 2 ] },
|
||||
"east": { "texture": "#smooth_stone", "uv": [ 0, 0, 16, 2 ] },
|
||||
"south": { "texture": "#smooth_stone", "uv": [ 0, 0, 16, 2 ] },
|
||||
"west": { "texture": "#smooth_stone", "uv": [ 0, 0, 16, 2 ] },
|
||||
"up": { "texture": "#flexpeater_off", "uv": [ 0, 0, 16, 16 ] },
|
||||
"down": { "texture": "#smooth_stone", "uv": [ 0, 0, 16, 16 ] }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "create:block/flexpeater",
|
||||
"parent": "create:block/repeaters/flexpeater",
|
||||
"textures": {
|
||||
"flexpeater_off": "create:block/flexpeater_on",
|
||||
"particle": "create:block/flexpeater_on"
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "create:block/repeaters/flexpeater_powered",
|
||||
"textures": {
|
||||
"torch": "minecraft:block/redstone_torch"
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "create:block/flexpeater",
|
||||
"parent": "create:block/repeaters/flexpeater",
|
||||
"textures": {
|
||||
"torch": "minecraft:block/redstone_torch"
|
||||
}
|
|
@ -2,10 +2,10 @@
|
|||
"__comment": "Model generated using MrCrayfish's Model Creator (https://mrcrayfish.com/tools?id=mc)",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"flexpeater_off": "create:block/flexpeater_off",
|
||||
"flexpeater_off": "create:block/flexpulsepeater_off",
|
||||
"torch": "minecraft:block/redstone_torch_off",
|
||||
"smooth_stone": "minecraft:block/smooth_stone",
|
||||
"particle": "create:block/flexpeater_off"
|
||||
"particle": "create:block/flexpulsepeater_off"
|
||||
},
|
||||
"elements": [
|
||||
{
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"parent": "create:block/repeaters/flexpulsepeater",
|
||||
"textures": {
|
||||
"flexpeater_off": "create:block/flexpulsepeater_on",
|
||||
"particle": "create:block/flexpulsepeater_on"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "create:block/repeaters/flexpulsepeater_powered",
|
||||
"textures": {
|
||||
"torch": "minecraft:block/redstone_torch"
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "create:block/flexpeater_powered",
|
||||
"parent": "create:block/repeaters/flexpulsepeater",
|
||||
"textures": {
|
||||
"torch": "minecraft:block/redstone_torch"
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "create:block/flexpeater",
|
||||
"parent": "create:block/repeaters/flexpeater",
|
||||
"textures": {
|
||||
"flexpeater_off": "create:block/flexpeater_item"
|
||||
},
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"parent": "create:block/repeaters/flexpulsepeater",
|
||||
"textures": {
|
||||
"flexpeater_off": "create:block/flexpulsepeater_item"
|
||||
},
|
||||
"display": {
|
||||
"fixed": {
|
||||
"rotation": [ 270, 0, 0 ],
|
||||
"translation": [ 0, 0, -3],
|
||||
"scale":[ 0.5, 0.5, 0.5 ]
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 527 B After Width: | Height: | Size: 524 B |
Before Width: | Height: | Size: 526 B After Width: | Height: | Size: 527 B |
Before Width: | Height: | Size: 529 B After Width: | Height: | Size: 541 B |
After Width: | Height: | Size: 527 B |
After Width: | Height: | Size: 526 B |
After Width: | Height: | Size: 529 B |
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "create:flexpulsepeater"
|
||||
}
|
||||
],
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"type": "crafting_shaped",
|
||||
"pattern": [
|
||||
"SP"
|
||||
],
|
||||
"key": {
|
||||
"P": {
|
||||
"item": "create:flexpeater"
|
||||
},
|
||||
"S": {
|
||||
"item": "create:pulse_repeater"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "create:flexpulsepeater",
|
||||
"count": 1
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"type": "create:module",
|
||||
"module": "logistics"
|
||||
}
|
||||
]
|
||||
}
|