Another pass through

This commit is contained in:
Vincent Lee committed 2019-06-29 14:54:39 -07:00
1 parent bd5b395ee8
commit fc1dd61c53
66 files changed
+170 -296

No files matched your search

@@ -184,7 +184,7 @@ public class TileEntitySpecialFlower extends TileEntity implements ITickableTile
IFloatingFlower.IslandType oldType = floatingData.getIslandType();
super.onDataPacket(net, packet);
if(oldType != floatingData.getIslandType() && isFloating()) {
world.markBlockRangeForRenderUpdate(pos, pos);
world.markForRerender(pos);
}
}
@@ -232,7 +232,7 @@ public class TileEntitySpecialFlower extends TileEntity implements ITickableTile
/**
* Called when a player right clicks this sub tile.
*/
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction side, float hitX, float hitY, float hitZ) { return false; }
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction side, double hitX, double hitY, double hitZ) { return false; }
/**
* Called when this sub tile is added to the world.
@@ -28,6 +28,7 @@ import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.PlantType;
import net.minecraftforge.common.ToolType;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -64,7 +65,7 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
ItemStack held = player.getHeldItem(hand);
if(held.getItem() instanceof HoeItem && world.isAirBlock(pos.up())) {
held.damageItem(1, player);
held.damageItem(1, player, e -> e.sendBreakAnimation(hand));
world.setBlockState(pos, Blocks.FARMLAND.getDefaultState(), 1 | 2);
return true;
}
@@ -93,8 +94,8 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
@Override
public boolean canSustainPlant(@Nonnull BlockState state, @Nonnull IBlockReader world, BlockPos pos, @Nonnull Direction direction, IPlantable plantable) {
EnumPlantType type = plantable.getPlantType(world, pos.down());
return type == EnumPlantType.Plains || type == EnumPlantType.Beach || plantable instanceof StemBlock;
PlantType type = plantable.getPlantType(world, pos.down());
return type == PlantType.Plains || type == PlantType.Beach || plantable instanceof StemBlock;
}
@OnlyIn(Dist.CLIENT)
@@ -143,7 +143,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
tile.setWater(true);
world.updateComparatorOutputLevel(pos, this);
world.checkLight(pos);
world.getChunkProvider().getLightManager().checkBlock(pos);
}
return true;
@@ -154,7 +154,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
tile.setLava(true);
tile.setWater(false);
world.updateComparatorOutputLevel(pos, this);
world.checkLight(pos);
world.getChunkProvider().getLightManager().checkBlock(pos);
return true;
} else if(!stack.isEmpty() && stack.getItem() == Items.BUCKET && (tile.hasWater || tile.hasLava) && !Botania.gardenOfGlassLoaded) {
@@ -170,7 +170,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
tile.setLava(false);
else tile.setWater(false);
world.updateComparatorOutputLevel(pos, this);
world.checkLight(pos);
world.getChunkProvider().getLightManager().checkBlock(pos);
return true;
}
@@ -218,11 +218,6 @@ public class BlockAltar extends BlockMod implements ILexiconable {
.orElse(stack);
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
@@ -115,11 +115,6 @@ public class BlockAnimatedTorch extends BlockMod implements IWandable, IManaTrig
return BlockRenderType.ENTITYBLOCK_ANIMATED;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Nonnull
@Override
public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext ctx) {
@@ -96,11 +96,6 @@ public class BlockAvatar extends BlockMod implements ILexiconable {
return getDefaultState().with(BotaniaStateProps.CARDINALS, context.getPlacementHorizontalFacing().getOpposite());
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Nonnull
@Override
public BlockRenderType getRenderType(BlockState state) {
@@ -36,11 +36,6 @@ public class BlockBifrostPerm extends BlockMod implements ILexiconable {
super(builder);
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@OnlyIn(Dist.CLIENT)
@Override
public void animateTick(BlockState state, World world, BlockPos pos, Random rand) {
@@ -62,11 +62,6 @@ public abstract class BlockCamo extends BlockMod {
return false;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
@@ -50,11 +50,6 @@ public class BlockCocoon extends BlockMod implements ILexiconable {
return SHAPE;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Nonnull
@Override
public BlockRenderType getRenderType(BlockState state) {
@@ -62,8 +62,8 @@ public class BlockCraftyCrate extends BlockOpenCrate implements IWandHUD {
int xc = mc.mainWindow.getScaledWidth() / 2 + 20;
int yc = mc.mainWindow.getScaledHeight() / 2 - height / 2;
AbstractGui.drawRect(xc - 6, yc - 6, xc + width + 6, yc + height + 6, 0x22000000);
AbstractGui.drawRect(xc - 4, yc - 4, xc + width + 4, yc + height + 4, 0x22000000);
AbstractGui.fill(xc - 6, yc - 6, xc + width + 6, yc + height + 6, 0x22000000);
AbstractGui.fill(xc - 4, yc - 4, xc + width + 4, yc + height + 4, 0x22000000);
for(int i = 0; i < 3; i++)
for(int j = 0; j < 3; j++) {
@@ -75,7 +75,7 @@ public class BlockCraftyCrate extends BlockOpenCrate implements IWandHUD {
if(craft.getPattern() != CratePattern.NONE)
enabled = craft.getPattern().openSlots.get(index);
AbstractGui.drawRect(xp, yp, xp + 16, yp + 16, enabled ? 0x22FFFFFF : 0x22FF0000);
AbstractGui.fill(xp, yp, xp + 16, yp + 16, enabled ? 0x22FFFFFF : 0x22FF0000);
ItemStack item = craft.getItemHandler().getStackInSlot(index);
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
@@ -45,7 +45,7 @@ public class BlockFakeAir extends AirBlock {
}
@Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
if(shouldRemove(world, pos))
world.getPendingBlockTicks().scheduleTick(pos, this, tickRate(world));
}
@@ -12,6 +12,7 @@ package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.monster.BlazeEntity;
import net.minecraft.entity.player.PlayerEntity;
@@ -53,7 +54,7 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
world.setBlockState(pos, Blocks.AIR.getDefaultState());
world.setBlockState(pos.down(), Blocks.AIR.getDefaultState());
world.setBlockState(pos.down(2), Blocks.AIR.getDefaultState());
BlazeEntity blaze = new BlazeEntity(world);
BlazeEntity blaze = EntityType.BLAZE.create(world);
blaze.setLocationAndAngles(pos.getX() + 0.5D, pos.getY() - 1.95D, pos.getZ() + 0.5D, 0.0F, 0.0F);
blaze.deathLootTable = LOOT_TABLE;
blaze.onInitialSpawn(world, world.getDifficultyForLocation(pos), SpawnReason.EVENT, null, null);
@@ -137,7 +137,7 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
return ((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, side, hitX, hitY, hitZ) || super.onBlockActivated(state, world, pos, player, hand, hit);
return ((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, hit.getFace(), hit.getHitVec().x, hit.getHitVec().y, hit.getHitVec().z) || super.onBlockActivated(state, world, pos, player, hand, hit);
}
@Override
@@ -40,11 +40,6 @@ public class BlockForestEye extends BlockMod implements ILexiconable {
return SHAPE;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean hasComparatorInputOverride(BlockState state) {
return true;
@@ -127,11 +127,6 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
super.onReplaced(state, world, pos, newState, isMoving);
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Nonnull
@Override
public BlockRenderType getRenderType(BlockState state) {
@@ -68,7 +68,7 @@ public class BlockIncensePlate extends BlockMod implements ILexiconable {
} else if(!plateStack.isEmpty() && !plate.burning) {
if(!stack.isEmpty() && stack.getItem() == Items.FLINT_AND_STEEL) {
plate.ignite();
stack.damageItem(1, player);
stack.damageItem(1, player, e -> e.sendBreakAnimation(hand));
did = true;
} else {
ItemHandlerHelper.giveItemToPlayer(player, plateStack);
@@ -57,12 +57,7 @@ public class BlockLightLauncher extends BlockMod implements ILexiconable {
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0|| world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.get(BotaniaStateProps.POWERED);
@@ -71,7 +71,7 @@ public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable
}
@Override
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) {
if(!worldIn.isRemote && variant == LuminizerVariant.TOGGLE) {
if(state.get(BotaniaStateProps.POWERED) && !worldIn.isBlockPowered(pos))
worldIn.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false));
@@ -96,11 +96,6 @@ public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable
&& state.get(BotaniaStateProps.POWERED) ? 15 : 0;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Nonnull
@Override
public BlockRenderType getRenderType(BlockState state) {
@@ -36,7 +36,7 @@ public class BlockManaBomb extends BlockMod implements IManaTrigger, ILexiconabl
public void onBurstCollision(IManaBurst burst, World world, BlockPos pos) {
if(!burst.isFake() && !world.isRemote) {
world.playEvent(2001, pos, Block.getStateId(getDefaultState()));
world.removeBlock(pos);
world.removeBlock(pos, false);
EntityManaStorm storm = new EntityManaStorm(world);
storm.setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
world.addEntity(storm);
@@ -67,7 +67,7 @@ public class BlockModDoubleFlower extends TallFlowerBlock implements ILexiconabl
List<ItemStack> ret = new ArrayList<>();
ret.add(new ItemStack(this));
BlockPos other = world.getBlockState(pos).get(HALF) == DoubleBlockHalf.UPPER ? pos.down() : pos.up();
world.removeBlock(pos);
world.removeBlock(pos, false);
world.destroyBlock(other, false);
return ret;
}
@@ -23,6 +23,8 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.DyeColor;
import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect;
import net.minecraft.potion.Effects;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
@@ -50,10 +52,15 @@ import java.util.Random;
public class BlockModFlower extends FlowerBlock implements ILexiconable, IGrowable {
public final DyeColor color;
protected BlockModFlower(DyeColor color, Properties builder) {
super(builder);
super(effectForFlower(color), 4, builder);
this.color = color;
}
private static Effect effectForFlower(DyeColor color) {
// todo 1.14
return Effects.REGENERATION;
}
@OnlyIn(Dist.CLIENT)
@Override
public void animateTick(BlockState state, World world, BlockPos pos, Random rand) {
@@ -29,6 +29,7 @@ import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ServerWorld;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.storage.WorldSavedData;
@@ -120,7 +121,7 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
world.playSound(null, pos, ModSounds.ding, SoundCategory.BLOCKS, 0.5F, 1F);
} else {
spawnAsEntity(world, pos, new ItemStack(this));
world.removeBlock(pos);
world.removeBlock(pos, false);
world.playEvent(2001, pos, Block.getStateId(getDefaultState()));
}
@@ -143,8 +144,8 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
private static final String ID = "PistonRelayPairs";
public WorldData(String id) {
super(id);
public WorldData() {
super(ID);
}
@Override
@@ -174,12 +175,11 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
}
public static WorldData get(World world) {
WorldData data = world.getSavedData(DimensionType.OVERWORLD, WorldData::new, ID);
WorldData data = ((ServerWorld) world).getSavedData().get(WorldData::new, ID);
if (data == null) {
data = new WorldData(ID);
data = new WorldData();
data.markDirty();
world.setSavedData(DimensionType.OVERWORLD, ID, data);
((ServerWorld) world).getSavedData().set(data);
}
return data;
}
@@ -25,6 +25,9 @@ import net.minecraft.util.Direction;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IBlockReader;
@@ -66,13 +69,20 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable,
this.variant = v;
}
/* todo 1.13
@Nonnull
@Override
public void addCollisionBoxToList(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull AxisAlignedBB par5AxisAlignedBB, @Nonnull List<AxisAlignedBB> stacks, Entity par7Entity, boolean isActualState) {
if(variant == Variant.INFRANGIBLE || variant == Variant.ABSTRUSE && par7Entity != null && par7Entity.posY > pos.getY() + 0.9 && (!(par7Entity instanceof PlayerEntity) || !par7Entity.isSneaking()))
super.addCollisionBoxToList(state, world, pos, par5AxisAlignedBB, stacks, par7Entity, isActualState);
public VoxelShape getCollisionShape(@Nonnull BlockState state, @Nonnull IBlockReader world, @Nonnull BlockPos pos, ISelectionContext context) {
Entity e = context.getEntity();
if(variant == Variant.INFRANGIBLE
|| variant == Variant.ABSTRUSE
&& e != null
&& e.posY > pos.getY() + 0.9
&& !context.isSneaking()) {
return super.getCollisionShape(state, world, pos, context);
} else {
return VoxelShapes.empty();
}
}
*/
@Override
public boolean canRenderInLayer(BlockState state, @Nonnull BlockRenderLayer layer) {
@@ -50,11 +50,6 @@ public class BlockPylon extends BlockMod implements ILexiconable {
return SHAPE;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Nonnull
@Override
public BlockRenderType getRenderType(BlockState state) {
@@ -56,12 +56,7 @@ public class BlockSparkChanger extends BlockMod implements ILexiconable {
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0 || world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.get(BotaniaStateProps.POWERED);
@@ -106,11 +106,6 @@ public class BlockTeruTeruBozu extends BlockMod implements ILexiconable {
return world.isRaining() ? 15 : 0;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Nonnull
@Override
public BlockRenderType getRenderType(BlockState state) {
@@ -41,11 +41,6 @@ public class BlockTinyPlanet extends BlockMod implements ILexiconable, IManaColl
return AABB;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
@@ -212,7 +212,7 @@ public class ModSubtiles {
public static void registerBlocks(RegistryEvent.Register<Block> evt) {
IForgeRegistry<Block> r = evt.getRegistry();
Block.Properties props = Block.Properties.from(Blocks.POPPY);
Block.Properties floatProps = Block.Properties.create(Material.GROUND).hardnessAndResistance(0.5F).sound(SoundType.GROUND).lightValue(15);
Block.Properties floatProps = Block.Properties.create(Material.EARTH).hardnessAndResistance(0.5F).sound(SoundType.GROUND).lightValue(15);
for (Pair<Supplier<? extends TileEntitySpecialFlower>, ResourceLocation> type : TYPES) {
register(r, new BlockSpecialFlower(props, type.getLeft()), type.getValue());
@@ -85,11 +85,6 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
return false;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Nonnull
@Override
public TileCorporeaBase createTileEntity(@Nonnull BlockState state, @Nonnull IBlockReader world) {
@@ -43,7 +43,7 @@ public class BlockCorporeaFunnel extends BlockCorporeaBase implements ILexiconab
}
@Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0 || world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.get(BotaniaStateProps.POWERED);
@@ -55,11 +55,6 @@ public class BlockCorporeaIndex extends BlockCorporeaBase implements ILexiconabl
super(builder);
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Nonnull
@Override
public BlockRenderType getRenderType(BlockState state) {
@@ -42,7 +42,7 @@ public class BlockCorporeaRetainer extends BlockMod implements ILexiconable {
}
@Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0 || world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.get(BotaniaStateProps.POWERED);
@@ -83,11 +83,6 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable {
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
ItemStack stack = player.getHeldItem(hand);
@@ -56,11 +56,6 @@ public class BlockManaFlame extends BlockMod implements ILexiconable {
return BlockRenderType.INVISIBLE;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
if(Botania.gardenOfGlassLoaded) {
@@ -37,11 +37,6 @@ public class BlockManaGlass extends BlockMod implements ILexiconable {
super(builder);
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@OnlyIn(Dist.CLIENT)
@Nonnull
@Override
@@ -51,11 +51,6 @@ public class BlockStarfield extends BlockMod implements ILexiconable {
return BlockRenderLayer.CUTOUT_MIPPED;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
@@ -127,11 +127,6 @@ public class BlockTinyPotato extends BlockMod implements ILexiconable {
}
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Nonnull
@Override
public BlockRenderType getRenderType(BlockState state) {
@@ -36,11 +36,6 @@ public class BlockModWall extends WallBlock implements ILexiconable {
super(props);
}
@Override
public boolean canPlaceTorchOnTop(BlockState state, IWorldReader world, BlockPos pos) {
return true;
}
@Override
public LexiconEntry getEntry(World world, BlockPos pos, PlayerEntity player, ItemStack lexicon) {
return LexiconData.decorativeBlocks;
@@ -68,11 +68,6 @@ public class BlockBellows extends BlockMod implements ILexiconable {
return true;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Nonnull
@Override
public BlockRenderType getRenderType(BlockState state) {
@@ -102,11 +102,6 @@ public class BlockBrewery extends BlockMod implements ILexiconable, IWandHUD {
return BlockRenderType.ENTITYBLOCK_ANIMATED;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
@@ -42,11 +42,6 @@ public class BlockDistributor extends BlockMod implements ILexiconable {
return SHAPE;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
@@ -65,11 +65,6 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
return SHAPE;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public void onBurstCollision(IManaBurst burst, World world, BlockPos pos) {
if(burst.isFake())
@@ -92,15 +87,17 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
if(entity instanceof IShearable && ((IShearable) entity).isShearable(stack, world, new BlockPos(entity))) {
shearables.add(entity);
} else if(entity instanceof CowEntity) {
List<ItemEntity> items = world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(entity.posX, entity.posY, entity.posZ, entity.posX + entity.width, entity.posY + entity.height, entity.posZ + entity.width));
List<ItemEntity> items = world.getEntitiesWithinAABB(ItemEntity.class, entity.getBoundingBox());
for(ItemEntity item : items) {
ItemStack itemstack = item.getItem();
if(!itemstack.isEmpty() && itemstack.getItem() == Items.BUCKET && !world.isRemote) {
while(itemstack.getCount() > 0) {
ItemEntity ent = entity.entityDropItem(new ItemStack(Items.MILK_BUCKET), 1.0F);
ent.motionY += world.rand.nextFloat() * 0.05F;
ent.motionX += (world.rand.nextFloat() - world.rand.nextFloat()) * 0.1F;
ent.motionZ += (world.rand.nextFloat() - world.rand.nextFloat()) * 0.1F;
ent.setMotion(ent.getMotion().add(
world.rand.nextFloat() * 0.05F,
(world.rand.nextFloat() - world.rand.nextFloat()) * 0.1F,
(world.rand.nextFloat() - world.rand.nextFloat()) * 0.1F
));
itemstack.shrink(1);
}
item.remove();
@@ -117,13 +114,14 @@ public class BlockForestDrum extends BlockMod implements IManaTrigger, ILexicona
break;
List<ItemStack> stacks = ((IShearable) entity).onSheared(stack, world, new BlockPos(entity), 0);
if(stacks != null)
for(ItemStack wool : stacks) {
ItemEntity ent = entity.entityDropItem(wool, 1.0F);
ent.motionY += world.rand.nextFloat() * 0.05F;
ent.motionX += (world.rand.nextFloat() - world.rand.nextFloat()) * 0.1F;
ent.motionZ += (world.rand.nextFloat() - world.rand.nextFloat()) * 0.1F;
}
for(ItemStack wool : stacks) {
ItemEntity ent = entity.entityDropItem(wool, 1.0F);
ent.setMotion(ent.getMotion().add(
world.rand.nextFloat() * 0.05F,
(world.rand.nextFloat() - world.rand.nextFloat()) * 0.1F,
(world.rand.nextFloat() - world.rand.nextFloat()) * 0.1F
));
}
++sheared;
}
}
@@ -18,9 +18,12 @@ import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.mana.IManaCollisionGhost;
@@ -55,9 +58,13 @@ public class BlockManaDetector extends BlockMod implements ILexiconable, IManaCo
@Nonnull
@Override
public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos) {
// todo 1.13 don't collide if it's a burst
return super.getCollisionShape(state, worldIn, pos);
public VoxelShape getCollisionShape(@Nonnull BlockState state, @Nonnull IBlockReader world, @Nonnull BlockPos pos,
ISelectionContext context) {
if(context.getEntity() instanceof IManaBurst) {
return VoxelShapes.empty();
} else {
return super.getCollisionShape(state, world, pos, context);
}
}
@Override
@@ -70,11 +70,6 @@ public class BlockPrism extends BlockMod implements IManaTrigger, ILexiconable,
return BlockRenderLayer.TRANSLUCENT;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
TileEntity tile = world.getTileEntity(pos);
@@ -64,11 +64,6 @@ public class BlockPump extends BlockMod implements ILexiconable {
}
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean hasComparatorInputOverride(BlockState state) {
return true;
@@ -49,11 +49,6 @@ public class BlockRuneAltar extends BlockMod implements IWandable, ILexiconable
return SHAPE;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
if(world.isRemote)
@@ -50,11 +50,6 @@ public class BlockSpawnerClaw extends BlockMod implements ILexiconable {
list.add(new ItemStack(Blocks.SPAWNER));
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
@@ -94,11 +94,6 @@ public class BlockSpreader extends BlockMod implements IWandable, IWandHUD, ILex
}
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Nonnull
@Override
public BlockRenderType getRenderType(BlockState state) {
@@ -66,11 +66,6 @@ public class BlockTerraPlate extends BlockMod implements ILexiconable {
return false;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean allowsMovement(@Nonnull BlockState state, @Nonnull IBlockReader world, @Nonnull BlockPos pos, PathType type) {
return false;
@@ -41,7 +41,7 @@ public class BlockRedStringDispenser extends BlockRedString {
}
@Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0 || world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.get(BotaniaStateProps.POWERED);
@@ -15,7 +15,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.ai.goal.HurtByTargetGoal;
import net.minecraft.entity.ai.goal.GoalSelector.EntityAITaskEntry;
import net.minecraft.entity.ai.goal.PrioritizedGoal;
import net.minecraft.entity.monster.IMob;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.AxisAlignedBB;
@@ -76,11 +76,11 @@ public class SubTileHeiseiDream extends TileEntityFunctionalFlower {
entity.setAttackTarget(null);
// Move any EntityAIHurtByTarget to highest priority
for (EntityAITaskEntry entry : entity.targetTasks.taskEntries) {
if (entry.action instanceof HurtByTargetGoal) {
for (PrioritizedGoal entry : entity.targetSelector.goals) {
if (entry.func_220772_j() instanceof HurtByTargetGoal) {
// Concurrent modification OK since we break out of the loop
entity.targetTasks.removeTask(entry.action);
entity.targetTasks.addTask(-1, entry.action);
entity.targetSelector.removeGoal(entry.func_220772_j());
entity.targetSelector.addGoal(-1, entry.func_220772_j());
break;
}
}
@@ -14,8 +14,8 @@ import net.minecraft.entity.MobEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.ai.goal.AvoidEntityGoal;
import net.minecraft.entity.ai.goal.NearestAttackableTargetGoal;
import net.minecraft.entity.ai.goal.GoalSelector.EntityAITaskEntry;
import net.minecraft.entity.ai.goal.AvoidEntityGoal;
import net.minecraft.entity.ai.goal.PrioritizedGoal;
import net.minecraft.entity.item.EnderCrystalEntity;
import net.minecraft.entity.item.EnderCrystalEntity;
import net.minecraft.entity.monster.CreeperEntity;
@@ -60,17 +60,17 @@ public class SubTileTigerseye extends TileEntityFunctionalFlower {
List<MobEntity> entities = getWorld().getEntitiesWithinAABB(MobEntity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE_Y, -RANGE), getPos().add(RANGE + 1, RANGE_Y + 1, RANGE + 1)));
for(MobEntity entity : entities) {
List<EntityAITaskEntry> entries = new ArrayList<>(entity.tasks.taskEntries);
entries.addAll(entity.targetTasks.taskEntries);
List<PrioritizedGoal> entries = new ArrayList<>(entity.goalSelector.goals);
entries.addAll(entity.targetSelector.goals);
boolean avoidsOcelots = false;
if(shouldAfffect)
for(EntityAITaskEntry entry : entries) {
if(entry.action instanceof AvoidEntityGoal)
avoidsOcelots = messWithRunAwayAI((AvoidEntityGoal) entry.action) || avoidsOcelots;
for(PrioritizedGoal entry : entries) {
if(entry.func_220772_j() instanceof AvoidEntityGoal)
avoidsOcelots = messWithRunAwayAI((AvoidEntityGoal) entry.func_220772_j()) || avoidsOcelots;
if(entry.action instanceof NearestAttackableTargetGoal)
messWithGetTargetAI((NearestAttackableTargetGoal) entry.action);
if(entry.func_220772_j() instanceof NearestAttackableTargetGoal)
messWithGetTargetAI((NearestAttackableTargetGoal) entry.func_220772_j());
}
if(entity instanceof CreeperEntity) {
@@ -236,7 +236,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
if(didAny) {
player.world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_GENERIC_SPLASH, SoundCategory.BLOCKS, 0.1F, 10F);
ServerPlayerEntity mp = (ServerPlayerEntity) player;
mp.inventoryContainer.detectAndSendChanges();
mp.container.detectAndSendChanges();
}
}
@@ -19,6 +19,7 @@ import net.minecraft.tileentity.TileEntityType;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.state.BotaniaStateProps;
@@ -51,7 +52,7 @@ public class TileEnderEye extends TileMod implements ITickableTileEntity {
if(!helm.isEmpty() && helm.getItem() == Item.getItemFromBlock(Blocks.PUMPKIN))
continue;
RayTraceResult pos = ToolCommons.raytraceFromEntity(world, player, true, 64);
RayTraceResult pos = ToolCommons.raytraceFromEntity(world, player, RayTraceContext.FluidMode.NONE, 64);
if(pos.getType() == RayTraceResult.Type.BLOCK && ((BlockRayTraceResult) pos).getPos().equals(getPos())) {
looking = true;
break;
@@ -13,6 +13,7 @@ package vazkii.botania.common.brew.potion;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.FishingBobberEntity;
import net.minecraft.potion.EffectType;
import vazkii.botania.common.lib.LibPotionNames;
import javax.annotation.Nonnull;
@@ -20,8 +21,7 @@ import javax.annotation.Nonnull;
public class PotionAllure extends PotionMod {
public PotionAllure() {
super(false, 0x0034E4, 5);
setBeneficial();
super(EffectType.BENEFICIAL, 0x0034E4, 5);
}
@Override
@@ -32,7 +32,7 @@ public class PotionAllure extends PotionMod {
@Override
public void performEffect(@Nonnull LivingEntity living, int amplified) {
if(living instanceof PlayerEntity) {
FishingBobberEntity hook = ((PlayerEntity) living).fishEntity;
FishingBobberEntity hook = ((PlayerEntity) living).fishingBobber;
if(hook != null)
hook.tick();
}
@@ -13,6 +13,7 @@ package vazkii.botania.common.brew.potion;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.potion.EffectType;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.eventbus.api.Event;
@@ -27,16 +28,18 @@ public class PotionBloodthirst extends PotionMod {
private static final int RANGE = 64;
public PotionBloodthirst() {
super(false, 0xC30000, 3);
setBeneficial();
super(EffectType.BENEFICIAL, 0xC30000, 3);
}
@SubscribeEvent
public static void onSpawn(LivingSpawnEvent.CheckSpawn event) {
if(event.getResult() != Event.Result.ALLOW && event.getEntityLiving() instanceof IMob) {
AxisAlignedBB aabb = new AxisAlignedBB(event.getX() - RANGE, event.getY() - RANGE, event.getZ() - RANGE, event.getX() + RANGE, event.getY() + RANGE, event.getZ() + RANGE);
for(PlayerEntity player : event.getWorld().getWorld().playerEntities) {
if(player.isPotionActive(ModPotions.bloodthrst) && !player.isPotionActive(ModPotions.emptiness) && player.getBoundingBox().intersects(aabb)) {
AxisAlignedBB aabb = new AxisAlignedBB(event.getX() - RANGE, event.getY() - RANGE, event.getZ() - RANGE,
event.getX() + RANGE, event.getY() + RANGE, event.getZ() + RANGE);
for(PlayerEntity player : event.getWorld().getPlayers()) {
if(player.isPotionActive(ModPotions.bloodthrst)
&& !player.isPotionActive(ModPotions.emptiness)
&& player.getBoundingBox().intersects(aabb)) {
event.setResult(Event.Result.ALLOW);
return;
}
@@ -14,13 +14,14 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.EffectType;
import javax.annotation.Nonnull;
public class PotionClear extends PotionMod {
public PotionClear() {
super(false, 0xFFFFFF, 0);
super(EffectType.NEUTRAL, 0xFFFFFF, 0);
}
@Override
@@ -13,6 +13,7 @@ package vazkii.botania.common.brew.potion;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.potion.EffectType;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.eventbus.api.Event;
@@ -24,15 +25,15 @@ public class PotionEmptiness extends PotionMod {
private static final int RANGE = 128;
public PotionEmptiness() {
super(false, 0xFACFFF, 2);
setBeneficial();
super(EffectType.BENEFICIAL, 0xFACFFF, 2);
}
@SubscribeEvent
public static void onSpawn(LivingSpawnEvent.CheckSpawn event) {
if(event.getResult() != Event.Result.ALLOW && event.getEntityLiving() instanceof IMob) {
AxisAlignedBB aabb = new AxisAlignedBB(event.getX() - RANGE, event.getY() - RANGE, event.getZ() - RANGE, event.getX() + RANGE, event.getY() + RANGE, event.getZ() + RANGE);
for(PlayerEntity player : event.getWorld().getWorld().playerEntities) {
AxisAlignedBB aabb = new AxisAlignedBB(event.getX() - RANGE, event.getY() - RANGE, event.getZ() - RANGE,
event.getX() + RANGE, event.getY() + RANGE, event.getZ() + RANGE);
for(PlayerEntity player : event.getWorld().getPlayers()) {
if(player.isPotionActive(ModPotions.emptiness) && player.getBoundingBox().intersects(aabb)) {
event.setResult(Event.Result.DENY);
return;
@@ -12,14 +12,14 @@ package vazkii.botania.common.brew.potion;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.potion.EffectType;
import javax.annotation.Nonnull;
public class PotionFeatherfeet extends PotionMod {
public PotionFeatherfeet() {
super(false, 0x26ADFF, 1);
setBeneficial();
super(EffectType.BENEFICIAL, 0x26ADFF, 1);
}
@Override
@@ -13,6 +13,7 @@ package vazkii.botania.common.brew.potion;
import javafx.geometry.Side;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.DisplayEffectsScreen;
import net.minecraft.client.renderer.BufferBuilder;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
@@ -20,6 +21,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.LivingEntity;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectType;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -30,14 +32,14 @@ public class PotionMod extends Effect {
private static final ResourceLocation resource = new ResourceLocation(LibResources.GUI_POTIONS);
private final int iconIndex;
public PotionMod(boolean badEffect, int color, int iconIndex) {
super(badEffect, color);
public PotionMod(EffectType type, int color, int iconIndex) {
super(type, color);
this.iconIndex = iconIndex;
}
@Override
@OnlyIn(Dist.CLIENT)
public void renderInventoryEffect(EffectInstance effect, AbstractGui gui, int x, int y, float z) {
public void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen<?> gui, int x, int y, float z) {
render(x + 6, y + 7, 1);
}
@@ -13,6 +13,7 @@ package vazkii.botania.common.brew.potion;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.potion.EffectType;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@@ -23,8 +24,7 @@ import vazkii.botania.common.lib.LibMisc;
public class PotionSoulCross extends PotionMod {
public PotionSoulCross() {
super(false, 0x47453d, 0);
setBeneficial();
super(EffectType.BENEFICIAL, 0x47453d, 0);
}
@SubscribeEvent
@@ -84,7 +84,7 @@ public abstract class EquipmentHandler {
if(event.phase != TickEvent.Phase.START || event.player.world.isRemote)
return;
PlayerEntity player = event.player;
player.world.profiler.startSection("botania:tick_wearables");
player.world.getProfiler().startSection("botania:tick_wearables");
ItemStack[] oldStacks = map.computeIfAbsent(player, p -> {
ItemStack[] array = new ItemStack[9];
@@ -99,11 +99,11 @@ public abstract class EquipmentHandler {
if(!ItemStack.areItemStacksEqual(old, current)) {
if(old.getItem() instanceof ItemBauble) {
player.getAttributeMap().removeAttributeModifiers(((ItemBauble) old.getItem()).getEquippedAttributeModifiers(old));
player.getAttributes().removeAttributeModifiers(((ItemBauble) old.getItem()).getEquippedAttributeModifiers(old));
((ItemBauble) old.getItem()).onUnequipped(old, player);
}
if(canEquip(current, player)) {
player.getAttributeMap().applyAttributeModifiers(((ItemBauble) current.getItem()).getEquippedAttributeModifiers(current));
player.getAttributes().applyAttributeModifiers(((ItemBauble) current.getItem()).getEquippedAttributeModifiers(current));
((ItemBauble) current.getItem()).onEquipped(current, player);
}
oldStacks[i] = current.copy(); // shift-clicking mutates the stack we stored,
@@ -114,7 +114,7 @@ public abstract class EquipmentHandler {
((ItemBauble) current.getItem()).onWornTick(current, player);
}
}
player.world.profiler.endSection();
player.world.getProfiler().endSection();
}
@@ -2,6 +2,7 @@ package vazkii.botania.common.core.handler;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.ServerWorld;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@@ -17,10 +18,12 @@ public final class SleepingHandler {
@SubscribeEvent
public static void trySleep(PlayerSleepInBedEvent event) {
World world = event.getEntityPlayer().world;
for(EntityDoppleganger guardian : world.getEntities(EntityDoppleganger.class, e -> true)) {
if(guardian.getPlayersAround().contains(event.getEntityPlayer())) {
event.setResult(PlayerEntity.SleepResult.NOT_SAFE);
}
boolean nearGuardian = ((ServerWorld) world).getEntities()
.filter(e -> e instanceof EntityDoppleganger)
.anyMatch(e -> ((EntityDoppleganger) e).getPlayersAround().contains(event.getEntityPlayer()));
if(nearGuardian) {
event.setResult(PlayerEntity.SleepResult.NOT_SAFE);
}
}
}
@@ -3,10 +3,12 @@ package vazkii.botania.common.core.loot;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.world.storage.loot.LootFunction;
import net.minecraft.world.storage.loot.LootParameters;
import net.minecraft.world.storage.loot.conditions.ILootCondition;
import net.minecraft.world.storage.loot.functions.ILootFunction;
import vazkii.botania.common.item.ModItems;
@@ -25,14 +27,14 @@ public class BindUuid extends LootFunction {
@Nonnull
@Override
public ItemStack doApply(@Nonnull ItemStack stack, @Nonnull LootContext context) {
if (context.getKillerPlayer() != null) {
((ItemRelic) ModItems.dice).bindToUUID(context.getKillerPlayer().getUniqueID(), stack);
if (context.get(LootParameters.KILLER_ENTITY) instanceof PlayerEntity) {
((ItemRelic) ModItems.dice).bindToUUID(context.get(LootParameters.KILLER_ENTITY).getUniqueID(), stack);
}
return stack;
}
public static class Serializer extends ILootFunction.Serializer<BindUuid> {
public static class Serializer extends LootFunction.Serializer<BindUuid> {
public Serializer() {
super(new ResourceLocation(LibMisc.MOD_ID, "bind_uuid"), BindUuid.class);
}
@@ -38,6 +38,7 @@ import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.network.play.server.SRemoveEntityEffectPacket;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectType;
import net.minecraft.potion.Effects;
import net.minecraft.potion.EffectInstance;
import net.minecraft.tags.BlockTags;
@@ -563,7 +564,7 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
private void clearPotions(PlayerEntity player) {
List<Effect> potionsToRemove = player.getActivePotionEffects().stream()
.filter(effect -> effect.getDuration() < 160 && effect.isAmbient() && !effect.getPotion().isBadEffect())
.filter(effect -> effect.getDuration() < 160 && effect.isAmbient() && effect.getPotion().type != EffectType.HARMFUL)
.map(EffectInstance::getPotion)
.distinct()
.collect(Collectors.toList());
@@ -17,7 +17,9 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.block.Blocks;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@@ -62,7 +64,8 @@ public class EntityThrownItem extends ItemEntity {
Vec3d vec3 = new Vec3d(posX, posY, posZ);
Vec3d vec31 = getPositionVec().add(getMotion());
RayTraceResult ray = world.rayTraceBlocks(vec3, vec31);
RayTraceResult ray = world.rayTraceBlocks(new RayTraceContext(vec3, vec31,
RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.NONE, this));
if (!world.isRemote)
@@ -96,30 +99,22 @@ public class EntityThrownItem extends ItemEntity {
if (ray != null)
{
if (ray.getType() == net.minecraft.util.math.RayTraceResult.Type.BLOCK && world.getBlockState(ray.getBlockPos()).getBlock() == Blocks.NETHER_PORTAL)
if (ray.getType() == RayTraceResult.Type.BLOCK
&& world.getBlockState(((BlockRayTraceResult) ray).getPos()).getBlock() == Blocks.NETHER_PORTAL)
{
setPortal(ray.getBlockPos());
setPortal(((BlockRayTraceResult) ray).getPos());
}
else
{
if (ray.type != null) {
ray.entity.attackEntityFrom(DamageSource.MAGIC, 2.0F);
if (ray.getType() == RayTraceResult.Type.ENTITY) {
((EntityRayTraceResult) ray).getEntity().attackEntityFrom(DamageSource.MAGIC, 2.0F);
if (!world.isRemote) {
Entity item = getItem().getItem().createEntity(world, this, getItem());
if (item == null) {
item = new ItemEntity(world, posX, posY, posZ, getItem());
world.addEntity(item);
item.motionX = motionX*0.25F;
item.motionY = motionY*0.25F;
item.motionZ = motionZ*0.25F;
}
else
{
item.motionX = motionX*0.25F;
item.motionY = motionY*0.25F;
item.motionZ = motionZ*0.25F;
}
item.setMotion(getMotion().scale(0.25));
}
remove();
@@ -127,23 +122,15 @@ public class EntityThrownItem extends ItemEntity {
}
}
Vector3 vec3m = new Vector3(motionX, motionY, motionZ);
Vector3 vec3m = new Vector3(getMotion());
if (vec3m.mag() < 1.0F) {
if (!world.isRemote) {
Entity item = getItem().getItem().createEntity(world, this, getItem());
if (item == null) {
item = new ItemEntity(world, posX, posY, posZ, getItem());
world.addEntity(item);
item.motionX = motionX;
item.motionY = motionY;
item.motionZ = motionZ;
}
else
{
item.motionX = motionX;
item.motionY = motionY;
item.motionZ = motionZ;
}
item.setMotion(getMotion());
}
remove();
}