mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-20 12:19:46 +00:00
Add waterlogging support for Botania blocks. (#3243)
* Waterlog all the things. * Header * Linting and friends. * Remove waterlogging for Manatide Bellows and Petal Apothecaries * Blank line.
This commit is contained in:
1 parent
aa5a74c746
commit
6a7da67f96
48 files changed
+256
-83
No files matched your search
@@ -33,7 +33,7 @@ public class BlockAlfPortal extends BlockMod implements IWandable {
|
||||
|
||||
public BlockAlfPortal(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BotaniaStateProps.ALFPORTAL_STATE, AlfPortalState.OFF));
|
||||
setDefaultState(getDefaultState().with(BotaniaStateProps.ALFPORTAL_STATE, AlfPortalState.OFF));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,7 +38,7 @@ import vazkii.botania.common.block.tile.TileAnimatedTorch;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockAnimatedTorch extends BlockMod implements IWandable, IManaTrigger, IHourglassTrigger, IWandHUD {
|
||||
public class BlockAnimatedTorch extends BlockModWaterloggable implements IWandable, IManaTrigger, IHourglassTrigger, IWandHUD {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(0, 0, 0, 16, 4, 16);
|
||||
|
||||
|
||||
@@ -17,11 +17,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
@@ -36,16 +32,15 @@ import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.core.helper.InventoryHelper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockAvatar extends BlockMod {
|
||||
public class BlockAvatar extends BlockModWaterloggable {
|
||||
|
||||
private static final VoxelShape X_AABB = makeCuboidShape(5, 0, 3.5, 11, 17, 12.5);
|
||||
private static final VoxelShape Z_AABB = makeCuboidShape(3.5, 0, 5, 12.5, 17, 11);
|
||||
|
||||
protected BlockAvatar(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.HORIZONTAL_FACING, Direction.NORTH));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING, Direction.NORTH));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -60,6 +55,7 @@ public class BlockAvatar extends BlockMod {
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(BlockStateProperties.HORIZONTAL_FACING);
|
||||
}
|
||||
|
||||
@@ -89,10 +85,10 @@ public class BlockAvatar extends BlockMod {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
return getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite());
|
||||
return super.getStateForPlacement(context).with(BlockStateProperties.HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -25,7 +25,7 @@ import javax.annotation.Nonnull;
|
||||
public class BlockCacophonium extends BlockMod {
|
||||
protected BlockCacophonium(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.POWERED, false));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.POWERED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,7 +34,7 @@ import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockCocoon extends BlockMod {
|
||||
public class BlockCocoon extends BlockModWaterloggable {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(3, 0, 3, 13, 14, 13);;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class BlockCraftyCrate extends BlockOpenCrate implements IWandHUD {
|
||||
|
||||
public BlockCraftyCrate(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BotaniaStateProps.CRATE_PATTERN, CratePattern.NONE));
|
||||
setDefaultState(getDefaultState().with(BotaniaStateProps.CRATE_PATTERN, CratePattern.NONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,7 +29,7 @@ public class BlockEnderEye extends BlockMod {
|
||||
|
||||
protected BlockEnderEye(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.POWERED, false));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.POWERED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,7 +32,7 @@ public class BlockFelPumpkin extends BlockMod {
|
||||
|
||||
public BlockFelPumpkin(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,7 @@ import vazkii.botania.common.block.tile.TileForestEye;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockForestEye extends BlockMod {
|
||||
public class BlockForestEye extends BlockModWaterloggable {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(4, 4, 4, 12, 12, 12);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BlockGhostRail extends AbstractRailBlock {
|
||||
|
||||
public BlockGhostRail(Properties builder) {
|
||||
super(true, builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.RAIL_SHAPE_STRAIGHT, RailShape.NORTH_SOUTH));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.RAIL_SHAPE_STRAIGHT, RailShape.NORTH_SOUTH));
|
||||
MinecraftForge.EVENT_BUS.addListener(this::cartSpawn);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::worldTick);
|
||||
}
|
||||
|
||||
@@ -47,13 +47,13 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable, IWandHUD {
|
||||
public class BlockHourglass extends BlockModWaterloggable implements IManaTrigger, IWandable, IWandHUD {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(4, 0, 4, 12, 18.4, 12);
|
||||
|
||||
protected BlockHourglass(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.POWERED, false));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.POWERED, false));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -64,6 +64,7 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(BlockStateProperties.POWERED);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,21 +30,23 @@ import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.common.block.tile.TileIncensePlate;
|
||||
import vazkii.botania.common.core.helper.InventoryHelper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockIncensePlate extends BlockMod {
|
||||
public class BlockIncensePlate extends BlockModWaterloggable {
|
||||
|
||||
private static final VoxelShape X_SHAPE = makeCuboidShape(6, 0, 2, 10, 1, 14);
|
||||
private static final VoxelShape Z_SHAPE = makeCuboidShape(2, 0, 6, 14, 1, 10);
|
||||
|
||||
protected BlockIncensePlate(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(BlockStateProperties.HORIZONTAL_FACING);
|
||||
}
|
||||
|
||||
@@ -56,6 +58,13 @@ public class BlockIncensePlate extends BlockMod {
|
||||
boolean did = false;
|
||||
|
||||
if (world.isRemote) {
|
||||
if (state.get(BlockStateProperties.WATERLOGGED)
|
||||
&& !plateStack.isEmpty()
|
||||
&& !plate.burning
|
||||
&& !stack.isEmpty()
|
||||
&& stack.getItem() == Items.FLINT_AND_STEEL) {
|
||||
plate.spawnSmokeParticles();
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -85,7 +94,7 @@ public class BlockIncensePlate extends BlockMod {
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
return getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite());
|
||||
return super.getStateForPlacement(context).with(BlockStateProperties.HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,4 +128,15 @@ public class BlockIncensePlate extends BlockMod {
|
||||
return new TileIncensePlate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReplaced(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState newState, boolean isMoving) {
|
||||
if (state.getBlock() != newState.getBlock()) {
|
||||
TileIncensePlate plate = (TileIncensePlate) world.getTileEntity(pos);
|
||||
if (plate != null && !plate.burning) {
|
||||
InventoryHelper.dropInventory(plate, world, state, pos);
|
||||
}
|
||||
}
|
||||
super.onReplaced(state, world, pos, newState, isMoving);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,13 +31,13 @@ import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockLightLauncher extends BlockMod {
|
||||
public class BlockLightLauncher extends BlockModWaterloggable {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(0, 0, 0, 16, 4, 16);
|
||||
|
||||
public BlockLightLauncher(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.POWERED, false));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.POWERED, false));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -48,6 +48,7 @@ public class BlockLightLauncher extends BlockMod {
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(BlockStateProperties.POWERED);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockLightRelay extends BlockMod implements IWandable {
|
||||
public class BlockLightRelay extends BlockModWaterloggable implements IWandable {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(5, 5, 5, 11, 11, 11);
|
||||
public final LuminizerVariant variant;
|
||||
@@ -44,7 +44,7 @@ public class BlockLightRelay extends BlockMod implements IWandable {
|
||||
protected BlockLightRelay(LuminizerVariant variant, Properties builder) {
|
||||
super(builder);
|
||||
this.variant = variant;
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.POWERED, false));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.POWERED, false));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -55,6 +55,7 @@ public class BlockLightRelay extends BlockMod implements IWandable {
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(BlockStateProperties.POWERED);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* This class is distributed as part of the Botania Mod.
|
||||
* Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.IWaterLoggable;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.WATERLOGGED;
|
||||
|
||||
public abstract class BlockModWaterloggable extends BlockMod implements IWaterLoggable {
|
||||
|
||||
public BlockModWaterloggable(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.WATERLOGGED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
builder.add(WATERLOGGED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFluidState getFluidState(BlockState state) {
|
||||
return state.get(WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : Fluids.EMPTY.getDefaultState();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
IFluidState fluidState = context.getWorld().getFluidState(context.getPos());
|
||||
return this.getDefaultState().with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState updatePostPlacement(BlockState stateIn, Direction side, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) {
|
||||
if (stateIn.get(WATERLOGGED)) {
|
||||
worldIn.getPendingFluidTicks().scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn));
|
||||
}
|
||||
|
||||
return stateIn;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import vazkii.botania.common.block.tile.TilePylon;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockPylon extends BlockMod {
|
||||
public class BlockPylon extends BlockModWaterloggable {
|
||||
private static final VoxelShape SHAPE = Block.makeCuboidShape(2, 0, 2, 14, 21, 14);
|
||||
|
||||
public enum Variant {
|
||||
|
||||
@@ -32,13 +32,13 @@ import vazkii.botania.common.item.ItemSparkUpgrade;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockSparkChanger extends BlockMod {
|
||||
public class BlockSparkChanger extends BlockModWaterloggable {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(0, 0, 0, 16, 3, 16);
|
||||
|
||||
public BlockSparkChanger(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.POWERED, true));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.POWERED, true));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -49,6 +49,7 @@ public class BlockSparkChanger extends BlockMod {
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(BlockStateProperties.POWERED);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import vazkii.botania.common.block.tile.TileTeruTeruBozu;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockTeruTeruBozu extends BlockMod {
|
||||
public class BlockTeruTeruBozu extends BlockModWaterloggable {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(4, 0.16, 4, 12, 15.84, 12);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import vazkii.botania.common.block.tile.TileTinyPlanet;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockTinyPlanet extends BlockMod implements IManaCollisionGhost {
|
||||
public class BlockTinyPlanet extends BlockModWaterloggable implements IManaCollisionGhost {
|
||||
|
||||
private static final VoxelShape AABB = makeCuboidShape(3, 3, 3, 13, 13, 13);
|
||||
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* This class is distributed as part of the Botania Mod.
|
||||
* Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.common.block.corporea;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.IWaterLoggable;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.WATERLOGGED;
|
||||
|
||||
public abstract class BlockCorporeaBaseWaterloggable extends BlockCorporeaBase implements IWaterLoggable {
|
||||
|
||||
public BlockCorporeaBaseWaterloggable(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.WATERLOGGED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
builder.add(WATERLOGGED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFluidState getFluidState(BlockState state) {
|
||||
return state.get(WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : Fluids.EMPTY.getDefaultState();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
IFluidState fluidState = context.getWorld().getFluidState(context.getPos());
|
||||
return this.getDefaultState().with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState updatePostPlacement(BlockState stateIn, Direction side, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) {
|
||||
if (stateIn.get(WATERLOGGED)) {
|
||||
worldIn.getPendingFluidTicks().scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn));
|
||||
}
|
||||
|
||||
return stateIn;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,7 +31,7 @@ import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements IWandable {
|
||||
public class BlockCorporeaCrystalCube extends BlockCorporeaBaseWaterloggable implements IWandable {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(3.0, 0, 3.0, 13.0, 16, 13.0);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class BlockCorporeaFunnel extends BlockCorporeaBase {
|
||||
|
||||
public BlockCorporeaFunnel(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.POWERED, false));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.POWERED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,7 @@ import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockCorporeaIndex extends BlockCorporeaBase {
|
||||
public class BlockCorporeaIndex extends BlockCorporeaBaseWaterloggable {
|
||||
public BlockCorporeaIndex(Block.Properties builder) {
|
||||
super(builder);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class BlockCorporeaInterceptor extends BlockCorporeaBase {
|
||||
|
||||
public BlockCorporeaInterceptor(Block.Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.POWERED, false));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.POWERED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,7 +26,7 @@ public class BlockCorporeaRetainer extends BlockMod {
|
||||
|
||||
public BlockCorporeaRetainer(Block.Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.POWERED, false));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.POWERED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,13 +26,12 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.item.IFloatingFlower;
|
||||
import vazkii.botania.api.item.IFloatingFlower.IslandType;
|
||||
import vazkii.botania.api.subtile.TileEntitySpecialFlower;
|
||||
import vazkii.botania.client.fx.SparkleParticleData;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.BlockModWaterloggable;
|
||||
import vazkii.botania.common.block.tile.TileFloatingFlower;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.IFloatingFlowerVariant;
|
||||
@@ -41,7 +40,7 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockFloatingFlower extends BlockMod {
|
||||
public class BlockFloatingFlower extends BlockModWaterloggable {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(1.6, 1.6, 1.6, 14.4, 14.4, 14.4);
|
||||
public final DyeColor color;
|
||||
|
||||
@@ -15,12 +15,12 @@ import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.BlockModWaterloggable;
|
||||
import vazkii.botania.common.block.tile.TileStarfield;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockStarfield extends BlockMod {
|
||||
public class BlockStarfield extends BlockModWaterloggable {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(0, 0, 0, 16, 4, 16);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.BlockModWaterloggable;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.block.tile.TileTinyPotato;
|
||||
import vazkii.botania.common.core.helper.InventoryHelper;
|
||||
@@ -39,18 +39,19 @@ import vazkii.botania.common.core.helper.InventoryHelper;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockTinyPotato extends BlockMod {
|
||||
public class BlockTinyPotato extends BlockModWaterloggable {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(6, 0, 6, 10, 6, 10);
|
||||
|
||||
public BlockTinyPotato(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState()
|
||||
setDefaultState(getDefaultState()
|
||||
.with(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(BlockStateProperties.HORIZONTAL_FACING);
|
||||
}
|
||||
|
||||
@@ -82,9 +83,10 @@ public class BlockTinyPotato extends BlockMod {
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext ctx) {
|
||||
return getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING, ctx.getPlacementHorizontalFacing().getOpposite());
|
||||
return super.getStateForPlacement(ctx).with(BlockStateProperties.HORIZONTAL_FACING, ctx.getPlacementHorizontalFacing().getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,11 +38,12 @@ public class BlockBellows extends BlockMod {
|
||||
|
||||
public BlockBellows(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(BlockStateProperties.HORIZONTAL_FACING);
|
||||
}
|
||||
|
||||
@@ -52,9 +53,10 @@ public class BlockBellows extends BlockMod {
|
||||
return SHAPE;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
return getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING, context.getPlacementHorizontalFacing());
|
||||
return super.getStateForPlacement(context).with(BlockStateProperties.HORIZONTAL_FACING, context.getPlacementHorizontalFacing());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,24 +29,25 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import vazkii.botania.api.wand.IWandHUD;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.BlockModWaterloggable;
|
||||
import vazkii.botania.common.block.tile.TileBrewery;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.core.helper.InventoryHelper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockBrewery extends BlockMod implements IWandHUD {
|
||||
public class BlockBrewery extends BlockModWaterloggable implements IWandHUD {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(6, 0.8, 6, 10, 15.2, 10);
|
||||
|
||||
public BlockBrewery(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.POWERED, false));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.POWERED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(BlockStateProperties.POWERED);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,12 +16,12 @@ import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.BlockModWaterloggable;
|
||||
import vazkii.botania.common.block.tile.mana.TileDistributor;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockDistributor extends BlockMod {
|
||||
public class BlockDistributor extends BlockModWaterloggable {
|
||||
|
||||
private static final VoxelShape SHAPE = Block.makeCuboidShape(4, 0, 4, 12, 16, 12);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class BlockEnchanter extends BlockMod implements IWandable, IWandHUD {
|
||||
|
||||
public BlockEnchanter(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BotaniaStateProps.ENCHANTER_DIRECTION, Direction.Axis.X));
|
||||
setDefaultState(getDefaultState().with(BotaniaStateProps.ENCHANTER_DIRECTION, Direction.Axis.X));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,7 @@ import net.minecraftforge.common.IShearable;
|
||||
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
import vazkii.botania.api.mana.IManaTrigger;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.BlockModWaterloggable;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.item.ItemHorn;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
@@ -39,7 +39,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockForestDrum extends BlockMod implements IManaTrigger {
|
||||
public class BlockForestDrum extends BlockModWaterloggable implements IManaTrigger {
|
||||
|
||||
public enum Variant {
|
||||
WILD,
|
||||
|
||||
@@ -32,7 +32,7 @@ public class BlockManaDetector extends BlockMod implements IManaCollisionGhost {
|
||||
|
||||
public BlockManaDetector(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.POWERED, false));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.POWERED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,7 +32,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.wand.IWandHUD;
|
||||
import vazkii.botania.api.wand.IWandable;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.BlockModWaterloggable;
|
||||
import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -40,7 +40,7 @@ import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockPool extends BlockMod implements IWandHUD, IWandable {
|
||||
public class BlockPool extends BlockModWaterloggable implements IWandHUD, IWandable {
|
||||
private static final VoxelShape SLAB = makeCuboidShape(0, 0, 0, 16, 8, 16);
|
||||
private static final VoxelShape CUTOUT = makeCuboidShape(1, 1, 1, 15, 8, 15);
|
||||
private static final VoxelShape REAL_SHAPE = VoxelShapes.combineAndSimplify(SLAB, CUTOUT, IBooleanFunction.ONLY_FIRST);
|
||||
|
||||
@@ -30,19 +30,19 @@ import vazkii.botania.api.mana.ILens;
|
||||
import vazkii.botania.api.mana.IManaCollisionGhost;
|
||||
import vazkii.botania.api.mana.IManaTrigger;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.BlockModWaterloggable;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.block.tile.mana.TilePrism;
|
||||
import vazkii.botania.common.core.helper.InventoryHelper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockPrism extends BlockMod implements IManaTrigger, IManaCollisionGhost {
|
||||
public class BlockPrism extends BlockModWaterloggable implements IManaTrigger, IManaCollisionGhost {
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(4, 0, 4, 12, 16, 12);
|
||||
|
||||
public BlockPrism(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState()
|
||||
setDefaultState(getDefaultState()
|
||||
.with(BlockStateProperties.POWERED, false)
|
||||
.with(BotaniaStateProps.HAS_LENS, false));
|
||||
}
|
||||
@@ -55,6 +55,7 @@ public class BlockPrism extends BlockMod implements IManaTrigger, IManaCollision
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(BlockStateProperties.POWERED, BotaniaStateProps.HAS_LENS);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,31 +21,31 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.BlockModWaterloggable;
|
||||
import vazkii.botania.common.block.tile.mana.TilePump;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockPump extends BlockMod {
|
||||
public class BlockPump extends BlockModWaterloggable {
|
||||
|
||||
private static final VoxelShape X_SHAPE = makeCuboidShape(0, 0, 4, 16, 8, 12);
|
||||
private static final VoxelShape Z_SHAPE = makeCuboidShape(4, 0, 0, 12, 8, 16);
|
||||
|
||||
public BlockPump(Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(getStateContainer().getBaseState().with(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING, Direction.SOUTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(BlockStateProperties.HORIZONTAL_FACING);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
||||
return getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite());
|
||||
return super.getStateForPlacement(context).with(BlockStateProperties.HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -27,14 +27,14 @@ import net.minecraft.world.World;
|
||||
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.wand.IWandable;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.BlockModWaterloggable;
|
||||
import vazkii.botania.common.block.tile.TileRuneAltar;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.core.helper.InventoryHelper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockRuneAltar extends BlockMod implements IWandable {
|
||||
public class BlockRuneAltar extends BlockModWaterloggable implements IWandable {
|
||||
|
||||
private static final VoxelShape TOP = Block.makeCuboidShape(0, 6, 0, 16, 12, 16);
|
||||
private static final VoxelShape BOTTOM = Block.makeCuboidShape(2, 0, 2, 14, 6, 14);
|
||||
|
||||
@@ -19,12 +19,12 @@ import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.BlockModWaterloggable;
|
||||
import vazkii.botania.common.block.tile.TileSpawnerClaw;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockSpawnerClaw extends BlockMod {
|
||||
public class BlockSpawnerClaw extends BlockModWaterloggable {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(2, 0, 2, 14, 2, 14);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import vazkii.botania.api.mana.ILens;
|
||||
import vazkii.botania.api.wand.IWandHUD;
|
||||
import vazkii.botania.api.wand.IWandable;
|
||||
import vazkii.botania.api.wand.IWireframeAABBProvider;
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.BlockModWaterloggable;
|
||||
import vazkii.botania.common.block.tile.mana.TileSpreader;
|
||||
import vazkii.botania.common.core.helper.ColorHelper;
|
||||
import vazkii.botania.common.core.helper.InventoryHelper;
|
||||
@@ -48,7 +48,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockSpreader extends BlockMod implements IWandable, IWandHUD, IWireframeAABBProvider {
|
||||
public class BlockSpreader extends BlockModWaterloggable implements IWandable, IWandHUD, IWireframeAABBProvider {
|
||||
private static final VoxelShape RENDER_SHAPE = makeCuboidShape(1, 1, 1, 15, 15, 15);
|
||||
|
||||
public enum Variant {
|
||||
|
||||
@@ -24,13 +24,13 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import vazkii.botania.common.block.BlockMod;
|
||||
import vazkii.botania.common.block.BlockModWaterloggable;
|
||||
import vazkii.botania.common.block.tile.TileTerraPlate;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BlockTerraPlate extends BlockMod {
|
||||
public class BlockTerraPlate extends BlockModWaterloggable {
|
||||
|
||||
private static final VoxelShape SHAPE = makeCuboidShape(0, 0, 0, 16, 3, 16);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class BlockRedStringComparator extends BlockRedString {
|
||||
|
||||
public BlockRedStringComparator(Block.Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.FACING, Direction.DOWN));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.FACING, Direction.DOWN));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,7 @@ public class BlockRedStringContainer extends BlockRedString {
|
||||
|
||||
public BlockRedStringContainer(Block.Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.FACING, Direction.DOWN));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.FACING, Direction.DOWN));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -26,7 +26,7 @@ public class BlockRedStringDispenser extends BlockRedString {
|
||||
|
||||
public BlockRedStringDispenser(Block.Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.FACING, Direction.DOWN).with(BlockStateProperties.POWERED, false));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.FACING, Direction.DOWN).with(BlockStateProperties.POWERED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,7 +29,7 @@ public class BlockRedStringFertilizer extends BlockRedString implements IGrowabl
|
||||
|
||||
public BlockRedStringFertilizer(Block.Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.FACING, Direction.DOWN));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.FACING, Direction.DOWN));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,7 +34,7 @@ public class BlockRedStringInterceptor extends BlockRedString {
|
||||
|
||||
public BlockRedStringInterceptor(Block.Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.FACING, Direction.DOWN).with(BlockStateProperties.POWERED, false));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.FACING, Direction.DOWN).with(BlockStateProperties.POWERED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,7 @@ public class BlockRedStringRelay extends BlockRedString {
|
||||
|
||||
public BlockRedStringRelay(Block.Properties builder) {
|
||||
super(builder);
|
||||
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.FACING, Direction.DOWN));
|
||||
setDefaultState(getDefaultState().with(BlockStateProperties.FACING, Direction.DOWN));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -11,8 +11,10 @@ package vazkii.botania.common.block.tile;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.potion.Effects;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
@@ -32,6 +34,7 @@ import vazkii.botania.common.lib.LibMisc;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class TileIncensePlate extends TileSimpleInventory implements ITickableTileEntity {
|
||||
@ObjectHolder(LibMisc.MOD_ID + ":" + LibBlockNames.INCENSE_PLATE) public static TileEntityType<TileIncensePlate> TYPE;
|
||||
@@ -51,6 +54,11 @@ public class TileIncensePlate extends TileSimpleInventory implements ITickableTi
|
||||
public void tick() {
|
||||
ItemStack stack = itemHandler.getStackInSlot(0);
|
||||
if (!stack.isEmpty() && burning) {
|
||||
if (getBlockState().get(BlockStateProperties.WATERLOGGED) && timeLeft > 1) {
|
||||
timeLeft = 1;
|
||||
spawnSmokeParticles();
|
||||
}
|
||||
|
||||
Brew brew = ((ItemIncenseStick) ModItems.incenseStick).getBrew(stack);
|
||||
EffectInstance effect = brew.getPotionEffects(stack).get(0);
|
||||
if (timeLeft > 0) {
|
||||
@@ -106,12 +114,32 @@ public class TileIncensePlate extends TileSimpleInventory implements ITickableTi
|
||||
}
|
||||
}
|
||||
|
||||
public void spawnSmokeParticles() {
|
||||
Random random = world.getRandom();
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
world.addParticle(ParticleTypes.SMOKE,
|
||||
pos.getX() + 0.5 + random.nextDouble() / 2.0 * (random.nextBoolean() ? 1 : -1),
|
||||
pos.getY() + 1,
|
||||
pos.getZ() + 0.5 + random.nextDouble() / 2.0 * (random.nextBoolean() ? 1 : -1),
|
||||
0.0D,
|
||||
0.05D,
|
||||
0.0D);
|
||||
}
|
||||
world.playSound(null, pos, SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE, SoundCategory.BLOCKS, 0.1F, 1.0F);
|
||||
}
|
||||
|
||||
public void ignite() {
|
||||
ItemStack stack = itemHandler.getStackInSlot(0);
|
||||
|
||||
if (stack.isEmpty() || burning) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (getBlockState().get(BlockStateProperties.WATERLOGGED)) {
|
||||
spawnSmokeParticles();
|
||||
return;
|
||||
}
|
||||
|
||||
burning = true;
|
||||
Brew brew = ((ItemIncenseStick) ModItems.incenseStick).getBrew(stack);
|
||||
timeLeft = brew.getPotionEffects(stack).get(0).getDuration() * ItemIncenseStick.TIME_MULTIPLIER;
|
||||
|
||||
Reference in new issue
Block a user