Even more blocks

This commit is contained in:
Vincent Lee committed 2019-02-09 21:47:05 -06:00
1 parent 0a9a3aa9a6
commit f577479e30
32 files changed
+352 -616

No files matched your search

@@ -45,7 +45,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
@Override
public void render(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
String name = player.getDisplayName().getUnformattedComponentText();
String name = player.getDisplayName().getString();
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks;
@@ -56,7 +56,7 @@ public class CorporeaAutoCompleteHandler {
try {
item.getSubItems(null, curList);
for(ItemStack stack : curList)
itemNames.add(CorporeaHelper.stripControlCodes(stack.getDisplayName().getUnformattedComponentText().trim()));
itemNames.add(CorporeaHelper.stripControlCodes(stack.getDisplayName().getString().trim()));
}
catch (Exception e) {}
}
@@ -349,7 +349,7 @@ public final class HUDHandler {
profiler.startSection("crystalCube");
ItemStack target = tile.getRequestTarget();
if(!target.isEmpty()) {
String s1 = target.getDisplayName().getUnformattedComponentText();
String s1 = target.getDisplayName().getString();
String s2 = tile.getItemCount() + "x";
int strlen = Math.max(mc.fontRenderer.getStringWidth(s1), mc.fontRenderer.getStringWidth(s2));
int w = mc.mainWindow.getScaledWidth();
@@ -63,7 +63,7 @@ public final class ItemsRemainingRenderHandler {
if(customString == null) {
if(!stack.isEmpty()) {
text = TextFormatting.GREEN + stack.getDisplayName().getUnformattedComponentText();
text = TextFormatting.GREEN + stack.getDisplayName().getString();
if(count >= 0) {
int max = stack.getMaxStackSize();
int stacks = count / max;
@@ -10,18 +10,19 @@
*/
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.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import vazkii.botania.api.lexicon.ILexiconable;
@@ -40,31 +41,14 @@ import javax.annotation.Nonnull;
public class BlockAlfPortal extends BlockMod implements IWandable, ILexiconable {
public BlockAlfPortal() {
super(Material.WOOD, LibBlockNames.ALF_PORTAL);
setHardness(10F);
setSoundType(SoundType.WOOD);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.ALFPORTAL_STATE, AlfPortalState.OFF));
}
@Nonnull
@Override
public BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BotaniaStateProps.ALFPORTAL_STATE);
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
if (meta > AlfPortalState.values().length) {
meta = 0;
}
return getDefaultState().withProperty(BotaniaStateProps.ALFPORTAL_STATE, AlfPortalState.values()[meta]);
public BlockAlfPortal(Builder builder) {
super(builder);
setDefaultState(stateContainer.getBaseState().with(BotaniaStateProps.ALFPORTAL_STATE, AlfPortalState.OFF));
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.ALFPORTAL_STATE).ordinal();
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
builder.add(BotaniaStateProps.ALFPORTAL_STATE);
}
@Override
@@ -74,7 +58,7 @@ public class BlockAlfPortal 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 TileAlfPortal();
}
@@ -93,10 +77,8 @@ public class BlockAlfPortal extends BlockMod implements IWandable, ILexiconable
}
@Override
public int getLightValue(@Nonnull IBlockState state, IBlockAccess world, @Nonnull BlockPos pos) {
if(world.getBlockState(pos).getBlock() != this)
return world.getBlockState(pos).getLightValue(world, pos);
return state.getValue(BotaniaStateProps.ALFPORTAL_STATE) != AlfPortalState.OFF ? 15 : 0;
public int getLightValue(@Nonnull IBlockState state) {
return state.get(BotaniaStateProps.ALFPORTAL_STATE) != AlfPortalState.OFF ? 15 : 0;
}
}
@@ -16,6 +16,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.common.block.tile.TileBifrost;
@@ -27,24 +28,18 @@ import java.util.Random;
public class BlockBifrost extends BlockBifrostPerm implements ILexiconable {
public BlockBifrost() {
super(LibBlockNames.BIFROST);
setBlockUnbreakable();
}
@Override
public boolean registerInCreative() {
return false;
public BlockBifrost(Builder builder) {
super(builder);
}
@Nonnull
@Override
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) {
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull IBlockReader world, @Nonnull BlockPos pos, EntityPlayer player) {
return new ItemStack(ModItems.rainbowRod);
}
@Override
public int quantityDropped(IBlockState state, int fortune, @Nonnull Random random) {
public int quantityDropped(IBlockState state, @Nonnull Random random) {
return 0;
}
@@ -55,7 +50,7 @@ public class BlockBifrost extends BlockBifrostPerm implements ILexiconable {
@Nonnull
@Override
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
public TileEntity createTileEntity(@Nonnull IBlockState state, @Nonnull IBlockReader world) {
return new TileBifrost();
}
}
@@ -18,7 +18,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -32,22 +31,8 @@ import javax.annotation.Nonnull;
import java.util.Random;
public class BlockBifrostPerm extends BlockMod implements ILexiconable {
public BlockBifrostPerm() {
this(LibBlockNames.BIFROST_PERM);
setHardness(0.3F);
}
public BlockBifrostPerm(String name) {
super(Material.GLASS, name);
setLightOpacity(0);
setLightLevel(1F);
setSoundType(SoundType.GLASS);
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
public BlockBifrostPerm(Builder builder) {
super(builder);
}
@Override
@@ -55,16 +40,9 @@ public class BlockBifrostPerm extends BlockMod implements ILexiconable {
return false;
}
@OnlyIn(Dist.CLIENT)
@Override
public boolean shouldSideBeRendered(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side) {
if (world.getBlockState(pos.offset(side)).getBlock() == this) {
return false;
}
return super.shouldSideBeRendered(state, world, pos, side);
}
@Override
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
public void animateTick(IBlockState state, World world, BlockPos pos, Random rand) {
if(rand.nextBoolean())
Botania.proxy.sparkleFX(pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6);
}
@@ -18,8 +18,10 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IItemProvider;
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 net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
@@ -33,30 +35,23 @@ import java.util.Random;
public class BlockEnchantedSoil extends BlockMod implements ILexiconable {
public BlockEnchantedSoil() {
super(Material.GRASS, LibBlockNames.ENCHANTED_SOIL);
setHardness(0.6F);
setSoundType(SoundType.PLANT);
}
@Override
protected boolean registerInCreative() {
return false;
public BlockEnchantedSoil(Builder builder) {
super(builder);
}
@Nonnull
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return Blocks.DIRT.getItemDropped(state, rand, fortune);
public IItemProvider getItemDropped(IBlockState state, World world, BlockPos pos, int fortune) {
return Blocks.DIRT.getItemDropped(state, world, pos, fortune);
}
@Override
public boolean canSustainPlant(@Nonnull IBlockState state, @Nonnull IBlockAccess world, BlockPos pos, @Nonnull EnumFacing direction, IPlantable plantable) {
public boolean canSustainPlant(@Nonnull IBlockState state, @Nonnull IBlockReader world, BlockPos pos, @Nonnull EnumFacing direction, IPlantable plantable) {
return plantable.getPlantType(world, pos.down()) == EnumPlantType.Plains;
}
@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;
}
@@ -10,17 +10,18 @@
*/
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;
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.math.BlockPos;
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;
@@ -33,29 +34,14 @@ import javax.annotation.Nonnull;
public class BlockEnderEye extends BlockMod implements ILexiconable {
protected BlockEnderEye() {
super(Material.IRON, LibBlockNames.ENDER_EYE_BLOCK);
setHardness(3F);
setResistance(10F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Nonnull
@Override
public BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(BotaniaStateProps.POWERED, meta == 15);
protected BlockEnderEye(Builder builder) {
super(builder);
setDefaultState(stateContainer.getBaseState().with(BotaniaStateProps.POWERED, false));
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(BotaniaStateProps.POWERED) ? 15 : 0;
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
builder.add(BotaniaStateProps.POWERED);
}
@Override
@@ -64,8 +50,8 @@ public class BlockEnderEye extends BlockMod implements ILexiconable {
}
@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
@@ -75,7 +61,7 @@ public class BlockEnderEye 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 TileEnderEye();
}
@@ -86,7 +72,7 @@ public class BlockEnderEye 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;
}
@@ -45,7 +45,7 @@ import javax.annotation.Nonnull;
import java.util.Random;
public class BlockModFlower extends BlockFlower implements ILexiconable, IGrowable {
private final EnumDyeColor color;
protected final EnumDyeColor color;
protected BlockModFlower(EnumDyeColor color, Builder builder) {
super(builder);
this.color = color;
@@ -20,7 +20,8 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -33,30 +34,21 @@ import java.util.Random;
public class BlockSolidVines extends BlockVine implements ILexiconable {
public BlockSolidVines() {
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.SOLID_VINE));
setTranslationKey(LibBlockNames.SOLID_VINE);
setHardness(0.5F);
setSoundType(SoundType.PLANT);
setCreativeTab(null);
public BlockSolidVines(Builder builder) {
super(builder);
}
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
return getBoundingBox(state, world, pos);
}
public void tick(@Nonnull IBlockState state, World world, @Nonnull BlockPos pos, @Nonnull Random rand) {}
@Override
public void updateTick(World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull Random rand) {}
@Override
public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos) {
public boolean isShearable(ItemStack item, IWorldReader world, BlockPos pos) {
return false;
}
@Nonnull
@Override
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) {
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull IBlockReader world, @Nonnull BlockPos pos, EntityPlayer player) {
return new ItemStack(Blocks.VINE);
}
@@ -215,63 +215,83 @@ public final class ModBlocks {
@ObjectHolder(LibBlockNames.PLATFORM_ABSTRUSE) public static Block abstrusePlatform;
@ObjectHolder(LibBlockNames.PLATFORM_SPECTRAL) public static Block spectralPlatform;
@ObjectHolder(LibBlockNames.PLATFORM_INFRANGIBLE) public static Block infrangiblePlatform;
public static final Block alfPortal = new BlockAlfPortal();
public static final Block dreamwood = new BlockDreamwood();
public static final Block conjurationCatalyst = new BlockConjurationCatalyst();
public static final Block bifrost = new BlockBifrost();
public static final Block solidVines = new BlockSolidVines();
public static final Block buriedPetals = new BlockBuriedPetals();
@ObjectHolder(LibBlockNames.ALF_PORTAL) public static Block alfPortal;
@ObjectHolder(LibBlockNames.DREAM_WOOD) public static Block dreamwood;
@ObjectHolder(LibBlockNames.DREAM_WOOD_PLANKS) public static Block dreamwoodPlanks;
@ObjectHolder(LibBlockNames.DREAM_WOOD_PLANKS_MOSSY) public static Block dreamwoodPlanksMossy;
@ObjectHolder(LibBlockNames.DREAM_WOOD_FRAMED) public static Block dreamwoodFramed;
@ObjectHolder(LibBlockNames.DREAM_WOOD_PATTERN_FRAMED) public static Block dreamwoodPatternFramed;
@ObjectHolder(LibBlockNames.DREAM_WOOD_GLIMMERING) public static Block dreamwoodGlimmering;
@ObjectHolder(LibBlockNames.CONJURATION_CATALYST) public static Block conjurationCatalyst;
@ObjectHolder(LibBlockNames.BIFROST) public static Block bifrost;
@ObjectHolder(LibBlockNames.SOLID_VINE) public static Block solidVines;
@ObjectHolder("white" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block whiteBuriedPetals;
@ObjectHolder("orange" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block orangeBuriedPetals;
@ObjectHolder("magenta" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block magentaBuriedPetals;
@ObjectHolder("light_blue" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block lightBlueBuriedPetals;
@ObjectHolder("yellow" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block yellowBuriedPetals;
@ObjectHolder("lime" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block limeBuriedPetals;
@ObjectHolder("pink" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block pinkBuriedPetals;
@ObjectHolder("gray" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block grayBuriedPetals;
@ObjectHolder("light_gray" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block lightGrayBuriedPetals;
@ObjectHolder("cyan" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block cyanBuriedPetals;
@ObjectHolder("purple" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block purpleBuriedPetals;
@ObjectHolder("blue" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block blueBuriedPetals;
@ObjectHolder("brown" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block brownBuriedPetals;
@ObjectHolder("green" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block greenBuriedPetals;
@ObjectHolder("red" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block redBuriedPetals;
@ObjectHolder("black" + LibBlockNames.BURIED_PETALS_SUFFIX) public static Block blackBuriedPetals;
public static final Block floatingFlower = new BlockFloatingFlower();
public static final Block tinyPotato = new BlockTinyPotato();
public static final Block spawnerClaw = new BlockSpawnerClaw();
public static final Block azulejo0 = new BlockAzulejo(0);
public static final Block azulejo1 = new BlockAzulejo(1);
public static final Block azulejo2 = new BlockAzulejo(2);
public static final Block azulejo3 = new BlockAzulejo(3);
public static final Block azulejo4 = new BlockAzulejo(4);
public static final Block azulejo5 = new BlockAzulejo(5);
public static final Block azulejo6 = new BlockAzulejo(6);
public static final Block azulejo7 = new BlockAzulejo(7);
public static final Block azulejo8 = new BlockAzulejo(8);
public static final Block azulejo9 = new BlockAzulejo(9);
public static final Block azulejo10 = new BlockAzulejo(10);
public static final Block azulejo11 = new BlockAzulejo(11);
public static final Block azulejo12 = new BlockAzulejo(12);
public static final Block azulejo13 = new BlockAzulejo(13);
public static final Block azulejo14 = new BlockAzulejo(14);
public static final Block azulejo15 = new BlockAzulejo(15);
public static final Block enderEye = new BlockEnderEye();
public static final Block starfield = new BlockStarfield();
public static final Block rfGenerator = new BlockRFGenerator();
public static final Block elfGlass = new BlockElfGlass();
public static final Block brewery = new BlockBrewery();
public static final Block manaGlass = new BlockManaGlass();
public static final Block terraPlate = new BlockTerraPlate();
public static final Block redStringContainer = new BlockRedStringContainer(Block.Builder.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_CONTAINER);
public static final Block redStringDispenser = new BlockRedStringDispenser(Block.Builder.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_DISPENSER);
public static final Block redStringFertilizer = new BlockRedStringFertilizer(Block.Builder.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_FERTILIZER);
public static final Block redStringComparator = new BlockRedStringComparator(Block.Builder.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_COMPARATOR);
public static final Block redStringRelay = new BlockRedStringRelay();
@ObjectHolder(LibBlockNames.TINY_POTATO) public static Block tinyPotato;
@ObjectHolder(LibBlockNames.SPAWNER_CLAW) public static Block spawnerClaw;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 0) public static Block azulejo0;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 1) public static Block azulejo1;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 2) public static Block azulejo2;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 3) public static Block azulejo3;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 4) public static Block azulejo4;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 5) public static Block azulejo5;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 6) public static Block azulejo6;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 7) public static Block azulejo7;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 8) public static Block azulejo8;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 9) public static Block azulejo9;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 10) public static Block azulejo10;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 11) public static Block azulejo11;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 12) public static Block azulejo12;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 13) public static Block azulejo13;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 14) public static Block azulejo14;
@ObjectHolder(LibBlockNames.AZULEJO_PREFIX + 15) public static Block azulejo15;
@ObjectHolder(LibBlockNames.ENDER_EYE_BLOCK) public static Block enderEye;
@ObjectHolder(LibBlockNames.STARFIELD) public static Block starfield;
@ObjectHolder(LibBlockNames.RF_GENERATOR) public static Block rfGenerator;
@ObjectHolder(LibBlockNames.ELF_GLASS) public static Block elfGlass;
@ObjectHolder(LibBlockNames.BREWERY) public static Block brewery;
@ObjectHolder(LibBlockNames.MANA_GLASS) public static Block manaGlass;
@ObjectHolder(LibBlockNames.TERRA_PLATE) public static Block terraPlate;
@ObjectHolder(LibBlockNames.RED_STRING_CONTAINER) public static Block redStringContainer;
@ObjectHolder(LibBlockNames.RED_STRING_DISPENSER) public static Block redStringDispenser;
@ObjectHolder(LibBlockNames.RED_STRING_FERTILIZER) public static Block redStringFertilizer;
@ObjectHolder(LibBlockNames.RED_STRING_COMPARATOR) public static Block redStringComparator;
@ObjectHolder(LibBlockNames.RED_STRING_RELAY) public static Block redStringRelay;
public static final Block floatingSpecialFlower = new BlockFloatingSpecialFlower();
public static final Block manaFlame = new BlockManaFlame();
public static final Block prism = new BlockPrism();
public static final Block enchantedSoil = new BlockEnchantedSoil();
public static final Block petalBlockWhite = new BlockPetalBlock(EnumDyeColor.WHITE);
public static final Block petalBlockOrange = new BlockPetalBlock(EnumDyeColor.ORANGE);
public static final Block petalBlockMagenta = new BlockPetalBlock(EnumDyeColor.MAGENTA);
public static final Block petalBlockLightBlue = new BlockPetalBlock(EnumDyeColor.LIGHT_BLUE);
public static final Block petalBlockYellow = new BlockPetalBlock(EnumDyeColor.YELLOW);
public static final Block petalBlockLime = new BlockPetalBlock(EnumDyeColor.LIME);
public static final Block petalBlockPink = new BlockPetalBlock(EnumDyeColor.PINK);
public static final Block petalBlockGray = new BlockPetalBlock(EnumDyeColor.GRAY);
public static final Block petalBlockSilver = new BlockPetalBlock(EnumDyeColor.LIGHT_GRAY);
public static final Block petalBlockCyan = new BlockPetalBlock(EnumDyeColor.CYAN);
public static final Block petalBlockPurple = new BlockPetalBlock(EnumDyeColor.PURPLE);
public static final Block petalBlockBlue = new BlockPetalBlock(EnumDyeColor.BLUE);
public static final Block petalBlockBrown = new BlockPetalBlock(EnumDyeColor.BROWN);
public static final Block petalBlockGreen = new BlockPetalBlock(EnumDyeColor.GREEN);
public static final Block petalBlockRed = new BlockPetalBlock(EnumDyeColor.RED);
public static final Block petalBlockBlack = new BlockPetalBlock(EnumDyeColor.BLACK);
@ObjectHolder(LibBlockNames.MANA_FLAME) public static Block manaFlame;
@ObjectHolder(LibBlockNames.PRISM) public static Block prism;
@ObjectHolder(LibBlockNames.ENCHANTED_SOIL) public static Block enchantedSoil;
@ObjectHolder("white" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockWhite;
@ObjectHolder("orange" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockOrange;
@ObjectHolder("magenta" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockMagenta;
@ObjectHolder("light_blue" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockLightBlue;
@ObjectHolder("yellow" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockYellow;
@ObjectHolder("lime" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockLime;
@ObjectHolder("pink" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockPink;
@ObjectHolder("gray" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockGray;
@ObjectHolder("light_gray" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockSilver;
@ObjectHolder("cyan" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockCyan;
@ObjectHolder("purple" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockPurple;
@ObjectHolder("blue" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockBlue;
@ObjectHolder("brown" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockBrown;
@ObjectHolder("green" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockGreen;
@ObjectHolder("red" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockRed;
@ObjectHolder("black" + LibBlockNames.PETAL_BLOCK_SUFFIX) public static Block petalBlockBlack;
public static final Block corporeaIndex = new BlockCorporeaIndex(Block.Builder.create(Material.IRON).hardnessAndResistance(5.5F).sound(SoundType.METAL)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CORPOREA_INDEX);
public static final Block corporeaFunnel = new BlockCorporeaFunnel();
public static final Block mushroom = new BlockModMushroom();
@@ -294,7 +314,7 @@ public final class ModBlocks {
public static final Block manaBomb = new BlockManaBomb();
public static final Block cacophonium = new BlockCacophonium();
public static final Block bellows = new BlockBellows();
public static final Block bifrostPerm = new BlockBifrostPerm();
@ObjectHolder(LibBlockNames.BIFROST_PERM) public static Block bifrostPerm;
public static final Block cellBlock = new BlockCell();
public static final Block redStringInterceptor = new BlockRedStringInterceptor();
public static final Block gaiaHead = new BlockGaiaHead();
@@ -315,6 +335,7 @@ public final class ModBlocks {
public static void registerBlocks(RegistryEvent.Register<Block> evt) {
IForgeRegistry<Block> r = evt.getRegistry();
ILexiconable decorative = (w, po, pl, st) -> LexiconData.decorativeBlocks;
ILexiconable elvenResource = (w, po, pl, st) -> LexiconData.elvenResources;
Block.Builder builder = Block.Builder.create(Material.PLANTS).doesNotBlockMovement().hardnessAndResistance(0).sound(SoundType.PLANT);
for(EnumDyeColor color : EnumDyeColor.values()) {
@@ -409,63 +430,60 @@ public final class ModBlocks {
r.register(new BlockPlatform(BlockPlatform.Variant.ABSTRUSE, builder).setRegistryName(LibMisc.MOD_ID, LibBlockNames.PLATFORM_ABSTRUSE));
r.register(new BlockPlatform(BlockPlatform.Variant.SPECTRAL, builder).setRegistryName(LibMisc.MOD_ID, LibBlockNames.PLATFORM_SPECTRAL));
r.register(new BlockPlatform(BlockPlatform.Variant.INFRANGIBLE, builder).setRegistryName(LibMisc.MOD_ID, LibBlockNames.PLATFORM_INFRANGIBLE));
r.register(alfPortal);
r.register(dreamwood);
r.register(conjurationCatalyst);
r.register(bifrost);
r.register(solidVines);
r.register(buriedPetals);
r.register(new BlockAlfPortal(Block.Builder.create(Material.WOOD).hardnessAndResistance(10).sound(SoundType.WOOD)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.ALF_PORTAL));
builder = Block.Builder.create(Material.WOOD).hardnessAndResistance(2).sound(SoundType.WOOD);
// todo 1.13: dreamwood should support leaves?
r.register(new BlockModLexiconable(builder, elvenResource).setRegistryName(LibMisc.MOD_ID, LibBlockNames.DREAM_WOOD));
r.register(new BlockModLexiconable(builder, elvenResource).setRegistryName(LibMisc.MOD_ID, LibBlockNames.DREAM_WOOD_PLANKS));
r.register(new BlockModLexiconable(builder, elvenResource).setRegistryName(LibMisc.MOD_ID, LibBlockNames.DREAM_WOOD_PLANKS_MOSSY));
r.register(new BlockModLexiconable(builder, elvenResource).setRegistryName(LibMisc.MOD_ID, LibBlockNames.DREAM_WOOD_FRAMED));
r.register(new BlockModLexiconable(builder, elvenResource).setRegistryName(LibMisc.MOD_ID, LibBlockNames.DREAM_WOOD_PATTERN_FRAMED);
r.register(new BlockModLexiconable(builder.lightValue(12), elvenResource).setRegistryName(LibMisc.MOD_ID, LibBlockNames.DREAM_WOOD_GLIMMERING));
r.register(new BlockConjurationCatalyst(Block.Builder.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.CONJURATION_CATALYST));
r.register(new BlockBifrost(Block.Builder.create(Material.GLASS).hardnessAndResistance(-1, 0.3F).lightValue(15).sound(SoundType.GLASS)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.BIFROST));
r.register(new BlockSolidVines(Block.Builder.create(Material.VINE).hardnessAndResistance(0.2F).sound(SoundType.PLANT)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.SOLID_VINE));
builder = Block.Builder.create(Material.PLANTS).doesNotBlockMovement().hardnessAndResistance(0).sound(SoundType.PLANT).lightValue(4);
for(EnumDyeColor color : EnumDyeColor.values()) {
r.register(new BlockBuriedPetals(color, builder).setRegistryName(LibMisc.MOD_ID, color.getName() + LibBlockNames.BURIED_PETALS_SUFFIX));
}
r.register(floatingFlower);
r.register(tinyPotato);
r.register(spawnerClaw);
r.register(azulejo0);
r.register(azulejo1);
r.register(azulejo2);
r.register(azulejo3);
r.register(azulejo4);
r.register(azulejo5);
r.register(azulejo6);
r.register(azulejo7);
r.register(azulejo8);
r.register(azulejo9);
r.register(azulejo10);
r.register(azulejo11);
r.register(azulejo12);
r.register(azulejo13);
r.register(azulejo14);
r.register(azulejo15);
r.register(enderEye);
r.register(starfield);
r.register(rfGenerator);
r.register(elfGlass);
r.register(brewery);
r.register(manaGlass);
r.register(terraPlate);
r.register(redStringContainer);
r.register(redStringDispenser);
r.register(redStringFertilizer);
r.register(redStringComparator);
r.register(redStringRelay);
r.register(new BlockTinyPotato(Block.Builder.create(Material.CLOTH).hardnessAndResistance(0.25F)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.TINY_POTATO));
r.register(new BlockSpawnerClaw(Block.Builder.create(Material.IRON).hardnessAndResistance(3)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.SPAWNER_CLAW));
builder = Block.Builder.create(Material.ROCK).hardnessAndResistance(2, 5).sound(SoundType.STONE);
ILexiconable azulejo = (w, po ,pl, st) -> LexiconData.azulejo;
for (int i = 0; i < 15; i++) {
r.register(new BlockModLexiconable(builder, azulejo).setRegistryName(LibMisc.MOD_ID, LibBlockNames.AZULEJO_PREFIX + i));
}
r.register(new BlockEnderEye(Block.Builder.create(Material.IRON).hardnessAndResistance(3, 10).sound(SoundType.METAL)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.ENDER_EYE_BLOCK));
r.register(new BlockStarfield(Block.Builder.create(Material.IRON).hardnessAndResistance(5, 2000).sound(SoundType.METAL)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.STARFIELD));
r.register(new BlockRFGenerator(Block.Builder.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RF_GENERATOR));
r.register(new BlockElfGlass(Block.Builder.create(Material.GLASS).hardnessAndResistance(0.3F).sound(SoundType.GLASS).lightValue(15)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.ELF_GLASS));
r.register(new BlockBrewery(Block.Builder.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.BREWERY));
r.register(new BlockManaGlass(Block.Builder.create(Material.GLASS).hardnessAndResistance(0.3F).sound(SoundType.GLASS).lightValue(15)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.MANA_GLASS));
r.register(new BlockTerraPlate(Block.Builder.create(Material.IRON).hardnessAndResistance(3, 10).sound(SoundType.METAL)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.TERRA_PLATE));
builder = Block.Builder.create(Material.ROCK).hardnessAndResistance(2, 10).sound(SoundType.STONE);
r.register(new BlockRedStringContainer(builder).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_CONTAINER));
r.register(new BlockRedStringDispenser(builder).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_DISPENSER));
r.register(new BlockRedStringFertilizer(builder).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_FERTILIZER));
r.register(new BlockRedStringComparator(builder).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_COMPARATOR));
r.register(new BlockRedStringRelay(builder).setRegistryName(LibMisc.MOD_ID, LibBlockNames.RED_STRING_RELAY));
r.register(floatingSpecialFlower);
r.register(manaFlame);
r.register(prism);
r.register(enchantedSoil);
r.register(petalBlockWhite);
r.register(petalBlockOrange);
r.register(petalBlockMagenta);
r.register(petalBlockLightBlue);
r.register(petalBlockYellow);
r.register(petalBlockLime);
r.register(petalBlockPink);
r.register(petalBlockGray);
r.register(petalBlockSilver);
r.register(petalBlockCyan);
r.register(petalBlockPurple);
r.register(petalBlockBlue);
r.register(petalBlockBrown);
r.register(petalBlockGreen);
r.register(petalBlockRed);
r.register(petalBlockBlack);
r.register(new BlockManaFlame(Block.Builder.create(Material.CLOTH).sound(SoundType.CLOTH).lightValue(15).doesNotBlockMovement()).setRegistryName(LibMisc.MOD_ID, LibBlockNames.MANA_FLAME));
r.register(new BlockPrism(Block.Builder.create(Material.GLASS).hardnessAndResistance(0.3F).sound(SoundType.GLASS).lightValue(15).doesNotBlockMovement()).setRegistryName(LibMisc.MOD_ID, LibBlockNames.PRISM));
r.register(new BlockEnchantedSoil(Block.Builder.create(Material.GRASS).hardnessAndResistance(0.6F).sound(SoundType.PLANT)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.ENCHANTED_SOIL));
builder = Block.Builder.create(Material.PLANTS).hardnessAndResistance(0.4F).sound(SoundType.PLANT);
for(EnumDyeColor color : EnumDyeColor.values()) {
r.register(new BlockPetalBlock(color, builder).setRegistryName(LibMisc.MOD_ID, color.getName() + LibBlockNames.PETAL_BLOCK_SUFFIX));
}
r.register(corporeaIndex);
r.register(corporeaFunnel);
r.register(mushroom);
@@ -488,7 +506,7 @@ public final class ModBlocks {
r.register(manaBomb);
r.register(cacophonium);
r.register(bellows);
r.register(bifrostPerm);
r.register(new BlockBifrostPerm(Block.Builder.create(Material.GLASS).hardnessAndResistance(0.3).lightValue(15).sound(SoundType.GLASS)).setRegistryName(LibMisc.MOD_ID, LibBlockNames.BIFROST_PERM));
r.register(cellBlock);
r.register(redStringInterceptor);
r.register(gaiaHead);
@@ -26,9 +26,6 @@ public class BlockAzulejo extends BlockMod implements ILexiconable {
public BlockAzulejo(int variant) {
super(Material.ROCK, LibBlockNames.AZULEJO_PREFIX + variant);
setHardness(2.0F);
setResistance(5.0F);
setSoundType(SoundType.STONE);
}
@Override
@@ -13,34 +13,31 @@ package vazkii.botania.common.block.decor;
import net.minecraft.block.Block;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
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.model.ModelLoader;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.BlockModFlower;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibBlockNames;
import javax.annotation.Nonnull;
import java.util.Random;
public class BlockBuriedPetals extends BlockModFlower {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 0.1, 1);
private static final VoxelShape SHAPE = makeCuboidShape(0, 0, 0, 16, 1.6, 16);
public BlockBuriedPetals() {
super(LibBlockNames.BURIED_PETALS);
setLightLevel(0.25F);
public BlockBuriedPetals(EnumDyeColor color, Builder builder) {
super(color, builder);
}
@Nonnull
@@ -52,14 +49,13 @@ public class BlockBuriedPetals extends BlockModFlower {
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) {
return AABB;
public VoxelShape getShape(IBlockState state, @Nonnull IBlockReader world, @Nonnull BlockPos pos) {
return SHAPE;
}
@OnlyIn(Dist.CLIENT)
@Override
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
EnumDyeColor color = state.getValue(BotaniaStateProps.COLOR);
public void animateTick(IBlockState state, World world, BlockPos pos, Random rand) {
int hex = color.getColorValue();
int r = (hex & 0xFF0000) >> 16;
int g = (hex & 0xFF00) >> 8;
@@ -71,20 +67,10 @@ public class BlockBuriedPetals extends BlockModFlower {
Botania.proxy.setSparkleFXNoClip(false);
}
@Override
public boolean registerInCreative() {
return false;
}
@Nonnull
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return ModItems.petals.get(state.getValue(BotaniaStateProps.COLOR));
}
@Override
public int damageDropped(IBlockState state) {
return 0;
public Item getItemDropped(IBlockState state, World world, BlockPos pos, int fortune) {
return ModItems.petals.get(color);
}
@Nonnull
@@ -93,15 +79,9 @@ public class BlockBuriedPetals extends BlockModFlower {
return EnumBlockRenderType.INVISIBLE;
}
@OnlyIn(Dist.CLIENT)
@Override
public final void registerModels() {
ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(getTypeProperty()).build());
}
@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;
}
@@ -22,8 +22,8 @@ import vazkii.botania.common.lib.LibBlockNames;
public class BlockElfGlass extends BlockManaGlass implements IElvenItem, ILexiconable {
public BlockElfGlass() {
super(LibBlockNames.ELF_GLASS);
public BlockElfGlass(Builder builder) {
super(builder);
}
@Override
@@ -10,24 +10,22 @@
*/
package vazkii.botania.common.block.decor;
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.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tags.ItemTags;
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.fml.common.Optional;
import net.minecraftforge.items.ItemHandlerHelper;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -36,38 +34,21 @@ import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.block.tile.TileManaFlame;
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 BlockManaFlame extends BlockMod implements ILexiconable {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.25, 0.25, 0.25, 0.75, 0.75, 0.75);
private static final VoxelShape SHAPE = makeCuboidShape(4, 4, 4, 12, 12, 12);
public BlockManaFlame() {
super(Material.CLOTH, LibBlockNames.MANA_FLAME);
setSoundType(SoundType.CLOTH);
setLightLevel(1F);
public BlockManaFlame(Builder builder) {
super(builder);
}
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
return AABB;
}
@Override
public boolean registerInCreative() {
return false;
}
@Override
@Optional.Method(modid = "easycoloredlights")
public int getLightValue(@Nonnull IBlockState state, IBlockAccess world, @Nonnull BlockPos pos) {
if(world.getBlockState(pos).getBlock() != this)
return world.getBlockState(pos).getLightValue(world, pos);
return ((TileManaFlame) world.getTileEntity(pos)).getLightColor();
public VoxelShape getShape(IBlockState state, IBlockReader world, BlockPos pos) {
return SHAPE;
}
@Nonnull
@@ -76,31 +57,16 @@ public class BlockManaFlame extends BlockMod implements ILexiconable {
return EnumBlockRenderType.INVISIBLE;
}
@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 true;
}
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) {
return NULL_AABB;
}
@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(Botania.gardenOfGlassLoaded) {
ItemStack stack = player.getHeldItem(hand);
if(!stack.isEmpty() && stack.getItem() == Item.getItemFromBlock(Blocks.SAPLING) && !player.inventory.hasItemStack(new ItemStack(ModItems.lexicon))) {
if(!stack.isEmpty() && ItemTags.SAPLINGS.contains(stack.getItem()) && !player.inventory.hasItemStack(new ItemStack(ModItems.lexicon))) {
if(!world.isRemote) {
stack.shrink(1);
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.lexicon));
@@ -114,7 +80,7 @@ public class BlockManaFlame 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;
}
@@ -125,7 +91,7 @@ public class BlockManaFlame 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 TileManaFlame();
}
@@ -136,7 +102,7 @@ public class BlockManaFlame 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;
}
}
@@ -19,7 +19,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -33,20 +32,8 @@ import javax.annotation.Nonnull;
public class BlockManaGlass extends BlockMod implements ILexiconable {
public BlockManaGlass() {
this(LibBlockNames.MANA_GLASS);
}
public BlockManaGlass(String name) {
super(Material.GLASS, name);
setHardness(0.3F);
setSoundType(SoundType.GLASS);
setLightLevel(1.0F);
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
public BlockManaGlass(Builder builder) {
super(builder);
}
@Override
@@ -54,13 +41,6 @@ public class BlockManaGlass extends BlockMod implements ILexiconable {
return false;
}
@OnlyIn(Dist.CLIENT)
@Override
public boolean shouldSideBeRendered(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side) {
Block block = world.getBlockState(pos.offset(side)).getBlock();
return block == this ? false : super.shouldSideBeRendered(state, world, pos, side);
}
@OnlyIn(Dist.CLIENT)
@Nonnull
@Override
@@ -12,10 +12,7 @@ package vazkii.botania.common.block.decor;
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.client.renderer.block.statemap.StateMap;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemStack;
@@ -38,10 +35,8 @@ import javax.annotation.Nonnull;
public class BlockPetalBlock extends BlockMod implements ILexiconable {
public final EnumDyeColor color;
public BlockPetalBlock(EnumDyeColor color) {
super(Material.PLANTS, color.getName() + LibBlockNames.PETAL_BLOCK_SUFFIX);
setHardness(0.4F);
setSoundType(SoundType.PLANT);
public BlockPetalBlock(EnumDyeColor color, Builder builder) {
super(builder);
this.color = color;
}
@@ -10,10 +10,7 @@
*/
package vazkii.botania.common.block.decor;
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;
@@ -22,36 +19,31 @@ import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
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.common.block.BlockMod;
import vazkii.botania.common.block.tile.TileStarfield;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import javax.annotation.Nonnull;
public class BlockStarfield 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 BlockStarfield() {
super(Material.IRON, LibBlockNames.STARFIELD);
setHardness(5F);
setResistance(2000F);
setSoundType(SoundType.METAL);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
public BlockStarfield(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;
}
@OnlyIn(Dist.CLIENT)
@@ -61,33 +53,11 @@ public class BlockStarfield extends BlockMod implements ILexiconable {
return BlockRenderLayer.CUTOUT_MIPPED;
}
@Nonnull
@Override
public BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BotaniaStateProps.POWERED);
}
@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);
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean hasTileEntity(IBlockState state) {
return true;
@@ -95,7 +65,7 @@ public class BlockStarfield 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 TileStarfield();
}
@@ -106,7 +76,7 @@ public class BlockStarfield 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;
}
@@ -10,22 +10,25 @@
*/
package vazkii.botania.common.block.decor;
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.fluid.IFluidState;
import net.minecraft.init.Particles;
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.EnumParticleTypes;
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.util.text.ITextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -35,97 +38,67 @@ import vazkii.botania.common.block.tile.TileSimpleInventory;
import vazkii.botania.common.block.tile.TileTinyPotato;
import vazkii.botania.common.core.helper.InventoryHelper;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
public class BlockTinyPotato extends BlockMod implements ILexiconable {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.375, 0, 0.375, 0.625, 0.375, 0.625);
private static final VoxelShape SHAPE = makeCuboidShape(6, 0, 6, 10, 6, 10);
public BlockTinyPotato() {
super(Material.CLOTH, LibBlockNames.TINY_POTATO);
setHardness(0.25F);
setDefaultState(blockState.getBaseState()
.withProperty(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
}
@Nonnull
@Override
public BlockStateContainer createBlockState() {
return new BlockStateContainer(this, BotaniaStateProps.CARDINALS);
public BlockTinyPotato(Builder builder) {
super(builder);
setDefaultState(stateContainer.getBaseState()
.with(BotaniaStateProps.CARDINALS, EnumFacing.SOUTH));
}
@Override
public int getMetaFromState(IBlockState state) {
switch (state.getValue(BotaniaStateProps.CARDINALS)) {
case NORTH: return 0;
case WEST: return 3;
case EAST: return 1;
case SOUTH:
default:
return 2; // wai vazkii senpai
}
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing side;
switch (meta) {
case 3: side = EnumFacing.WEST; break;
case 0: side = EnumFacing.NORTH; break;
case 1: side = EnumFacing.EAST; break;
case 2:
default:
side = EnumFacing.SOUTH; break;
}
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, side);
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
builder.add(BotaniaStateProps.CARDINALS);
}
@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);
}
@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
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(IBlockState state, World world, BlockPos pos, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileTinyPotato) {
((TileTinyPotato) tile).interact(player, hand, player.getHeldItem(hand), par6);
world.spawnParticle(EnumParticleTypes.HEART, pos.getX() + AABB.minX + Math.random() * (AABB.maxX - AABB.minX), pos.getY() + AABB.maxY, pos.getZ() + AABB.minZ + Math.random() * (AABB.maxZ - AABB.minZ), 0, 0 ,0);
AxisAlignedBB box = SHAPE.getBoundingBox();
world.spawnParticle(Particles.HEART, pos.getX() + box.minX + Math.random() * (box.maxX - box.minX), pos.getY() + box.maxY, pos.getZ() + box.minZ + Math.random() * (box.maxZ - box.minZ), 0, 0 ,0);
}
return true;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack) {
world.setBlockState(pos, state.withProperty(BotaniaStateProps.CARDINALS, par5EntityLiving.getHorizontalFacing().getOpposite()));
// todo 1.13 move to getstateforplacement
world.setBlockState(pos, state.with(BotaniaStateProps.CARDINALS, par5EntityLiving.getHorizontalFacing().getOpposite()));
if (par6ItemStack.hasDisplayName())
((TileTinyPotato) world.getTileEntity(pos)).name = par6ItemStack.getDisplayName();
}
@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
// Copy of super.removedByPlayer but don't remove block 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);
}
}
@@ -133,27 +106,22 @@ public class BlockTinyPotato extends BlockMod implements ILexiconable {
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> list, IBlockAccess world, BlockPos pos, @Nonnull IBlockState state, int fortune) {
public void getDrops(IBlockState state, NonNullList<ItemStack> list, World world, BlockPos pos, int fortune) {
TileEntity tile = world.getTileEntity(pos);
if(tile != null) {
ItemStack stack = new ItemStack(this);
String name = ((TileTinyPotato) tile).name;
if(!name.isEmpty())
stack.setStackDisplayName(name);
ITextComponent name = ((TileTinyPotato) tile).name;
if(!name.getString().isEmpty())
stack.setDisplayName(name);
list.add(stack);
}
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
@@ -172,7 +140,7 @@ public class BlockTinyPotato 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 TileTinyPotato();
}
@@ -183,7 +151,7 @@ public class BlockTinyPotato 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;
}
}
@@ -10,24 +10,24 @@
*/
package vazkii.botania.common.block.mana;
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.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.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;
@@ -49,45 +49,30 @@ import javax.annotation.Nonnull;
public class BlockBrewery extends BlockMod implements ILexiconable, IWandHUD {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.375, 0.05, 0.375, 0.625, 0.95, 0.625);
private static final VoxelShape SHAPE = makeCuboidShape(6, 0.8, 6, 10, 15.2, 10);
public BlockBrewery() {
super(Material.ROCK, LibBlockNames.BREWERY);
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
public BlockBrewery(Builder builder) {
super(builder);
setDefaultState(stateContainer.getBaseState().with(BotaniaStateProps.POWERED, false));
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
builder.add(BotaniaStateProps.POWERED);
}
@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);
}
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
return AABB;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float par7, float par8, float par9) {
public boolean onBlockActivated(IBlockState state, World world, BlockPos pos, EntityPlayer player, EnumHand hand, EnumFacing side, float par7, float par8, float par9) {
TileBrewery brew = (TileBrewery) world.getTileEntity(pos);
if(player.isSneaking()) {
if(brew.recipe == null && !state.getValue(BotaniaStateProps.POWERED)) {
if(brew.recipe == null && !state.get(BotaniaStateProps.POWERED)) {
InventoryHelper.withdrawFromInventory(brew, player);
return true;
}
@@ -100,12 +85,12 @@ public class BlockBrewery extends BlockMod implements ILexiconable, IWandHUD {
}
@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
@@ -125,11 +110,6 @@ public class BlockBrewery extends BlockMod implements ILexiconable, IWandHUD {
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
@@ -142,7 +122,7 @@ public class BlockBrewery extends BlockMod implements ILexiconable, IWandHUD {
@Nonnull
@Override
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
public TileEntity createTileEntity(@Nonnull IBlockState state, @Nonnull IBlockReader world) {
return new TileBrewery();
}
@@ -153,8 +133,8 @@ public class BlockBrewery extends BlockMod implements ILexiconable, IWandHUD {
@OnlyIn(Dist.CLIENT)
@Override
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
((TileBrewery) world.getTileEntity(pos)).renderHUD(mc, res);
public void renderHUD(Minecraft mc, World world, BlockPos pos) {
((TileBrewery) world.getTileEntity(pos)).renderHUD(mc);
}
@OnlyIn(Dist.CLIENT)
@@ -167,7 +147,7 @@ public class BlockBrewery extends BlockMod implements ILexiconable, IWandHUD {
@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,20 +11,19 @@
package vazkii.botania.common.block.mana;
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.BlockRenderLayer;
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.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -41,47 +40,28 @@ import vazkii.botania.common.block.tile.TileSimpleInventory;
import vazkii.botania.common.block.tile.mana.TilePrism;
import vazkii.botania.common.core.helper.InventoryHelper;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import javax.annotation.Nonnull;
import java.util.Random;
public class BlockPrism extends BlockMod implements IManaTrigger, ILexiconable, IManaCollisionGhost {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.25, 0, 0.25, 0.75, 1, 0.75);
private static final VoxelShape SHAPE = makeCuboidShape(4, 0, 4, 12, 16, 12);
public BlockPrism() {
super(Material.GLASS, LibBlockNames.PRISM);
setHardness(0.3F);
setSoundType(SoundType.GLASS);
setLightLevel(1.0F);
setDefaultState(blockState.getBaseState()
.withProperty(BotaniaStateProps.POWERED, false)
.withProperty(BotaniaStateProps.HAS_LENS, false));
public BlockPrism(Builder builder) {
super(builder);
setDefaultState(stateContainer.getBaseState()
.with(BotaniaStateProps.POWERED, false)
.with(BotaniaStateProps.HAS_LENS, 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, BotaniaStateProps.HAS_LENS);
public VoxelShape getShape(IBlockState state, IBlockReader world, BlockPos pos) {
return SHAPE;
}
@Override
public int getMetaFromState(IBlockState state) {
return (state.getValue(BotaniaStateProps.POWERED) ? 8 : 0)
+ (state.getValue(BotaniaStateProps.HAS_LENS) ? 1 : 0);
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(BotaniaStateProps.POWERED, (meta & 8) > 0)
.withProperty(BotaniaStateProps.HAS_LENS, (meta & 1) > 0);
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
builder.add(BotaniaStateProps.POWERED, BotaniaStateProps.HAS_LENS);
}
@Nonnull
@@ -91,23 +71,13 @@ public class BlockPrism extends BlockMod implements IManaTrigger, ILexiconable,
return BlockRenderLayer.TRANSLUCENT;
}
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) {
return NULL_AABB;
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float par7, float par8, float par9) {
public boolean onBlockActivated(IBlockState state, World world, BlockPos pos, EntityPlayer player, EnumHand hand, EnumFacing side, float par7, float par8, float par9) {
TileEntity tile = world.getTileEntity(pos);
if(!(tile instanceof TilePrism))
return false;
@@ -118,17 +88,17 @@ public class BlockPrism extends BlockMod implements IManaTrigger, ILexiconable,
boolean isHeldItemLens = !heldItem.isEmpty() && heldItem.getItem() instanceof ILens;
if(lens.isEmpty() && isHeldItemLens) {
if(!player.capabilities.isCreativeMode)
if(!player.abilities.isCreativeMode)
player.setHeldItem(hand, ItemStack.EMPTY);
prism.getItemHandler().setStackInSlot(0, heldItem.copy());
prism.markDirty();
world.setBlockState(pos, state.withProperty(BotaniaStateProps.HAS_LENS, true), 1 | 2);
world.setBlockState(pos, state.with(BotaniaStateProps.HAS_LENS, true), 1 | 2);
} else if(!lens.isEmpty()) {
ItemHandlerHelper.giveItemToPlayer(player, lens);
prism.getItemHandler().setStackInSlot(0, ItemStack.EMPTY);
prism.markDirty();
world.setBlockState(pos, state.withProperty(BotaniaStateProps.HAS_LENS, false), 1 | 2);
world.setBlockState(pos, state.with(BotaniaStateProps.HAS_LENS, false), 1 | 2);
}
return true;
@@ -137,23 +107,23 @@ public class BlockPrism extends BlockMod implements IManaTrigger, ILexiconable,
@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(!world.isRemote) {
if(power && !powered)
world.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, true), 1 | 2);
world.setBlockState(pos, state.with(BotaniaStateProps.POWERED, true), 1 | 2);
else if(!power && powered)
world.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, false), 1 | 2);
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);
super.onReplaced(state, world, pos, newState, isMoving);
}
@Override
@@ -163,7 +133,7 @@ public class BlockPrism extends BlockMod implements IManaTrigger, ILexiconable,
@Nonnull
@Override
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
public TileEntity createTileEntity(@Nonnull IBlockState state, @Nonnull IBlockReader world) {
return new TilePrism();
}
@@ -186,7 +156,7 @@ public class BlockPrism extends BlockMod implements IManaTrigger, 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;
}
}
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -29,11 +30,8 @@ import javax.annotation.Nonnull;
public class BlockRFGenerator extends BlockMod implements ILexiconable {
public BlockRFGenerator() {
super(Material.ROCK, LibBlockNames.RF_GENERATOR);
setHardness(2.0F);
setResistance(10.0F);
setSoundType(SoundType.STONE);
public BlockRFGenerator(Builder builder) {
super(builder);
}
@Override
@@ -43,7 +41,7 @@ public class BlockRFGenerator 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 TileRFGenerator();
}
@@ -13,16 +13,17 @@ package vazkii.botania.common.block.mana;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
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.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -35,28 +36,22 @@ import javax.annotation.Nonnull;
public class BlockSpawnerClaw extends BlockMod implements ILexiconable {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.125, 0, 0.125, 0.875, 0.125, 0.875);
private static final VoxelShape SHAPE = makeCuboidShape(2, 0, 2, 14, 2, 14);
public BlockSpawnerClaw() {
super(Material.IRON, LibBlockNames.SPAWNER_CLAW);
setHardness(3.0F);
public BlockSpawnerClaw(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
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
list.add(new ItemStack(this));
list.add(new ItemStack(Blocks.MOB_SPAWNER));
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> list) {
super.fillItemGroup(group, list);
list.add(new ItemStack(Blocks.SPAWNER));
}
@Override
@@ -71,7 +66,7 @@ public class BlockSpawnerClaw extends BlockMod implements ILexiconable {
@Nonnull
@Override
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
public TileEntity createTileEntity(@Nonnull IBlockState state, IBlockReader world) {
return new TileSpawnerClaw();
}
@@ -82,7 +77,7 @@ public class BlockSpawnerClaw 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;
}
@@ -22,7 +22,9 @@ 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.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.ILexiconable;
@@ -37,29 +39,26 @@ import javax.annotation.Nonnull;
public class BlockTerraPlate 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 BlockTerraPlate() {
super(Material.IRON, LibBlockNames.TERRA_PLATE);
setHardness(3F);
setResistance(10F);
setSoundType(SoundType.METAL);
public BlockTerraPlate(Builder builder) {
super(builder);
BotaniaAPI.blacklistBlockFromMagnet(this, Short.MAX_VALUE);
}
@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
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);
if(!stack.isEmpty()
&& (stack.getItem() == ModItems.manaSteel || stack.getItem() == ModItems.manaPearl || stack.getItem() == ModItems.manaDiamond)) {
if(!world.isRemote) {
ItemStack target = stack.splitStack(1);
ItemStack target = stack.split(1);
EntityItem item = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, target);
item.setPickupDelay(40);
item.motionX = item.motionY = item.motionZ = 0;
@@ -77,11 +76,6 @@ public class BlockTerraPlate extends BlockMod implements ILexiconable {
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean isPassable(IBlockAccess world, BlockPos pos) {
return false;
@@ -94,7 +88,7 @@ public class BlockTerraPlate 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 TileTerraPlate();
}
@@ -120,7 +114,7 @@ public class BlockTerraPlate 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;
}
@@ -238,11 +238,11 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver, I
return !isFull();
}
public void renderHUD(Minecraft mc, ScaledResolution res) {
public void renderHUD(Minecraft mc) {
int manaToGet = getManaCost();
if(manaToGet > 0) {
int x = res.getScaledWidth() / 2 + 20;
int y = res.getScaledHeight() / 2 - 8;
int x = mc.mainWindow.getScaledWidth() / 2 + 20;
int y = mc.mainWindow.getScaledHeight() / 2 - 8;
if(recipe == null)
return;
@@ -18,16 +18,7 @@ public class TileStarfield extends TileMod implements ITickable {
@Override
public void tick() {
boolean state = world.getBlockState(getPos()).get(BotaniaStateProps.POWERED);
if(!world.isRemote) {
boolean newState = !world.isDaytime();
if(newState != state) {
world.setBlockState(getPos(), world.getBlockState(getPos()).with(BotaniaStateProps.POWERED, newState), 1 | 2);
state = newState;
}
}
if(state) {
if(!world.isDaytime() && world.isRemote) {
double radius = 512;
int iter = 2;
for(int i = 0; i < iter; i++) {
@@ -20,6 +20,7 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.ITickable;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.items.ItemHandlerHelper;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
@@ -33,7 +34,7 @@ public class TileTinyPotato extends TileSimpleInventory implements ITickable {
private static final String TAG_NAME = "name";
public int jumpTicks = 0;
public String name = "";
public ITextComponent name = new TextComponentString("");
public int nextDoIt = 0;
public void interact(EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side) {
@@ -59,7 +60,7 @@ public class TileTinyPotato extends TileSimpleInventory implements ITickable {
jump();
if(!world.isRemote) {
if(name.toLowerCase().trim().endsWith("shia labeouf") && nextDoIt == 0) {
if(name.getString().toLowerCase().trim().endsWith("shia labeouf") && nextDoIt == 0) {
nextDoIt = 40;
world.playSound(null, pos, ModSounds.doit, SoundCategory.BLOCKS, 1F, 1F);
}
@@ -101,13 +102,13 @@ public class TileTinyPotato extends TileSimpleInventory implements ITickable {
@Override
public void writePacketNBT(NBTTagCompound cmp) {
super.writePacketNBT(cmp);
cmp.setString(TAG_NAME, name);
cmp.setString(TAG_NAME, ITextComponent.Serializer.toJson(name));
}
@Override
public void readPacketNBT(NBTTagCompound cmp) {
super.readPacketNBT(cmp);
name = cmp.getString(TAG_NAME);
name = ITextComponent.Serializer.fromJson(cmp.getString(TAG_NAME));
}
@Override
@@ -561,7 +561,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
@OnlyIn(Dist.CLIENT)
public void renderHUD(Minecraft mc) {
String name = new ItemStack(getBlockState().getBlock()).getDisplayName().getUnformattedComponentText();
String name = new ItemStack(getBlockState().getBlock()).getDisplayName().getString();
int color = isRedstone() ? 0xFF0000 : isDreamwood() ? 0xFF00AE : 0x00FF00;
HUDHandler.drawSimpleManaHUD(color, knownMana, getMaxMana(), name);
@@ -569,14 +569,14 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
if(!lens.isEmpty()) {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
String lensName = lens.getDisplayName().getUnformattedComponentText();
String lensName = lens.getDisplayName().getString();
int width = 16 + mc.fontRenderer.getStringWidth(lensName) / 2;
int x = mc.mainWindow.getScaledWidth() / 2 - width;
int y = mc.mainWindow.getScaledHeight() / 2 + 50;
mc.fontRenderer.drawStringWithShadow(lensName, x + 20, y + 5, color);
RenderHelper.enableGUIStandardItemLighting();
mc.getRenderItem().renderItemAndEffectIntoGUI(lens, x, y);
mc.getItemRenderer().renderItemAndEffectIntoGUI(lens, x, y);
RenderHelper.disableStandardItemLighting();
GlStateManager.disableLighting();
GlStateManager.disableBlend();
@@ -588,7 +588,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if(!recieverStack.isEmpty()) {
String stackName = recieverStack.getDisplayName().getUnformattedComponentText();
String stackName = recieverStack.getDisplayName().getString();
int width = 16 + mc.fontRenderer.getStringWidth(stackName) / 2;
int x = mc.mainWindow.getScaledWidth() / 2 - width;
int y = mc.mainWindow.getScaledHeight() / 2 + 30;
@@ -391,7 +391,7 @@ public class EntityDoppleganger extends EntityLiving implements IBotaniaBoss, IE
EntityPlayer player = (EntityPlayer) e;
String name = player.getName().getUnformattedComponentText();
String name = player.getName().getString();
return !(player instanceof FakePlayer || FAKE_PLAYER_PATTERN.matcher(name).matches());
}
@@ -520,7 +520,7 @@ public class ItemCraftingHalo extends ItemMod {
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if(slot == 0) {
String name = craftingTable.getDisplayName().getUnformattedComponentText();
String name = craftingTable.getDisplayName().getString();
int l = mc.fontRenderer.getStringWidth(name);
int x = mc.mainWindow.getScaledWidth() / 2 - l / 2;
int y = mc.mainWindow.getScaledHeight() / 2 - 65;
@@ -66,10 +66,15 @@ public final class LibBlockNames {
public static final String PLATFORM_INFRANGIBLE = "infrangible_platform";
public static final String ALF_PORTAL = "alfheim_portal";
public static final String DREAM_WOOD = "dreamwood";
public static final String DREAM_WOOD_PLANKS = "dreamwood_planks";
public static final String DREAM_WOOD_PLANKS_MOSSY = "mossy_dreamwood_planks";
public static final String DREAM_WOOD_FRAMED = "framed_dreamwood";
public static final String DREAM_WOOD_PATTERN_FRAMED = "pattern_framed_dreamwood";
public static final String DREAM_WOOD_GLIMMERING = "glimmering_dreamwood";
public static final String CONJURATION_CATALYST = "conjuration_catalyst";
public static final String BIFROST = "bifrost";
public static final String SOLID_VINE = "solid_vine";
public static final String BURIED_PETALS = "buried_petals";
public static final String BURIED_PETALS_SUFFIX = "_buried_petals";
public static final String PRISMARINE = "prismarine";
public static final String MINI_ISLAND = "mini_island";
public static final String TINY_POTATO = "tiny_potato";