Analog Gearshifting

- Added the analog belt pulley, an encased belt with adjustable speed transfer
- Added an analog redstone lever
- Fixed motor values jumping inconsistently
- Stabilized Rotation propagation a little
- Formatted numbers shown when wearing goggles
- Kinetic blocks no longer convey weak redstone power to neighbours
- Removed obsolete overlay text for rainbow debug
- Fixed Deployers not updating placed/removed fluids consistently
- Fixed Crash when entities placed by a deployer drop loot
This commit is contained in:
simibubi 2020-02-03 00:31:55 +01:00
parent 87f61ce538
commit 005a9e3177
47 changed files with 997 additions and 115 deletions

View file

@ -37,12 +37,14 @@ import com.simibubi.create.modules.contraptions.components.saw.SawBlock;
import com.simibubi.create.modules.contraptions.components.turntable.TurntableBlock; import com.simibubi.create.modules.contraptions.components.turntable.TurntableBlock;
import com.simibubi.create.modules.contraptions.components.waterwheel.WaterWheelBlock; import com.simibubi.create.modules.contraptions.components.waterwheel.WaterWheelBlock;
import com.simibubi.create.modules.contraptions.processing.BasinBlock; import com.simibubi.create.modules.contraptions.processing.BasinBlock;
import com.simibubi.create.modules.contraptions.redstone.AnalogLeverBlock;
import com.simibubi.create.modules.contraptions.redstone.ContactBlock; import com.simibubi.create.modules.contraptions.redstone.ContactBlock;
import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.modules.contraptions.relays.belt.BeltTunnelBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltTunnelBlock;
import com.simibubi.create.modules.contraptions.relays.elementary.CogWheelBlock; import com.simibubi.create.modules.contraptions.relays.elementary.CogWheelBlock;
import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock; import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
import com.simibubi.create.modules.contraptions.relays.elementary.ShaftHalfBlock; import com.simibubi.create.modules.contraptions.relays.elementary.ShaftHalfBlock;
import com.simibubi.create.modules.contraptions.relays.encased.AdjustablePulleyBlock;
import com.simibubi.create.modules.contraptions.relays.encased.ClutchBlock; import com.simibubi.create.modules.contraptions.relays.encased.ClutchBlock;
import com.simibubi.create.modules.contraptions.relays.encased.EncasedBeltBlock; import com.simibubi.create.modules.contraptions.relays.encased.EncasedBeltBlock;
import com.simibubi.create.modules.contraptions.relays.encased.EncasedShaftBlock; import com.simibubi.create.modules.contraptions.relays.encased.EncasedShaftBlock;
@ -112,10 +114,11 @@ public enum AllBlocks {
LARGE_COGWHEEL(new CogWheelBlock(true)), LARGE_COGWHEEL(new CogWheelBlock(true)),
SHAFTLESS_COGWHEEL(new RenderUtilityAxisBlock()), SHAFTLESS_COGWHEEL(new RenderUtilityAxisBlock()),
ENCASED_SHAFT(new EncasedShaftBlock()), ENCASED_SHAFT(new EncasedShaftBlock()),
ENCASED_BELT(new EncasedBeltBlock()), GEARBOX(new GearboxBlock()),
CLUTCH(new ClutchBlock()), CLUTCH(new ClutchBlock()),
GEARSHIFT(new GearshiftBlock()), GEARSHIFT(new GearshiftBlock()),
GEARBOX(new GearboxBlock()), ENCASED_BELT(new EncasedBeltBlock()),
ADJUSTABLE_PULLEY(new AdjustablePulleyBlock()),
BELT(new BeltBlock()), BELT(new BeltBlock()),
BELT_PULLEY(new RenderUtilityAxisBlock()), BELT_PULLEY(new RenderUtilityAxisBlock()),
MOTOR(new MotorBlock()), MOTOR(new MotorBlock()),
@ -136,11 +139,6 @@ 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()),
@ -166,8 +164,16 @@ public enum AllBlocks {
SAW(new SawBlock()), SAW(new SawBlock()),
HARVESTER(new HarvesterBlock()), HARVESTER(new HarvesterBlock()),
HARVESTER_BLADE(new HarvesterBladeBlock()), HARVESTER_BLADE(new HarvesterBladeBlock()),
DEPLOYER(new DeployerBlock()),
DEPLOYER_POLE(new RenderUtilityBlock()),
DEPLOYER_HAND_POINTING(new RenderUtilityBlock()),
DEPLOYER_HAND_PUNCHING(new RenderUtilityBlock()),
DEPLOYER_HAND_HOLDING(new RenderUtilityBlock()),
CART_ASSEMBLER(new CartAssemblerBlock()), CART_ASSEMBLER(new CartAssemblerBlock()),
MINECART_ANCHOR(new MinecartAnchorBlock()), MINECART_ANCHOR(new MinecartAnchorBlock()),
ANALOG_LEVER(new AnalogLeverBlock()),
ANALOG_LEVER_HANDLE(new RenderUtilityBlock()),
ANALOG_LEVER_INDICATOR(new RenderUtilityBlock()),
ANDESITE_CASING(new CasingBlock("andesite_casing")), ANDESITE_CASING(new CasingBlock("andesite_casing")),
COPPER_CASING(new CasingBlock("copper_casing")), COPPER_CASING(new CasingBlock("copper_casing")),
@ -266,7 +272,8 @@ public enum AllBlocks {
DOLOMITE_BRICKS(new Block(Properties.from(DOLOMITE.block))), DOLOMITE_BRICKS(new Block(Properties.from(DOLOMITE.block))),
POLISHED_DOLOMITE(new Block(Properties.from(DOLOMITE.block))), POLISHED_DOLOMITE(new Block(Properties.from(DOLOMITE.block))),
DOLOMITE_PILLAR(new RotatedPillarBlock(Properties.from(DOLOMITE.block))), DOLOMITE_PILLAR(new RotatedPillarBlock(Properties.from(DOLOMITE.block))),
DOLOMITE_LAYERS(new LayeredCTBlock(Properties.from(DOLOMITE.block), AllCTs.DOLOMITE_LAYERS, AllCTs.POLISHED_DOLOMITE)), DOLOMITE_LAYERS(
new LayeredCTBlock(Properties.from(DOLOMITE.block), AllCTs.DOLOMITE_LAYERS, AllCTs.POLISHED_DOLOMITE)),
VOLCANIC_ROCK(new VolcanicRockBlock()), VOLCANIC_ROCK(new VolcanicRockBlock()),

View file

@ -37,11 +37,14 @@ import com.simibubi.create.modules.contraptions.components.turntable.TurntableTi
import com.simibubi.create.modules.contraptions.components.waterwheel.WaterWheelTileEntity; import com.simibubi.create.modules.contraptions.components.waterwheel.WaterWheelTileEntity;
import com.simibubi.create.modules.contraptions.processing.BasinTileEntity; import com.simibubi.create.modules.contraptions.processing.BasinTileEntity;
import com.simibubi.create.modules.contraptions.processing.BasinTileEntityRenderer; import com.simibubi.create.modules.contraptions.processing.BasinTileEntityRenderer;
import com.simibubi.create.modules.contraptions.redstone.AnalogLeverTileEntity;
import com.simibubi.create.modules.contraptions.redstone.AnalogLeverTileEntityRenderer;
import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntity; import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntity;
import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntityRenderer; import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntityRenderer;
import com.simibubi.create.modules.contraptions.relays.belt.BeltTunnelTileEntity; import com.simibubi.create.modules.contraptions.relays.belt.BeltTunnelTileEntity;
import com.simibubi.create.modules.contraptions.relays.belt.BeltTunnelTileEntityRenderer; import com.simibubi.create.modules.contraptions.relays.belt.BeltTunnelTileEntityRenderer;
import com.simibubi.create.modules.contraptions.relays.elementary.ShaftTileEntity; import com.simibubi.create.modules.contraptions.relays.elementary.ShaftTileEntity;
import com.simibubi.create.modules.contraptions.relays.encased.AdjustablePulleyTileEntity;
import com.simibubi.create.modules.contraptions.relays.encased.ClutchTileEntity; import com.simibubi.create.modules.contraptions.relays.encased.ClutchTileEntity;
import com.simibubi.create.modules.contraptions.relays.encased.EncasedShaftTileEntity; import com.simibubi.create.modules.contraptions.relays.encased.EncasedShaftTileEntity;
import com.simibubi.create.modules.contraptions.relays.encased.EncasedShaftTileEntityRenderer; import com.simibubi.create.modules.contraptions.relays.encased.EncasedShaftTileEntityRenderer;
@ -93,6 +96,7 @@ public enum AllTileEntities {
GEARBOX(GearboxTileEntity::new, AllBlocks.GEARBOX), GEARBOX(GearboxTileEntity::new, AllBlocks.GEARBOX),
TURNTABLE(TurntableTileEntity::new, AllBlocks.TURNTABLE), TURNTABLE(TurntableTileEntity::new, AllBlocks.TURNTABLE),
ENCASED_SHAFT(EncasedShaftTileEntity::new, AllBlocks.ENCASED_SHAFT, AllBlocks.ENCASED_BELT), ENCASED_SHAFT(EncasedShaftTileEntity::new, AllBlocks.ENCASED_SHAFT, AllBlocks.ENCASED_BELT),
ADJUSTABLE_PULLEY(AdjustablePulleyTileEntity::new, AllBlocks.ADJUSTABLE_PULLEY),
ENCASED_FAN(EncasedFanTileEntity::new, AllBlocks.ENCASED_FAN), ENCASED_FAN(EncasedFanTileEntity::new, AllBlocks.ENCASED_FAN),
NOZZLE(NozzleTileEntity::new, AllBlocks.NOZZLE), NOZZLE(NozzleTileEntity::new, AllBlocks.NOZZLE),
CLUTCH(ClutchTileEntity::new, AllBlocks.CLUTCH), CLUTCH(ClutchTileEntity::new, AllBlocks.CLUTCH),
@ -102,10 +106,7 @@ public enum AllTileEntities {
BELT_TUNNEL(BeltTunnelTileEntity::new, AllBlocks.BELT_TUNNEL), BELT_TUNNEL(BeltTunnelTileEntity::new, AllBlocks.BELT_TUNNEL),
MECHANICAL_PISTON(MechanicalPistonTileEntity::new, AllBlocks.MECHANICAL_PISTON, AllBlocks.STICKY_MECHANICAL_PISTON), MECHANICAL_PISTON(MechanicalPistonTileEntity::new, AllBlocks.MECHANICAL_PISTON, AllBlocks.STICKY_MECHANICAL_PISTON),
MECHANICAL_BEARING(MechanicalBearingTileEntity::new, AllBlocks.MECHANICAL_BEARING), MECHANICAL_BEARING(MechanicalBearingTileEntity::new, AllBlocks.MECHANICAL_BEARING),
CHASSIS( CHASSIS(ChassisTileEntity::new, AllBlocks.ROTATION_CHASSIS, AllBlocks.TRANSLATION_CHASSIS,
ChassisTileEntity::new,
AllBlocks.ROTATION_CHASSIS,
AllBlocks.TRANSLATION_CHASSIS,
AllBlocks.TRANSLATION_CHASSIS_SECONDARY), AllBlocks.TRANSLATION_CHASSIS_SECONDARY),
DRILL(DrillTileEntity::new, AllBlocks.DRILL), DRILL(DrillTileEntity::new, AllBlocks.DRILL),
SAW(SawTileEntity::new, AllBlocks.SAW), SAW(SawTileEntity::new, AllBlocks.SAW),
@ -120,6 +121,7 @@ public enum AllTileEntities {
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),
STRESS_GAUGE(StressGaugeTileEntity::new, AllBlocks.STRESS_GAUGE), STRESS_GAUGE(StressGaugeTileEntity::new, AllBlocks.STRESS_GAUGE),
ANALOG_LEVER(AnalogLeverTileEntity::new, AllBlocks.ANALOG_LEVER),
// Logistics // Logistics
REDSTONE_BRIDGE(RedstoneLinkTileEntity::new, AllBlocks.REDSTONE_BRIDGE), REDSTONE_BRIDGE(RedstoneLinkTileEntity::new, AllBlocks.REDSTONE_BRIDGE),
@ -128,9 +130,7 @@ public enum AllTileEntities {
EXTRACTOR(ExtractorTileEntity::new, AllBlocks.EXTRACTOR, AllBlocks.VERTICAL_EXTRACTOR), EXTRACTOR(ExtractorTileEntity::new, AllBlocks.EXTRACTOR, AllBlocks.VERTICAL_EXTRACTOR),
LINKED_EXTRACTOR(LinkedExtractorTileEntity::new, AllBlocks.LINKED_EXTRACTOR, AllBlocks.VERTICAL_LINKED_EXTRACTOR), LINKED_EXTRACTOR(LinkedExtractorTileEntity::new, AllBlocks.LINKED_EXTRACTOR, AllBlocks.VERTICAL_LINKED_EXTRACTOR),
TRANSPOSER(TransposerTileEntity::new, AllBlocks.TRANSPOSER, AllBlocks.VERTICAL_TRANSPOSER), TRANSPOSER(TransposerTileEntity::new, AllBlocks.TRANSPOSER, AllBlocks.VERTICAL_TRANSPOSER),
LINKED_TRANSPOSER( LINKED_TRANSPOSER(LinkedTransposerTileEntity::new, AllBlocks.LINKED_TRANSPOSER,
LinkedTransposerTileEntity::new,
AllBlocks.LINKED_TRANSPOSER,
AllBlocks.VERTICAL_LINKED_TRANSPOSER), AllBlocks.VERTICAL_LINKED_TRANSPOSER),
BELT_FUNNEL(FunnelTileEntity::new, AllBlocks.BELT_FUNNEL, AllBlocks.VERTICAL_FUNNEL), BELT_FUNNEL(FunnelTileEntity::new, AllBlocks.BELT_FUNNEL, AllBlocks.VERTICAL_FUNNEL),
ENTITY_DETECTOR(BeltObserverTileEntity::new, AllBlocks.ENTITY_DETECTOR), ENTITY_DETECTOR(BeltObserverTileEntity::new, AllBlocks.ENTITY_DETECTOR),
@ -176,6 +176,7 @@ public enum AllTileEntities {
bind(TurntableTileEntity.class, new KineticTileEntityRenderer()); bind(TurntableTileEntity.class, new KineticTileEntityRenderer());
bind(MotorTileEntity.class, new MotorTileEntityRenderer()); bind(MotorTileEntity.class, new MotorTileEntityRenderer());
bind(EncasedShaftTileEntity.class, new EncasedShaftTileEntityRenderer()); bind(EncasedShaftTileEntity.class, new EncasedShaftTileEntityRenderer());
bind(AdjustablePulleyTileEntity.class, new EncasedShaftTileEntityRenderer());
bind(DrillTileEntity.class, new DrillTileEntityRenderer()); bind(DrillTileEntity.class, new DrillTileEntityRenderer());
bind(SawTileEntity.class, new SawTileEntityRenderer()); bind(SawTileEntity.class, new SawTileEntityRenderer());
bind(EncasedFanTileEntity.class, new EncasedFanTileEntityRenderer()); bind(EncasedFanTileEntity.class, new EncasedFanTileEntityRenderer());
@ -185,6 +186,7 @@ public enum AllTileEntities {
bind(BeltTileEntity.class, new BeltTileEntityRenderer()); bind(BeltTileEntity.class, new BeltTileEntityRenderer());
bind(WaterWheelTileEntity.class, new KineticTileEntityRenderer()); bind(WaterWheelTileEntity.class, new KineticTileEntityRenderer());
bind(HandCrankTileEntity.class, new HandCrankTileEntityRenderer()); bind(HandCrankTileEntity.class, new HandCrankTileEntityRenderer());
bind(AnalogLeverTileEntity.class, new AnalogLeverTileEntityRenderer());
bind(MechanicalPistonTileEntity.class, new MechanicalPistonTileEntityRenderer()); bind(MechanicalPistonTileEntity.class, new MechanicalPistonTileEntityRenderer());
bind(MechanicalBearingTileEntity.class, new MechanicalBearingTileEntityRenderer()); bind(MechanicalBearingTileEntity.class, new MechanicalBearingTileEntityRenderer());

View file

@ -78,7 +78,6 @@ public class ClientEvents {
public static void onRenderHotbar() { public static void onRenderHotbar() {
CreateClient.schematicHandler.renderOverlay(); CreateClient.schematicHandler.renderOverlay();
KineticDebugger.renderOverlayText();
} }
@SubscribeEvent @SubscribeEvent

View file

@ -14,7 +14,6 @@ import net.minecraft.tags.NetworkTagManager;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent; import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.EmptyTickList;
import net.minecraft.world.ITickList; import net.minecraft.world.ITickList;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.storage.MapData; import net.minecraft.world.storage.MapData;
@ -44,14 +43,19 @@ public class WrappedWorld extends World {
return 15 - amount; return 15 - amount;
} }
@Override
public void notifyBlockUpdate(BlockPos pos, BlockState oldState, BlockState newState, int flags) {
world.notifyBlockUpdate(pos, oldState, newState, flags);
}
@Override @Override
public ITickList<Block> getPendingBlockTicks() { public ITickList<Block> getPendingBlockTicks() {
return EmptyTickList.get(); return world.getPendingBlockTicks();
} }
@Override @Override
public ITickList<Fluid> getPendingFluidTicks() { public ITickList<Fluid> getPendingFluidTicks() {
return EmptyTickList.get(); return world.getPendingFluidTicks();
} }
@Override @Override
@ -63,10 +67,6 @@ public class WrappedWorld extends World {
return Collections.emptyList(); return Collections.emptyList();
} }
@Override
public void notifyBlockUpdate(BlockPos pos, BlockState oldState, BlockState newState, int flags) {
}
@Override @Override
public void playSound(PlayerEntity player, double x, double y, double z, SoundEvent soundIn, SoundCategory category, public void playSound(PlayerEntity player, double x, double y, double z, SoundEvent soundIn, SoundCategory category,
float volume, float pitch) { float volume, float pitch) {
@ -89,6 +89,7 @@ public class WrappedWorld extends World {
@Override @Override
public boolean addEntity(Entity entityIn) { public boolean addEntity(Entity entityIn) {
entityIn.setWorld(world);
return world.addEntity(entityIn); return world.addEntity(entityIn);
} }

View file

@ -1,8 +1,5 @@
package com.simibubi.create.modules.contraptions; package com.simibubi.create.modules.contraptions;
import java.util.ArrayList;
import java.util.List;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.CreateClientConfig; import com.simibubi.create.CreateClientConfig;
import com.simibubi.create.foundation.utility.TessellatorHelper; import com.simibubi.create.foundation.utility.TessellatorHelper;
@ -33,36 +30,23 @@ public class KineticDebugger {
TessellatorHelper.prepareForDrawing(); TessellatorHelper.prepareForDrawing();
GlStateManager.disableTexture(); GlStateManager.disableTexture();
GlStateManager.lineWidth(2); GlStateManager.lineWidth(3);
GlStateManager.pushMatrix();
GlStateManager.translated(toOutline.getX(), toOutline.getY(), toOutline.getZ());
float f = 1 + 1 / 128f;
GlStateManager.scaled(f, f, f);
WorldRenderer.drawShape(shape, toOutline.getX(), toOutline.getY(), toOutline.getZ(), te.hasSource() ? .5f : 1, WorldRenderer.drawShape(shape, 0, 0, 0, te.hasSource() ? .5f : 1, .75f, .75f, 1);
.75f, .75f, 1);
GlStateManager.popMatrix();
GlStateManager.lineWidth(1); GlStateManager.lineWidth(1);
GlStateManager.enableTexture(); GlStateManager.enableTexture();
TessellatorHelper.cleanUpAfterDrawing(); TessellatorHelper.cleanUpAfterDrawing();
} }
public static void renderOverlayText() {
if (!isActive())
return;
KineticTileEntity te = getSelectedTE();
if (te == null)
return;
List<String> info = new ArrayList<>();
te.addDebugInformation(info);
Minecraft mc = Minecraft.getInstance();
int x = mc.mainWindow.getScaledWidth() / 2 - 25;
int y = mc.mainWindow.getScaledHeight() / 2 + 25;
for (String text : info) {
mc.fontRenderer.drawStringWithShadow(text, x, y, 0xFFFFFF);
y += 10;
}
}
public static boolean isActive() { public static boolean isActive() {
return Minecraft.getInstance().gameSettings.showDebugInfo && CreateClientConfig.instance.enableRainbowDebug.get(); return Minecraft.getInstance().gameSettings.showDebugInfo
&& CreateClientConfig.instance.enableRainbowDebug.get();
} }
public static KineticTileEntity getSelectedTE() { public static KineticTileEntity getSelectedTE() {

View file

@ -9,7 +9,6 @@ import static net.minecraft.state.properties.BlockStateProperties.AXIS;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateConfig; import com.simibubi.create.CreateConfig;
import com.simibubi.create.modules.contraptions.base.IRotate; import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
@ -26,6 +25,8 @@ import net.minecraft.world.World;
public class RotationPropagator { public class RotationPropagator {
private static final int MAX_FLICKER_SCORE = 128;
/** /**
* Determines the change in rotation between two attached kinetic entities. For * Determines the change in rotation between two attached kinetic entities. For
* instance, an axis connection returns 1 while a 1-to-1 gear connection * instance, an axis connection returns 1 while a 1-to-1 gear connection
@ -68,9 +69,9 @@ public class RotationPropagator {
} }
// Attached Encased Belts // Attached Encased Belts
if (AllBlocks.ENCASED_BELT.typeOf(stateFrom) && AllBlocks.ENCASED_BELT.typeOf(stateTo)) { if (stateFrom.getBlock() instanceof EncasedBeltBlock && stateTo.getBlock() instanceof EncasedBeltBlock) {
boolean connected = EncasedBeltBlock.areBlocksConnected(stateFrom, stateTo, direction); boolean connected = EncasedBeltBlock.areBlocksConnected(stateFrom, stateTo, direction);
return connected ? 1 : 0; return connected ? EncasedBeltBlock.getRotationSpeedModifier(from, to) : 0;
} }
// Large Gear <-> Large Gear // Large Gear <-> Large Gear
@ -209,7 +210,7 @@ public class RotationPropagator {
&& (newSpeed != 0 && neighbourTE.speed != 0); && (newSpeed != 0 && neighbourTE.speed != 0);
boolean tooFast = Math.abs(newSpeed) > parameters.maxRotationSpeed.get(); boolean tooFast = Math.abs(newSpeed) > parameters.maxRotationSpeed.get();
boolean speedChangedTooOften = updateTE.speedChangeCounter > 50; boolean speedChangedTooOften = updateTE.speedChangeCounter > MAX_FLICKER_SCORE;
if (tooFast || speedChangedTooOften) { if (tooFast || speedChangedTooOften) {
world.destroyBlock(pos, true); world.destroyBlock(pos, true);
return; return;
@ -307,6 +308,7 @@ public class RotationPropagator {
List<KineticTileEntity> potentialNewSources = new LinkedList<>(); List<KineticTileEntity> potentialNewSources = new LinkedList<>();
List<BlockPos> frontier = new LinkedList<>(); List<BlockPos> frontier = new LinkedList<>();
frontier.add(updateTE.getPos()); frontier.add(updateTE.getPos());
BlockPos missingSource = updateTE.hasSource() ? updateTE.getSource() : null;
while (!frontier.isEmpty()) { while (!frontier.isEmpty()) {
final BlockPos pos = frontier.remove(0); final BlockPos pos = frontier.remove(0);
@ -316,6 +318,8 @@ public class RotationPropagator {
currentTE.sendData(); currentTE.sendData();
for (KineticTileEntity neighbourTE : getConnectedNeighbours(currentTE)) { for (KineticTileEntity neighbourTE : getConnectedNeighbours(currentTE)) {
if (neighbourTE.getPos().equals(missingSource))
continue;
if (!neighbourTE.hasSource()) if (!neighbourTE.hasSource())
continue; continue;
@ -324,9 +328,8 @@ public class RotationPropagator {
continue; continue;
} }
if (neighbourTE.isSource()) { if (neighbourTE.isSource())
potentialNewSources.add(neighbourTE); potentialNewSources.add(neighbourTE);
}
frontier.add(neighbourTE.getPos()); frontier.add(neighbourTE.getPos());
} }

View file

@ -19,14 +19,12 @@ import com.simibubi.create.foundation.behaviour.filtering.FilteringBehaviour;
import com.simibubi.create.foundation.behaviour.filtering.FilteringBehaviour.SlotPositioning; import com.simibubi.create.foundation.behaviour.filtering.FilteringBehaviour.SlotPositioning;
import com.simibubi.create.foundation.behaviour.inventory.ExtractingBehaviour; import com.simibubi.create.foundation.behaviour.inventory.ExtractingBehaviour;
import com.simibubi.create.foundation.item.ItemHelper; 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.NBTHelper;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.foundation.utility.WrappedWorld; import com.simibubi.create.foundation.utility.WrappedWorld;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.curiosities.tools.SandPaperItem; import com.simibubi.create.modules.curiosities.tools.SandPaperItem;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -59,7 +57,6 @@ import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceContext.BlockMode; import net.minecraft.util.math.RayTraceContext.BlockMode;
import net.minecraft.util.math.RayTraceContext.FluidMode; import net.minecraft.util.math.RayTraceContext.FluidMode;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.ITickList;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.ForgeHooks;
@ -252,7 +249,7 @@ public class DeployerTileEntity extends KineticTileEntity {
Vec3d rayTarget = center.add(movementVector.scale(5 / 2f - 1 / 64f)); Vec3d rayTarget = center.add(movementVector.scale(5 / 2f - 1 / 64f));
BlockPos clickedPos = pos.offset(direction, 2); BlockPos clickedPos = pos.offset(direction, 2);
player.rotationYaw = AngleHelper.horizontalAngle(direction); player.rotationYaw = direction.getHorizontalAngle();
player.rotationPitch = direction == Direction.UP ? -90 : direction == Direction.DOWN ? 90 : 0; player.rotationPitch = direction == Direction.UP ? -90 : direction == Direction.DOWN ? 90 : 0;
player.setPosition(rayOrigin.x, rayOrigin.y, rayOrigin.z); player.setPosition(rayOrigin.x, rayOrigin.y, rayOrigin.z);
@ -386,28 +383,24 @@ public class DeployerTileEntity extends KineticTileEntity {
if (item instanceof BucketItem || item instanceof SandPaperItem) { if (item instanceof BucketItem || item instanceof SandPaperItem) {
world = new WrappedWorld(world) { world = new WrappedWorld(world) {
boolean rayMode = false;
@Override
public BlockRayTraceResult rayTraceBlocks(RayTraceContext context) {
rayMode = true;
BlockRayTraceResult rayTraceBlocks = super.rayTraceBlocks(context);
rayMode = false;
return rayTraceBlocks;
};
@Override @Override
public BlockState getBlockState(BlockPos position) { public BlockState getBlockState(BlockPos position) {
if (pos.offset(direction, 3).equals(position) || pos.offset(direction, 1).equals(position)) if (rayMode
&& (pos.offset(direction, 3).equals(position) || pos.offset(direction, 1).equals(position)))
return Blocks.BEDROCK.getDefaultState(); return Blocks.BEDROCK.getDefaultState();
return world.getBlockState(position); return world.getBlockState(position);
} }
@Override
public void notifyBlockUpdate(BlockPos pos, BlockState oldState, BlockState newState, int flags) {
world.notifyBlockUpdate(pos, oldState, newState, flags);
}
@Override
public ITickList<Block> getPendingBlockTicks() {
return world.getPendingBlockTicks();
}
@Override
public ITickList<Fluid> getPendingFluidTicks() {
return world.getPendingFluidTicks();
}
}; };
} }

View file

@ -75,8 +75,19 @@ public class MotorBlock extends HorizontalKineticBlock
@Override @Override
public void onScroll(BlockState state, IWorld world, BlockPos pos, double delta) { public void onScroll(BlockState state, IWorld world, BlockPos pos, double delta) {
withTileEntityDo(world, pos, te -> { withTileEntityDo(world, pos, te -> {
int d = Math.abs(te.newGeneratedSpeed) < 32 ? 4 : 16; boolean forward = delta > 0;
te.setSpeedValueLazily((int) (te.newGeneratedSpeed + delta * d)); int step = forward ? 1 : -1;
int currentSpeed = te.newGeneratedSpeed;
int magnitude = Math.abs(currentSpeed) - (forward == currentSpeed > 0 ? 0 : 1);
if (magnitude >= 4)
step *= 4;
if (magnitude >= 32)
step *= 4;
if (magnitude >= 128)
step *= 4;
te.setSpeedValueLazily(currentSpeed + step);
}); });
} }

View file

@ -12,7 +12,7 @@ import net.minecraft.util.math.MathHelper;
public class MotorTileEntity extends GeneratingKineticTileEntity { public class MotorTileEntity extends GeneratingKineticTileEntity {
public static final int DEFAULT_SPEED = 64; public static final int DEFAULT_SPEED = 16;
public int newGeneratedSpeed; public int newGeneratedSpeed;
public int generatedSpeed; public int generatedSpeed;
public int lastModified; public int lastModified;

View file

@ -0,0 +1,130 @@
package com.simibubi.create.modules.contraptions.redstone;
import java.util.Random;
import com.simibubi.create.foundation.block.IWithTileEntity;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.HorizontalFaceBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.particles.RedstoneParticleData;
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.SoundCategory;
import net.minecraft.util.SoundEvents;
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;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class AnalogLeverBlock extends HorizontalFaceBlock implements IWithTileEntity<AnalogLeverTileEntity> {
public AnalogLeverBlock() {
super(Properties.from(Blocks.LEVER));
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new AnalogLeverTileEntity();
}
@Override
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn,
BlockRayTraceResult hit) {
if (worldIn.isRemote) {
addParticles(state, worldIn, pos, 1.0F);
return true;
}
boolean sneak = player.isSneaking();
AnalogLeverTileEntity te = getTileEntity(worldIn, pos);
if (te == null)
return true;
te.changeState(sneak);
float f = .25f + ((te.state + 5) / 15f) * .5f;
worldIn.playSound((PlayerEntity) null, pos, SoundEvents.BLOCK_LEVER_CLICK, SoundCategory.BLOCKS, 0.2F, f);
return true;
}
@Override
public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) {
AnalogLeverTileEntity tileEntity = getTileEntity(blockAccess, pos);
if (tileEntity == null)
return 0;
return tileEntity.state;
}
@Override
public boolean canProvidePower(BlockState state) {
return true;
}
@Override
public int getStrongPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) {
return getFacing(blockState) == side ? getWeakPower(blockState, blockAccess, pos, side) : 0;
}
@Override
@OnlyIn(Dist.CLIENT)
public void animateTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
AnalogLeverTileEntity tileEntity = getTileEntity(worldIn, pos);
if (tileEntity == null)
return;
if (tileEntity.state != 0 && rand.nextFloat() < 0.25F)
addParticles(stateIn, worldIn, pos, 0.5F);
}
@Override
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
AnalogLeverTileEntity tileEntity = getTileEntity(worldIn, pos);
if (tileEntity != null && !isMoving && state.getBlock() != newState.getBlock()) {
if (tileEntity.state != 0)
updateNeighbors(state, worldIn, pos);
worldIn.removeTileEntity(pos);
}
}
private static void addParticles(BlockState state, IWorld worldIn, BlockPos pos, float alpha) {
Direction direction = state.get(HORIZONTAL_FACING).getOpposite();
Direction direction1 = getFacing(state).getOpposite();
double d0 = (double) pos.getX() + 0.5D + 0.1D * (double) direction.getXOffset()
+ 0.2D * (double) direction1.getXOffset();
double d1 = (double) pos.getY() + 0.5D + 0.1D * (double) direction.getYOffset()
+ 0.2D * (double) direction1.getYOffset();
double d2 = (double) pos.getZ() + 0.5D + 0.1D * (double) direction.getZOffset()
+ 0.2D * (double) direction1.getZOffset();
worldIn.addParticle(new RedstoneParticleData(1.0F, 0.0F, 0.0F, alpha), d0, d1, d2, 0.0D, 0.0D, 0.0D);
}
static void updateNeighbors(BlockState state, World world, BlockPos pos) {
world.notifyNeighborsOfStateChange(pos, state.getBlock());
world.notifyNeighborsOfStateChange(pos.offset(getFacing(state).getOpposite()), state.getBlock());
}
@SuppressWarnings("deprecation")
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return Blocks.LEVER.getShape(state, worldIn, pos, context);
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
super.fillStateContainer(builder.add(HORIZONTAL_FACING, FACE));
}
}

View file

@ -0,0 +1,72 @@
package com.simibubi.create.modules.contraptions.redstone;
import java.util.List;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.foundation.behaviour.base.SmartTileEntity;
import com.simibubi.create.foundation.behaviour.base.TileEntityBehaviour;
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.MathHelper;
public class AnalogLeverTileEntity extends SmartTileEntity {
int state = 0;
int lastChange;
InterpolatedChasingValue clientState = new InterpolatedChasingValue().withSpeed(.2f);
public AnalogLeverTileEntity() {
super(AllTileEntities.ANALOG_LEVER.type);
}
@Override
public CompoundNBT write(CompoundNBT compound) {
compound.putInt("State", state);
compound.putInt("ChangeTimer", lastChange);
return super.write(compound);
}
@Override
public void read(CompoundNBT compound) {
state = compound.getInt("State");
lastChange = compound.getInt("ChangeTimer");
clientState.target(state);
super.read(compound);
}
@Override
public void tick() {
super.tick();
if (lastChange > 0) {
lastChange--;
if (lastChange == 0)
updateOutput();
}
if (world.isRemote)
clientState.tick();
}
private void updateOutput() {
AnalogLeverBlock.updateNeighbors(getBlockState(), world, pos);
}
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
}
@Override
public boolean hasFastRenderer() {
return true;
}
public void changeState(boolean back) {
int prevState = state;
state += back ? -1 : 1;
state = MathHelper.clamp(state, 0, 15);
if (prevState != state)
lastChange = 15;
sendData();
}
}

View file

@ -0,0 +1,52 @@
package com.simibubi.create.modules.contraptions.redstone;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.state.properties.AttachFace;
import net.minecraft.util.Direction.Axis;
import net.minecraftforge.client.model.animation.TileEntityRendererFast;
public class AnalogLeverTileEntityRenderer extends TileEntityRendererFast<AnalogLeverTileEntity> {
@Override
public void renderTileEntityFast(AnalogLeverTileEntity te, double x, double y, double z, float partialTicks,
int destroyStage, BufferBuilder buffer) {
BlockState leverState = te.getBlockState();
if (!AllBlocks.ANALOG_LEVER.typeOf(leverState))
return;
int lightCoords = leverState.getPackedLightmapCoords(getWorld(), te.getPos());
float state = te.clientState.get(partialTicks);
// Handle
SuperByteBuffer handle = render(AllBlocks.ANALOG_LEVER_HANDLE);
float angle = (float) ((state / 15) * 90 / 180 * Math.PI);
handle.translate(-1 / 2f, -1 / 16f, -1 / 2f).rotate(Axis.X, angle).translate(1 / 2f, 1 / 16f, 1 / 2f);
transform(handle, leverState).light(lightCoords).translate(x, y, z).renderInto(buffer);
// Indicator
int color = ColorHelper.mixColors(0x2C0300, 0xCD0000, state / 15f);
SuperByteBuffer indicator = transform(render(AllBlocks.ANALOG_LEVER_INDICATOR), leverState);
indicator.light(lightCoords).translate(x, y, z).color(color).renderInto(buffer);
}
private SuperByteBuffer render(AllBlocks model) {
return CreateClient.bufferCache.renderGenericBlockModel(model.getDefault());
}
private SuperByteBuffer transform(SuperByteBuffer buffer, BlockState leverState) {
AttachFace face = leverState.get(AnalogLeverBlock.FACE);
float rX = face == AttachFace.FLOOR ? 0 : face == AttachFace.WALL ? 90 : 180;
float rY = AngleHelper.horizontalAngle(leverState.get(AnalogLeverBlock.HORIZONTAL_FACING));
buffer.rotateCentered(Axis.X, (float) (rX / 180 * Math.PI));
buffer.rotateCentered(Axis.Y, (float) (rY / 180 * Math.PI));
return buffer;
}
}

View file

@ -0,0 +1,64 @@
package com.simibubi.create.modules.contraptions.relays.encased;
import com.simibubi.create.foundation.block.IWithTileEntity;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
public class AdjustablePulleyBlock extends EncasedBeltBlock implements IWithTileEntity<AdjustablePulleyTileEntity> {
public static BooleanProperty POWERED = BlockStateProperties.POWERED;
public AdjustablePulleyBlock() {
setDefaultState(getDefaultState().with(POWERED, false));
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
super.fillStateContainer(builder.add(POWERED));
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new AdjustablePulleyTileEntity();
}
@Override
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
if (oldState.getBlock() != state.getBlock())
withTileEntityDo(worldIn, pos, AdjustablePulleyTileEntity::neighborChanged);
}
@Override
public void updateNeighbors(BlockState stateIn, IWorld worldIn, BlockPos pos, int flags) {
super.updateNeighbors(stateIn, worldIn, pos, flags);
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
return super.getStateForPlacement(context).with(POWERED, context.getWorld().isBlockPowered(context.getPos()));
}
@Override
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) {
if (worldIn.isRemote)
return;
withTileEntityDo(worldIn, pos, AdjustablePulleyTileEntity::neighborChanged);
boolean previouslyPowered = state.get(POWERED);
if (previouslyPowered != worldIn.isBlockPowered(pos))
worldIn.setBlockState(pos, state.cycle(POWERED), 18);
}
}

View file

@ -0,0 +1,69 @@
package com.simibubi.create.modules.contraptions.relays.encased;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import net.minecraft.nbt.CompoundNBT;
public class AdjustablePulleyTileEntity extends KineticTileEntity {
int signal;
boolean signalChanged;
public AdjustablePulleyTileEntity() {
super(AllTileEntities.ADJUSTABLE_PULLEY.type);
signal = 0;
setLazyTickRate(40);
}
@Override
public CompoundNBT write(CompoundNBT compound) {
compound.putInt("Signal", signal);
return super.write(compound);
}
@Override
public void read(CompoundNBT compound) {
signal = compound.getInt("Signal");
super.read(compound);
}
public float getModifier() {
return getModifierForSignal(signal);
}
public void neighborChanged() {
int power = world.getRedstonePowerFromNeighbors(pos);
if (power != signal)
signalChanged = true;
}
@Override
public void lazyTick() {
super.lazyTick();
neighborChanged();
}
@Override
public void tick() {
super.tick();
if (signalChanged) {
signalChanged = false;
analogSignalChanged(world.getRedstonePowerFromNeighbors(pos));
}
}
protected void analogSignalChanged(int newSignal) {
detachKinetics();
removeSource();
signal = newSignal;
attachKinetics();
}
protected float getModifierForSignal(int newPower) {
if (newPower == 0)
return 1;
return 1 + ((newPower + 1) / 16f);
}
}

View file

@ -1,6 +1,7 @@
package com.simibubi.create.modules.contraptions.relays.encased; package com.simibubi.create.modules.contraptions.relays.encased;
import com.simibubi.create.modules.contraptions.base.DirectionalAxisKineticBlock; import com.simibubi.create.modules.contraptions.base.DirectionalAxisKineticBlock;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock; import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -33,6 +34,11 @@ public class EncasedBeltBlock extends RotatedPillarKineticBlock {
setDefaultState(getDefaultState().with(PART, Part.NONE)); setDefaultState(getDefaultState().with(PART, Part.NONE));
} }
@Override
public boolean shouldCheckWeakPower(BlockState state, IWorldReader world, BlockPos pos, Direction side) {
return false;
}
@Override @Override
protected void fillStateContainer(Builder<Block, BlockState> builder) { protected void fillStateContainer(Builder<Block, BlockState> builder) {
super.fillStateContainer(builder.add(PART, CONNECTED_ALONG_FIRST_COORDINATE)); super.fillStateContainer(builder.add(PART, CONNECTED_ALONG_FIRST_COORDINATE));
@ -73,7 +79,7 @@ public class EncasedBeltBlock extends RotatedPillarKineticBlock {
if (axis == faceAxis) if (axis == faceAxis)
return stateIn; return stateIn;
if (neighbour.getBlock() != this) { if (!(neighbour.getBlock() instanceof EncasedBeltBlock)) {
if (facingAlongFirst != connectionAlongFirst || part == Part.NONE) if (facingAlongFirst != connectionAlongFirst || part == Part.NONE)
return stateIn; return stateIn;
if (part == Part.MIDDLE) if (part == Part.MIDDLE)
@ -141,6 +147,16 @@ public class EncasedBeltBlock extends RotatedPillarKineticBlock {
return false; return false;
} }
public static float getRotationSpeedModifier(KineticTileEntity from, KineticTileEntity to) {
float fromMod = 1;
float toMod = 1;
if (from instanceof AdjustablePulleyTileEntity)
fromMod = ((AdjustablePulleyTileEntity) from).getModifier();
if (to instanceof AdjustablePulleyTileEntity)
toMod = ((AdjustablePulleyTileEntity) to).getModifier();
return fromMod / toMod;
}
@Override @Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) { public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new EncasedShaftTileEntity(); return new EncasedShaftTileEntity();

View file

@ -19,6 +19,11 @@ public class EncasedShaftBlock extends RotatedPillarKineticBlock {
super(Properties.from(Blocks.ANDESITE)); super(Properties.from(Blocks.ANDESITE));
} }
@Override
public boolean shouldCheckWeakPower(BlockState state, IWorldReader world, BlockPos pos, Direction side) {
return false;
}
@Override @Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) { public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new EncasedShaftTileEntity(); return new EncasedShaftTileEntity();

View file

@ -51,8 +51,8 @@ public class GearshiftBlock extends EncasedShaftBlock {
boolean previouslyPowered = state.get(POWERED); boolean previouslyPowered = state.get(POWERED);
if (previouslyPowered != worldIn.isBlockPowered(pos)) { if (previouslyPowered != worldIn.isBlockPowered(pos)) {
worldIn.setBlockState(pos, state.cycle(POWERED), 2 | 16);
RotationPropagator.handleRemoved(worldIn, pos, (KineticTileEntity) worldIn.getTileEntity(pos)); RotationPropagator.handleRemoved(worldIn, pos, (KineticTileEntity) worldIn.getTileEntity(pos));
worldIn.setBlockState(pos, state.cycle(POWERED), 2);
} }
} }

View file

@ -1,8 +1,10 @@
package com.simibubi.create.modules.contraptions.relays.gauge; package com.simibubi.create.modules.contraptions.relays.gauge;
import static net.minecraft.util.text.TextFormatting.AQUA;
import static net.minecraft.util.text.TextFormatting.DARK_GRAY; import static net.minecraft.util.text.TextFormatting.DARK_GRAY;
import static net.minecraft.util.text.TextFormatting.GRAY; import static net.minecraft.util.text.TextFormatting.GRAY;
import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -37,6 +39,8 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@EventBusSubscriber(value = Dist.CLIENT) @EventBusSubscriber(value = Dist.CLIENT)
public class GaugeInformationRenderer { public class GaugeInformationRenderer {
private static DecimalFormat decimalFormat = new DecimalFormat("#.##");
@SubscribeEvent @SubscribeEvent
public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEvent.Post event) { public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEvent.Post event) {
if (event.getType() != ElementType.HOTBAR) if (event.getType() != ElementType.HOTBAR)
@ -101,11 +105,20 @@ public class GaugeInformationRenderer {
if (stressApplied == 0) if (stressApplied == 0)
return; return;
tooltip.add(spacing + Lang.translate("gui.goggles.kinetic_stats")); String _kineticStatsTitle = Lang.translate("gui.goggles.kinetic_stats");
tooltip.add(spacing + GRAY + Lang.translate("tooltip.stressImpact")); String _stressImpact = Lang.translate("tooltip.stressImpact");
String addedCapacity = TextFormatting.AQUA + "" + stressApplied + Lang.translate("generic.unit.stress") + " " String _atCurrentSpeed = Lang.translate("gui.goggles.at_current_speed");
+ DARK_GRAY + Lang.translate("gui.goggles.at_current_speed"); String _stressUnit = Lang.translate("generic.unit.stress");
tooltip.add(spacing + " " + addedCapacity); String _baseValue = Lang.translate("gui.goggles.base_value");
tooltip.add(spacing + _kineticStatsTitle);
tooltip.add(spacing + GRAY + _stressImpact);
String addedStress = AQUA + "" + format(stressApplied) + _stressUnit + " " + DARK_GRAY + _atCurrentSpeed;
String addedStressAtBase = GRAY + "" + format(stressApplied * te.getSpeed()) + _stressUnit + " " + DARK_GRAY
+ _baseValue;
tooltip.add(spacing + " " + addedStress);
tooltip.add(spacing + " " + addedStressAtBase);
} }
private static void addGeneratorTooltip(BlockState state, List<String> tooltip, GeneratingKineticTileEntity te) { private static void addGeneratorTooltip(BlockState state, List<String> tooltip, GeneratingKineticTileEntity te) {
@ -114,25 +127,45 @@ public class GaugeInformationRenderer {
if (addedStressCapacity == 0) if (addedStressCapacity == 0)
return; return;
tooltip.add(spacing + Lang.translate("gui.goggles.generator_stats")); String _stressUnit = Lang.translate("generic.unit.stress");
tooltip.add(spacing + GRAY + Lang.translate("tooltip.capacityProvided")); String _atCurrentSpeed = Lang.translate("gui.goggles.at_current_speed");
String _baseValue = Lang.translate("gui.goggles.base_value");
String _generatorStatsTitle = Lang.translate("gui.goggles.generator_stats");
String _capacityProvided = Lang.translate("tooltip.capacityProvided");
if (te.speed != te.getGeneratedSpeed() && te.speed != 0)
addedStressCapacity *= (te.getGeneratedSpeed() / te.speed);
tooltip.add(spacing + _generatorStatsTitle);
tooltip.add(spacing + GRAY + _capacityProvided);
float actualSpeed = Math.abs(te.speed); float actualSpeed = Math.abs(te.speed);
float relativeCap = 0; float relativeCap = 0;
if (actualSpeed != 0) if (actualSpeed != 0)
relativeCap = addedStressCapacity * actualSpeed; relativeCap = addedStressCapacity * actualSpeed;
String addedCapacity = TextFormatting.AQUA + "" + addedStressCapacity + Lang.translate("generic.unit.stress") String addedCapacity = AQUA + "" + format(addedStressCapacity) + _stressUnit + " " + DARK_GRAY
+ " " + DARK_GRAY + Lang.translate("gui.goggles.at_current_speed"); + _atCurrentSpeed;
String addedCapacityAtBase = GRAY + "" + (relativeCap) + Lang.translate("generic.unit.stress") + " " + DARK_GRAY String addedCapacityAtBase = GRAY + "" + format(relativeCap) + _stressUnit + " " + DARK_GRAY + _baseValue;
+ Lang.translate("gui.goggles.base_value");
tooltip.add(spacing + " " + addedCapacity); tooltip.add(spacing + " " + addedCapacity);
tooltip.add(spacing + " " + addedCapacityAtBase); tooltip.add(spacing + " " + addedCapacityAtBase);
} }
private static void addGaugeTooltip(BlockState state, List<String> tooltip, TileEntity te) { private static void addGaugeTooltip(BlockState state, List<String> tooltip, TileEntity te) {
String _rpmUnit = Lang.translate("generic.unit.rpm");
String _speedGaugeTitle = Lang.translate("gui.speed_gauge.title");
String _infoHeader = Lang.translate("gui.gauge.info_header");
String _overStressed = Lang.translate("gui.stress_gauge.overstressed");
String _noRotation = Lang.translate("gui.stress_gauge.no_rotation");
String _capacity = Lang.translate("gui.stress_gauge.capacity");
String _stressGaugeTitle = Lang.translate("gui.stress_gauge.title");
String _stressUnit = Lang.translate("generic.unit.stress");
String _atCurrentSpeed = Lang.translate("gui.goggles.at_current_speed");
String _baseValue = Lang.translate("gui.goggles.base_value");
String spacing = " "; String spacing = " ";
tooltip.add(spacing + Lang.translate("gui.gauge.info_header")); tooltip.add(spacing + _infoHeader);
if (AllBlocks.STRESS_GAUGE.typeOf(state)) { if (AllBlocks.STRESS_GAUGE.typeOf(state)) {
if (!(te instanceof StressGaugeTileEntity)) if (!(te instanceof StressGaugeTileEntity))
@ -154,8 +187,7 @@ public class GaugeInformationRenderer {
if (impactId == StressImpact.HIGH) if (impactId == StressImpact.HIGH)
color = TextFormatting.GOLD; color = TextFormatting.GOLD;
String level = TextFormatting.DARK_RED + ItemDescription.makeProgressBar(3, 2) + "" String level = TextFormatting.DARK_RED + ItemDescription.makeProgressBar(3, 2) + "" + _overStressed;
+ Lang.translate("gui.stress_gauge.overstressed");
if (impactId != null) { if (impactId != null) {
int index = impactId.ordinal(); int index = impactId.ordinal();
level = color + ItemDescription.makeProgressBar(3, index) + stressLevels.get(index); level = color + ItemDescription.makeProgressBar(3, index) + stressLevels.get(index);
@ -165,25 +197,20 @@ public class GaugeInformationRenderer {
float actualSpeed = stressGauge.speed; float actualSpeed = stressGauge.speed;
if (actualSpeed == 0) if (actualSpeed == 0)
level = DARK_GRAY + ItemDescription.makeProgressBar(3, -1) level = DARK_GRAY + ItemDescription.makeProgressBar(3, -1) + _noRotation;
+ Lang.translate("gui.stress_gauge.no_rotation");
tooltip.add(spacing + GRAY + Lang.translate("gui.stress_gauge.title")); tooltip.add(spacing + GRAY + _stressGaugeTitle);
tooltip.add(spacing + level); tooltip.add(spacing + level);
if (actualSpeed != 0) { if (actualSpeed != 0) {
tooltip.add(spacing + GRAY + Lang.translate("gui.stress_gauge.capacity")); tooltip.add(spacing + GRAY + _capacity);
String capacity = color + "" + ((cap - stress) / Math.abs(actualSpeed)) String capacity = color + "" + format((cap - stress) / Math.abs(actualSpeed)) + _stressUnit + " "
+ Lang.translate("generic.unit.stress") + " " + DARK_GRAY + DARK_GRAY + _atCurrentSpeed;
+ Lang.translate("gui.goggles.at_current_speed"); String capacityAtBase = GRAY + "" + format(cap - stress) + _stressUnit + " " + DARK_GRAY + _baseValue;
String capacityAtBase = GRAY + "" + (cap - stress) + Lang.translate("generic.unit.stress") + " " + DARK_GRAY
+ Lang.translate("gui.goggles.base_value");
tooltip.add(spacing + " " + capacity); tooltip.add(spacing + " " + capacity);
tooltip.add(spacing + " " + capacityAtBase); tooltip.add(spacing + " " + capacityAtBase);
} }
} }
if (AllBlocks.SPEED_GAUGE.typeOf(state)) { if (AllBlocks.SPEED_GAUGE.typeOf(state)) {
@ -201,14 +228,18 @@ public class GaugeInformationRenderer {
int index = speedLevel.ordinal(); int index = speedLevel.ordinal();
String level = color + ItemDescription.makeProgressBar(3, index) String level = color + ItemDescription.makeProgressBar(3, index)
+ (speedLevel != SpeedLevel.NONE ? speedLevels.get(index) : ""); + (speedLevel != SpeedLevel.NONE ? speedLevels.get(index) : "");
level += " (" + Math.abs(speedGauge.speed) + "" + Lang.translate("generic.unit.rpm") + ") "; level += " (" + format(Math.abs(speedGauge.speed)) + "" + _rpmUnit + ") ";
tooltip.add(spacing + GRAY + Lang.translate("gui.speed_gauge.title")); tooltip.add(spacing + GRAY + _speedGaugeTitle);
tooltip.add(spacing + level); tooltip.add(spacing + level);
if (overstressed) if (overstressed)
tooltip.add(spacing + TextFormatting.DARK_RED + Lang.translate("gui.stress_gauge.overstressed")); tooltip.add(spacing + TextFormatting.DARK_RED + _overStressed);
} }
} }
private static String format(double d) {
return decimalFormat.format(d);
}
} }

View file

@ -0,0 +1,59 @@
{
"variants": {
"powered=false,part=none,axis_along_first=false,axis=x": { "model": "create:block/adjustable_pulley/single", "y": 90 },
"powered=false,part=none,axis_along_first=false,axis=y": { "model": "create:block/adjustable_pulley/single", "x": 90 },
"powered=false,part=none,axis_along_first=false,axis=z": { "model": "create:block/adjustable_pulley/single" },
"powered=false,part=none,axis_along_first=true,axis=x": { "model": "create:block/adjustable_pulley/single", "y": 90 },
"powered=false,part=none,axis_along_first=true,axis=y": { "model": "create:block/adjustable_pulley/single", "x": 90 },
"powered=false,part=none,axis_along_first=true,axis=z": { "model": "create:block/adjustable_pulley/single" },
"powered=false,part=start,axis_along_first=false,axis=x": { "model": "create:block/adjustable_pulley/end_horizontal", "x": 180 },
"powered=false,part=start,axis_along_first=true,axis=x": { "model": "create:block/adjustable_pulley/end_horizontal", "x": 270 },
"powered=false,part=middle,axis_along_first=false,axis=x": { "model": "create:block/adjustable_pulley/middle_horizontal" },
"powered=false,part=middle,axis_along_first=true,axis=x": { "model": "create:block/adjustable_pulley/middle_horizontal", "x": 90 },
"powered=false,part=end,axis_along_first=false,axis=x": { "model": "create:block/adjustable_pulley/end_horizontal" },
"powered=false,part=end,axis_along_first=true,axis=x": { "model": "create:block/adjustable_pulley/end_horizontal", "x": 90 },
"powered=false,part=start,axis_along_first=false,axis=y": { "model": "create:block/adjustable_pulley/end_vertical" },
"powered=false,part=start,axis_along_first=true,axis=y": { "model": "create:block/adjustable_pulley/end_vertical", "y": 270 },
"powered=false,part=middle,axis_along_first=false,axis=y": { "model": "create:block/adjustable_pulley/middle_vertical" },
"powered=false,part=middle,axis_along_first=true,axis=y": { "model": "create:block/adjustable_pulley/middle_vertical", "y": 90 },
"powered=false,part=end,axis_along_first=false,axis=y": { "model": "create:block/adjustable_pulley/end_vertical", "y": 180 },
"powered=false,part=end,axis_along_first=true,axis=y": { "model": "create:block/adjustable_pulley/end_vertical", "y": 90 },
"powered=false,part=start,axis_along_first=false,axis=z": { "model": "create:block/adjustable_pulley/end_horizontal", "x": 270, "y": 90 },
"powered=false,part=start,axis_along_first=true,axis=z": { "model": "create:block/adjustable_pulley/end_horizontal", "y": 90 },
"powered=false,part=middle,axis_along_first=false,axis=z": { "model": "create:block/adjustable_pulley/middle_horizontal", "x": 90, "y": 90 },
"powered=false,part=middle,axis_along_first=true,axis=z": { "model": "create:block/adjustable_pulley/middle_horizontal", "y": 90 },
"powered=false,part=end,axis_along_first=false,axis=z": { "model": "create:block/adjustable_pulley/end_horizontal", "x": 90, "y": 90 },
"powered=false,part=end,axis_along_first=true,axis=z": { "model": "create:block/adjustable_pulley/end_horizontal", "y": 270 },
"powered=true,part=none,axis_along_first=false,axis=x": { "model": "create:block/adjustable_pulley/powered/single", "y": 90 },
"powered=true,part=none,axis_along_first=false,axis=y": { "model": "create:block/adjustable_pulley/powered/single", "x": 90 },
"powered=true,part=none,axis_along_first=false,axis=z": { "model": "create:block/adjustable_pulley/powered/single" },
"powered=true,part=none,axis_along_first=true,axis=x": { "model": "create:block/adjustable_pulley/powered/single", "y": 90 },
"powered=true,part=none,axis_along_first=true,axis=y": { "model": "create:block/adjustable_pulley/powered/single", "x": 90 },
"powered=true,part=none,axis_along_first=true,axis=z": { "model": "create:block/adjustable_pulley/powered/single" },
"powered=true,part=start,axis_along_first=false,axis=x": { "model": "create:block/adjustable_pulley/powered/end_horizontal", "x": 180 },
"powered=true,part=start,axis_along_first=true,axis=x": { "model": "create:block/adjustable_pulley/powered/end_horizontal", "x": 270 },
"powered=true,part=middle,axis_along_first=false,axis=x": { "model": "create:block/adjustable_pulley/powered/middle_horizontal" },
"powered=true,part=middle,axis_along_first=true,axis=x": { "model": "create:block/adjustable_pulley/powered/middle_horizontal", "x": 90 },
"powered=true,part=end,axis_along_first=false,axis=x": { "model": "create:block/adjustable_pulley/powered/end_horizontal" },
"powered=true,part=end,axis_along_first=true,axis=x": { "model": "create:block/adjustable_pulley/powered/end_horizontal", "x": 90 },
"powered=true,part=start,axis_along_first=false,axis=y": { "model": "create:block/adjustable_pulley/powered/end_vertical" },
"powered=true,part=start,axis_along_first=true,axis=y": { "model": "create:block/adjustable_pulley/powered/end_vertical", "y": 270 },
"powered=true,part=middle,axis_along_first=false,axis=y": { "model": "create:block/adjustable_pulley/powered/middle_vertical" },
"powered=true,part=middle,axis_along_first=true,axis=y": { "model": "create:block/adjustable_pulley/powered/middle_vertical", "y": 90 },
"powered=true,part=end,axis_along_first=false,axis=y": { "model": "create:block/adjustable_pulley/powered/end_vertical", "y": 180 },
"powered=true,part=end,axis_along_first=true,axis=y": { "model": "create:block/adjustable_pulley/powered/end_vertical", "y": 90 },
"powered=true,part=start,axis_along_first=false,axis=z": { "model": "create:block/adjustable_pulley/powered/end_horizontal", "x": 270, "y": 90 },
"powered=true,part=start,axis_along_first=true,axis=z": { "model": "create:block/adjustable_pulley/powered/end_horizontal", "y": 90 },
"powered=true,part=middle,axis_along_first=false,axis=z": { "model": "create:block/adjustable_pulley/powered/middle_horizontal", "x": 90, "y": 90 },
"powered=true,part=middle,axis_along_first=true,axis=z": { "model": "create:block/adjustable_pulley/powered/middle_horizontal", "y": 90 },
"powered=true,part=end,axis_along_first=false,axis=z": { "model": "create:block/adjustable_pulley/powered/end_horizontal", "x": 90, "y": 90 },
"powered=true,part=end,axis_along_first=true,axis=z": { "model": "create:block/adjustable_pulley/powered/end_horizontal", "y": 270 }
}
}

View file

@ -0,0 +1,28 @@
{
"variants": {
"face=ceiling,facing=north": { "model": "create:block/analog_lever/body", "x": 180, "y": 180 },
"face=ceiling,facing=east": { "model": "create:block/analog_lever/body", "x": 180, "y": 270 },
"face=ceiling,facing=south": { "model": "create:block/analog_lever/body", "x": 180},
"face=ceiling,facing=west": { "model": "create:block/analog_lever/body", "x": 180, "y": 90 },
"face=floor,facing=north": { "model": "create:block/analog_lever/body" },
"face=floor,facing=east": { "model": "create:block/analog_lever/body", "y": 90 },
"face=floor,facing=south": { "model": "create:block/analog_lever/body", "y": 180 },
"face=floor,facing=west": { "model": "create:block/analog_lever/body", "y": 270 },
"face=wall,facing=north": { "model": "create:block/analog_lever/body", "x": 90 },
"face=wall,facing=east": { "model": "create:block/analog_lever/body", "x": 90, "y": 90 },
"face=wall,facing=south": { "model": "create:block/analog_lever/body", "x": 90, "y": 180 },
"face=wall,facing=west": { "model": "create:block/analog_lever/body", "x": 90, "y": 270 },
"face=ceiling,facing=north": { "model": "create:block/analog_lever/body", "x": 180, "y": 180 },
"face=ceiling,facing=east": { "model": "create:block/analog_lever/body", "x": 180, "y": 270 },
"face=ceiling,facing=south": { "model": "create:block/analog_lever/body", "x": 180},
"face=ceiling,facing=west": { "model": "create:block/analog_lever/body", "x": 180, "y": 90 },
"face=floor,facing=north": { "model": "create:block/analog_lever/body" },
"face=floor,facing=east": { "model": "create:block/analog_lever/body", "y": 90 },
"face=floor,facing=south": { "model": "create:block/analog_lever/body", "y": 180 },
"face=floor,facing=west": { "model": "create:block/analog_lever/body", "y": 270 },
"face=wall,facing=north": { "model": "create:block/analog_lever/body", "x": 90 },
"face=wall,facing=east": { "model": "create:block/analog_lever/body", "x": 90, "y": 90 },
"face=wall,facing=south": { "model": "create:block/analog_lever/body", "x": 90, "y": 180 },
"face=wall,facing=west": { "model": "create:block/analog_lever/body", "x": 90, "y": 270 }
}
}

View file

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

View file

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

View file

@ -88,6 +88,7 @@
"block.create.encased_belt": "Encased Belt", "block.create.encased_belt": "Encased Belt",
"block.create.encased_shaft": "Encased Shaft", "block.create.encased_shaft": "Encased Shaft",
"block.create.encased_fan": "Encased Fan", "block.create.encased_fan": "Encased Fan",
"block.create.adjustable_pulley": "Analog Belt Pulley",
"block.create.nozzle": "Nozzle", "block.create.nozzle": "Nozzle",
"block.create.hand_crank": "Hand Crank", "block.create.hand_crank": "Hand Crank",
"block.create.motor": "Motor", "block.create.motor": "Motor",
@ -105,6 +106,7 @@
"block.create.speed_gauge": "Speedometer", "block.create.speed_gauge": "Speedometer",
"block.create.stress_gauge": "Stress Gauge", "block.create.stress_gauge": "Stress Gauge",
"block.create.cart_assembler": "Cart Assembler", "block.create.cart_assembler": "Cart Assembler",
"block.create.analog_lever": "Analog Lever",
"block.create.sticky_mechanical_piston": "Sticky Mechanical Piston", "block.create.sticky_mechanical_piston": "Sticky Mechanical Piston",
"block.create.mechanical_piston": "Mechanical Piston", "block.create.mechanical_piston": "Mechanical Piston",

View file

@ -0,0 +1,7 @@
{
"parent": "create:block/encased_belt/end_horizontal",
"textures": {
"0": "create:block/adjustable_pulley_off",
"particle": "create:block/adjustable_pulley_off"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "create:block/encased_belt/end_vertical",
"textures": {
"1": "create:block/adjustable_pulley_off",
"particle": "create:block/adjustable_pulley_off"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "create:block/encased_belt/item",
"textures": {
"0": "create:block/adjustable_pulley_off"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "create:block/encased_belt/middle_horizontal",
"textures": {
"0": "create:block/adjustable_pulley_off",
"particle": "create:block/adjustable_pulley_off"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "create:block/encased_belt/middle_vertical",
"textures": {
"0": "create:block/adjustable_pulley_off",
"particle": "create:block/adjustable_pulley_off"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "create:block/encased_belt/end_horizontal",
"textures": {
"0": "create:block/adjustable_pulley_on",
"particle": "create:block/adjustable_pulley_on"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "create:block/encased_belt/end_vertical",
"textures": {
"1": "create:block/adjustable_pulley_on",
"particle": "create:block/adjustable_pulley_on"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "create:block/encased_belt/middle_horizontal",
"textures": {
"0": "create:block/adjustable_pulley_on",
"particle": "create:block/adjustable_pulley_on"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "create:block/encased_belt/middle_vertical",
"textures": {
"0": "create:block/adjustable_pulley_on",
"particle": "create:block/adjustable_pulley_on"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "create:block/encased_belt/single",
"textures": {
"0": "create:block/adjustable_pulley_on",
"particle": "create:block/adjustable_pulley_on"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "create:block/encased_belt/single",
"textures": {
"0": "create:block/adjustable_pulley_off",
"particle": "create:block/adjustable_pulley_off"
}
}

View file

@ -0,0 +1,30 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"ambientocclusion": false,
"textures": {
"4": "create:block/analog_lever",
"particle": "block/lever"
},
"elements": [
{
"from": [5, 0, 4],
"to": [11, 3, 12],
"faces": {
"north": {"uv": [0, 0, 3, 6], "rotation": 270, "texture": "#4"},
"east": {"uv": [3, 6, 11, 9], "texture": "#4"},
"south": {"uv": [11, 0, 14, 6], "rotation": 90, "texture": "#4"},
"west": {"uv": [3, 6, 11, 9], "texture": "#4"},
"up": {"uv": [3, 0, 11, 6], "rotation": 90, "texture": "#4"},
"down": {"uv": [3, 10, 11, 16], "rotation": 90, "texture": "#4", "cullface": "down"}
}
}
],
"groups": [
{
"name": "lever",
"origin": [8, 8, 8],
"children": [0]
}
]
}

View file

@ -0,0 +1,31 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"ambientocclusion": false,
"textures": {
"1": "block/lever",
"particle": "block/lever"
},
"elements": [
{
"from": [7, 0, -2],
"to": [9, 2, 8],
"rotation": {"angle": 45, "axis": "x", "origin": [8, 1, 8]},
"faces": {
"north": {"uv": [7, 6, 9, 8], "rotation": 180, "texture": "#1"},
"east": {"uv": [7, 6, 9, 16], "rotation": 90, "texture": "#1"},
"south": {"uv": [0, 0, 0, 0], "texture": "#1"},
"west": {"uv": [7, 6, 9, 16], "rotation": 270, "texture": "#1"},
"up": {"uv": [7, 6, 9, 16], "texture": "#1"},
"down": {"uv": [7, 6, 9, 16], "rotation": 180, "texture": "#1"}
}
}
],
"groups": [
{
"name": "lever",
"origin": [8, 8, 8],
"children": [0]
}
]
}

View file

@ -0,0 +1,28 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"ambientocclusion": false,
"textures": {
"4": "create:block/analog_lever",
"particle": "block/lever"
},
"elements": [
{
"from": [4.99, 1, 3.99],
"to": [11.01, 2, 12.01],
"faces": {
"north": {"uv": [2, 10, 3, 16], "rotation": 270, "texture": "#4"},
"east": {"uv": [3, 9, 11.02, 10], "texture": "#4"},
"south": {"uv": [11, 10, 12, 16], "rotation": 90, "texture": "#4"},
"west": {"uv": [3, 9, 11.02, 10], "texture": "#4"}
}
}
],
"groups": [
{
"name": "lever",
"origin": [8, 8, 8],
"children": [0]
}
]
}

View file

@ -0,0 +1,81 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"ambientocclusion": false,
"textures": {
"1": "block/lever",
"4": "create:block/analog_lever",
"particle": "block/lever"
},
"elements": [
{
"from": [5, 0, 4],
"to": [11, 3, 12],
"faces": {
"north": {"uv": [0, 0, 3, 6], "rotation": 270, "texture": "#4"},
"east": {"uv": [3, 6, 11, 9], "texture": "#4"},
"south": {"uv": [11, 0, 14, 6], "rotation": 90, "texture": "#4"},
"west": {"uv": [3, 6, 11, 9], "texture": "#4"},
"up": {"uv": [3, 0, 11, 6], "rotation": 90, "texture": "#4"},
"down": {"uv": [3, 10, 11, 16], "rotation": 90, "texture": "#4", "cullface": "down"}
}
},
{
"from": [7, 0, -2],
"to": [9, 2, 8],
"rotation": {"angle": 45, "axis": "x", "origin": [8, 1, 8]},
"faces": {
"north": {"uv": [7, 6, 9, 8], "rotation": 180, "texture": "#1"},
"east": {"uv": [7, 6, 9, 16], "rotation": 90, "texture": "#1"},
"south": {"uv": [0, 0, 0, 0], "texture": "#1"},
"west": {"uv": [7, 6, 9, 16], "rotation": 270, "texture": "#1"},
"up": {"uv": [7, 6, 9, 16], "texture": "#1"},
"down": {"uv": [7, 6, 9, 16], "rotation": 180, "texture": "#1"}
}
}
],
"display": {
"thirdperson_righthand": {
"rotation": [75, 45, 0],
"translation": [0, 1.75, 2.25],
"scale": [0.375, 0.375, 0.375]
},
"thirdperson_lefthand": {
"rotation": [75, 45, 0],
"translation": [0, 1.75, 2.25],
"scale": [0.375, 0.375, 0.375]
},
"firstperson_righthand": {
"rotation": [74.25, -1.5, 0],
"scale": [0.4, 0.4, 0.4]
},
"firstperson_lefthand": {
"rotation": [74.25, -1.5, 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],
"translation": [0, 2.5, 0],
"scale": [0.75, 0.75, 0.75]
},
"head": {
"translation": [0, 14.5, 0]
},
"fixed": {
"rotation": [-90, 0, 0],
"translation": [0, 0, -6],
"scale": [0.75, 0.75, 0.75]
}
},
"groups": [
{
"name": "lever",
"origin": [8, 8, 8],
"children": [0, 1]
}
]
}

View file

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

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "create:adjustable_pulley"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "create:analog_lever"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,29 @@
{
"type": "crafting_shaped",
"pattern": [
"A",
"B",
"C"
],
"key": {
"A": {
"item": "create:electron_tube"
},
"B": {
"item": "create:encased_belt"
},
"C": {
"item": "create:large_cogwheel"
}
},
"result": {
"item": "create:adjustable_pulley",
"count": 1
},
"conditions": [
{
"type": "create:module",
"module": "contraptions"
}
]
}

View file

@ -0,0 +1,25 @@
{
"type": "crafting_shaped",
"pattern": [
"A",
"C"
],
"key": {
"A": {
"tag": "forge:rods/wooden"
},
"C": {
"item": "create:andesite_casing"
}
},
"result": {
"item": "create:analog_lever",
"count": 1
},
"conditions": [
{
"type": "create:module",
"module": "contraptions"
}
]
}