Improve glue behavior. Glue can no longer place on torch or so on

This commit is contained in:
Snownee 2020-05-16 01:49:32 +08:00
parent 2a9795f411
commit 1578a2ac68
2 changed files with 6 additions and 3 deletions

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.ItemUseType;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
@ -164,11 +165,13 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
}
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))
return false;
if (BlockMovementTraits.notSupportive(world.getBlockState(pos), direction)) {
if (BlockMovementTraits.notSupportive(state, direction))
return false;
}
return true;
}

View file

@ -83,7 +83,7 @@ public class SuperGlueRenderer extends EntityRenderer<SuperGlueEntity> {
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());
return SuperGlueEntity.isValidFace(entity.world, pos2, entity.getFacingDirection()) != SuperGlueEntity.isValidFace(entity.world, pos, entity.getFacingDirection().getOpposite());
}
private void initQuads() {