No pushing

- Fixed Schematicannon asking for "Air" items
- Made several blocks immovable by piston
This commit is contained in:
simibubi 2019-11-07 12:00:27 +01:00
parent 44dc7e054b
commit 7f0ba8211d
9 changed files with 51 additions and 23 deletions

View file

@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = 'mc1.14.4_v0.1.1a'
version = 'mc1.14.4_v0.1.1b'
group = 'com.simibubi.create'
archivesBaseName = 'create'

View file

@ -28,7 +28,7 @@ public class Create {
public static final String ID = "create";
public static final String NAME = "Create";
public static final String VERSION = "0.1.1a";
public static final String VERSION = "0.1.1b";
public static Logger logger = LogManager.getLogger();
public static ItemGroup creativeTab = new CreateItemGroup();

View file

@ -17,6 +17,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.block.material.PushReaction;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.BlockItemUseContext;
@ -148,5 +149,10 @@ public class BeltFunnelBlock extends HorizontalBlock implements IBeltAttachment,
return true;
}
@Override
public PushReaction getPushReaction(BlockState state) {
return PushReaction.BLOCK;
}
}

View file

@ -9,6 +9,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.block.material.PushReaction;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.BooleanProperty;
@ -35,7 +36,7 @@ public class ExtractorBlock extends HorizontalBlock implements IBlockWithFilter
SHAPE_SOUTH = makeCuboidShape(4, 2, 11, 12, 10, 17), SHAPE_WEST = makeCuboidShape(-1, 2, 4, 5, 10, 12),
SHAPE_EAST = makeCuboidShape(11, 2, 4, 17, 10, 12);
private static final List<Vec3d> itemPositions = new ArrayList<>(Direction.values().length);
public ExtractorBlock() {
super(Properties.from(Blocks.ANDESITE));
setDefaultState(getDefaultState().with(POWERED, false));
@ -47,28 +48,28 @@ public class ExtractorBlock extends HorizontalBlock implements IBlockWithFilter
builder.add(HORIZONTAL_FACING, POWERED);
super.fillStateContainer(builder);
}
@Override
public boolean showsCount() {
return true;
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new ExtractorTileEntity();
}
@Override
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn,
BlockRayTraceResult hit) {
return handleActivatedFilterSlots(state, worldIn, pos, player, handIn, hit);
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
BlockState state = getDefaultState();
@ -86,7 +87,7 @@ public class ExtractorBlock extends HorizontalBlock implements IBlockWithFilter
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
updateObservedInventory(state, worldIn, pos);
}
@Override
public void onNeighborChange(BlockState state, IWorldReader world, BlockPos pos, BlockPos neighbor) {
if (world.isRemote())
@ -95,18 +96,18 @@ public class ExtractorBlock extends HorizontalBlock implements IBlockWithFilter
return;
updateObservedInventory(state, world, pos);
}
private void updateObservedInventory(BlockState state, IWorldReader world, BlockPos pos) {
IExtractor extractor = (IExtractor) world.getTileEntity(pos);
if (extractor == null)
return;
extractor.neighborChanged();
}
private boolean isObserving(BlockState state, BlockPos pos, BlockPos observing) {
return observing.equals(pos.offset(state.get(HORIZONTAL_FACING)));
}
@Override
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) {
@ -159,7 +160,7 @@ public class ExtractorBlock extends HorizontalBlock implements IBlockWithFilter
itemPositions.add(position);
}
}
@Override
public float getItemHitboxScale() {
return 1.76f / 16f;
@ -176,4 +177,9 @@ public class ExtractorBlock extends HorizontalBlock implements IBlockWithFilter
return state.get(HORIZONTAL_FACING).getOpposite();
}
@Override
public PushReaction getPushReaction(BlockState state) {
return PushReaction.BLOCK;
}
}

View file

@ -35,7 +35,9 @@ public interface IInventoryManipulator {
if (!invState.hasTileEntity())
return false;
TileEntity invTE = world.getTileEntity(invPos);
if (invTE == null)
return false;
LazyOptional<IItemHandler> inventory = invTE.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY);
setInventory(inventory);
if (inventory.isPresent()) {

View file

@ -11,6 +11,7 @@ import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.material.PushReaction;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.BooleanProperty;
@ -238,4 +239,9 @@ public class RedstoneBridgeBlock extends ProperDirectionalBlock implements IBloc
return state.get(FACING);
}
@Override
public PushReaction getPushReaction(BlockState state) {
return PushReaction.BLOCK;
}
}

View file

@ -6,6 +6,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.block.material.PushReaction;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.IntegerProperty;
@ -136,5 +137,10 @@ public class StockswitchBlock extends HorizontalBlock {
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new StockswitchTileEntity();
}
@Override
public PushReaction getPushReaction(BlockState state) {
return PushReaction.BLOCK;
}
}

View file

@ -23,6 +23,7 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT;
@ -56,7 +57,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
public static final int NEIGHBOUR_CHECKING = 100;
public static final int MAX_ANCHOR_DISTANCE = 256;
public enum State {
STOPPED, PAUSED, RUNNING;
}
@ -169,13 +170,13 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
public AxisAlignedBB getRenderBoundingBox() {
return INFINITE_EXTENT_AABB;
}
@Override
@OnlyIn(Dist.CLIENT)
public double getMaxRenderDistanceSquared() {
return super.getMaxRenderDistanceSquared() * 16;
}
public SchematicannonTileEntity(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
attachedInventories = new LinkedList<>();
@ -454,15 +455,15 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
}
BlockState blockState = blockReader.getBlockState(target);
if (!shouldPlace(target, blockState)) {
ItemStack requiredItem = getItemForBlock(blockState);
if (!shouldPlace(target, blockState) || requiredItem.isEmpty()) {
statusMsg = "searching";
blockSkipped = true;
return;
}
// Find Item
ItemStack requiredItem = getItemForBlock(blockState);
// Find item
if (blockState.has(BlockStateProperties.SLAB_TYPE)
&& blockState.get(BlockStateProperties.SLAB_TYPE) == SlabType.DOUBLE)
requiredItem.setCount(2);
@ -547,7 +548,8 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
}
protected ItemStack getItemForBlock(BlockState blockState) {
return new ItemStack(BlockItem.BLOCK_TO_ITEM.getOrDefault(blockState.getBlock(), Items.AIR));
Item item = BlockItem.BLOCK_TO_ITEM.getOrDefault(blockState.getBlock(), Items.AIR);
return item == Items.AIR ? ItemStack.EMPTY : new ItemStack(item);
}
protected boolean findItemInAttachedInventories(ItemStack requiredItem) {

View file

@ -4,7 +4,7 @@ loaderVersion="[28,)"
[[mods]]
modId="create"
version="0.1.1a"
version="0.1.1b"
displayName="Create"
#updateJSONURL=""
authors="simibubi"