mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 15:36:43 +01:00
Sunday's bugs
- Fixed Girder Encased Shafts getting ignored by the Schematicannon - Fixed Belts not offering a valid item handler until their first tick - NPE Guard in Funnel-Arm interaction
This commit is contained in:
parent
f07574bff1
commit
405b7cbc36
3 changed files with 18 additions and 5 deletions
|
@ -183,6 +183,8 @@ public class BeltTileEntity extends KineticTileEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
|
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
|
||||||
|
if (!isRemoved() && !itemHandler.isPresent())
|
||||||
|
initializeItemHandler();
|
||||||
if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||||
if (side == Direction.UP || BeltBlock.canAccessFromSide(side, getBlockState())) {
|
if (side == Direction.UP || BeltBlock.canAccessFromSide(side, getBlockState())) {
|
||||||
return itemHandler.cast();
|
return itemHandler.cast();
|
||||||
|
|
|
@ -8,6 +8,8 @@ import com.simibubi.create.AllTileEntities;
|
||||||
import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock;
|
import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||||
|
import com.simibubi.create.content.schematics.ISpecialBlockItemRequirement;
|
||||||
|
import com.simibubi.create.content.schematics.ItemRequirement;
|
||||||
import com.simibubi.create.foundation.block.ITE;
|
import com.simibubi.create.foundation.block.ITE;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -22,6 +24,7 @@ import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
|
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.StateDefinition.Builder;
|
import net.minecraft.world.level.block.state.StateDefinition.Builder;
|
||||||
|
@ -34,7 +37,7 @@ import net.minecraft.world.phys.shapes.Shapes;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
|
|
||||||
public class GirderEncasedShaftBlock extends HorizontalAxisKineticBlock
|
public class GirderEncasedShaftBlock extends HorizontalAxisKineticBlock
|
||||||
implements ITE<KineticTileEntity>, SimpleWaterloggedBlock, IWrenchable {
|
implements ITE<KineticTileEntity>, SimpleWaterloggedBlock, IWrenchable, ISpecialBlockItemRequirement {
|
||||||
|
|
||||||
public static final BooleanProperty TOP = GirderBlock.TOP;
|
public static final BooleanProperty TOP = GirderBlock.TOP;
|
||||||
public static final BooleanProperty BOTTOM = GirderBlock.BOTTOM;
|
public static final BooleanProperty BOTTOM = GirderBlock.BOTTOM;
|
||||||
|
@ -123,4 +126,10 @@ public class GirderEncasedShaftBlock extends HorizontalAxisKineticBlock
|
||||||
return state.setValue(WATERLOGGED, Boolean.valueOf(ifluidstate.getType() == Fluids.WATER));
|
return state.setValue(WATERLOGGED, Boolean.valueOf(ifluidstate.getType() == Fluids.WATER));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemRequirement getRequiredItems(BlockState state, BlockEntity te) {
|
||||||
|
return ItemRequirement.of(AllBlocks.SHAFT.getDefaultState(), te)
|
||||||
|
.union(ItemRequirement.of(AllBlocks.METAL_GIRDER.getDefaultState(), te));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
import net.minecraft.core.Vec3i;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.Containers;
|
import net.minecraft.world.Containers;
|
||||||
import net.minecraft.world.InteractionResultHolder;
|
import net.minecraft.world.InteractionResultHolder;
|
||||||
|
@ -501,16 +502,17 @@ public class AllArmInteractionPointTypes {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Vec3 getInteractionPositionVector() {
|
protected Vec3 getInteractionPositionVector() {
|
||||||
|
Direction funnelFacing = FunnelBlock.getFunnelFacing(cachedState);
|
||||||
|
Vec3i normal = funnelFacing != null ? funnelFacing.getNormal() : Vec3i.ZERO;
|
||||||
return VecHelper.getCenterOf(pos)
|
return VecHelper.getCenterOf(pos)
|
||||||
.add(Vec3.atLowerCornerOf(FunnelBlock.getFunnelFacing(cachedState)
|
.add(Vec3.atLowerCornerOf(normal)
|
||||||
.getNormal())
|
|
||||||
.scale(-.15f));
|
.scale(-.15f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Direction getInteractionDirection() {
|
protected Direction getInteractionDirection() {
|
||||||
return FunnelBlock.getFunnelFacing(cachedState)
|
Direction funnelFacing = FunnelBlock.getFunnelFacing(cachedState);
|
||||||
.getOpposite();
|
return funnelFacing != null ? funnelFacing.getOpposite() : Direction.UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue