Even more blocks

This commit is contained in:
Vincent Lee committed 2019-02-10 20:11:56 -06:00
1 parent 70c5e51df4
commit 3227e1b591
17 files changed
+253 -528

No files matched your search

@@ -101,12 +101,6 @@ public final class BotaniaStateProps {
// BlockEnchanter
public static final EnumProperty<EnumFacing.Axis> ENCHANTER_DIRECTION = EnumProperty.create("facing", EnumFacing.Axis.class, Predicates.not(Predicates.equalTo(EnumFacing.Axis.Y)));
// BlockGhostRail
public static final EnumProperty<RailShape> RAIL_DIRECTION = BlockRailPowered.SHAPE;
// BlockLightRelay
public static final EnumProperty<LuminizerVariant> LUMINIZER_VARIANT = EnumProperty.create("variant", LuminizerVariant.class);
// BlockModDoubleFlower (white to gray)
public static final EnumProperty<EnumDyeColor> DOUBLEFLOWER_VARIANT_1 = EnumProperty.create("df_variant", EnumDyeColor.class, new Predicate<EnumDyeColor>() {
@Override
@@ -12,15 +12,17 @@ package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.fluid.IFluidState;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.tile.TileCacophonium;
@@ -32,62 +34,44 @@ import java.util.List;
public class BlockCacophonium extends BlockMod {
protected BlockCacophonium() {
super(Material.WOOD, LibBlockNames.CACOPHONIUM);
setHardness(0.8F);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@Override
public BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
protected BlockCacophonium(Builder builder) {
super(builder);
setDefaultState(stateContainer.getBaseState().with(BotaniaStateProps.POWERED, false));
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 8 : 0;
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(BotaniaStateProps.POWERED, meta == 8);
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
builder.add(BotaniaStateProps.POWERED);
}
@Override
public boolean canSilkHarvest(World world, BlockPos pos, @Nonnull IBlockState state, EntityPlayer player) {
return false;
}
@Override
public boolean registerInCreative() {
public boolean canSilkHarvest(@Nonnull IBlockState state, IWorldReader world, BlockPos pos, EntityPlayer player) {
return false;
}
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0 || world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.getValue(BotaniaStateProps.POWERED);
boolean powered = state.get(BotaniaStateProps.POWERED);
if(power && !powered) {
TileEntity tile = world.getTileEntity(pos);
if(tile != null && tile instanceof TileCacophonium)
((TileCacophonium) tile).annoyDirewolf();
world.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, true), 4);
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, true), 4);
} else if(!power && powered)
world.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, false), 4);
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false), 4);
}
@Override
public boolean removedByPlayer(@Nonnull IBlockState state, World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player, boolean willHarvest) {
public boolean removedByPlayer(@Nonnull IBlockState state, World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player, boolean willHarvest, IFluidState fluid) {
if (willHarvest) {
// Copy of super.removedByPlayer but don't set to air yet
// This is so getDrops below will have a TE to work with
onBlockHarvested(world, pos, state, player);
return true;
} else {
return super.removedByPlayer(state, world, pos, player, willHarvest);
return super.removedByPlayer(state, world, pos, player, willHarvest, fluid);
}
}
@@ -95,14 +79,14 @@ public class BlockCacophonium extends BlockMod {
public void harvestBlock(@Nonnull World world, EntityPlayer player, @Nonnull BlockPos pos, @Nonnull IBlockState state, TileEntity te, ItemStack stack) {
super.harvestBlock(world, player, pos, state, te, stack);
// Now delete the block and TE
world.setBlockToAir(pos);
world.removeBlock(pos);
}
@Override
public void getDrops(NonNullList<ItemStack> stacks, IBlockAccess world, BlockPos pos, @Nonnull IBlockState state, int fortune) {
public void getDrops(@Nonnull IBlockState state, NonNullList<ItemStack> stacks, World world, BlockPos pos, int fortune) {
TileEntity tile = world.getTileEntity(pos);
if(tile != null && tile instanceof TileCacophonium) {
stacks.add(new ItemStack(Blocks.NOTEBLOCK));
stacks.add(new ItemStack(Blocks.NOTE_BLOCK));
ItemStack thingy = ((TileCacophonium) tile).stack;
if(!thingy.isEmpty())
stacks.add(thingy.copy());
@@ -116,7 +100,7 @@ public class BlockCacophonium extends BlockMod {
@Nonnull
@Override
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
public TileEntity createTileEntity(@Nonnull IBlockState state, @Nonnull IBlockReader world) {
return new TileCacophonium();
}
@@ -10,50 +10,45 @@
*/
package vazkii.botania.common.block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.init.Particles;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.block.tile.TileCocoon;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import javax.annotation.Nonnull;
import java.util.Random;
public class BlockCocoon extends BlockMod implements ILexiconable {
private static final AxisAlignedBB AABB = new AxisAlignedBB(3.0/16, 0, 3.0/16, 13.0/16, 0.875, 13.0/16);;
private static final VoxelShape SHAPE = makeCuboidShape(3, 0, 3, 13, 14, 13);;
protected BlockCocoon() {
super(Material.CLOTH, LibBlockNames.COCOON);
setHardness(3.0F);
setResistance(50.0F);
setSoundType(SoundType.CLOTH);
protected BlockCocoon(Builder builder) {
super(builder);
}
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
return AABB;
public VoxelShape getShape(IBlockState state, IBlockReader world, BlockPos pos) {
return SHAPE;
}
@Override
@@ -61,11 +56,6 @@ public class BlockCocoon extends BlockMod implements ILexiconable {
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Nonnull
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
@@ -73,21 +63,21 @@ public class BlockCocoon extends BlockMod implements ILexiconable {
}
@Override
public void onEntityCollision(World world, BlockPos pos, IBlockState state, Entity e) {
public void onEntityCollision(IBlockState state, World world, BlockPos pos, Entity e) {
if(!world.isRemote && e instanceof EntityItem) {
EntityItem item = (EntityItem) e;
ItemStack stack = item.getItem();
addStack(world, pos, stack, false);
if(stack.isEmpty())
item.setDead();
item.remove();
}
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
public boolean onBlockActivated(IBlockState state, World world, BlockPos pos, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
ItemStack stack = player.getHeldItem(hand);
return addStack(world, pos, stack, player.capabilities.isCreativeMode);
return addStack(world, pos, stack, player.abilities.isCreativeMode);
}
private boolean addStack(World world, BlockPos pos, ItemStack stack, boolean creative) {
@@ -100,12 +90,12 @@ public class BlockCocoon extends BlockMod implements ILexiconable {
if(!creative)
stack.shrink(1);
cocoon.emeraldsGiven++;
((WorldServer) world).spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0, 0, 0, 0.5);
((WorldServer) world).spawnParticle(Particles.HAPPY_VILLAGER, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0, 0, 0, 0.5);
} else if(item == Items.CHORUS_FRUIT && cocoon.chorusFruitGiven < TileCocoon.MAX_CHORUS_FRUITS) {
if(!creative)
stack.shrink(1);
cocoon.chorusFruitGiven++;
((WorldServer) world).spawnParticle(EnumParticleTypes.PORTAL, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, 32, 0, 0, 0, 0.5);
((WorldServer) world).spawnParticle(Particles.PORTAL, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, 32, 0, 0, 0, 0.5);
}
}
@@ -117,12 +107,12 @@ public class BlockCocoon extends BlockMod implements ILexiconable {
@Nonnull
@Override
public Item getItemDropped(IBlockState state, @Nonnull Random rand, int fortune) {
public Item getItemDropped(IBlockState state, World world, BlockPos pos, int fortune) {
return Items.AIR;
}
@Override
public boolean canSilkHarvest(World world, BlockPos pos, @Nonnull IBlockState state, EntityPlayer player) {
public boolean canSilkHarvest(@Nonnull IBlockState state, IWorldReader world, BlockPos pos, EntityPlayer player) {
return false;
}
@@ -133,7 +123,7 @@ public class BlockCocoon extends BlockMod implements ILexiconable {
@Nonnull
@Override
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
public TileEntity createTileEntity(@Nonnull IBlockState state, @Nonnull IBlockReader world) {
return new TileCocoon();
}
@@ -144,7 +134,7 @@ public class BlockCocoon extends BlockMod implements ILexiconable {
@Nonnull
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
public BlockFaceShape getBlockFaceShape(IBlockReader world, IBlockState state, BlockPos pos, EnumFacing side) {
return side.getAxis() == EnumFacing.Axis.Y ? BlockFaceShape.CENTER_BIG : BlockFaceShape.MIDDLE_POLE_THICK;
}
@@ -10,9 +10,9 @@
*/
package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
@@ -20,7 +20,10 @@ import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
@@ -28,7 +31,6 @@ import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.api.lexicon.ILexiconable;
@@ -46,65 +48,35 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
private static final ResourceLocation LOOT_TABLE = new ResourceLocation(LibMisc.MOD_ID, "fel_blaze");
private static final String TAG_FEL_SPAWNED = "Botania-FelSpawned";
public BlockFelPumpkin() {
super(Material.GOURD, LibBlockNames.FEL_PUMPKIN);
setHardness(1F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
}
@Nonnull
@Override
public BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BotaniaStateProps.CARDINALS);
public BlockFelPumpkin(Builder builder) {
super(builder);
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.HORIZONTAL_FACING, EnumFacing.SOUTH));
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CARDINALS).getHorizontalIndex();
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.byHorizontalIndex(meta));
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
builder.add(BlockStateProperties.HORIZONTAL_FACING);
}
@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
super.onBlockAdded(world, pos, state);
public void onBlockAdded(IBlockState state, World world, BlockPos pos, IBlockState oldState) {
super.onBlockAdded(state, world, pos, oldState);
if(!world.isRemote && world.getBlockState(pos.down()).getBlock() == Blocks.IRON_BARS && world.getBlockState(pos.down(2)).getBlock() == Blocks.IRON_BARS) {
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
world.setBlockState(pos.down(), Blocks.AIR.getDefaultState(), 2);
world.setBlockState(pos.down(2), Blocks.AIR.getDefaultState(), 2);
world.setBlockState(pos, Blocks.AIR.getDefaultState());
world.setBlockState(pos.down(), Blocks.AIR.getDefaultState());
world.setBlockState(pos.down(2), Blocks.AIR.getDefaultState());
EntityBlaze blaze = new EntityBlaze(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.getDifficultyForLocation(pos), null);
blaze.onInitialSpawn(world.getDifficultyForLocation(pos), null, null);
world.spawnEntity(blaze);
world.notifyNeighborsOfStateChange(pos, Blocks.AIR, false);
world.notifyNeighborsOfStateChange(pos.down(), Blocks.AIR, false);
world.notifyNeighborsOfStateChange(pos.down(2), Blocks.AIR, false);
}
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
world.setBlockState(pos, state.withProperty(BotaniaStateProps.CARDINALS, placer.getHorizontalFacing().getOpposite()));
}
// Legacy support
@SubscribeEvent
public static void onDrops(LivingDropsEvent event) {
if(event.getEntityLiving() instanceof EntityBlaze && event.getEntityLiving().getEntityData().getBoolean(TAG_FEL_SPAWNED))
if(event.getDrops().isEmpty())
event.getDrops().add(new EntityItem(event.getEntityLiving().world, event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ, new ItemStack(Items.BLAZE_POWDER, 6)));
else for(EntityItem item : event.getDrops()) {
ItemStack stack = item.getItem();
if(stack.getItem() == Items.BLAZE_ROD)
item.setItem(new ItemStack(Items.BLAZE_POWDER, stack.getCount() * 10));
}
public IBlockState getStateForPlacement(BlockItemUseContext context) {
return getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING, context.getNearestLookingDirection().getOpposite());
}
@Override
@@ -112,10 +84,4 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
return LexiconData.gardenOfGlass;
}
@OnlyIn(Dist.CLIENT)
@Override
public void registerModels() {
ModelHandler.registerBlockToState(this, 0, getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.NORTH));
}
}
@@ -13,18 +13,19 @@ package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRailBase;
import net.minecraft.block.BlockRailPowered;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.state.IProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.state.properties.RailShape;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.minecart.MinecartUpdateEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.api.lexicon.ILexiconable;
@@ -44,29 +45,14 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable, IMode
private static final String TAG_FLOAT_TICKS = "Botania_FloatTicks";
public BlockGhostRail() {
super(true);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.RAIL_DIRECTION, EnumRailDirection.NORTH_SOUTH));
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.GHOST_RAIL));
setTranslationKey(LibBlockNames.GHOST_RAIL);
}
@Nonnull
@Override
public BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BotaniaStateProps.RAIL_DIRECTION);
public BlockGhostRail(Builder builder) {
super(true, builder);
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.RAIL_SHAPE_STRAIGHT, RailShape.NORTH_SOUTH));
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.RAIL_DIRECTION).getMetadata();
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(BotaniaStateProps.RAIL_DIRECTION, EnumRailDirection.byMetadata(meta));
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
builder.add(BlockStateProperties.RAIL_SHAPE_STRAIGHT);
}
@SubscribeEvent
@@ -107,8 +93,8 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable, IMode
@Nonnull
@Override
public IProperty<EnumRailDirection> getShapeProperty() {
return BlockRailPowered.SHAPE;
public IProperty<RailShape> getShapeProperty() {
return BlockStateProperties.RAIL_SHAPE_STRAIGHT;
}
@OnlyIn(Dist.CLIENT)
@@ -10,25 +10,24 @@
*/
package vazkii.botania.common.block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.Block;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReaderBase;
import net.minecraft.world.World;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.ModelLoader;
@@ -48,47 +47,32 @@ import vazkii.botania.common.block.tile.TileSimpleInventory;
import vazkii.botania.common.core.helper.InventoryHelper;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import javax.annotation.Nonnull;
import java.util.Random;
public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable, IWandHUD, ILexiconable {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.25, 0, 0.25, 0.75, 1.15, 0.75);
private static final VoxelShape SHAPE = makeCuboidShape(4, 0, 4, 12, 18.4, 12);
protected BlockHourglass() {
super(Material.IRON, LibBlockNames.HOURGLASS);
setHardness(2.0F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
protected BlockHourglass(Builder builder) {
super(builder);
setDefaultState(stateContainer.getBaseState().with(BotaniaStateProps.POWERED, false));
}
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
return AABB;
}
@Nonnull
@Override
public BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
public VoxelShape getShape(IBlockState state, IBlockReader world, BlockPos pos) {
return SHAPE;
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 1 : 0;
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(BotaniaStateProps.POWERED, meta == 1);
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
builder.add(BotaniaStateProps.POWERED);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float xs, float ys, float zs) {
public boolean onBlockActivated(IBlockState state, World world, BlockPos pos, EntityPlayer player, EnumHand hand, EnumFacing side, float xs, float ys, float zs) {
TileHourglass hourglass = (TileHourglass) world.getTileEntity(pos);
ItemStack hgStack = hourglass.getItemHandler().getStackInSlot(0);
ItemStack stack = player.getHeldItem(hand);
@@ -122,33 +106,28 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
}
@Override
public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
return state.getValue(BotaniaStateProps.POWERED) ? 15 : 0;
public int getWeakPower(IBlockState state, IBlockReader world, BlockPos pos, EnumFacing side) {
return state.get(BotaniaStateProps.POWERED) ? 15 : 0;
}
@Override
public int tickRate(World world) {
public int tickRate(IWorldReaderBase world) {
return 4;
}
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
if(state.getValue(BotaniaStateProps.POWERED))
world.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, false), 1 | 2);
public void tick(IBlockState state, World world, BlockPos pos, Random rand) {
if(state.get(BotaniaStateProps.POWERED))
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false), 1 | 2);
}
@Override
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
public void onReplaced(@Nonnull IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState newState, boolean isMoving) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.breakBlock(world, pos, state);
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
super.onReplaced(state, world, pos, newState, isMoving);
}
@Override
@@ -169,7 +148,7 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
@Nonnull
@Override
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
public TileEntity createTileEntity(@Nonnull IBlockState state, @Nonnull IBlockReader world) {
return new TileHourglass();
}
@@ -190,9 +169,9 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
@OnlyIn(Dist.CLIENT)
@Override
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
public void renderHUD(Minecraft mc, World world, BlockPos pos) {
TileHourglass tile = (TileHourglass) world.getTileEntity(pos);
tile.renderHUD(res);
tile.renderHUD();
}
@Override
@@ -200,17 +179,9 @@ public class BlockHourglass extends BlockMod implements IManaTrigger, IWandable,
return LexiconData.hourglass;
}
@OnlyIn(Dist.CLIENT)
@Override
public void registerModels() {
ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(BotaniaStateProps.POWERED).build());
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(this), 0, TileHourglass.class);
ModelHandler.registerCustomItemblock(this, "hovering_hourglass");
}
@Nonnull
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
public BlockFaceShape getBlockFaceShape(IBlockReader world, IBlockState state, BlockPos pos, EnumFacing side) {
return BlockFaceShape.UNDEFINED;
}
@@ -10,21 +10,20 @@
*/
package vazkii.botania.common.block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.Block;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.items.ItemHandlerHelper;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
@@ -33,44 +32,26 @@ import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.tile.TileIncensePlate;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import javax.annotation.Nonnull;
public class BlockIncensePlate extends BlockMod implements ILexiconable {
private static final AxisAlignedBB X_AABB = new AxisAlignedBB(0.375, 0, 0.125, 0.625, 1/16.0, 0.875);
private static final AxisAlignedBB Z_AABB = new AxisAlignedBB(0.125, 0, 0.375, 0.875, 1/16.0, 0.625);
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() {
super(Material.WOOD, LibBlockNames.INCENSE_PLATE);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
}
@Nonnull
@Override
public BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BotaniaStateProps.CARDINALS);
protected BlockIncensePlate(Builder builder) {
super(builder);
setDefaultState(stateContainer.getBaseState().with(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CARDINALS).getIndex();
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
if (meta < 2 || meta > 5) {
meta = 2;
}
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.byIndex(meta));
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
builder.add(BotaniaStateProps.CARDINALS);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
public boolean onBlockActivated(IBlockState state, World world, BlockPos pos, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
TileIncensePlate plate = (TileIncensePlate) world.getTileEntity(pos);
ItemStack plateStack = plate.getItemHandler().getStackInSlot(0);
ItemStack stack = player.getHeldItem(hand);
@@ -103,8 +84,8 @@ public class BlockIncensePlate extends BlockMod implements ILexiconable {
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
world.setBlockState(pos, state.withProperty(BotaniaStateProps.CARDINALS, placer.getHorizontalFacing().getOpposite()));
public IBlockState getStateForPlacement(BlockItemUseContext context) {
return getDefaultState().with(BotaniaStateProps.CARDINALS, context.getNearestLookingDirection().getOpposite());
}
@Override
@@ -119,19 +100,14 @@ public class BlockIncensePlate extends BlockMod implements ILexiconable {
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
if(state.getValue(BotaniaStateProps.CARDINALS).getAxis() == EnumFacing.Axis.X) {
return X_AABB;
public VoxelShape getShape(IBlockState state, IBlockReader world, BlockPos pos) {
if(state.get(BotaniaStateProps.CARDINALS).getAxis() == EnumFacing.Axis.X) {
return X_SHAPE;
} else {
return Z_AABB;
return Z_SHAPE;
}
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
@@ -144,7 +120,7 @@ public class BlockIncensePlate extends BlockMod implements ILexiconable {
@Nonnull
@Override
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
public TileEntity createTileEntity(@Nonnull IBlockState state, @Nonnull IBlockReader world) {
return new TileIncensePlate();
}
@@ -155,7 +131,7 @@ public class BlockIncensePlate extends BlockMod implements ILexiconable {
@Nonnull
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
public BlockFaceShape getBlockFaceShape(IBlockReader world, IBlockState state, BlockPos pos, EnumFacing side) {
return BlockFaceShape.UNDEFINED;
}
@@ -11,8 +11,6 @@
package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
@@ -25,14 +23,15 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.tile.TileLightRelay;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import javax.annotation.Nonnull;
import java.util.ArrayList;
@@ -40,19 +39,17 @@ import java.util.List;
public class BlockLightLauncher extends BlockMod implements ILexiconable {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 0.25, 1);
private static final VoxelShape SHAPE = makeCuboidShape(0, 0, 0, 16, 4, 16);
public BlockLightLauncher() {
super(Material.WOOD, LibBlockNames.LIGHT_LAUNCHER);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
public BlockLightLauncher(Builder builder) {
super(builder);
setDefaultState(stateContainer.getBaseState().with(BotaniaStateProps.POWERED, false));
}
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
return AABB;
public VoxelShape getShape(IBlockState state, IBlockReader world, BlockPos pos) {
return SHAPE;
}
@Nonnull
@@ -61,47 +58,26 @@ public class BlockLightLauncher extends BlockMod implements ILexiconable {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 8 : 0;
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(BotaniaStateProps.POWERED, meta == 8);
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
public boolean isPassable(IBlockAccess world, BlockPos pos) {
return false;
}
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0|| world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.getValue(BotaniaStateProps.POWERED);
boolean powered = state.get(BotaniaStateProps.POWERED);
if(power && !powered) {
pickUpEntities(world, pos);
world.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, true), 4);
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, true), 4);
} else if(!power && powered)
world.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, false), 4);
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false), 4);
}
private void pickUpEntities(World world, BlockPos pos) {
List<TileLightRelay> relays = new ArrayList<>();
for(EnumFacing dir : EnumFacing.HORIZONTALS) {
for(EnumFacing dir : EnumFacing.BY_INDEX) {
TileEntity tile = world.getTileEntity(pos.offset(dir));
if(tile instanceof TileLightRelay) {
TileLightRelay relay = (TileLightRelay) tile;
@@ -131,7 +107,7 @@ public class BlockLightLauncher extends BlockMod implements ILexiconable {
@Nonnull
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
public BlockFaceShape getBlockFaceShape(IBlockReader world, IBlockState state, BlockPos pos, EnumFacing side) {
return side == EnumFacing.DOWN ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
}
@@ -11,133 +11,89 @@
package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReaderBase;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.LuminizerVariant;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.client.core.handler.ModelHandler;
import vazkii.botania.common.block.tile.TileLightRelay;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import javax.annotation.Nonnull;
import java.util.Random;
public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable {
private static final AxisAlignedBB AABB = new AxisAlignedBB(5.0/16, 5.0/16, 5.0/16, 11.0/16, 11.0/16, 11.0/16);
private static final VoxelShape SHAPE = makeCuboidShape(5, 5, 5, 11, 11, 11);
private final LuminizerVariant variant;
protected BlockLightRelay() {
super(Material.GLASS, LibBlockNames.LIGHT_RELAY);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.LUMINIZER_VARIANT, LuminizerVariant.DEFAULT).withProperty(BotaniaStateProps.POWERED, false));
protected BlockLightRelay(LuminizerVariant variant, Builder builder) {
super(builder);
this.variant = variant;
setDefaultState(stateContainer.getBaseState().with(BotaniaStateProps.POWERED, false));
}
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
return AABB;
}
@Nonnull
@Override
public BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BotaniaStateProps.LUMINIZER_VARIANT, BotaniaStateProps.POWERED);
public VoxelShape getShape(IBlockState state, IBlockReader world, BlockPos pos) {
return SHAPE;
}
@Override
public int getMetaFromState(IBlockState state) {
int meta = state.getValue(BotaniaStateProps.LUMINIZER_VARIANT).ordinal();
if (state.getValue(BotaniaStateProps.POWERED)) {
meta |= 8;
} else {
meta &= -9;
}
return meta;
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
boolean powered = (meta & 8) != 0;
meta &= -9;
return getDefaultState().withProperty(BotaniaStateProps.POWERED, powered).withProperty(BotaniaStateProps.LUMINIZER_VARIANT, LuminizerVariant.class.getEnumConstants()[meta]);
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
builder.add(BotaniaStateProps.POWERED);
}
@Override
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
for(int i = 0; i < 4; i++)
list.add(new ItemStack(this, 1, i));
}
@Override
public int damageDropped(IBlockState state) {
return state.getValue(BotaniaStateProps.LUMINIZER_VARIANT).ordinal();
}
@Override
public boolean isPassable(IBlockAccess world, BlockPos pos) {
return false;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
public boolean onBlockActivated(IBlockState state, World world, BlockPos pos, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
((TileLightRelay) world.getTileEntity(pos)).mountEntity(player);
return true;
}
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) {
return NULL_AABB;
}
@Override
public int tickRate(World world) {
public int tickRate(IWorldReaderBase world) {
return 2;
}
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
if(!worldIn.isRemote && state.getValue(BotaniaStateProps.LUMINIZER_VARIANT) == LuminizerVariant.TOGGLE) {
if(state.getValue(BotaniaStateProps.POWERED) && !worldIn.isBlockPowered(pos))
worldIn.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, false));
else if(!state.getValue(BotaniaStateProps.POWERED) && worldIn.isBlockPowered(pos))
worldIn.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, true));
if(!worldIn.isRemote && variant == LuminizerVariant.TOGGLE) {
if(state.get(BotaniaStateProps.POWERED) && !worldIn.isBlockPowered(pos))
worldIn.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false));
else if(!state.get(BotaniaStateProps.POWERED) && worldIn.isBlockPowered(pos))
worldIn.setBlockState(pos, state.with(BotaniaStateProps.POWERED, true));
}
}
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
world.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, false), 1 | 2);
public void tick(IBlockState state, World world, BlockPos pos, Random rand) {
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false), 1 | 2);
}
@Override
public boolean canProvidePower(IBlockState state) {
return state.getValue(BotaniaStateProps.LUMINIZER_VARIANT) == LuminizerVariant.DETECTOR;
return variant == LuminizerVariant.DETECTOR;
}
@Override
public int getWeakPower(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing s) {
return state.getValue(BotaniaStateProps.LUMINIZER_VARIANT) == LuminizerVariant.DETECTOR
&& state.getValue(BotaniaStateProps.POWERED) ? 15 : 0;
public int getWeakPower(IBlockState state, IBlockReader world, BlockPos pos, EnumFacing s) {
return variant == LuminizerVariant.DETECTOR
&& state.get(BotaniaStateProps.POWERED) ? 15 : 0;
}
@Override
@@ -145,11 +101,6 @@ public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Nonnull
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
@@ -163,7 +114,7 @@ public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable
@Nonnull
@Override
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
public TileEntity createTileEntity(@Nonnull IBlockState state, @Nonnull IBlockReader world) {
return new TileLightRelay();
}
@@ -177,17 +128,9 @@ public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable
return LexiconData.luminizerTransport;
}
@OnlyIn(Dist.CLIENT)
@Override
public void registerModels() {
int i = 0;
for(LuminizerVariant v : LuminizerVariant.values())
ModelHandler.registerBlockToState(this, i++, getDefaultState().withProperty(BotaniaStateProps.LUMINIZER_VARIANT, v));
}
@Nonnull
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
public BlockFaceShape getBlockFaceShape(IBlockReader world, IBlockState state, BlockPos pos, EnumFacing side) {
return BlockFaceShape.UNDEFINED;
}
@@ -27,17 +27,15 @@ import vazkii.botania.common.lib.LibBlockNames;
public class BlockManaBomb extends BlockMod implements IManaTrigger, ILexiconable {
public BlockManaBomb() {
super(Material.WOOD, LibBlockNames.MANA_BOMB);
setHardness(12.0F);
setSoundType(SoundType.WOOD);
public BlockManaBomb(Builder builder) {
super(builder);
}
@Override
public void onBurstCollision(IManaBurst burst, World world, BlockPos pos) {
if(!burst.isFake() && !world.isRemote) {
world.playEvent(2001, pos, Block.getStateId(getDefaultState()));
world.setBlockToAir(pos);
world.removeBlock(pos);
EntityManaStorm storm = new EntityManaStorm(world);
storm.setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
world.spawnEntity(storm);
@@ -30,26 +30,18 @@ import java.util.Random;
public class BlockRoot extends BlockMod implements ILexiconable {
public BlockRoot() {
super(Material.PLANTS, LibBlockNames.ROOT);
setHardness(1.2F);
setSoundType(SoundType.WOOD);
public BlockRoot(Builder builder) {
super(builder);
}
@Nonnull
@Override
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) {
return new ItemStack(this);
}
@Nonnull
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
public Item getItemDropped(IBlockState state, World world, BlockPos pos, int fortune) {
return ModItems.livingroot;
}
@Override
public int quantityDropped(Random r) {
public int quantityDropped(IBlockState state, Random r) {
return 2 + r.nextInt(3);
}
@@ -14,16 +14,17 @@ import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.items.ItemHandlerHelper;
import vazkii.botania.api.lexicon.ILexiconable;
@@ -33,7 +34,6 @@ import vazkii.botania.common.block.tile.TileSimpleInventory;
import vazkii.botania.common.block.tile.TileSparkChanger;
import vazkii.botania.common.core.helper.InventoryHelper;
import vazkii.botania.common.item.ItemSparkUpgrade;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
@@ -41,37 +41,22 @@ import javax.annotation.Nonnull;
public class BlockSparkChanger extends BlockMod implements ILexiconable {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 3.0/16, 1);
private static final VoxelShape SHAPE = makeCuboidShape(0, 0, 0, 16, 3, 16);
public BlockSparkChanger() {
super(Material.ROCK, LibBlockNames.SPARK_CHANGER);
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, true));
public BlockSparkChanger(Builder builder) {
super(builder);
setDefaultState(stateContainer.getBaseState().with(BotaniaStateProps.POWERED, true));
}
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
return AABB;
}
@Nonnull
@Override
public BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
public VoxelShape getShape(IBlockState state, IBlockReader world, BlockPos pos) {
return SHAPE;
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 8 : 0;
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(BotaniaStateProps.POWERED, meta == 8);
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
builder.add(BotaniaStateProps.POWERED);
}
@Override
@@ -79,30 +64,20 @@ public class BlockSparkChanger extends BlockMod implements ILexiconable {
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean isPassable(IBlockAccess world, BlockPos pos) {
return false;
}
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0 || world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.getValue(BotaniaStateProps.POWERED);
boolean powered = state.get(BotaniaStateProps.POWERED);
if(power && !powered) {
((TileSparkChanger) world.getTileEntity(pos)).doSwap();
world.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, true), 4);
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, true), 4);
} else if(!power && powered)
world.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, false), 4);
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, false), 4);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
public boolean onBlockActivated(IBlockState state, World world, BlockPos pos, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
TileSparkChanger changer = (TileSparkChanger) world.getTileEntity(pos);
ItemStack pstack = player.getHeldItem(hand);
ItemStack cstack = changer.getItemHandler().getStackInSlot(0);
@@ -113,7 +88,7 @@ public class BlockSparkChanger extends BlockMod implements ILexiconable {
ItemHandlerHelper.giveItemToPlayer(player, cstack);
return true;
} else if(!pstack.isEmpty() && pstack.getItem() instanceof ItemSparkUpgrade) {
changer.getItemHandler().setStackInSlot(0, pstack.splitStack(1));
changer.getItemHandler().setStackInSlot(0, pstack.split(1));
world.updateComparatorOutputLevel(pos, this);
changer.markDirty();
@@ -124,12 +99,12 @@ public class BlockSparkChanger extends BlockMod implements ILexiconable {
}
@Override
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
public void onReplaced(@Nonnull IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState newState, boolean isMoving) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.breakBlock(world, pos, state);
super.onReplaced(state, world, pos, newState, isMoving);
}
@Override
@@ -153,7 +128,7 @@ public class BlockSparkChanger extends BlockMod implements ILexiconable {
@Nonnull
@Override
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
public TileEntity createTileEntity(@Nonnull IBlockState state, @Nonnull IBlockReader world) {
return new TileSparkChanger();
}
@@ -164,7 +139,7 @@ public class BlockSparkChanger extends BlockMod implements ILexiconable {
@Nonnull
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
public BlockFaceShape getBlockFaceShape(IBlockReader world, IBlockState state, BlockPos pos, EnumFacing side) {
return side == EnumFacing.DOWN ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
}
@@ -29,6 +29,7 @@ import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.recipe.RecipeManaInfusion;
import vazkii.botania.api.state.enums.LuminizerVariant;
import vazkii.botania.api.subtile.SubTileEntity;
import vazkii.botania.common.block.corporea.BlockCorporeaCrystalCube;
import vazkii.botania.common.block.corporea.BlockCorporeaFunnel;
@@ -315,20 +316,23 @@ public final class ModBlocks {
public static final Block doubleFlower2 = new BlockModDoubleFlower2();
@ObjectHolder(LibBlockNames.FAKE_AIR) public static Block fakeAir;
@ObjectHolder(LibBlockNames.BLAZE_BLOCK) public static Block blazeBlock;
public static final Block corporeaInterceptor = new BlockCorporeaInterceptor(Block.Builder.create(Material.IRON).hardnessAndResistance(5.5F).sound(SoundType.METAL)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CORPOREA_INTERCEPTOR);
public static final Block corporeaCrystalCube = new BlockCorporeaCrystalCube(Block.Builder.create(Material.IRON).hardnessAndResistance(5.5F).sound(SoundType.METAL)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CORPOREA_CRYSTAL_CUBE);
public static final Block incensePlate = new BlockIncensePlate();
public static final Block hourglass = new BlockHourglass();
public static final Block ghostRail = new BlockGhostRail();
public static final Block sparkChanger = new BlockSparkChanger();
public static final Block root = new BlockRoot();
public static final Block felPumpkin = new BlockFelPumpkin();
public static final Block cocoon = new BlockCocoon();
public static final Block lightRelay = new BlockLightRelay();
public static final Block lightLauncher = new BlockLightLauncher();
public static final Block manaBomb = new BlockManaBomb();
public static final Block cacophonium = new BlockCacophonium();
public static final Block bellows = new BlockBellows();
@ObjectHolder(LibBlockNames.CORPOREA_INTERCEPTOR) public static Block corporeaInterceptor;
@ObjectHolder(LibBlockNames.CORPOREA_CRYSTAL_CUBE) public static Block corporeaCrystalCube;
@ObjectHolder(LibBlockNames.INCENSE_PLATE) public static Block incensePlate;
@ObjectHolder(LibBlockNames.HOURGLASS) public static Block hourglass;
@ObjectHolder(LibBlockNames.GHOST_RAIL) public static Block ghostRail;
@ObjectHolder(LibBlockNames.SPARK_CHANGER) public static Block sparkChanger;
@ObjectHolder(LibBlockNames.ROOT) public static Block root;
@ObjectHolder(LibBlockNames.FEL_PUMPKIN) public static Block felPumpkin;
@ObjectHolder(LibBlockNames.COCOON) public static Block cocoon;
@ObjectHolder(LibBlockNames.LIGHT_RELAY) public static Block lightRelayDefault;
@ObjectHolder("detector" + LibBlockNames.LIGHT_RELAY_SUFFIX) public static Block lightRelayDetector;
@ObjectHolder("toggle" + LibBlockNames.LIGHT_RELAY_SUFFIX) public static Block lightRelayToggle;
@ObjectHolder("fork" + LibBlockNames.LIGHT_RELAY_SUFFIX) public static Block lightRelayFork;
@ObjectHolder(LibBlockNames.LIGHT_LAUNCHER) public static Block lightLauncher;
@ObjectHolder(LibBlockNames.MANA_BOMB) public static Block manaBomb;
@ObjectHolder(LibBlockNames.CACOPHONIUM) public static Block cacophonium;
@ObjectHolder(LibBlockNames.BELLOWS) public static Block bellows;
@ObjectHolder(LibBlockNames.BIFROST_PERM) public static Block bifrostPerm;
@ObjectHolder(LibBlockNames.CELL_BLOCK) public static Block cellBlock;
@ObjectHolder(LibBlockNames.RED_STRING_INTERCEPTOR) public static Block redStringInterceptor;
@@ -514,20 +518,26 @@ public final class ModBlocks {
r.register(new BlockFakeAir(Block.Builder.create(Material.STRUCTURE_VOID).needsRandomTick()).setRegistryName(LibMisc.MOD_ID, LibBlockNames.FAKE_AIR));
r.register(new BlockModLexiconable(Block.Builder.create(Material.IRON).hardnessAndResistance(3, 10).sound(SoundType.METAL).lightValue(15), (w, po, pl, st) -> LexiconData.blazeBlock)
.setRegistryName(LibMisc.MOD_ID, LibBlockNames.BLAZE_BLOCK));
r.register(corporeaInterceptor);
r.register(corporeaCrystalCube);
r.register(incensePlate);
r.register(hourglass);
r.register(ghostRail);
r.register(sparkChanger);
r.register(root);
r.register(felPumpkin);
r.register(cocoon);
r.register(lightRelay);
r.register(lightLauncher);
r.register(manaBomb);
r.register(cacophonium);
r.register(bellows);
r.register(new BlockCorporeaInterceptor(Block.Builder.create(Material.IRON).hardnessAndResistance(5.5F).sound(SoundType.METAL)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CORPOREA_INTERCEPTOR));
r.register(new BlockCorporeaCrystalCube(Block.Builder.create(Material.IRON).hardnessAndResistance(5.5F).sound(SoundType.METAL)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CORPOREA_CRYSTAL_CUBE));
r.register(new BlockIncensePlate(Block.Builder.create(Material.WOOD).hardnessAndResistance(2).sound(SoundType.WOOD)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.INCENSE_PLATE));
r.register(new BlockHourglass(Block.Builder.create(Material.IRON).hardnessAndResistance(2).sound(SoundType.METAL)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.HOURGLASS));
r.register(new BlockGhostRail(Block.Builder.create(Material.CIRCUITS).doesNotBlockMovement().hardnessAndResistance(0.7F).sound(SoundType.METAL)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.GHOST_RAIL));
r.register(new BlockSparkChanger(Block.Builder.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.SPARK_CHANGER));
r.register(new BlockRoot(Block.Builder.create(Material.PLANTS).hardnessAndResistance(1.2F).sound(SoundType.WOOD)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.ROOT));
r.register(new BlockFelPumpkin(Block.Builder.from(Blocks.CARVED_PUMPKIN)));
r.register(new BlockCocoon(Block.Builder.create(Material.CLOTH).hardnessAndResistance(3, 60).sound(SoundType.CLOTH)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.COCOON));
builder = Block.Builder.create(Material.GLASS).doesNotBlockMovement();
r.register(new BlockLightRelay(LuminizerVariant.DEFAULT, builder).setRegistryName(LibMisc.MOD_ID, LibBlockNames.LIGHT_RELAY));
r.register(new BlockLightRelay(LuminizerVariant.DETECTOR, builder).setRegistryName(LibMisc.MOD_ID, "detector" + LibBlockNames.LIGHT_RELAY_SUFFIX));
r.register(new BlockLightRelay(LuminizerVariant.FORK, builder).setRegistryName(LibMisc.MOD_ID, "fork" + LibBlockNames.LIGHT_RELAY_SUFFIX));
r.register(new BlockLightRelay(LuminizerVariant.TOGGLE, builder).setRegistryName(LibMisc.MOD_ID, "toggle" + LibBlockNames.LIGHT_RELAY_SUFFIX));
r.register(new BlockLightLauncher(Block.Builder.create(Material.WOOD).hardnessAndResistance(2).sound(SoundType.WOOD)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.LIGHT_LAUNCHER));
r.register(new BlockManaBomb(Block.Builder.create(Material.WOOD).hardnessAndResistance(12).sound(SoundType.WOOD)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.MANA_BOMB));
r.register(new BlockCacophonium(Block.Builder.create(Material.WOOD).hardnessAndResistance(0.8F)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CACOPHONIUM));
r.register(new BlockBellows(Block.Builder.create(Material.WOOD).hardnessAndResistance(2).sound(SoundType.WOOD)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.BELLOWS));
r.register(new BlockBifrostPerm(Block.Builder.create(Material.GLASS).hardnessAndResistance(0.3F).lightValue(15).sound(SoundType.GLASS)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.BIFROST_PERM));
r.register(new BlockCell(Block.Builder.create(Material.GOURD).sound(SoundType.CLOTH)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CELL_BLOCK));
r.register(new BlockGaiaHead(Block.Builder.create(Material.CIRCUITS).hardnessAndResistance(1)));
@@ -10,94 +10,65 @@
*/
package vazkii.botania.common.block.mana;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.Block;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.client.core.handler.ModelHandler;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.block.tile.mana.TileBellows;
import vazkii.botania.common.entity.EntityDoppleganger;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import javax.annotation.Nonnull;
public class BlockBellows extends BlockMod implements ILexiconable {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.1875, 0, 0.1875, 1-0.1875, 10.0 / 16, 1-0.1875);
private static final VoxelShape SHAPE = makeCuboidShape(3, 0, 3, 13, 10.0, 13);
public BlockBellows() {
super(Material.WOOD, LibBlockNames.BELLOWS);
setHardness(2.0F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
public BlockBellows(Builder builder) {
super(builder);
setDefaultState(stateContainer.getBaseState().with(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
builder.add(BotaniaStateProps.CARDINALS);
}
@Nonnull
@Override
public BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BotaniaStateProps.CARDINALS);
public VoxelShape getShape(IBlockState state, IBlockReader world, BlockPos pos) {
return SHAPE;
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.CARDINALS).getIndex();
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
if (meta < 2 || meta > 5) {
meta = 2;
}
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.byIndex(meta));
}
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
return AABB;
public IBlockState getStateForPlacement(BlockItemUseContext context) {
return getDefaultState().with(BotaniaStateProps.CARDINALS, context.getNearestLookingDirection().getOpposite());
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
world.setBlockState(pos, state.withProperty(BotaniaStateProps.CARDINALS, placer.getHorizontalFacing()), 2);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
public boolean onBlockActivated(IBlockState state, World world, BlockPos pos, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
if(EntityDoppleganger.isTruePlayer(player))
((TileBellows) world.getTileEntity(pos)).interact();
return true;
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
@@ -116,7 +87,7 @@ public class BlockBellows extends BlockMod implements ILexiconable {
@Nonnull
@Override
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
public TileEntity createTileEntity(@Nonnull IBlockState state, @Nonnull IBlockReader world) {
return new TileBellows();
}
@@ -125,17 +96,9 @@ public class BlockBellows extends BlockMod implements ILexiconable {
return LexiconData.bellows;
}
@OnlyIn(Dist.CLIENT)
@Override
public void registerModels() {
ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(BotaniaStateProps.CARDINALS).build());
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(this), 0, TileBellows.class);
ModelHandler.registerCustomItemblock(this, "bellows");
}
@Nonnull
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
public BlockFaceShape getBlockFaceShape(IBlockReader world, IBlockState state, BlockPos pos, EnumFacing side) {
return BlockFaceShape.UNDEFINED;
}
@@ -187,17 +187,17 @@ public class TileHourglass extends TileSimpleInventory implements ITickable {
}
@OnlyIn(Dist.CLIENT)
public void renderHUD(ScaledResolution res) {
Minecraft mc = Minecraft.getMinecraft();
int x = res.getScaledWidth() / 2 + 10;
int y = res.getScaledHeight() / 2 - 10;
public void renderHUD() {
Minecraft mc = Minecraft.getInstance();
int x = mc.mainWindow.getScaledWidth() / 2 + 10;
int y = mc.mainWindow.getScaledHeight() / 2 - 10;
ItemStack stack = itemHandler.getStackInSlot(0);
if(!stack.isEmpty()) {
RenderHelper.enableGUIStandardItemLighting();
GlStateManager.enableRescaleNormal();
mc.getRenderItem().renderItemIntoGUI(stack, x, y);
mc.getRenderItem().renderItemOverlays(mc.fontRenderer, stack, x, y);
mc.getItemRenderer().renderItemIntoGUI(stack, x, y);
mc.getItemRenderer().renderItemOverlays(mc.fontRenderer, stack, x, y);
GlStateManager.disableRescaleNormal();
RenderHelper.disableStandardItemLighting();
@@ -15,16 +15,15 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class TileMod extends TileEntity {
@Override
public boolean shouldRefresh(World world, BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState) {
return oldState.getBlock() != newState.getBlock();
public TileMod(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
}
@Nonnull
@@ -61,6 +61,7 @@ public final class LibBlockNames {
public static final String DRUM_GATHERING = "drum_gathering";
public static final String DRUM_CANOPY = "drum_canopy";
public static final String SHINY_FLOWER_SUFFIX = "_shiny_flower";
public static final String PLATFORM = "platform";
public static final String PLATFORM_ABSTRUSE = "abstruse_platform";
public static final String PLATFORM_SPECTRAL = "spectral_platform";
public static final String PLATFORM_INFRANGIBLE = "infrangible_platform";
@@ -118,6 +119,7 @@ public final class LibBlockNames {
public static final String FEL_PUMPKIN = "fel_pumpkin";
public static final String COCOON = "cocoon";
public static final String LIGHT_RELAY = "light_relay";
public static final String LIGHT_RELAY_SUFFIX = "_" + LIGHT_RELAY;
public static final String LIGHT_LAUNCHER = "light_launcher";
public static final String MANA_BOMB = "mana_bomb";
public static final String CACOPHONIUM = "cacophonium_block";