mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 07:27:15 +01:00
Bug Hunt
- Fixed extractors looking for belt inventories too eagerly, adresses #327 - Slightly refactored Extendo Grip handlers - Fixed missing particle texture of Extendo Grips - Fixed crash when assembled minecarts pick up the block below their assembler - Ploughs no longer break blocks if farmland is below them, adresses #345 - Fixed Schematic tools placing lit furnaces, adresses #342 - Super glue can no longer be removed while inbetween two blocks, adresses #341 - Added a safety check in RotationPropagation, addresses #340
This commit is contained in:
parent
dbb2a74839
commit
c5e783207f
13 changed files with 119 additions and 89 deletions
|
@ -17,6 +17,7 @@ import com.simibubi.create.content.contraptions.relays.encased.SplitShaftTileEnt
|
||||||
import com.simibubi.create.content.contraptions.relays.gearbox.GearboxTileEntity;
|
import com.simibubi.create.content.contraptions.relays.gearbox.GearboxTileEntity;
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
@ -40,8 +41,14 @@ public class RotationPropagator {
|
||||||
private static float getRotationSpeedModifier(KineticTileEntity from, KineticTileEntity to) {
|
private static float getRotationSpeedModifier(KineticTileEntity from, KineticTileEntity to) {
|
||||||
final BlockState stateFrom = from.getBlockState();
|
final BlockState stateFrom = from.getBlockState();
|
||||||
final BlockState stateTo = to.getBlockState();
|
final BlockState stateTo = to.getBlockState();
|
||||||
final IRotate definitionFrom = (IRotate) stateFrom.getBlock();
|
|
||||||
final IRotate definitionTo = (IRotate) stateTo.getBlock();
|
Block fromBlock = stateFrom.getBlock();
|
||||||
|
Block toBlock = stateTo.getBlock();
|
||||||
|
if (!(fromBlock instanceof IRotate && toBlock instanceof IRotate))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
final IRotate definitionFrom = (IRotate) fromBlock;
|
||||||
|
final IRotate definitionTo = (IRotate) toBlock;
|
||||||
final BlockPos diff = to.getPos()
|
final BlockPos diff = to.getPos()
|
||||||
.subtract(from.getPos());
|
.subtract(from.getPos());
|
||||||
final Direction direction = Direction.getFacingFromVector(diff.getX(), diff.getY(), diff.getZ());
|
final Direction direction = Direction.getFacingFromVector(diff.getX(), diff.getY(), diff.getZ());
|
||||||
|
@ -75,7 +82,7 @@ public class RotationPropagator {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attached Encased Belts
|
// Attached Encased Belts
|
||||||
if (stateFrom.getBlock() instanceof EncasedBeltBlock && stateTo.getBlock() instanceof EncasedBeltBlock) {
|
if (fromBlock instanceof EncasedBeltBlock && toBlock instanceof EncasedBeltBlock) {
|
||||||
boolean connected = EncasedBeltBlock.areBlocksConnected(stateFrom, stateTo, direction);
|
boolean connected = EncasedBeltBlock.areBlocksConnected(stateFrom, stateTo, direction);
|
||||||
return connected ? EncasedBeltBlock.getRotationSpeedModifier(from, to) : 0;
|
return connected ? EncasedBeltBlock.getRotationSpeedModifier(from, to) : 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,9 +155,9 @@ public class BlockBreakingMovementBehaviour extends MovementBehaviour {
|
||||||
data.remove("Progress");
|
data.remove("Progress");
|
||||||
data.remove("TicksUntilNextProgress");
|
data.remove("TicksUntilNextProgress");
|
||||||
data.remove("BreakingPos");
|
data.remove("BreakingPos");
|
||||||
context.stall = false;
|
|
||||||
world.sendBlockBreakProgress(id, breakingPos, -1);
|
world.sendBlockBreakProgress(id, breakingPos, -1);
|
||||||
}
|
}
|
||||||
|
context.stall = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.FarmlandBlock;
|
||||||
import net.minecraft.block.FlowingFluidBlock;
|
import net.minecraft.block.FlowingFluidBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ItemUseContext;
|
import net.minecraft.item.ItemUseContext;
|
||||||
|
@ -26,8 +27,8 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isActive(MovementContext context) {
|
public boolean isActive(MovementContext context) {
|
||||||
return !VecHelper
|
return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.get(HORIZONTAL_FACING)
|
||||||
.isVecPointingTowards(context.relativeMotion, context.state.get(HORIZONTAL_FACING).getOpposite());
|
.getOpposite());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -57,7 +58,8 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3d getActiveAreaOffset(MovementContext context) {
|
public Vec3d getActiveAreaOffset(MovementContext context) {
|
||||||
return new Vec3d(context.state.get(HORIZONTAL_FACING).getDirectionVec()).scale(.45);
|
return new Vec3d(context.state.get(HORIZONTAL_FACING)
|
||||||
|
.getDirectionVec()).scale(.45);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -67,8 +69,10 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBreak(World world, BlockPos breakingPos, BlockState state) {
|
public boolean canBreak(World world, BlockPos breakingPos, BlockState state) {
|
||||||
return state.getCollisionShape(world, breakingPos).isEmpty()
|
return state.getCollisionShape(world, breakingPos)
|
||||||
&& !(state.getBlock() instanceof FlowingFluidBlock);
|
.isEmpty() && !(state.getBlock() instanceof FlowingFluidBlock)
|
||||||
|
&& !(world.getBlockState(breakingPos.down())
|
||||||
|
.getBlock() instanceof FarmlandBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -64,8 +64,6 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
||||||
return super.insertItem(slot, stack, simulate);
|
return super.insertItem(slot, stack, simulate);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void onContentsChanged(int slot) {
|
protected void onContentsChanged(int slot) {
|
||||||
if (!getStackInSlot(slot).isEmpty() && phase == Phase.IDLE)
|
if (!getStackInSlot(slot).isEmpty() && phase == Phase.IDLE)
|
||||||
checkCompletedRecipe(false);
|
checkCompletedRecipe(false);
|
||||||
|
@ -82,7 +80,7 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
||||||
protected Phase phase;
|
protected Phase phase;
|
||||||
protected int countDown;
|
protected int countDown;
|
||||||
protected boolean covered;
|
protected boolean covered;
|
||||||
private boolean wasPoweredBefore = true;
|
protected boolean wasPoweredBefore;
|
||||||
|
|
||||||
protected GroupedItems groupedItemsBeforeCraft; // for rendering on client
|
protected GroupedItems groupedItemsBeforeCraft; // for rendering on client
|
||||||
private InsertingBehaviour inserting;
|
private InsertingBehaviour inserting;
|
||||||
|
@ -93,6 +91,9 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
||||||
setLazyTickRate(20);
|
setLazyTickRate(20);
|
||||||
phase = Phase.IDLE;
|
phase = Phase.IDLE;
|
||||||
groupedItemsBeforeCraft = new GroupedItems();
|
groupedItemsBeforeCraft = new GroupedItems();
|
||||||
|
|
||||||
|
// Does not get serialized due to active checking in tick
|
||||||
|
wasPoweredBefore = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -422,11 +423,13 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean craftingItemPresent() {
|
public boolean craftingItemPresent() {
|
||||||
return !inventory.getStackInSlot(0).isEmpty();
|
return !inventory.getStackInSlot(0)
|
||||||
|
.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean craftingItemOrCoverPresent() {
|
public boolean craftingItemOrCoverPresent() {
|
||||||
return !inventory.getStackInSlot(0).isEmpty() || covered;
|
return !inventory.getStackInSlot(0)
|
||||||
|
.isEmpty() || covered;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkCompletedRecipe(boolean poweredStart) {
|
protected void checkCompletedRecipe(boolean poweredStart) {
|
||||||
|
@ -434,8 +437,10 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
||||||
return;
|
return;
|
||||||
if (world.isRemote)
|
if (world.isRemote)
|
||||||
return;
|
return;
|
||||||
List<MechanicalCrafterTileEntity> chain =
|
List<MechanicalCrafterTileEntity> chain = RecipeGridHandler.getAllCraftersOfChainIf(this,
|
||||||
RecipeGridHandler.getAllCraftersOfChainIf(this, poweredStart ? MechanicalCrafterTileEntity::craftingItemPresent : MechanicalCrafterTileEntity::craftingItemOrCoverPresent, poweredStart);
|
poweredStart ? MechanicalCrafterTileEntity::craftingItemPresent
|
||||||
|
: MechanicalCrafterTileEntity::craftingItemOrCoverPresent,
|
||||||
|
poweredStart);
|
||||||
if (chain == null)
|
if (chain == null)
|
||||||
return;
|
return;
|
||||||
chain.forEach(MechanicalCrafterTileEntity::begin);
|
chain.forEach(MechanicalCrafterTileEntity::begin);
|
||||||
|
|
|
@ -39,7 +39,6 @@ public class RecipeGridHandler {
|
||||||
return getAllCraftersOfChainIf(root, test, false);
|
return getAllCraftersOfChainIf(root, test, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static List<MechanicalCrafterTileEntity> getAllCraftersOfChainIf(MechanicalCrafterTileEntity root,
|
public static List<MechanicalCrafterTileEntity> getAllCraftersOfChainIf(MechanicalCrafterTileEntity root,
|
||||||
Predicate<MechanicalCrafterTileEntity> test, boolean poweredStart) {
|
Predicate<MechanicalCrafterTileEntity> test, boolean poweredStart) {
|
||||||
List<MechanicalCrafterTileEntity> crafters = new ArrayList<>();
|
List<MechanicalCrafterTileEntity> crafters = new ArrayList<>();
|
||||||
|
@ -62,7 +61,8 @@ public class RecipeGridHandler {
|
||||||
empty = true;
|
empty = true;
|
||||||
else
|
else
|
||||||
allEmpty = false;
|
allEmpty = false;
|
||||||
if(poweredStart && current.getWorld().isBlockPowered(current.getPos()))
|
if (poweredStart && current.getWorld()
|
||||||
|
.isBlockPowered(current.getPos()))
|
||||||
powered = true;
|
powered = true;
|
||||||
|
|
||||||
crafters.add(current);
|
crafters.add(current);
|
||||||
|
|
|
@ -69,8 +69,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerData() {
|
protected void registerData() {}
|
||||||
}
|
|
||||||
|
|
||||||
public int getWidthPixels() {
|
public int getWidthPixels() {
|
||||||
return 12;
|
return 12;
|
||||||
|
@ -95,11 +94,13 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
|
|
||||||
protected void updateFacingWithBoundingBox() {
|
protected void updateFacingWithBoundingBox() {
|
||||||
Validate.notNull(getFacingDirection());
|
Validate.notNull(getFacingDirection());
|
||||||
if (getFacingDirection().getAxis().isHorizontal()) {
|
if (getFacingDirection().getAxis()
|
||||||
|
.isHorizontal()) {
|
||||||
this.rotationPitch = 0.0F;
|
this.rotationPitch = 0.0F;
|
||||||
this.rotationYaw = getFacingDirection().getHorizontalIndex() * 90;
|
this.rotationYaw = getFacingDirection().getHorizontalIndex() * 90;
|
||||||
} else {
|
} else {
|
||||||
this.rotationPitch = -90 * getFacingDirection().getAxisDirection().getOffset();
|
this.rotationPitch = -90 * getFacingDirection().getAxisDirection()
|
||||||
|
.getOffset();
|
||||||
this.rotationYaw = 0.0F;
|
this.rotationYaw = 0.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +119,8 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
double w = getWidthPixels();
|
double w = getWidthPixels();
|
||||||
double h = getHeightPixels();
|
double h = getHeightPixels();
|
||||||
double l = getWidthPixels();
|
double l = getWidthPixels();
|
||||||
Axis axis = this.getFacingDirection().getAxis();
|
Axis axis = this.getFacingDirection()
|
||||||
|
.getAxis();
|
||||||
double depth = 2 - 1 / 128f;
|
double depth = 2 - 1 / 128f;
|
||||||
|
|
||||||
switch (axis) {
|
switch (axis) {
|
||||||
|
@ -151,14 +153,25 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isVisible() {
|
||||||
|
if (!isAlive())
|
||||||
|
return false;
|
||||||
|
BlockPos pos = hangingPosition;
|
||||||
|
BlockPos pos2 = pos.offset(getFacingDirection().getOpposite());
|
||||||
|
return isValidFace(world, pos2, getFacingDirection()) != isValidFace(world, pos,
|
||||||
|
getFacingDirection().getOpposite());
|
||||||
|
}
|
||||||
|
|
||||||
public boolean onValidSurface() {
|
public boolean onValidSurface() {
|
||||||
BlockPos pos = hangingPosition;
|
BlockPos pos = hangingPosition;
|
||||||
BlockPos pos2 = hangingPosition.offset(getFacingDirection().getOpposite());
|
BlockPos pos2 = hangingPosition.offset(getFacingDirection().getOpposite());
|
||||||
if (!world.isAreaLoaded(pos, 0) || !world.isAreaLoaded(pos2, 0))
|
if (!world.isAreaLoaded(pos, 0) || !world.isAreaLoaded(pos2, 0))
|
||||||
return true;
|
return true;
|
||||||
if (!isValidFace(world, pos2, getFacingDirection()) && !isValidFace(world, pos, getFacingDirection().getOpposite()))
|
if (!isValidFace(world, pos2, getFacingDirection())
|
||||||
|
&& !isValidFace(world, pos, getFacingDirection().getOpposite()))
|
||||||
return false;
|
return false;
|
||||||
return world.getEntitiesInAABBexcluding(this, getBoundingBox(), e -> e instanceof SuperGlueEntity).isEmpty();
|
return world.getEntitiesInAABBexcluding(this, getBoundingBox(), e -> e instanceof SuperGlueEntity)
|
||||||
|
.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isValidFace(World world, BlockPos pos, Direction direction) {
|
public static boolean isValidFace(World world, BlockPos pos, Direction direction) {
|
||||||
|
@ -193,7 +206,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||||
if (this.isInvulnerableTo(source))
|
if (this.isInvulnerableTo(source))
|
||||||
return false;
|
return false;
|
||||||
if (isAlive() && !world.isRemote) {
|
if (isAlive() && !world.isRemote && isVisible()) {
|
||||||
remove();
|
remove();
|
||||||
markVelocityChanged();
|
markVelocityChanged();
|
||||||
onBroken(source.getTrueSource());
|
onBroken(source.getTrueSource());
|
||||||
|
@ -268,7 +281,8 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeAdditional(CompoundNBT compound) {
|
public void writeAdditional(CompoundNBT compound) {
|
||||||
compound.putByte("Facing", (byte) this.getFacingDirection().getIndex());
|
compound.putByte("Facing", (byte) this.getFacingDirection()
|
||||||
|
.getIndex());
|
||||||
BlockPos blockpos = this.getHangingPosition();
|
BlockPos blockpos = this.getHangingPosition();
|
||||||
compound.putInt("TileX", blockpos.getX());
|
compound.putInt("TileX", blockpos.getX());
|
||||||
compound.putInt("TileY", blockpos.getY());
|
compound.putInt("TileY", blockpos.getY());
|
||||||
|
@ -285,8 +299,10 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemEntity entityDropItem(ItemStack stack, float yOffset) {
|
public ItemEntity entityDropItem(ItemStack stack, float yOffset) {
|
||||||
float xOffset = (float) this.getFacingDirection().getXOffset() * 0.15F;
|
float xOffset = (float) this.getFacingDirection()
|
||||||
float zOffset = (float) this.getFacingDirection().getZOffset() * 0.15F;
|
.getXOffset() * 0.15F;
|
||||||
|
float zOffset = (float) this.getFacingDirection()
|
||||||
|
.getZOffset() * 0.15F;
|
||||||
ItemEntity itementity =
|
ItemEntity itementity =
|
||||||
new ItemEntity(this.world, this.getX() + xOffset, this.getY() + yOffset, this.getZ() + zOffset, stack);
|
new ItemEntity(this.world, this.getX() + xOffset, this.getY() + yOffset, this.getZ() + zOffset, stack);
|
||||||
itementity.setDefaultPickupDelay();
|
itementity.setDefaultPickupDelay();
|
||||||
|
@ -308,7 +324,8 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getRotatedYaw(Rotation transformRotation) {
|
public float getRotatedYaw(Rotation transformRotation) {
|
||||||
if (this.getFacingDirection().getAxis() != Direction.Axis.Y) {
|
if (this.getFacingDirection()
|
||||||
|
.getAxis() != Direction.Axis.Y) {
|
||||||
switch (transformRotation) {
|
switch (transformRotation) {
|
||||||
case CLOCKWISE_180:
|
case CLOCKWISE_180:
|
||||||
facingDirection = facingDirection.getOpposite();
|
facingDirection = facingDirection.getOpposite();
|
||||||
|
@ -350,12 +367,10 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStruckByLightning(LightningBoltEntity lightningBolt) {
|
public void onStruckByLightning(LightningBoltEntity lightningBolt) {}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recalculateSize() {
|
public void recalculateSize() {}
|
||||||
}
|
|
||||||
|
|
||||||
public static EntityType.Builder<?> build(EntityType.Builder<?> builder) {
|
public static EntityType.Builder<?> build(EntityType.Builder<?> builder) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class SuperGlueRenderer extends EntityRenderer<SuperGlueEntity> {
|
||||||
super.render(entity, p_225623_2_, p_225623_3_, ms, buffer, light);
|
super.render(entity, p_225623_2_, p_225623_3_, ms, buffer, light);
|
||||||
|
|
||||||
PlayerEntity player = Minecraft.getInstance().player;
|
PlayerEntity player = Minecraft.getInstance().player;
|
||||||
boolean visible = isVisible(entity);
|
boolean visible = entity.isVisible();
|
||||||
boolean holdingGlue = AllItems.SUPER_GLUE.isIn(player.getHeldItemMainhand())
|
boolean holdingGlue = AllItems.SUPER_GLUE.isIn(player.getHeldItemMainhand())
|
||||||
|| AllItems.SUPER_GLUE.isIn(player.getHeldItemOffhand());
|
|| AllItems.SUPER_GLUE.isIn(player.getHeldItemOffhand());
|
||||||
|
|
||||||
|
@ -83,17 +83,6 @@ public class SuperGlueRenderer extends EntityRenderer<SuperGlueEntity> {
|
||||||
ms.pop();
|
ms.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isVisible(SuperGlueEntity entity) {
|
|
||||||
if (!entity.isAlive())
|
|
||||||
return false;
|
|
||||||
BlockPos pos = entity.hangingPosition;
|
|
||||||
BlockPos pos2 = pos.offset(entity.getFacingDirection()
|
|
||||||
.getOpposite());
|
|
||||||
return SuperGlueEntity.isValidFace(entity.world, pos2, entity.getFacingDirection()) != SuperGlueEntity
|
|
||||||
.isValidFace(entity.world, pos, entity.getFacingDirection()
|
|
||||||
.getOpposite());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initQuads() {
|
private void initQuads() {
|
||||||
Vec3d diff = new Vec3d(Direction.SOUTH.getDirectionVec());
|
Vec3d diff = new Vec3d(Direction.SOUTH.getDirectionVec());
|
||||||
Vec3d extension = diff.normalize()
|
Vec3d extension = diff.normalize()
|
||||||
|
|
|
@ -29,6 +29,10 @@ public class MountedContraption extends Contraption {
|
||||||
|
|
||||||
public CartMovementMode rotationMode;
|
public CartMovementMode rotationMode;
|
||||||
|
|
||||||
|
public MountedContraption() {
|
||||||
|
rotationMode = CartMovementMode.ROTATE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AllContraptionTypes getType() {
|
protected AllContraptionTypes getType() {
|
||||||
return AllContraptionTypes.MOUNTED;
|
return AllContraptionTypes.MOUNTED;
|
||||||
|
@ -47,9 +51,8 @@ public class MountedContraption extends Contraption {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Axis axis = state.get(RAIL_SHAPE) == RailShape.EAST_WEST ? Axis.X : Axis.Z;
|
Axis axis = state.get(RAIL_SHAPE) == RailShape.EAST_WEST ? Axis.X : Axis.Z;
|
||||||
contraption.add(pos, Pair.of(new BlockInfo(pos,
|
contraption.add(pos, Pair.of(new BlockInfo(pos, AllBlocks.MINECART_ANCHOR.getDefaultState()
|
||||||
AllBlocks.MINECART_ANCHOR.getDefaultState().with(BlockStateProperties.HORIZONTAL_AXIS, axis),
|
.with(BlockStateProperties.HORIZONTAL_AXIS, axis), null), null));
|
||||||
null), null));
|
|
||||||
contraption.removeBlocksFromWorld(world, BlockPos.ZERO);
|
contraption.removeBlocksFromWorld(world, BlockPos.ZERO);
|
||||||
contraption.initActors(world);
|
contraption.initActors(world);
|
||||||
contraption.expandBoundsAroundAxis(Axis.Y);
|
contraption.expandBoundsAroundAxis(Axis.Y);
|
||||||
|
|
|
@ -16,6 +16,9 @@ import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
public class ExtendoGripItemRenderer extends CustomRenderedItemModelRenderer<ExtendoGripModel> {
|
public class ExtendoGripItemRenderer extends CustomRenderedItemModelRenderer<ExtendoGripModel> {
|
||||||
|
|
||||||
|
private static final Vec3d rotationOffset = new Vec3d(0, 1 / 2f, 1 / 2f);
|
||||||
|
private static final Vec3d cogRotationOffset = new Vec3d(0, 1 / 16f, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void render(ItemStack stack, ExtendoGripModel model, PartialItemModelRenderer renderer, MatrixStack ms,
|
protected void render(ItemStack stack, ExtendoGripModel model, PartialItemModelRenderer renderer, MatrixStack ms,
|
||||||
IRenderTypeBuffer buffer, int light, int overlay) {
|
IRenderTypeBuffer buffer, int light, int overlay) {
|
||||||
|
@ -30,8 +33,6 @@ public class ExtendoGripItemRenderer extends CustomRenderedItemModelRenderer<Ext
|
||||||
ExtendoGripRenderHandler.mainHandAnimation);
|
ExtendoGripRenderHandler.mainHandAnimation);
|
||||||
|
|
||||||
animation = animation * animation * animation;
|
animation = animation * animation * animation;
|
||||||
|
|
||||||
Vec3d rotationOffset = new Vec3d(0, 1 / 2f, 1 / 2f);
|
|
||||||
float extensionAngle = MathHelper.lerp(animation, 24f, 156f);
|
float extensionAngle = MathHelper.lerp(animation, 24f, 156f);
|
||||||
float halfAngle = extensionAngle / 2;
|
float halfAngle = extensionAngle / 2;
|
||||||
float oppositeAngle = 180 - extensionAngle;
|
float oppositeAngle = 180 - extensionAngle;
|
||||||
|
@ -101,11 +102,9 @@ public class ExtendoGripItemRenderer extends CustomRenderedItemModelRenderer<Ext
|
||||||
if (leftHand || rightHand)
|
if (leftHand || rightHand)
|
||||||
angle += 360 * animation;
|
angle += 360 * animation;
|
||||||
angle %= 360;
|
angle %= 360;
|
||||||
float offset = 1 / 16f;
|
stacker.translate(cogRotationOffset)
|
||||||
rotationOffset = new Vec3d(0, offset, 0);
|
|
||||||
stacker.translate(rotationOffset)
|
|
||||||
.rotateZ(angle)
|
.rotateZ(angle)
|
||||||
.translateBack(rotationOffset);
|
.translateBack(cogRotationOffset);
|
||||||
renderer.renderSolid(model.getPartial("cog"), light);
|
renderer.renderSolid(model.getPartial("cog"), light);
|
||||||
ms.pop();
|
ms.pop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,9 +69,8 @@ public class ExtendoGripRenderHandler {
|
||||||
mc.getTextureManager()
|
mc.getTextureManager()
|
||||||
.bindTexture(abstractclientplayerentity.getLocationSkin());
|
.bindTexture(abstractclientplayerentity.getLocationSkin());
|
||||||
|
|
||||||
float f = rightHand ? 1.0F : -1.0F;
|
float flip = rightHand ? 1.0F : -1.0F;
|
||||||
float swingProgress = event.getSwingProgress();
|
float swingProgress = event.getSwingProgress();
|
||||||
float f3 = 0.4F * MathHelper.sin(((float) Math.PI * 2F));
|
|
||||||
boolean blockItem = heldItem.getItem() instanceof BlockItem;
|
boolean blockItem = heldItem.getItem() instanceof BlockItem;
|
||||||
float equipProgress = blockItem ? 0 : event.getEquipProgress() / 4;
|
float equipProgress = blockItem ? 0 : event.getEquipProgress() / 4;
|
||||||
|
|
||||||
|
@ -85,16 +84,16 @@ public class ExtendoGripRenderHandler {
|
||||||
ExtendoGripRenderHandler.mainHandAnimation);
|
ExtendoGripRenderHandler.mainHandAnimation);
|
||||||
animation = animation * animation * animation;
|
animation = animation * animation * animation;
|
||||||
|
|
||||||
ms.translate(f * (0.64000005F - .1f), f3 + -0.4F + equipProgress * -0.6F, -0.71999997F + .3f);
|
ms.translate(flip * (0.64000005F - .1f), -0.4F + equipProgress * -0.6F, -0.71999997F + .3f);
|
||||||
|
|
||||||
ms.push();
|
ms.push();
|
||||||
msr.rotateY(f * 75.0F);
|
msr.rotateY(flip * 75.0F);
|
||||||
ms.translate(f * -1.0F, 3.6F, 3.5F);
|
ms.translate(flip * -1.0F, 3.6F, 3.5F);
|
||||||
msr.rotateZ(f * 120)
|
msr.rotateZ(flip * 120)
|
||||||
.rotateX(200)
|
.rotateX(200)
|
||||||
.rotateY(f * -135.0F);
|
.rotateY(flip * -135.0F);
|
||||||
ms.translate(f * 5.6F, 0.0F, 0.0F);
|
ms.translate(flip * 5.6F, 0.0F, 0.0F);
|
||||||
msr.rotateY(f * 40.0F);
|
msr.rotateY(flip * 40.0F);
|
||||||
ms.translate(0.05f, -0.3f, -0.3f);
|
ms.translate(0.05f, -0.3f, -0.3f);
|
||||||
|
|
||||||
PlayerRenderer playerrenderer = (PlayerRenderer) mc.getRenderManager()
|
PlayerRenderer playerrenderer = (PlayerRenderer) mc.getRenderManager()
|
||||||
|
@ -107,7 +106,7 @@ public class ExtendoGripRenderHandler {
|
||||||
|
|
||||||
// Render gun
|
// Render gun
|
||||||
ms.push();
|
ms.push();
|
||||||
ms.translate(f * -0.1f, 0, -0.3f);
|
ms.translate(flip * -0.1f, 0, -0.3f);
|
||||||
FirstPersonRenderer firstPersonRenderer = mc.getFirstPersonRenderer();
|
FirstPersonRenderer firstPersonRenderer = mc.getFirstPersonRenderer();
|
||||||
TransformType transform =
|
TransformType transform =
|
||||||
rightHand ? TransformType.FIRST_PERSON_RIGHT_HAND : TransformType.FIRST_PERSON_LEFT_HAND;
|
rightHand ? TransformType.FIRST_PERSON_RIGHT_HAND : TransformType.FIRST_PERSON_LEFT_HAND;
|
||||||
|
@ -117,7 +116,7 @@ public class ExtendoGripRenderHandler {
|
||||||
if (!notInOffhand) {
|
if (!notInOffhand) {
|
||||||
ForgeHooksClient.handleCameraTransforms(ms, mc.getItemRenderer()
|
ForgeHooksClient.handleCameraTransforms(ms, mc.getItemRenderer()
|
||||||
.getItemModelWithOverrides(offhandItem, null, null), transform, false);
|
.getItemModelWithOverrides(offhandItem, null, null), transform, false);
|
||||||
ms.translate(f * -.05f, .15f, -1.2f);
|
ms.translate(flip * -.05f, .15f, -1.2f);
|
||||||
ms.translate(0, 0, -animation * 2.25f);
|
ms.translate(0, 0, -animation * 2.25f);
|
||||||
if (blockItem && mc.getItemRenderer()
|
if (blockItem && mc.getItemRenderer()
|
||||||
.getItemModelWithOverrides(heldItem, null, null)
|
.getItemModelWithOverrides(heldItem, null, null)
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity;
|
||||||
|
import com.simibubi.create.content.contraptions.relays.belt.transport.BeltInventory;
|
||||||
import com.simibubi.create.content.logistics.block.AttachedLogisticalBlock;
|
import com.simibubi.create.content.logistics.block.AttachedLogisticalBlock;
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
|
@ -102,7 +103,10 @@ public class ExtractorTileEntity extends SmartTileEntity {
|
||||||
return false;
|
return false;
|
||||||
BeltTileEntity controller = belt.getControllerTE();
|
BeltTileEntity controller = belt.getControllerTE();
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
if (!controller.getInventory().canInsertFrom(belt.index, Direction.UP))
|
BeltInventory inventory = controller.getInventory();
|
||||||
|
if (inventory == null)
|
||||||
|
return false;
|
||||||
|
if (!inventory.canInsertFrom(belt.index, Direction.UP))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import net.minecraft.entity.item.ItemFrameEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.fluid.IFluidState;
|
import net.minecraft.fluid.IFluidState;
|
||||||
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -100,8 +101,12 @@ public class SchematicWorld extends WrappedWorld {
|
||||||
|
|
||||||
if (pos.getY() - bounds.minY == -1 && !renderMode)
|
if (pos.getY() - bounds.minY == -1 && !renderMode)
|
||||||
return Blocks.GRASS_BLOCK.getDefaultState();
|
return Blocks.GRASS_BLOCK.getDefaultState();
|
||||||
if (getBounds().isVecInside(pos) && blocks.containsKey(pos))
|
if (getBounds().isVecInside(pos) && blocks.containsKey(pos)) {
|
||||||
return blocks.get(pos);
|
BlockState blockState = blocks.get(pos);
|
||||||
|
if (blockState.has(BlockStateProperties.LIT))
|
||||||
|
blockState = blockState.with(BlockStateProperties.LIT, false);
|
||||||
|
return blockState;
|
||||||
|
}
|
||||||
return Blocks.AIR.getDefaultState();
|
return Blocks.AIR.getDefaultState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"textures": {
|
"textures": {
|
||||||
"3": "create:block/mechanical_press_pole",
|
"3": "create:block/mechanical_press_pole",
|
||||||
"4": "create:item/extendo_grip",
|
"4": "create:item/extendo_grip",
|
||||||
"particle": "texture"
|
"particle": "#4"
|
||||||
},
|
},
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue