Merge branch 'master' into mc1.15/dev

This commit is contained in:
simibubi 2020-05-16 09:58:14 +02:00
commit 170f154b74
3 changed files with 24 additions and 12 deletions

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -519,16 +520,20 @@ public abstract class Contraption {
glueToRemove.forEach(SuperGlueEntity::remove); glueToRemove.forEach(SuperGlueEntity::remove);
for (boolean brittles : Iterate.trueAndFalse) { for (boolean brittles : Iterate.trueAndFalse) {
for (BlockInfo block : blocks.values()) { for (Iterator<BlockInfo> iterator = blocks.values().iterator(); iterator.hasNext();) {
BlockInfo block = iterator.next();
if (brittles != BlockMovementTraits.isBrittle(block.state)) if (brittles != BlockMovementTraits.isBrittle(block.state))
continue; continue;
BlockPos add = block.pos.add(anchor).add(offset); BlockPos add = block.pos.add(anchor).add(offset);
if (customRemoval.test(add, block.state)) if (customRemoval.test(add, block.state))
continue; continue;
Block blockIn = world.getBlockState(add).getBlock();
if (block.state.getBlock() != blockIn)
iterator.remove();
world.getWorld().removeTileEntity(add); world.getWorld().removeTileEntity(add);
int flags = 67; int flags = 67;
if (world.getBlockState(add).getBlock() instanceof DoorBlock) if (blockIn instanceof DoorBlock)
flags = flags | 32 | 16; flags = flags | 32 | 16;
world.setBlockState(add, Blocks.AIR.getDefaultState(), flags); world.setBlockState(add, Blocks.AIR.getDefaultState(), flags);
} }
@ -565,11 +570,15 @@ public abstract class Contraption {
state = state.with(SawBlock.RUNNING, false); state = state.with(SawBlock.RUNNING, false);
BlockState blockState = world.getBlockState(targetPos); BlockState blockState = world.getBlockState(targetPos);
if (blockState.getBlockHardness(world, targetPos) == -1) if (blockState.getBlockHardness(world, targetPos) == -1
continue; || (state.getCollisionShape(world, targetPos).isEmpty()
if (state.getCollisionShape(world, targetPos).isEmpty() && !blockState.getCollisionShape(world, targetPos).isEmpty())) {
&& !blockState.getCollisionShape(world, targetPos).isEmpty()) if (targetPos.getY() == 0)
targetPos = targetPos.up();
world.playEvent(2001, targetPos, Block.getStateId(state));
Block.spawnDrops(state, world, targetPos, null);
continue; continue;
}
world.destroyBlock(targetPos, true); world.destroyBlock(targetPos, true);
world.setBlockState(targetPos, state, 3 | BlockFlags.IS_MOVING); world.setBlockState(targetPos, state, 3 | BlockFlags.IS_MOVING);

View file

@ -13,6 +13,7 @@ import com.simibubi.create.modules.schematics.ISpecialEntityItemRequirement;
import com.simibubi.create.modules.schematics.ItemRequirement; import com.simibubi.create.modules.schematics.ItemRequirement;
import com.simibubi.create.modules.schematics.ItemRequirement.ItemUseType; import com.simibubi.create.modules.schematics.ItemRequirement.ItemUseType;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld; import net.minecraft.client.world.ClientWorld;
@ -161,11 +162,13 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
} }
public static boolean isValidFace(World world, BlockPos pos, Direction direction) { public static boolean isValidFace(World world, BlockPos pos, Direction direction) {
BlockState state = world.getBlockState(pos);
if (BlockMovementTraits.isBlockAttachedTowards(state, direction))
return true;
if (!BlockMovementTraits.movementNecessary(world, pos)) if (!BlockMovementTraits.movementNecessary(world, pos))
return false; return false;
if (BlockMovementTraits.notSupportive(world.getBlockState(pos), direction)) { if (BlockMovementTraits.notSupportive(state, direction))
return false; return false;
}
return true; return true;
} }

View file

@ -89,8 +89,8 @@ public class SuperGlueRenderer extends EntityRenderer<SuperGlueEntity> {
BlockPos pos = entity.hangingPosition; BlockPos pos = entity.hangingPosition;
BlockPos pos2 = pos.offset(entity.getFacingDirection() BlockPos pos2 = pos.offset(entity.getFacingDirection()
.getOpposite()); .getOpposite());
return !SuperGlueEntity.isValidFace(entity.world, pos2, entity.getFacingDirection()) return SuperGlueEntity.isValidFace(entity.world, pos2, entity.getFacingDirection()) != SuperGlueEntity
|| !SuperGlueEntity.isValidFace(entity.world, pos, entity.getFacingDirection() .isValidFace(entity.world, pos, entity.getFacingDirection()
.getOpposite()); .getOpposite());
} }