InitBlocks no longer has errors and all blocks contructors are now correct

This commit is contained in:
Michael 2020-09-08 15:41:52 +01:00
parent 6e0fb39544
commit 6139ca68fa
No known key found for this signature in database
GPG Key ID: 971C5B254742488F
32 changed files with 450 additions and 453 deletions

View File

@ -5,6 +5,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlacer;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
@ -21,18 +22,19 @@ import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockBreaker extends BlockContainerBase {
private final boolean isPlacer;
public BlockBreaker(boolean isPlacer, String name) {
super(Material.ROCK, name);
public BlockBreaker(boolean isPlacer) {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
this.isPlacer = isPlacer;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
}
@Override

View File

@ -4,26 +4,25 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockCanolaPress extends BlockContainerBase {
public BlockCanolaPress(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockCanolaPress() {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override
@ -54,9 +53,4 @@ public class BlockCanolaPress extends BlockContainerBase {
}
return true;
}
@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.RARE;
}
}

View File

@ -1,11 +1,10 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.Random;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator;
import net.minecraft.block.Block;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
@ -16,25 +15,24 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Random;
public class BlockCoalGenerator extends BlockContainerBase {
public BlockCoalGenerator(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
this.setTickRandomly(true);
public BlockCoalGenerator() {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE)
.tickRandomly());
}
@Override

View File

@ -4,6 +4,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
import net.minecraft.block.Block;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
@ -23,17 +24,17 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockCoffeeMachine extends BlockContainerBase {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1 - 0.0625, 1 - 0.0625 * 2, 1 - 0.0625);
public BlockCoffeeMachine(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockCoffeeMachine() {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override

View File

@ -1,5 +1,6 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.Properties;
import java.util.Random;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
@ -25,21 +26,22 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.oredict.OreDictionary;
public class BlockColoredLamp extends BlockBase {
public class BlockColoredLamp extends Block {
public static final TheColoredLampColors[] ALL_LAMP_TYPES = TheColoredLampColors.values();
public static final PropertyEnum<TheColoredLampColors> TYPE = PropertyEnum.create("type", TheColoredLampColors.class);
public final boolean isOn;
public BlockColoredLamp(boolean isOn, String name) {
super(Material.REDSTONE_LIGHT, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(0.5F);
this.setResistance(3.0F);
public BlockColoredLamp(boolean isOn) {
super(Block.Properties.create(Material.REDSTONE_LIGHT)
.hardnessAndResistance(0.5f, 3.0f)
.harvestTool(ToolType.PICKAXE));
this.isOn = isOn;
}

View File

@ -1,10 +1,5 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.List;
import net.minecraft.state.IProperty;
import org.apache.commons.lang3.tuple.Pair;
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
@ -12,9 +7,9 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@ -23,6 +18,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.IProperty;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
@ -33,11 +29,15 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.tuple.Pair;
import java.util.List;
public class BlockCompost extends BlockContainerBase implements IHudDisplay {
@ -48,12 +48,11 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay {
protected static final AxisAlignedBB AABB_WALL_WEST = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D);
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1 - 0.0625, 11 * 0.0625, 1 - 0.0625);
public BlockCompost(String name) {
super(Material.WOOD, name);
this.setHarvestLevel("axe", 0);
this.setHardness(0.5F);
this.setResistance(5.0F);
this.setSoundType(SoundType.WOOD);
public BlockCompost() {
super(Block.Properties.create(Material.WOOD)
.hardnessAndResistance(0.5f, 5.0f)
.harvestTool(ToolType.AXE)
.sound(SoundType.WOOD));
}
@Override

View File

@ -4,6 +4,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
@ -20,15 +21,15 @@ import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockDropper extends BlockContainerBase {
public BlockDropper(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockDropper() {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override

View File

@ -5,6 +5,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@ -16,18 +17,19 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockEnergizer extends BlockContainerBase {
private final boolean isEnergizer;
public BlockEnergizer(boolean isEnergizer, String name) {
super(Material.ROCK, name);
public BlockEnergizer(boolean isEnergizer) {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(2.0f, 100f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
this.isEnergizer = isEnergizer;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(2.0F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
}
@Override

View File

@ -4,6 +4,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@ -15,15 +16,15 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockFeeder extends BlockContainerBase {
public BlockFeeder(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(0.5F);
this.setResistance(6.0F);
this.setSoundType(SoundType.STONE);
public BlockFeeder() {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(0.5f, 6.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override
@ -42,9 +43,4 @@ public class BlockFeeder extends BlockContainerBase {
}
return true;
}
@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.UNCOMMON;
}
}

View File

@ -4,6 +4,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@ -15,15 +16,15 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockFermentingBarrel extends BlockContainerBase {
public BlockFermentingBarrel(String name) {
super(Material.WOOD, name);
this.setHarvestLevel("axe", 0);
this.setHardness(0.5F);
this.setResistance(5.0F);
this.setSoundType(SoundType.WOOD);
public BlockFermentingBarrel() {
super(Block.Properties.create(Material.WOOD)
.hardnessAndResistance(0.5f, 5.0f)
.harvestTool(ToolType.AXE)
.sound(SoundType.WOOD));
}
@Override

View File

@ -2,6 +2,7 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFishingNet;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@ -12,17 +13,17 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockFishingNet extends BlockContainerBase {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 0.0625, 1);
public BlockFishingNet(String name) {
super(Material.WOOD, name);
this.setHarvestLevel("axe", 0);
this.setHardness(0.5F);
this.setResistance(3.0F);
this.setSoundType(SoundType.WOOD);
public BlockFishingNet() {
super(Block.Properties.create(Material.WOOD)
.hardnessAndResistance(0.5f, 3.0f)
.harvestTool(ToolType.AXE)
.sound(SoundType.WOOD));
}
@Override

View File

@ -5,6 +5,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidPlacer;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
@ -21,18 +22,19 @@ import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockFluidCollector extends BlockContainerBase {
private final boolean isPlacer;
public BlockFluidCollector(boolean isPlacer, String name) {
super(Material.ROCK, name);
public BlockFluidCollector(boolean isPlacer) {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
this.isPlacer = isPlacer;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
}
@Override

View File

@ -1,8 +1,5 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.List;
import java.util.Random;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
@ -22,29 +19,28 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
import java.util.Random;
public class BlockFurnaceDouble extends BlockContainerBase {
public static final PropertyBool IS_ON = PropertyBool.create("on");
public BlockFurnaceDouble(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
this.setTickRandomly(true);
public BlockFurnaceDouble() {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE)
.tickRandomly());
}
@Override

View File

@ -2,6 +2,7 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceSolar;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@ -12,17 +13,17 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockFurnaceSolar extends BlockContainerBase {
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 6 * 0.0625, 1);
public BlockFurnaceSolar(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockFurnaceSolar() {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override

View File

@ -1,178 +1,178 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.List;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestLarge;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestMedium;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandlerModifiable;
public class BlockGiantChest extends BlockContainerBase {
public final int type;
public BlockGiantChest(String name, int type) {
super(Material.WOOD, name);
this.type = type;
this.setHarvestLevel("axe", 0);
this.setHardness(0.5F);
this.setResistance(15.0F);
this.setSoundType(SoundType.WOOD);
}
@Override
public TileEntity createNewTileEntity(World world, int par2) {
switch (this.type) {
case 1:
return new TileEntityGiantChestMedium();
case 2:
return new TileEntityGiantChestLarge();
default:
return new TileEntityGiantChest();
}
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileEntityGiantChest chest = (TileEntityGiantChest) world.getTileEntity(pos);
if (chest != null) {
chest.fillWithLoot(player);
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.GIANT_CHEST.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
}
return true;
}
return true;
}
@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.EPIC;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
if (stack.getTagCompound() != null) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityGiantChest) {
NBTTagList list = stack.getTagCompound().getTagList("Items", 10);
IItemHandlerModifiable inv = ((TileEntityGiantChest) tile).inv;
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound compound = list.getCompoundTagAt(i);
if (compound != null && compound.hasKey("id")) {
inv.setStackInSlot(i, new ItemStack(list.getCompoundTagAt(i)));
}
}
}
}
super.onBlockPlacedBy(world, pos, state, entity, stack);
}
@Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
super.getDrops(drops, world, pos, state, fortune);
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityGiantChest) {
ItemStackHandlerAA slots = ((TileEntityGiantChest) tile).inv;
int place = ItemUtil.getPlaceAt(slots.getItems(), new ItemStack(InitItems.itemCrateKeeper), false);
if (place >= 0) {
NBTTagList list = new NBTTagList();
for (int i = 0; i < slots.getSlots(); i++) {
//Destroy the keeper
if (i != place) {
NBTTagCompound compound = new NBTTagCompound();
if (StackUtil.isValid(slots.getStackInSlot(i))) {
slots.getStackInSlot(i).writeToNBT(compound);
}
list.appendTag(compound);
}
}
if (list.tagCount() > 0) {
ItemStack stackInQuestion = drops.get(0);
if (StackUtil.isValid(stackInQuestion)) {
if (stackInQuestion.getTagCompound() == null) {
stackInQuestion.setTagCompound(new NBTTagCompound());
}
stackInQuestion.getTagCompound().setTag("Items", list);
}
}
}
}
}
@Override
public boolean shouldDropInventory(World world, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
return !(tile instanceof TileEntityGiantChest) || !ItemUtil.contains(((TileEntityGiantChest) tile).inv.getItems(), new ItemStack(InitItems.itemCrateKeeper), false);
}
@Override
protected ItemBlockBase getItemBlock() {
return new TheItemBlock(this);
}
public static class TheItemBlock extends ItemBlockBase {
public TheItemBlock(Block block) {
super(block);
}
@Override
public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced) {
int type = this.block instanceof BlockGiantChest ? ((BlockGiantChest) this.block).type : -1;
if (type == 2) {
tooltip.add(TextFormatting.ITALIC + StringUtil.localize("container." + ActuallyAdditions.MODID + ".giantChestLarge.desc"));
} else if (type == 0) {
tooltip.add(TextFormatting.ITALIC + StringUtil.localize("container." + ActuallyAdditions.MODID + ".giantChest.desc"));
}
}
@Override
public NBTTagCompound getNBTShareTag(ItemStack stack) {
return null;
}
}
}
// todo: delete. I'm not allowed to port this one haha
//package de.ellpeck.actuallyadditions.mod.blocks;
//
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
//import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
//import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
//import de.ellpeck.actuallyadditions.mod.items.InitItems;
//import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
//import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestLarge;
//import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestMedium;
//import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
//import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
//import de.ellpeck.actuallyadditions.mod.util.StackUtil;
//import de.ellpeck.actuallyadditions.mod.util.StringUtil;
//import net.minecraft.block.Block;
//import net.minecraft.block.SoundType;
//import net.minecraft.block.material.Material;
//import net.minecraft.block.state.IBlockState;
//import net.minecraft.client.util.ITooltipFlag;
//import net.minecraft.entity.EntityLivingBase;
//import net.minecraft.entity.player.EntityPlayer;
//import net.minecraft.item.EnumRarity;
//import net.minecraft.item.ItemStack;
//import net.minecraft.nbt.NBTTagCompound;
//import net.minecraft.nbt.NBTTagList;
//import net.minecraft.tileentity.TileEntity;
//import net.minecraft.util.EnumFacing;
//import net.minecraft.util.EnumHand;
//import net.minecraft.util.NonNullList;
//import net.minecraft.util.math.BlockPos;
//import net.minecraft.util.text.TextFormatting;
//import net.minecraft.world.IBlockAccess;
//import net.minecraft.world.World;
//import net.minecraftforge.common.ToolType;
//import net.minecraftforge.items.IItemHandlerModifiable;
//
//import java.util.List;
//
//public class BlockGiantChest extends BlockContainerBase {
//
// public final int type;
//
// public BlockGiantChest(int type) {
// super(Block.Properties.create(Material.WOOD)
// .hardnessAndResistance(0.5f, 15.0f)
// .harvestTool(ToolType.AXE)
// .sound(SoundType.STONE));
//
// this.type = type;
// }
//
// @Override
// public TileEntity createNewTileEntity(World world, int par2) {
// switch (this.type) {
// case 1:
// return new TileEntityGiantChestMedium();
// case 2:
// return new TileEntityGiantChestLarge();
// default:
// return new TileEntityGiantChest();
// }
// }
//
// @Override
// public boolean isFullCube(IBlockState state) {
// return false;
// }
//
// @Override
// public boolean isOpaqueCube(IBlockState state) {
// return false;
// }
//
// @Override
// public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
// if (!world.isRemote) {
// TileEntityGiantChest chest = (TileEntityGiantChest) world.getTileEntity(pos);
// if (chest != null) {
// chest.fillWithLoot(player);
// player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.GIANT_CHEST.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
// }
// return true;
// }
// return true;
// }
//
// @Override
// public EnumRarity getRarity(ItemStack stack) {
// return EnumRarity.EPIC;
// }
//
// @Override
// public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
// if (stack.getTagCompound() != null) {
// TileEntity tile = world.getTileEntity(pos);
// if (tile instanceof TileEntityGiantChest) {
// NBTTagList list = stack.getTagCompound().getTagList("Items", 10);
// IItemHandlerModifiable inv = ((TileEntityGiantChest) tile).inv;
//
// for (int i = 0; i < list.tagCount(); i++) {
// NBTTagCompound compound = list.getCompoundTagAt(i);
// if (compound != null && compound.hasKey("id")) {
// inv.setStackInSlot(i, new ItemStack(list.getCompoundTagAt(i)));
// }
// }
// }
// }
//
// super.onBlockPlacedBy(world, pos, state, entity, stack);
// }
//
// @Override
// public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
// super.getDrops(drops, world, pos, state, fortune);
// TileEntity tile = world.getTileEntity(pos);
// if (tile instanceof TileEntityGiantChest) {
// ItemStackHandlerAA slots = ((TileEntityGiantChest) tile).inv;
// int place = ItemUtil.getPlaceAt(slots.getItems(), new ItemStack(InitItems.itemCrateKeeper), false);
// if (place >= 0) {
// NBTTagList list = new NBTTagList();
// for (int i = 0; i < slots.getSlots(); i++) {
// //Destroy the keeper
// if (i != place) {
// NBTTagCompound compound = new NBTTagCompound();
// if (StackUtil.isValid(slots.getStackInSlot(i))) {
// slots.getStackInSlot(i).writeToNBT(compound);
// }
// list.appendTag(compound);
// }
// }
//
// if (list.tagCount() > 0) {
// ItemStack stackInQuestion = drops.get(0);
// if (StackUtil.isValid(stackInQuestion)) {
// if (stackInQuestion.getTagCompound() == null) {
// stackInQuestion.setTagCompound(new NBTTagCompound());
// }
// stackInQuestion.getTagCompound().setTag("Items", list);
// }
// }
// }
// }
// }
//
// @Override
// public boolean shouldDropInventory(World world, BlockPos pos) {
// TileEntity tile = world.getTileEntity(pos);
// return !(tile instanceof TileEntityGiantChest) || !ItemUtil.contains(((TileEntityGiantChest) tile).inv.getItems(), new ItemStack(InitItems.itemCrateKeeper), false);
// }
//
// @Override
// protected ItemBlockBase getItemBlock() {
// return new TheItemBlock(this);
// }
//
// public static class TheItemBlock extends ItemBlockBase {
//
// public TheItemBlock(Block block) {
// super(block);
// }
//
// @Override
// public void addInformation(ItemStack stack, World playerIn, List<String> tooltip, ITooltipFlag advanced) {
// int type = this.block instanceof BlockGiantChest ? ((BlockGiantChest) this.block).type : -1;
// if (type == 2) {
// tooltip.add(TextFormatting.ITALIC + StringUtil.localize("container." + ActuallyAdditions.MODID + ".giantChestLarge.desc"));
// } else if (type == 0) {
// tooltip.add(TextFormatting.ITALIC + StringUtil.localize("container." + ActuallyAdditions.MODID + ".giantChest.desc"));
// }
// }
//
// @Override
// public NBTTagCompound getNBTShareTag(ItemStack stack) {
// return null;
// }
// }
//}

View File

@ -1,10 +1,5 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.Random;
import org.apache.commons.lang3.tuple.Triple;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
import net.minecraft.block.SoundType;
@ -17,18 +12,21 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.tuple.Triple;
public class BlockGreenhouseGlass extends BlockBase {
import java.util.Random;
public BlockGreenhouseGlass(String name) {
super(Material.GLASS, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(0.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.GLASS);
this.setTickRandomly(true);
public class BlockGreenhouseGlass extends Block {
public BlockGreenhouseGlass() {
super(Block.Properties.create(Material.GLASS)
.hardnessAndResistance(0.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.GLASS)
.tickRandomly());
}
@Override

View File

@ -1,12 +1,11 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.Random;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinderDouble;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
@ -21,15 +20,22 @@ import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Random;
public class BlockGrinder extends BlockContainerBase {
private final boolean isDouble;
public BlockGrinder(boolean isDouble, String name) {
super(Material.ROCK, name);
public BlockGrinder(boolean isDouble) {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
this.isDouble = isDouble;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);

View File

@ -2,21 +2,22 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityHeatCollector;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockHeatCollector extends BlockContainerBase {
public BlockHeatCollector(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(2.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockHeatCollector() {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(2.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override

View File

@ -1,7 +1,5 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.Random;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
@ -22,6 +20,9 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import java.util.Random;
public class BlockInputter extends BlockContainerBase {
@ -29,13 +30,13 @@ public class BlockInputter extends BlockContainerBase {
public final boolean isAdvanced;
public BlockInputter(boolean isAdvanced, String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
this.setTickRandomly(true);
public BlockInputter(boolean isAdvanced) {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE)
.tickRandomly());
this.isAdvanced = isAdvanced;
}

View File

@ -4,6 +4,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemRepairer;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@ -16,16 +17,16 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockItemRepairer extends BlockContainerBase {
public BlockItemRepairer(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(20.0F);
this.setResistance(15.0F);
this.setSoundType(SoundType.STONE);
this.setTickRandomly(true);
public BlockItemRepairer() {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(20.0f, 15.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE)
.tickRandomly());
}
@Override

View File

@ -1,8 +1,5 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.ArrayList;
import java.util.List;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.Block;
@ -19,15 +16,18 @@ import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockLampPowerer extends BlockBase {
import java.util.ArrayList;
import java.util.List;
public BlockLampPowerer(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public class BlockLampPowerer extends Block {
public BlockLampPowerer() {
super(Block.Properties.create(Material.REDSTONE_LIGHT)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override

View File

@ -4,6 +4,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLavaFactoryController;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
@ -14,17 +15,17 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockLavaFactoryController extends BlockContainerBase implements IHudDisplay {
public BlockLavaFactoryController(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(4.5F);
this.setResistance(20.0F);
this.setSoundType(SoundType.STONE);
public BlockLavaFactoryController() {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(4.5f, 20.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override
@ -32,11 +33,6 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IH
return new TileEntityLavaFactoryController();
}
@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.RARE;
}
@Override
@SideOnly(Side.CLIENT)
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution) {

View File

@ -6,6 +6,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
@ -14,17 +15,18 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraftforge.common.ToolType;
public class BlockMisc extends BlockBase {
public class BlockMisc extends Block {
public static final TheMiscBlocks[] ALL_MISC_BLOCKS = TheMiscBlocks.values();
public static final PropertyEnum<TheMiscBlocks> TYPE = PropertyEnum.create("type", TheMiscBlocks.class);
public BlockMisc(String name) {
super(Material.ROCK, name);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setHarvestLevel("pickaxe", 1);
public BlockMisc() {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override

View File

@ -1,11 +1,10 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.Random;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
import net.minecraft.block.Block;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
@ -16,25 +15,24 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Random;
public class BlockOilGenerator extends BlockContainerBase {
public BlockOilGenerator(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
this.setTickRandomly(true);
public BlockOilGenerator() {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE)
.tickRandomly());
}
@Override

View File

@ -3,12 +3,7 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBreaker;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomEnergyface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomItemface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomLiquiface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomRedstoneface;
import de.ellpeck.actuallyadditions.mod.tile.*;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
@ -30,6 +25,7 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -37,13 +33,13 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
public final Type type;
public BlockPhantom(Type type, String name) {
super(Material.ROCK, name);
public BlockPhantom(Type type) {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(4.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
this.type = type;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(4.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
}
@Override

View File

@ -2,6 +2,7 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBooster;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
@ -12,17 +13,17 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class BlockPhantomBooster extends BlockContainerBase {
private static final AxisAlignedBB AABB = new AxisAlignedBB(2 * 0.0625, 0, 2 * 0.0625, 1 - 2 * 0.0625, 1, 1 - 2 * 0.0625);
public BlockPhantomBooster(String name) {
super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F);
this.setResistance(10.0F);
this.setSoundType(SoundType.STONE);
public BlockPhantomBooster() {
super(Block.Properties.create(Material.ROCK)
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(ToolType.PICKAXE)
.sound(SoundType.STONE));
}
@Override

View File

@ -1,12 +1,12 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.BlockState;
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;
@ -21,6 +21,7 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -29,16 +30,18 @@ public class BlockSlabs extends Block {
public static final AxisAlignedBB AABB_BOTTOM_HALF = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5D, 1.0D);
private static final AxisAlignedBB AABB_TOP_HALF = new AxisAlignedBB(0.0D, 0.5D, 0.0D, 1.0D, 1.0D, 1.0D);
private final IBlockState fullBlockState;
private final BlockState fullBlockState;
public BlockSlabs(String name, Block fullBlock) {
this(name, fullBlock.getDefaultState());
public BlockSlabs(Block fullBlock) {
this(fullBlock.getDefaultState());
}
public BlockSlabs(String name, BlockState fullBlockState) {
super(fullBlockState.getMaterial(), name);
this.setHardness(1.5F);
this.setResistance(10.0F);
public BlockSlabs(BlockState fullBlockState) {
super(Properties.create(fullBlockState.getMaterial())
.harvestTool(fullBlockState.getHarvestTool())
.hardnessAndResistance(1.5f, 10.0f)
.sound(fullBlockState.getSoundType()));
this.fullBlockState = fullBlockState;
}

View File

@ -1,10 +1,8 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import java.util.Random;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.recipe.TreasureChestLoot;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import net.minecraft.block.Block;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
@ -18,28 +16,24 @@ import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.WeightedRandom;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockTreasureChest extends BlockBase {
import java.util.Random;
public BlockTreasureChest(String name) {
super(Material.WOOD, name);
this.setHarvestLevel("axe", 0);
this.setHardness(300.0F);
this.setResistance(50.0F);
this.setSoundType(SoundType.WOOD);
this.setTickRandomly(true);
public class BlockTreasureChest extends Block {
public BlockTreasureChest() {
super(Block.Properties.create(Material.WOOD)
.hardnessAndResistance(300.0f, 50.0f)
.harvestTool(ToolType.AXE)
.sound(SoundType.WOOD)
.tickRandomly());
}
@Override

View File

@ -4,6 +4,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.BlockWall;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
@ -15,20 +16,22 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockWallAA extends BlockBase {
public class BlockWallAA extends Block {
protected static final AxisAlignedBB[] AABB_BY_INDEX = new AxisAlignedBB[] { new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.3125D, 0.0D, 0.0D, 0.6875D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.3125D, 1.0D, 0.875D, 0.6875D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D) };
protected static final AxisAlignedBB[] CLIP_AABB_BY_INDEX = new AxisAlignedBB[] { AABB_BY_INDEX[0].setMaxY(1.5D), AABB_BY_INDEX[1].setMaxY(1.5D), AABB_BY_INDEX[2].setMaxY(1.5D), AABB_BY_INDEX[3].setMaxY(1.5D), AABB_BY_INDEX[4].setMaxY(1.5D), AABB_BY_INDEX[5].setMaxY(1.5D), AABB_BY_INDEX[6].setMaxY(1.5D), AABB_BY_INDEX[7].setMaxY(1.5D), AABB_BY_INDEX[8].setMaxY(1.5D), AABB_BY_INDEX[9].setMaxY(1.5D), AABB_BY_INDEX[10].setMaxY(1.5D), AABB_BY_INDEX[11].setMaxY(1.5D), AABB_BY_INDEX[12].setMaxY(1.5D), AABB_BY_INDEX[13].setMaxY(1.5D), AABB_BY_INDEX[14].setMaxY(1.5D), AABB_BY_INDEX[15].setMaxY(1.5D) };
@SuppressWarnings("deprecation")
public BlockWallAA(String name, Block blocc) {
super(blocc.getDefaultState().getMaterial(), name);
this.setHardness(1.5F);
this.setResistance(10F);
this.setSoundType(blocc.getSoundType());
public BlockWallAA(Block blocc) {
super(Block.Properties.create(blocc.getDefaultState().getMaterial())
.hardnessAndResistance(1.5f, 10.0f)
.harvestTool(blocc.getDefaultState().getHarvestTool())
.sound(blocc.getDefaultState().getSoundType()));
this.setDefaultState(this.blockState.getBaseState().withProperty(BlockWall.UP, false).withProperty(BlockWall.NORTH, false).withProperty(BlockWall.EAST, false).withProperty(BlockWall.SOUTH, false).withProperty(BlockWall.WEST, false));
}

View File

@ -29,9 +29,8 @@ public class BlockWildPlant extends BlockBushBase {
public static final TheWildPlants[] ALL_WILD_PLANTS = TheWildPlants.values();
public static final PropertyEnum<TheWildPlants> TYPE = PropertyEnum.create("type", TheWildPlants.class);
public BlockWildPlant(String name) {
super(name);
this.setSoundType(SoundType.PLANT);
public BlockWildPlant() {
super(Properties.create(Material.PLANTS));
}
@Override

View File

@ -127,16 +127,16 @@ public final class InitBlocks {
= BLOCKS.register("block_testifi_bucks_white_stairs", () -> new StairsBlock(() -> blockTestifiBucksWhiteWall.get().getDefaultState(), Block.Properties.create(Material.ROCK)));
public static final RegistryObject<Block> blockTestifiBucksGreenSlab
= BLOCKS.register("block_testifi_bucks_green_slab", () -> new BlockSlabs(blockTestifiBucksGreenWall);
= BLOCKS.register("block_testifi_bucks_green_slab", () -> new BlockSlabs(blockTestifiBucksGreenWall.get()));
public static final RegistryObject<Block> blockTestifiBucksWhiteSlab
= BLOCKS.register("block_testifi_bucks_white_slab", () -> new BlockSlabs(blockTestifiBucksWhiteWall);
= BLOCKS.register("block_testifi_bucks_white_slab", () -> new BlockSlabs(blockTestifiBucksWhiteWall.get()));
public static final RegistryObject<Block> blockTestifiBucksGreenFence
= BLOCKS.register("block_testifi_bucks_green_fence", () -> new BlockWallAA(blockTestifiBucksGreenWall);
= BLOCKS.register("block_testifi_bucks_green_fence", () -> new BlockWallAA(blockTestifiBucksGreenWall.get()));
public static final RegistryObject<Block> blockTestifiBucksWhiteFence
= BLOCKS.register("block_testifi_bucks_white_fence", () -> new BlockWallAA(blockTestifiBucksWhiteWall);
= BLOCKS.register("block_testifi_bucks_white_fence", () -> new BlockWallAA(blockTestifiBucksWhiteWall.get()));
public static final RegistryObject<Block> blockColoredLamp
= BLOCKS.register("block_colored_lamp", () -> new BlockColoredLamp(false));
@ -210,14 +210,14 @@ public final class InitBlocks {
public static final RegistryObject<Block> blockFeeder
= BLOCKS.register("block_feeder", BlockFeeder::new);
public static final RegistryObject<Block> blockGiantChest
= BLOCKS.register("block_giant_chest", BlockGiantChest::new);
public static final RegistryObject<Block> blockGiantChestMedium
= BLOCKS.register("block_giant_chest_medium", BlockGiantChest::new);
public static final RegistryObject<Block> blockGiantChestLarge
= BLOCKS.register("block_giant_chest_large", BlockGiantChest::new);
// public static final RegistryObject<Block> blockGiantChest
// = BLOCKS.register("block_giant_chest", BlockGiantChest::new);
//
// public static final RegistryObject<Block> blockGiantChestMedium
// = BLOCKS.register("block_giant_chest_medium", BlockGiantChest::new);
//
// public static final RegistryObject<Block> blockGiantChestLarge
// = BLOCKS.register("block_giant_chest_large", BlockGiantChest::new);
public static final RegistryObject<Block> blockGrinder
= BLOCKS.register("block_grinder", () -> new BlockGrinder(false));
@ -274,31 +274,31 @@ public final class InitBlocks {
= BLOCKS.register("block_wild", BlockWildPlant::new);
public static final RegistryObject<Block> blockQuartzWall
= BLOCKS.register("block_quartz_wall", () -> new BlockWallAA(blockMisc));
= BLOCKS.register("block_quartz_wall", () -> new BlockWallAA(blockMisc.get()));
public static final RegistryObject<Block> blockChiseledQuartzWall
= BLOCKS.register("block_chiseled_quartz_wall", () -> new BlockWallAA(blockMisc));
= BLOCKS.register("block_chiseled_quartz_wall", () -> new BlockWallAA(blockMisc.get()));
public static final RegistryObject<Block> blockPillarQuartzWall
= BLOCKS.register("block_pillar_quartz_wall", () -> new BlockWallAA(blockMisc));
= BLOCKS.register("block_pillar_quartz_wall", () -> new BlockWallAA(blockMisc.get()));
public static final RegistryObject<Block> blockQuartzStair
= BLOCKS.register("block_quartz_stair", () -> new StairsBlock(blockMisc.get().getDefaultState().with(BlockMisc.TYPE, TheMiscBlocks.QUARTZ), Block.Properties.create(Material.ROCK)));
= BLOCKS.register("block_quartz_stair", () -> new StairsBlock(() -> blockMisc.get().getDefaultState().with(BlockMisc.TYPE, TheMiscBlocks.QUARTZ), Block.Properties.create(Material.ROCK)));
public static final RegistryObject<Block> blockChiseledQuartzStair
= BLOCKS.register("block_chiseled_quartz_stair", () -> new StairsBlock(blockMisc.get().getDefaultState().with(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_CHISELED), Block.Properties.create(Material.ROCK)));
= BLOCKS.register("block_chiseled_quartz_stair", () -> new StairsBlock(() -> blockMisc.get().getDefaultState().with(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_CHISELED), Block.Properties.create(Material.ROCK)));
public static final RegistryObject<Block> blockPillarQuartzStair
= BLOCKS.register("block_pillar_quartz_stair", () -> new StairsBlock(blockMisc.get().getDefaultState().with(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_PILLAR), Block.Properties.create(Material.ROCK)));
= BLOCKS.register("block_pillar_quartz_stair", () -> new StairsBlock(() -> blockMisc.get().getDefaultState().with(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_PILLAR), Block.Properties.create(Material.ROCK)));
public static final RegistryObject<Block> blockQuartzSlab
= BLOCKS.register("block_quartz_slab", () -> new BlockSlabs(blockMisc.get().getDefaultState().with(BlockMisc.TYPE, TheMiscBlocks.QUARTZ), Block.Properties.create(Material.ROCK)));
= BLOCKS.register("block_quartz_slab", () -> new BlockSlabs(blockMisc.get().getDefaultState().with(BlockMisc.TYPE, TheMiscBlocks.QUARTZ)));
public static final RegistryObject<Block> blockChiseledQuartzSlab
= BLOCKS.register("block_chiseled_quartz_slab", () -> new BlockSlabs(blockMisc.get().getDefaultState().with(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_CHISELED), Block.Properties.create(Material.ROCK)));
= BLOCKS.register("block_chiseled_quartz_slab", () -> new BlockSlabs(blockMisc.get().getDefaultState().with(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_CHISELED)));
public static final RegistryObject<Block> blockPillarQuartzSlab
= BLOCKS.register("block_pillar_quartz_slab", () -> new BlockSlabs(blockMisc.get().getDefaultState().with(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_PILLAR), Block.Properties.create(Material.ROCK)));
= BLOCKS.register("block_pillar_quartz_slab", () -> new BlockSlabs(blockMisc.get().getDefaultState().with(BlockMisc.TYPE, TheMiscBlocks.QUARTZ_PILLAR)));
public static void init() {
ActuallyAdditions.LOGGER.info("Initializing Blocks...");

View File

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.blocks.base;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.block.BlockState;
import net.minecraft.block.CropsBlock;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -32,17 +33,18 @@ import java.util.List;
public class BlockPlant extends CropsBlock {// implements ItemBlockBase.ICustomRarity, IHasModel {
// private final String name;
private final int minDropAmount = 1;
private final int addDropAmount = 1;
private final int minDropAmount;
private final int addDropAmount;
public Item seedItem;
private Item returnItem;
private int returnMeta;
public BlockPlant(Properties properties) {
super(properties);
// todo: find the correct properties for crops
public BlockPlant(int minDropAmount, int addDropAmount) {
super(Properties.create(Material.PLANTS));
// this.name = name;
// this.minDropAmount = minDropAmount;
// this.addDropAmount = addDropAmount;
this.minDropAmount = minDropAmount;
this.addDropAmount = addDropAmount;
// this.register();
}