mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-16 06:51:56 +01:00
Fix super glue behavior. Fix super glue can stay between two unmovable blocks
This commit is contained in:
parent
8d4e6895bc
commit
463bf0b641
2 changed files with 12 additions and 7 deletions
|
@ -8,6 +8,7 @@ import com.simibubi.create.AllEntities;
|
|||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllPackets;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
import com.simibubi.create.modules.contraptions.components.contraptions.BlockMovementTraits;
|
||||
import com.simibubi.create.modules.schematics.ISpecialEntityItemRequirement;
|
||||
import com.simibubi.create.modules.schematics.ItemRequirement;
|
||||
import com.simibubi.create.modules.schematics.ItemRequirement.ItemUseType;
|
||||
|
@ -157,11 +158,20 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
BlockPos pos2 = hangingPosition.offset(getFacingDirection().getOpposite());
|
||||
if (!world.isAreaLoaded(pos, 0) || !world.isAreaLoaded(pos2, 0))
|
||||
return true;
|
||||
if (world.isAirBlock(pos) && world.isAirBlock(pos2))
|
||||
if (!isValidFace(world, pos2, getFacingDirection()) && !isValidFace(world, pos, getFacingDirection().getOpposite()))
|
||||
return false;
|
||||
return world.getEntitiesInAABBexcluding(this, getBoundingBox(), e -> e instanceof SuperGlueEntity).isEmpty();
|
||||
}
|
||||
|
||||
public static boolean isValidFace(World world, BlockPos pos, Direction direction) {
|
||||
if (!BlockMovementTraits.movementNecessary(world, pos))
|
||||
return false;
|
||||
if (BlockMovementTraits.notSupportive(world.getBlockState(pos), direction)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith() {
|
||||
return true;
|
||||
|
@ -236,11 +246,6 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
return Math.max(light, light2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyEntityCollision(Entity entityIn) {
|
||||
super.applyEntityCollision(entityIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processInitialInteract(PlayerEntity player, Hand hand) {
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
|
||||
|
|
|
@ -83,7 +83,7 @@ public class SuperGlueRenderer extends EntityRenderer<SuperGlueEntity> {
|
|||
return false;
|
||||
BlockPos pos = entity.hangingPosition;
|
||||
BlockPos pos2 = pos.offset(entity.getFacingDirection().getOpposite());
|
||||
return entity.world.isAirBlock(pos) != entity.world.isAirBlock(pos2);
|
||||
return !SuperGlueEntity.isValidFace(entity.world, pos2, entity.getFacingDirection()) || !SuperGlueEntity.isValidFace(entity.world, pos, entity.getFacingDirection().getOpposite());
|
||||
}
|
||||
|
||||
private void initQuads() {
|
||||
|
|
Loading…
Reference in a new issue