Items dropped by a pegasus onto cloud blocks should not fall through. This also has some... interesting behavioural quirks.

This commit is contained in:
Sollace 2019-01-27 17:35:39 +02:00
parent a520e799dc
commit 3d02ee6856
2 changed files with 13 additions and 1 deletions

View file

@ -66,6 +66,10 @@ public enum CloudType implements IStringSerializable {
} }
public boolean canInteract(Entity e) { public boolean canInteract(Entity e) {
if (e == null) {
return false;
}
if (this == ENCHANTED) { if (this == ENCHANTED) {
return true; return true;
} }

View file

@ -8,6 +8,7 @@ import net.minecraft.block.BlockTorch;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
@ -54,7 +55,14 @@ public interface ICloudBlock {
} }
default boolean getCanInteract(IBlockState state, Entity e) { default boolean getCanInteract(IBlockState state, Entity e) {
return getCloudMaterialType(state).canInteract(e); if (getCloudMaterialType(state).canInteract(e)) {
if (e instanceof EntityItem) {
e.setNoGravity(true);
}
return true;
}
return false;
} }
default boolean isDense(IBlockState blockState) { default boolean isDense(IBlockState blockState) {