mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-24 22:16:38 +01:00
commit
5e3b3bf3e1
5 changed files with 44 additions and 8 deletions
|
@ -497,13 +497,16 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
|||
}
|
||||
|
||||
public void disassemble() {
|
||||
if (!isAlive()) {
|
||||
return;
|
||||
}
|
||||
if (getContraption() != null) {
|
||||
remove();
|
||||
BlockPos offset = new BlockPos(getAnchorVec().add(.5, .5, .5));
|
||||
Vec3d rotation = new Vec3d(getRoll(1), getYaw(1), getPitch(1));
|
||||
getContraption().addBlocksToWorld(world, offset, rotation);
|
||||
preventMovedEntitiesFromGettingStuck();
|
||||
}
|
||||
remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -82,7 +82,7 @@ public class DeployerHandler {
|
|||
|
||||
static boolean shouldActivate(ItemStack held, World world, BlockPos targetPos) {
|
||||
if (held.getItem() instanceof BlockItem)
|
||||
if (!world.getBlockState(targetPos).getMaterial().isReplaceable())
|
||||
if (world.getBlockState(targetPos).getBlock() == ((BlockItem) held.getItem()).getBlock())
|
||||
return false;
|
||||
|
||||
if (held.getItem() instanceof BucketItem) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.simibubi.create.modules.logistics.block.extractor;
|
||||
|
||||
import com.simibubi.create.foundation.item.ItemHelper;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import com.simibubi.create.modules.contraptions.components.contraptions.MovementBehaviour;
|
||||
import com.simibubi.create.modules.contraptions.components.contraptions.MovementContext;
|
||||
import com.simibubi.create.modules.logistics.block.AttachedLogisticalBlock;
|
||||
|
@ -35,18 +34,18 @@ public class ExtractorMovementBehaviour extends MovementBehaviour {
|
|||
ItemStack filter = getFilter(context);
|
||||
int amount = getFilterAmount(context);
|
||||
ItemStack dropped = ItemHelper.extract(context.contraption.inventory,
|
||||
stack -> FilterItem.test(context.world, stack, filter), amount == 0 ? -1 : amount, false);
|
||||
stack -> FilterItem.test(context.world, stack, filter), amount == 0 ? 64 : amount, false);
|
||||
|
||||
if (dropped.isEmpty())
|
||||
return;
|
||||
if (world.isRemote)
|
||||
return;
|
||||
|
||||
Vec3d entityPos = VecHelper.getCenterOf(pos).add(0, -0.5f, 0);
|
||||
Vec3d entityPos = context.position;
|
||||
Entity entityIn = null;
|
||||
Direction facing = AttachedLogisticalBlock.getBlockFacing(context.state);
|
||||
if (facing == Direction.DOWN)
|
||||
entityPos = entityPos.add(0, .5, 0);
|
||||
if (facing != Direction.DOWN)
|
||||
entityPos = entityPos.add(0, -0.5f, 0);
|
||||
|
||||
entityIn = new ItemEntity(world, entityPos.x, entityPos.y, entityPos.z, dropped);
|
||||
entityIn.setMotion(Vec3d.ZERO);
|
||||
|
|
|
@ -7,6 +7,9 @@ import java.util.List;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.SeaPickleBlock;
|
||||
import net.minecraft.block.SnowBlock;
|
||||
import net.minecraft.block.TurtleEggBlock;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.item.ArmorStandEntity;
|
||||
|
@ -56,6 +59,12 @@ public class ItemRequirement {
|
|||
// double slab needs two items
|
||||
if (state.has(BlockStateProperties.SLAB_TYPE) && state.get(BlockStateProperties.SLAB_TYPE) == SlabType.DOUBLE)
|
||||
return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(item, 2)));
|
||||
if (block instanceof TurtleEggBlock)
|
||||
return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(item, state.get(TurtleEggBlock.EGGS).intValue())));
|
||||
if (block instanceof SeaPickleBlock)
|
||||
return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(item, state.get(SeaPickleBlock.PICKLES).intValue())));
|
||||
if (block instanceof SnowBlock)
|
||||
return new ItemRequirement(ItemUseType.CONSUME, Arrays.asList(new ItemStack(item, state.get(SnowBlock.LAYERS).intValue())));
|
||||
|
||||
return item == Items.AIR ? INVALID : new ItemRequirement(ItemUseType.CONSUME, item);
|
||||
}
|
||||
|
|
|
@ -8,17 +8,24 @@ import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Part;
|
|||
import com.simibubi.create.modules.contraptions.relays.belt.item.BeltConnectorItem;
|
||||
import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
|
||||
public abstract class LaunchedItem {
|
||||
|
||||
|
@ -108,13 +115,31 @@ public abstract class LaunchedItem {
|
|||
void place(World world) {
|
||||
// Piston
|
||||
if (state.has(BlockStateProperties.EXTENDED))
|
||||
state = state.with(BlockStateProperties.EXTENDED, false);
|
||||
state = state.with(BlockStateProperties.EXTENDED, Boolean.FALSE);
|
||||
if (state.has(BlockStateProperties.WATERLOGGED))
|
||||
state = state.with(BlockStateProperties.WATERLOGGED, Boolean.FALSE);
|
||||
|
||||
if (AllBlocks.BELT.typeOf(state)) {
|
||||
world.setBlockState(target, state, 2);
|
||||
return;
|
||||
}
|
||||
else if (state.getBlock() == Blocks.COMPOSTER)
|
||||
state = Blocks.COMPOSTER.getDefaultState();
|
||||
else if (state.getBlock() != Blocks.SEA_PICKLE && state.getBlock() instanceof IPlantable)
|
||||
state = ((IPlantable) state.getBlock()).getPlant(world, target);
|
||||
|
||||
if (world.dimension.doesWaterVaporize() && state.getFluidState().getFluid().isIn(FluidTags.WATER)) {
|
||||
int i = target.getX();
|
||||
int j = target.getY();
|
||||
int k = target.getZ();
|
||||
world.playSound(null, target, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||
|
||||
for (int l = 0; l < 8; ++l) {
|
||||
world.addParticle(ParticleTypes.LARGE_SMOKE, i + Math.random(), j + Math.random(), k + Math.random(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
Block.spawnDrops(state, world, target);
|
||||
return;
|
||||
}
|
||||
world.setBlockState(target, state, 18);
|
||||
state.getBlock().onBlockPlacedBy(world, target, state, null, stack);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue