Non-pegasus players can now hit blocks behind clouds

This commit is contained in:
Sollace 2019-01-10 10:23:11 +02:00
parent 72aad10845
commit 48509a3b0a
2 changed files with 28 additions and 0 deletions

View file

@ -15,12 +15,15 @@ import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
@ -188,6 +191,17 @@ public class BlockCloud extends Block implements ICloudBlock, ITillable {
return (CloudType)blockState.getValue(VARIANT);
}
@Deprecated
@Override
public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end) {
if (worldIn.isRemote) {
if (!getCanInteract(blockState, Minecraft.getMinecraft().player)) {
return null;
}
}
return super.collisionRayTrace(blockState, worldIn, pos, start, end);
}
@Override
public boolean canBeTilled(ItemStack hoe, EntityPlayer player, World world, IBlockState state, BlockPos pos) {
return PlayerSpeciesList.instance().getPlayer(player).getPlayerSpecies().canInteractWithClouds()

View file

@ -9,12 +9,15 @@ import com.minelittlepony.unicopia.UBlocks;
import net.minecraft.block.SoundType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -99,6 +102,17 @@ public class BlockCloudFarm extends UFarmland implements ICloudBlock {
return getCanInteract(state, entity) && super.canEntityDestroy(state, world, pos, entity);
}
@Deprecated
@Override
public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end) {
if (worldIn.isRemote) {
if (!getCanInteract(blockState, Minecraft.getMinecraft().player)) {
return null;
}
}
return super.collisionRayTrace(blockState, worldIn, pos, start, end);
}
@Deprecated
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entity, boolean p_185477_7_) {
if (getCanInteract(state, entity)) {