Kinetic loops

- Fixed cases of self-powering loops caused by blocks rotated using the wrench, addresses #319
- Fixed Extendo Grip animation for left-handed players
This commit is contained in:
simibubi 2020-06-08 21:39:03 +02:00
parent 20a97c6b39
commit b91a9bbf28
3 changed files with 11 additions and 8 deletions

View file

@ -353,6 +353,10 @@ public abstract class KineticTileEntity extends SmartTileEntity
TileEntity tileEntityIn = world.getTileEntity(pos);
boolean isKinetic = tileEntityIn instanceof KineticTileEntity;
if (tileEntityIn == null)
return;
if (tileEntityIn.getBlockState() == state)
return;
if (!isKinetic) {
world.setBlockState(pos, state, 3);
return;
@ -365,7 +369,6 @@ public abstract class KineticTileEntity extends SmartTileEntity
tileEntity.detachKinetics();
tileEntity.removeSource();
world.setBlockState(pos, state, 3);
tileEntity.attachKinetics();
}
@Override

View file

@ -4,6 +4,7 @@ import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.content.contraptions.components.crafter.ConnectedInputHandler.ConnectedInput;
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity.Phase;
import com.simibubi.create.foundation.block.ITE;
@ -154,9 +155,8 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock implements IT
@Override
public ActionResultType onWrenched(BlockState state, ItemUseContext context) {
if (context.getFace() == state.get(HORIZONTAL_FACING)) {
context.getWorld()
.setBlockState(context.getPos(), state.cycle(POINTING));
withTileEntityDo(context.getWorld(), context.getPos(), TileEntity::markDirty);
if (!context.getWorld().isRemote)
KineticTileEntity.switchToBlockState(context.getWorld(), context.getPos(), state.cycle(POINTING));
return ActionResultType.SUCCESS;
}

View file

@ -94,7 +94,7 @@ public class ExtendoGripRenderHandler {
.rotateY(flip * -135.0F);
ms.translate(flip * 5.6F, 0.0F, 0.0F);
msr.rotateY(flip * 40.0F);
ms.translate(0.05f, -0.3f, -0.3f);
ms.translate(flip * 0.05f, -0.3f, -0.3f);
PlayerRenderer playerrenderer = (PlayerRenderer) mc.getRenderManager()
.getRenderer(player);
@ -115,14 +115,14 @@ public class ExtendoGripRenderHandler {
if (!notInOffhand) {
ForgeHooksClient.handleCameraTransforms(ms, mc.getItemRenderer()
.getItemModelWithOverrides(offhandItem, null, null), transform, false);
.getItemModelWithOverrides(offhandItem, null, null), transform, !rightHand);
ms.translate(flip * -.05f, .15f, -1.2f);
ms.translate(0, 0, -animation * 2.25f);
if (blockItem && mc.getItemRenderer()
.getItemModelWithOverrides(heldItem, null, null)
.isGui3d()) {
msr.rotateY(45);
ms.translate(0.15f, -0.15f, -.05f);
msr.rotateY(flip * 45);
ms.translate(flip * 0.15f, -0.15f, -.05f);
ms.scale(1.25f, 1.25f, 1.25f);
}