mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Sooo.. yea, I'm still at it.
And still not compilable. Oh god.
This commit is contained in:
parent
020745a813
commit
b2a00d2c8d
112 changed files with 665 additions and 1126 deletions
|
@ -2,7 +2,7 @@ package cofh.api.energy;
|
|||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyHandler}. Use/extend this or implement your own.
|
||||
|
@ -30,34 +30,34 @@ public class TileEnergyHandler extends TileEntity implements IEnergyHandler {
|
|||
|
||||
/* IEnergyConnection */
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
public boolean canConnectEnergy(EnumFacing from) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* IEnergyReceiver */
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate) {
|
||||
|
||||
return storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
/* IEnergyProvider */
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate) {
|
||||
|
||||
return storage.extractEnergy(maxExtract, simulate);
|
||||
}
|
||||
|
||||
/* IEnergyReceiver and IEnergyProvider */
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
public int getEnergyStored(EnumFacing from) {
|
||||
|
||||
return storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from) {
|
||||
public int getMaxEnergyStored(EnumFacing from) {
|
||||
|
||||
return storage.getMaxEnergyStored();
|
||||
}
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
package cofh.api.energy;
|
||||
|
||||
import cofh.api.CoFHAPIProps;
|
||||
import cpw.mods.fml.common.API;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
|
|
|
@ -5,5 +5,4 @@
|
|||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI")
|
||||
package cofh.api;
|
||||
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
|
@ -60,7 +60,7 @@ public class CrusherRecipe{
|
|||
return null;
|
||||
}
|
||||
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.outputOne, false);
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.outputOne);
|
||||
if(stacks != null && !stacks.isEmpty()){
|
||||
List<ItemStack> stacksCopy = new ArrayList<ItemStack>();
|
||||
for(ItemStack stack : stacks){
|
||||
|
@ -84,7 +84,7 @@ public class CrusherRecipe{
|
|||
return null;
|
||||
}
|
||||
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.outputTwo, false);
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.outputTwo);
|
||||
if(stacks != null && !stacks.isEmpty()){
|
||||
List<ItemStack> stacksCopy = new ArrayList<ItemStack>();
|
||||
for(ItemStack stack : stacks){
|
||||
|
@ -108,7 +108,7 @@ public class CrusherRecipe{
|
|||
return null;
|
||||
}
|
||||
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.input, false);
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.input);
|
||||
if(stacks != null && !stacks.isEmpty()){
|
||||
List<ItemStack> stacksCopy = new ArrayList<ItemStack>();
|
||||
for(ItemStack stack : stacks){
|
||||
|
|
|
@ -46,7 +46,7 @@ public class LensNoneRecipe{
|
|||
return null;
|
||||
}
|
||||
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.output, false);
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.output);
|
||||
if(stacks != null && !stacks.isEmpty()){
|
||||
List<ItemStack> stacksCopy = new ArrayList<ItemStack>();
|
||||
for(ItemStack stack : stacks){
|
||||
|
@ -70,7 +70,7 @@ public class LensNoneRecipe{
|
|||
return null;
|
||||
}
|
||||
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.input, false);
|
||||
List<ItemStack> stacks = OreDictionary.getOres(this.input);
|
||||
if(stacks != null && !stacks.isEmpty()){
|
||||
List<ItemStack> stacksCopy = new ArrayList<ItemStack>();
|
||||
for(ItemStack stack : stacks){
|
||||
|
|
|
@ -70,21 +70,21 @@ public class BlockBookletStand extends BlockContainerBase implements IHudDisplay
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||
Position pos = new Position(x, y, z);
|
||||
Position thePos = Position.fromBlockPos(pos);
|
||||
|
||||
if(rotation == 0){
|
||||
pos.setMetadata(world, 2, 2);
|
||||
thePos.setMetadata(world, 2, 2);
|
||||
}
|
||||
if(rotation == 1){
|
||||
pos.setMetadata(world, 1, 2);
|
||||
thePos.setMetadata(world, 1, 2);
|
||||
}
|
||||
if(rotation == 2){
|
||||
pos.setMetadata(world, 0, 2);
|
||||
thePos.setMetadata(world, 0, 2);
|
||||
}
|
||||
if(rotation == 3){
|
||||
pos.setMetadata(world, 3, 2);
|
||||
thePos.setMetadata(world, 3, 2);
|
||||
}
|
||||
|
||||
TileEntityBookletStand tile = (TileEntityBookletStand)world.getTileEntity(pos);
|
||||
|
@ -97,7 +97,7 @@ public class BlockBookletStand extends BlockContainerBase implements IHudDisplay
|
|||
}
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
|
||||
|
@ -17,13 +18,14 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
|||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
@ -37,8 +39,6 @@ public class BlockColoredLamp extends BlockBase{
|
|||
|
||||
public static TheColoredLampColors[] allLampTypes = TheColoredLampColors.values();
|
||||
public boolean isOn;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] textures;
|
||||
|
||||
public BlockColoredLamp(boolean isOn, String name){
|
||||
super(Material.redstoneLight, name);
|
||||
|
@ -49,27 +49,21 @@ public class BlockColoredLamp extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return meta >= allLampTypes.length ? null : textures[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random rand, int par3){
|
||||
public Item getItemDropped(IBlockState state, Random rand, int par3){
|
||||
return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta){
|
||||
return meta;
|
||||
public int damageDropped(IBlockState state){
|
||||
return this.getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ){
|
||||
//Turning On
|
||||
if(player.isSneaking()){
|
||||
if(!world.isRemote){
|
||||
world.setBlock(x, y, z, this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn, world.getBlockMetadata(x, y, z), 2);
|
||||
Position.fromBlockPos(pos).setBlock(world, this.isOn ? InitBlocks.blockColoredLamp : InitBlocks.blockColoredLampOn, Position.fromBlockPos(pos).getMetadata(world), 2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -81,9 +75,9 @@ public class BlockColoredLamp extends BlockBase{
|
|||
String name = OreDictionary.getOreName(oreID);
|
||||
TheColoredLampColors color = TheColoredLampColors.getColorFromDyeName(name);
|
||||
if(color != null){
|
||||
if(world.getBlockMetadata(x, y, z) != color.ordinal()){
|
||||
if(Position.fromBlockPos(pos).getMetadata(world) != color.ordinal()){
|
||||
if(!world.isRemote){
|
||||
world.setBlockMetadataWithNotify(x, y, z, color.ordinal(), 2);
|
||||
Position.fromBlockPos(pos).setMetadata(world, color.ordinal(), 2);
|
||||
if(!player.capabilities.isCreativeMode){
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
|
@ -98,13 +92,13 @@ public class BlockColoredLamp extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack createStackedBlock(int meta){
|
||||
return new ItemStack(InitBlocks.blockColoredLamp, 1, meta);
|
||||
public ItemStack createStackedBlock(IBlockState state){
|
||||
return new ItemStack(InitBlocks.blockColoredLamp, 1, this.getMetaFromState(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World world, int x, int y, int z){
|
||||
public Item getItem(World world, BlockPos pos){
|
||||
return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
|
||||
}
|
||||
|
||||
|
@ -117,16 +111,7 @@ public class BlockColoredLamp extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.textures = new IIcon[allLampTypes.length];
|
||||
for(int i = 0; i < allLampTypes.length; i++){
|
||||
this.textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+allLampTypes[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z){
|
||||
public int getLightValue(IBlockAccess world, BlockPos pos){
|
||||
return this.isOn ? 15 : 0;
|
||||
}
|
||||
|
||||
|
@ -137,7 +122,7 @@ public class BlockColoredLamp extends BlockBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
@ -153,7 +138,7 @@ public class BlockColoredLamp extends BlockBase{
|
|||
if(stack.getItemDamage() >= allLampTypes.length){
|
||||
return null;
|
||||
}
|
||||
return StringUtil.localize(this.getUnlocalizedName(stack)+".name")+(((BlockColoredLamp)this.field_150939_a).isOn ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".onSuffix.desc")+")" : "");
|
||||
return StringUtil.localize(this.getUnlocalizedName(stack)+".name")+(((BlockColoredLamp)this.block).isOn ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".onSuffix.desc")+")" : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,28 +10,23 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
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 de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
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.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockFermentingBarrel extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
public BlockFermentingBarrel(String name){
|
||||
super(Material.wood, name);
|
||||
this.setHarvestLevel("axe", 0);
|
||||
|
@ -46,38 +41,25 @@ public class BlockFermentingBarrel extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, Position.fromBlockPos(pos));
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return side <= 1 ? this.iconTop : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel)world.getTileEntity(x, y, z);
|
||||
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel)world.getTileEntity(pos);
|
||||
if(press != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FERMENTING_BARREL.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.FERMENTING_BARREL.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.iconTop = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,26 +10,21 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
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.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockFireworkBox extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
|
||||
public BlockFireworkBox(String name){
|
||||
super(Material.rock, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -44,31 +39,18 @@ public class BlockFireworkBox extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side == 1 ? this.topIcon : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
return this.tryToggleRedstone(world, x, y, z, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
return this.tryToggleRedstone(world, Position.fromBlockPos(pos), player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, Position.fromBlockPos(pos));
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,15 +14,10 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFishingNet;
|
||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockFishingNet extends BlockContainerBase{
|
||||
|
||||
|
@ -40,35 +35,18 @@ public class BlockFishingNet extends BlockContainerBase{
|
|||
return new TileEntityFishingNet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return AssetUtil.TESR_RENDER_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = Blocks.planks.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,33 +10,24 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
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.TileEntityFluidCollector;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
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.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockFluidCollector extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon frontIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
|
||||
private boolean isPlacer;
|
||||
|
||||
public BlockFluidCollector(boolean isPlacer, String name){
|
||||
|
@ -53,31 +44,6 @@ public class BlockFluidCollector extends BlockContainerBase{
|
|||
return this.isPlacer ? new TileEntityFluidCollector.TileEntityFluidPlacer() : new TileEntityFluidCollector();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(side != meta && (side == 0 || side == 1)){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == meta){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(side == 0 || side == 1){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == 3){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
if(this.tryToggleRedstone(world, x, y, z, player)){
|
||||
|
@ -93,30 +59,22 @@ public class BlockFluidCollector extends BlockContainerBase{
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
|
||||
Position.fromBlockPos(pos).setMetadata(world, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, Position.fromBlockPos(pos));
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,27 +12,19 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockLampPowerer extends BlockBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon frontIcon;
|
||||
|
||||
public BlockLampPowerer(String name){
|
||||
super(Material.rock, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -42,59 +34,35 @@ public class BlockLampPowerer extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(side == meta){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock){
|
||||
this.updateLamp(world, Position.fromBlockPos(pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(side == 3){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state){
|
||||
this.updateLamp(world, Position.fromBlockPos(pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block){
|
||||
this.updateLamp(world, x, y, z);
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal();
|
||||
Position.fromBlockPos(pos).setMetadata(world, rotation, 2);
|
||||
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z){
|
||||
this.updateLamp(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
}
|
||||
|
||||
private void updateLamp(World world, int x, int y, int z){
|
||||
private void updateLamp(World world, Position pos){
|
||||
if(!world.isRemote){
|
||||
Position coords = WorldUtil.getCoordsFromSide(ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)), x, y, z, 0);
|
||||
Position coords = WorldUtil.getCoordsFromSide(WorldUtil.getDirectionByPistonRotation(pos.getMetadata(world)), pos, 0);
|
||||
if(coords != null && coords.getBlock(world) instanceof BlockColoredLamp){
|
||||
if(world.isBlockIndirectlyGettingPowered(x, y, z)){
|
||||
if(world.isBlockIndirectlyGettingPowered(pos) > 0){
|
||||
if(!((BlockColoredLamp)coords.getBlock(world)).isOn){
|
||||
world.setBlock(coords.getX(), coords.getY(), coords.getZ(), InitBlocks.blockColoredLampOn, world.getBlockMetadata(coords.getX(), coords.getY(), coords.getZ()), 2);
|
||||
pos.setBlock(world, InitBlocks.blockColoredLampOn, coords.getMetadata(world), 2);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(((BlockColoredLamp)coords.getBlock(world)).isOn){
|
||||
world.setBlock(coords.getX(), coords.getY(), coords.getZ(), InitBlocks.blockColoredLamp, world.getBlockMetadata(coords.getX(), coords.getY(), coords.getZ()), 2);
|
||||
pos.setBlock(world, InitBlocks.blockColoredLamp, coords.getMetadata(world), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,6 +71,6 @@ public class BlockLampPowerer extends BlockBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,19 +15,19 @@ 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.TileEntityMiner;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
@ -35,11 +35,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
|
||||
public class BlockMiner extends BlockContainerBase implements IHudDisplay{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon frontIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
|
||||
public BlockMiner(String name){
|
||||
super(Material.rock, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -48,39 +43,25 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay{
|
|||
this.setStepSound(soundTypeStone);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side == 0 ? this.frontIcon : (side == 1 ? this.topIcon : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileEntityMiner){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.MINER.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.MINER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,17 +13,14 @@ 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.blocks.metalists.TheMiscBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -32,13 +29,6 @@ import java.util.List;
|
|||
public class BlockMisc extends BlockBase{
|
||||
|
||||
public static final TheMiscBlocks[] allMiscBlocks = TheMiscBlocks.values();
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon[] textures;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon ironCasingSeasonalTop;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon ironCasingSeasonal;
|
||||
|
||||
public BlockMisc(String name){
|
||||
super(Material.rock, name);
|
||||
|
@ -48,19 +38,8 @@ public class BlockMisc extends BlockBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
if(ClientProxy.jingleAllTheWay && side != 0){
|
||||
if(metadata == TheMiscBlocks.IRON_CASING.ordinal()){
|
||||
return side == 1 ? this.ironCasingSeasonalTop : this.ironCasingSeasonal;
|
||||
}
|
||||
}
|
||||
return metadata >= textures.length ? null : textures[metadata];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta){
|
||||
return meta;
|
||||
public int damageDropped(IBlockState state){
|
||||
return this.getMetaFromState(state);
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
|
@ -71,18 +50,6 @@ public class BlockMisc extends BlockBase{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.textures = new IIcon[allMiscBlocks.length];
|
||||
for(int i = 0; i < textures.length; i++){
|
||||
textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+allMiscBlocks[i].name);
|
||||
}
|
||||
|
||||
this.ironCasingSeasonalTop = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":blockMiscIronCasingSnowTop");
|
||||
this.ironCasingSeasonal = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":blockMiscIronCasingSnow");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends ItemBlockBase> getItemBlock(){
|
||||
return TheItemBlock.class;
|
||||
|
@ -90,7 +57,7 @@ public class BlockMisc extends BlockBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.common : allMiscBlocks[stack.getItemDamage()].rarity;
|
||||
return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.COMMON : allMiscBlocks[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
|
|
@ -10,20 +10,21 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
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.proxy.ClientProxy;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
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.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -32,11 +33,6 @@ import java.util.Random;
|
|||
|
||||
public class BlockOilGenerator extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon bottomIcon;
|
||||
|
||||
public BlockOilGenerator(String name){
|
||||
super(Material.rock, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -53,50 +49,34 @@ public class BlockOilGenerator extends BlockContainerBase{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side <= 1 ? (side == 0 ? this.bottomIcon : this.topIcon) : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(meta == 1){
|
||||
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
|
||||
if(Position.fromBlockPos(pos).getMetadata(world) == 1){
|
||||
for(int i = 0; i < 5; i++){
|
||||
world.spawnParticle(ClientProxy.bulletForMyValentine ? "heart" : "smoke", (double)x+0.5F, (double)y+1.0F, (double)z+0.5F, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(ClientProxy.bulletForMyValentine ? EnumParticleTypes.HEART : EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityOilGenerator generator = (TileEntityOilGenerator)world.getTileEntity(x, y, z);
|
||||
TileEntityOilGenerator generator = (TileEntityOilGenerator)world.getTileEntity(pos);
|
||||
if(generator != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.OIL_GENERATOR.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.OIL_GENERATOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, Position.fromBlockPos(pos));
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBushBase;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
||||
|
@ -17,18 +18,19 @@ import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheWildPlants;
|
|||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockWildPlant extends BlockBushBase{
|
||||
|
@ -41,8 +43,10 @@ public class BlockWildPlant extends BlockBushBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockStay(World world, int x, int y, int z){
|
||||
return world.getBlockMetadata(x, y, z) == TheWildPlants.RICE.ordinal() ? world.getBlock(x, y-1, z).getMaterial() == Material.water : world.getBlock(x, y-1, z).canSustainPlant(world, x, y-1, z, ForgeDirection.UP, this);
|
||||
public boolean canBlockStay(World world, BlockPos pos, IBlockState state){
|
||||
Position thePos = Position.fromBlockPos(pos);
|
||||
Position offset = thePos.getOffsetPosition(0, -1, 0);
|
||||
return thePos.getMetadata(world) == TheWildPlants.RICE.ordinal() ? offset.getMaterial(world) == Material.water : offset.getBlock(world).canSustainPlant(world, offset, EnumFacing.UP, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,24 +61,18 @@ public class BlockWildPlant extends BlockBushBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.common : allWildPlants[stack.getItemDamage()].rarity;
|
||||
return stack.getItemDamage() >= allWildPlants.length ? EnumRarity.COMMON : allWildPlants[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getIcon(0, 7);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSilkHarvest(){
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World world, int x, int y, int z){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
public Item getItem(World world, BlockPos pos){
|
||||
int meta = Position.fromBlockPos(pos).getMetadata(world);
|
||||
return meta >= allWildPlants.length ? null : ((BlockPlant)allWildPlants[meta].wildVersionOf).seedItem;
|
||||
}
|
||||
|
||||
|
@ -87,14 +85,9 @@ public class BlockWildPlant extends BlockBushBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune){
|
||||
return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getDrops(world, x, y, z, 7, fortune);
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune){
|
||||
int metadata = Position.fromBlockPos(pos).getMetadata(world);
|
||||
return metadata >= allWildPlants.length ? null : allWildPlants[metadata].wildVersionOf.getDrops(world, pos, allWildPlants[metadata].wildVersionOf.getStateFromMeta(7), fortune);
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlockBase{
|
||||
|
@ -105,12 +98,6 @@ public class BlockWildPlant extends BlockBushBase{
|
|||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta){
|
||||
return this.field_150939_a.getIcon(0, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack){
|
||||
return stack.getItemDamage() >= allWildPlants.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allWildPlants[stack.getItemDamage()].name;
|
||||
|
|
|
@ -10,36 +10,28 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
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.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
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.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockXPSolidifier extends BlockContainerBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon frontIcon;
|
||||
|
||||
public BlockXPSolidifier(String name){
|
||||
super(Material.rock, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -54,93 +46,61 @@ public class BlockXPSolidifier extends BlockContainerBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(side == 1 || side == 0){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == meta+2){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(side == 1 || side == 0){
|
||||
return this.topIcon;
|
||||
}
|
||||
if(side == 3){
|
||||
return this.frontIcon;
|
||||
}
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)world.getTileEntity(x, y, z);
|
||||
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)world.getTileEntity(pos);
|
||||
if(solidifier != null){
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.XP_SOLIDIFIER.ordinal(), world, x, y, z);
|
||||
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.XP_SOLIDIFIER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Top");
|
||||
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+"Front");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
|
||||
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
|
||||
Position thePos = Position.fromBlockPos(pos);
|
||||
|
||||
if(rotation == 0){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
|
||||
thePos.setMetadata(world, 0, 2);
|
||||
}
|
||||
if(rotation == 1){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
thePos.setMetadata(world, 3, 2);
|
||||
}
|
||||
if(rotation == 2){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
thePos.setMetadata(world, 1, 2);
|
||||
}
|
||||
if(rotation == 3){
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
thePos.setMetadata(world, 2, 2);
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
super.onBlockPlacedBy(world, pos, state, player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
this.dropInventory(world, Position.fromBlockPos(pos));
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileEntityXPSolidifier){
|
||||
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)tile;
|
||||
if(solidifier.amount > 0){
|
||||
int stacks = solidifier.amount/64;
|
||||
int rest = solidifier.amount%64;
|
||||
for(int i = 0; i < stacks; i++){
|
||||
this.spawnItem(world, x, y, z, new ItemStack(InitItems.itemSolidifiedExperience, 64));
|
||||
this.spawnItem(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(InitItems.itemSolidifiedExperience, 64));
|
||||
}
|
||||
this.spawnItem(world, x, y, z, new ItemStack(InitItems.itemSolidifiedExperience, rest));
|
||||
this.spawnItem(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(InitItems.itemSolidifiedExperience, rest));
|
||||
solidifier.amount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
private void spawnItem(World world, int x, int y, int z, ItemStack stack){
|
||||
|
|
|
@ -11,12 +11,13 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class FluidAA extends Fluid{
|
||||
|
||||
public FluidAA(String fluidName){
|
||||
super(fluidName);
|
||||
public FluidAA(String fluidName, String textureName){
|
||||
super(fluidName, new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/"+textureName+"Still.png"), new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/"+textureName+"Flowing.png"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -209,7 +209,7 @@ public class InitBlocks{
|
|||
//Canola Fluid
|
||||
String canolaOil = "canolaoil";
|
||||
if(!FluidRegistry.isFluidRegistered(canolaOil) || ConfigBoolValues.PREVENT_CANOLA_OVERRIDE.isEnabled()){
|
||||
fluidCanolaOil = new FluidAA(canolaOil).setRarity(EnumRarity.uncommon);
|
||||
fluidCanolaOil = new FluidAA(canolaOil, "blockCanolaOil").setRarity(EnumRarity.UNCOMMON);
|
||||
FluidRegistry.registerFluid(fluidCanolaOil);
|
||||
}
|
||||
else{
|
||||
|
@ -229,7 +229,7 @@ public class InitBlocks{
|
|||
//Oil Fluid
|
||||
String oil = "oil";
|
||||
if(!FluidRegistry.isFluidRegistered(oil) || ConfigBoolValues.PREVENT_OIL_OVERRIDE.isEnabled()){
|
||||
fluidOil = new FluidAA(oil).setRarity(EnumRarity.uncommon);
|
||||
fluidOil = new FluidAA(oil, "blockOil").setRarity(EnumRarity.UNCOMMON);
|
||||
FluidRegistry.registerFluid(fluidOil);
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -30,7 +30,7 @@ public class BlockBase extends Block{
|
|||
}
|
||||
|
||||
private void register(){
|
||||
this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
|
||||
if(this.shouldAddCreative()){
|
||||
this.setCreativeTab(CreativeTab.instance);
|
||||
|
@ -53,6 +53,6 @@ public class BlockBase extends Block{
|
|||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class BlockBushBase extends BlockBush{
|
|||
}
|
||||
|
||||
private void register(){
|
||||
this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
|
||||
if(this.shouldAddCreative()){
|
||||
this.setCreativeTab(CreativeTab.instance);
|
||||
|
@ -52,6 +52,6 @@ public class BlockBushBase extends BlockBush{
|
|||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class BlockStair extends BlockStairs{
|
|||
}
|
||||
|
||||
public BlockStair(Block block, String name, int meta){
|
||||
super(block, meta);
|
||||
super(block.getStateFromMeta(meta));
|
||||
this.name = name;
|
||||
this.setLightOpacity(0);
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class BlockStair extends BlockStairs{
|
|||
}
|
||||
|
||||
private void register(){
|
||||
this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
|
||||
if(this.shouldAddCreative()){
|
||||
this.setCreativeTab(CreativeTab.instance);
|
||||
|
@ -59,6 +59,6 @@ public class BlockStair extends BlockStairs{
|
|||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@ import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
|||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockWall;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -45,7 +45,7 @@ public class BlockWallAA extends BlockWall{
|
|||
}
|
||||
|
||||
private void register(){
|
||||
this.setBlockName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
|
||||
if(this.shouldAddCreative()){
|
||||
this.setCreativeTab(CreativeTab.instance);
|
||||
|
@ -68,13 +68,7 @@ public class BlockWallAA extends BlockWall{
|
|||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.common;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return this.baseBlock.getIcon(side, this.meta);
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -85,7 +79,7 @@ public class BlockWallAA extends BlockWall{
|
|||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta){
|
||||
return meta;
|
||||
public int damageDropped(IBlockState state){
|
||||
return this.getMetaFromState(state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,26 +36,26 @@ public class ItemBlockBase extends ItemBlock{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
if(this.field_150939_a instanceof BlockBase){
|
||||
return ((BlockBase)this.field_150939_a).getRarity(stack);
|
||||
if(this.block instanceof BlockBase){
|
||||
return ((BlockBase)this.block).getRarity(stack);
|
||||
}
|
||||
else if(this.field_150939_a instanceof BlockContainerBase){
|
||||
return ((BlockContainerBase)this.field_150939_a).getRarity(stack);
|
||||
else if(this.block instanceof BlockContainerBase){
|
||||
return ((BlockContainerBase)this.block).getRarity(stack);
|
||||
}
|
||||
else if(this.field_150939_a instanceof BlockFluidFlowing){
|
||||
return ((BlockFluidFlowing)this.field_150939_a).getRarity(stack);
|
||||
else if(this.block instanceof BlockFluidFlowing){
|
||||
return ((BlockFluidFlowing)this.block).getRarity(stack);
|
||||
}
|
||||
else if(this.field_150939_a instanceof BlockPlant){
|
||||
return ((BlockPlant)this.field_150939_a).getRarity(stack);
|
||||
else if(this.block instanceof BlockPlant){
|
||||
return ((BlockPlant)this.block).getRarity(stack);
|
||||
}
|
||||
else if(this.field_150939_a instanceof BlockStair){
|
||||
return ((BlockStair)this.field_150939_a).getRarity(stack);
|
||||
else if(this.block instanceof BlockStair){
|
||||
return ((BlockStair)this.block).getRarity(stack);
|
||||
}
|
||||
else if(this.field_150939_a instanceof BlockWallAA){
|
||||
return ((BlockWallAA)this.field_150939_a).getRarity(stack);
|
||||
else if(this.block instanceof BlockWallAA){
|
||||
return ((BlockWallAA)this.block).getRarity(stack);
|
||||
}
|
||||
else if(this.field_150939_a instanceof BlockBushBase){
|
||||
return ((BlockBushBase)this.field_150939_a).getRarity(stack);
|
||||
else if(this.block instanceof BlockBushBase){
|
||||
return ((BlockBushBase)this.block).getRarity(stack);
|
||||
}
|
||||
else{
|
||||
return Util.FALLBACK_RARITY;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.model.ModelBaseAA;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -22,14 +23,14 @@ public class RenderLaserRelay extends RenderTileEntity{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int par6){
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(0.0F, -2.0F, 0.0F);
|
||||
this.bindTexture(resLoc);
|
||||
|
||||
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
int meta = Position.fromTileEntity(tile).getMetadata(tile.getWorld());
|
||||
if(meta == 0){
|
||||
GL11.glRotatef(180F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, -2F, 0F);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.model.ModelBaseAA;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.cloud.ISmileyCloudEasterEgg;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.cloud.SmileyCloudEasterEggs;
|
||||
|
@ -19,8 +20,6 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
|||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -34,7 +33,7 @@ public class RenderSmileyCloud extends RenderTileEntity{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int partial){
|
||||
if(!(tile instanceof TileEntitySmileyCloud)){
|
||||
return;
|
||||
}
|
||||
|
@ -43,7 +42,7 @@ public class RenderSmileyCloud extends RenderTileEntity{
|
|||
GL11.glPushMatrix();
|
||||
{
|
||||
if(theCloud.flyHeight == 0){
|
||||
theCloud.flyHeight = tile.getWorldObj().rand.nextInt(30)+30;
|
||||
theCloud.flyHeight = tile.getWorld().rand.nextInt(30)+30;
|
||||
}
|
||||
int bobHeight = theCloud.flyHeight;
|
||||
double theTime = Minecraft.getSystemTime();
|
||||
|
@ -67,7 +66,7 @@ public class RenderSmileyCloud extends RenderTileEntity{
|
|||
GL11.glPushMatrix();
|
||||
{
|
||||
if(theModel.doesRotate()){
|
||||
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
int meta = Position.fromTileEntity(tile).getMetadata(tile.getWorld());
|
||||
if(meta == 0){
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
}
|
||||
|
@ -113,8 +112,8 @@ public class RenderSmileyCloud extends RenderTileEntity{
|
|||
GL11.glRotatef(180F, 1F, 0F, 0F);
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
|
||||
GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
float f = 1.6F;
|
||||
float f1 = 0.016666668F*f;
|
||||
GL11.glScalef(-f1, -f1, f1);
|
||||
|
@ -123,20 +122,21 @@ public class RenderSmileyCloud extends RenderTileEntity{
|
|||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
//TODO Fix nameplate with Smiley Cloud
|
||||
/*Tessellator tessellator = Tessellator.getInstance();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
tessellator.startDrawingQuads();
|
||||
int i = Minecraft.getMinecraft().fontRenderer.getStringWidth(theCloud.name)/2;
|
||||
int i = Minecraft.getMinecraft().fontRendererObj.getStringWidth(theCloud.name)/2;
|
||||
tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
|
||||
tessellator.addVertex(-i-1, -1.0D, 0.0D);
|
||||
tessellator.addVertex(-i-1, 8.0D, 0.0D);
|
||||
tessellator.addVertex(i+1, 8.0D, 0.0D);
|
||||
tessellator.addVertex(i+1, -1.0D, 0.0D);
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);*/
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(theCloud.name, -Minecraft.getMinecraft().fontRenderer.getStringWidth(theCloud.name)/2, 0, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
Minecraft.getMinecraft().fontRendererObj.drawString(theCloud.name, -Minecraft.getMinecraft().fontRendererObj.getStringWidth(theCloud.name)/2, 0, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.model.ModelBaseAA;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
@ -28,7 +29,7 @@ public class RenderTileEntity extends TileEntitySpecialRenderer{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5, int i){
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
|
@ -36,7 +37,7 @@ public class RenderTileEntity extends TileEntitySpecialRenderer{
|
|||
this.bindTexture(resLoc);
|
||||
|
||||
if(theModel.doesRotate()){
|
||||
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
int meta = Position.fromTileEntity(tile).getMetadata(tile.getWorld());
|
||||
if(meta == 0){
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
}
|
||||
|
|
|
@ -90,8 +90,9 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
this.saveOnClose = saveOnClose;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawHoveringText(List list, int x, int y){
|
||||
super.func_146283_a(list, x, y);
|
||||
super.drawHoveringText(list, x, y);
|
||||
}
|
||||
|
||||
public FontRenderer getFontRenderer(){
|
||||
|
@ -181,7 +182,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
else{
|
||||
if(AND_HIS_NAME_IS.length > this.hisNameIsAt && AND_HIS_NAME_IS[this.hisNameIsAt] == key){
|
||||
if(this.hisNameIsAt+1 >= AND_HIS_NAME_IS.length){
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147673_a(new ResourceLocation(ModUtil.MOD_ID_LOWER, "duhDuhDuhDuuuh")));
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation(ModUtil.MOD_ID_LOWER, "duhDuhDuhDuuuh")));
|
||||
ModUtil.LOGGER.info("AND HIS NAME IS JOHN CENA DUH DUH DUH DUUUH");
|
||||
this.hisNameIsAt = 0;
|
||||
}
|
||||
|
@ -211,8 +212,13 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
BookletUtils.openIndexEntry(this, null, 1, true);
|
||||
}
|
||||
}
|
||||
try{
|
||||
super.mouseClicked(par1, par2, par3);
|
||||
}
|
||||
catch(Exception e){
|
||||
ModUtil.LOGGER.error("Something bad happened when trying to click a button in the booklet!", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button){
|
||||
|
@ -283,11 +289,11 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
|
||||
ArrayList updateHover = new ArrayList();
|
||||
if(UpdateChecker.checkFailed){
|
||||
updateHover.add(IChatComponent.Serializer.func_150699_a(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.failed")).getFormattedText());
|
||||
updateHover.add(IChatComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.failed")).getFormattedText());
|
||||
}
|
||||
else if(UpdateChecker.needsUpdateNotify){
|
||||
updateHover.add(IChatComponent.Serializer.func_150699_a(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.generic")).getFormattedText());
|
||||
updateHover.add(IChatComponent.Serializer.func_150699_a(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".update.versionCompare", ModUtil.VERSION, UpdateChecker.updateVersion)).getFormattedText());
|
||||
updateHover.add(IChatComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.generic")).getFormattedText());
|
||||
updateHover.add(IChatComponent.Serializer.jsonToComponent(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".update.versionCompare", ModUtil.VERSION, UpdateChecker.updateVersion)).getFormattedText());
|
||||
updateHover.add(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.buttonOptions"));
|
||||
}
|
||||
this.buttonUpdate = new TexturedButton(4, this.guiLeft-11, this.guiTop-11, 245, 0, 11, 11, updateHover);
|
||||
|
@ -327,7 +333,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
this.buttonList.add(this.bookmarkButtons[i]);
|
||||
}
|
||||
|
||||
this.searchField = new GuiTextField(this.fontRendererObj, guiLeft+148, guiTop+162, 66, 10);
|
||||
this.searchField = new GuiTextField(4500, this.fontRendererObj, guiLeft+148, guiTop+162, 66, 10);
|
||||
this.searchField.setMaxStringLength(30);
|
||||
this.searchField.setEnableBackgroundDrawing(false);
|
||||
this.searchField.setCanLoseFocus(false);
|
||||
|
@ -366,8 +372,13 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
BookletUtils.handlePreviousPage(this);
|
||||
}
|
||||
}
|
||||
try{
|
||||
super.handleMouseInput();
|
||||
}
|
||||
catch(Exception e){
|
||||
ModUtil.LOGGER.error("Something bad happened when trying to click a button in the booklet!", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen(){
|
||||
|
@ -404,8 +415,8 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
|
||||
@Override
|
||||
public void renderTooltipAndTransferButton(BookletPage from, ItemStack stack, int x, int y, boolean renderTransferButton, boolean mousePressed){
|
||||
boolean flagBefore = this.mc.fontRenderer.getUnicodeFlag();
|
||||
this.mc.fontRenderer.setUnicodeFlag(false);
|
||||
boolean flagBefore = this.mc.fontRendererObj.getUnicodeFlag();
|
||||
this.mc.fontRendererObj.setUnicodeFlag(false);
|
||||
|
||||
List list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||
|
||||
|
@ -426,14 +437,14 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
|
|||
if(mousePressed){
|
||||
BookletUtils.openIndexEntry(this, page.getChapter().getEntry(), ActuallyAdditionsAPI.bookletEntries.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true);
|
||||
BookletUtils.openChapter(this, page.getChapter(), page);
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.drawHoveringText(list, x, y);
|
||||
|
||||
this.mc.fontRenderer.setUnicodeFlag(flagBefore);
|
||||
this.mc.fontRendererObj.setUnicodeFlag(flagBefore);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,7 +36,7 @@ public class GuiBookletStand extends GuiBooklet{
|
|||
@Override
|
||||
public void actionPerformed(GuiButton button){
|
||||
if(button == this.buttonSetPage){
|
||||
PacketHandler.theNetwork.sendToServer(new PacketBookletStandButton(this.theStand.xCoord, this.theStand.yCoord, this.theStand.zCoord, this.theStand.getWorldObj(), Minecraft.getMinecraft().thePlayer, this.currentEntrySet));
|
||||
PacketHandler.theNetwork.sendToServer(new PacketBookletStandButton(this.theStand.getPos().getX(), this.theStand.getPos().getY(), this.theStand.getPos().getZ(), this.theStand.getWorld(), Minecraft.getMinecraft().thePlayer, this.currentEntrySet));
|
||||
}
|
||||
super.actionPerformed(button);
|
||||
}
|
||||
|
@ -54,15 +54,15 @@ public class GuiBookletStand extends GuiBooklet{
|
|||
this.buttonSetPage = new GuiButton(-100, this.guiLeft+this.xSize+10, this.guiTop+10, 100, 20, "Set Page"){
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int x, int y){
|
||||
boolean unicodeBefore = mc.fontRenderer.getUnicodeFlag();
|
||||
mc.fontRenderer.setUnicodeFlag(false);
|
||||
boolean unicodeBefore = mc.fontRendererObj.getUnicodeFlag();
|
||||
mc.fontRendererObj.setUnicodeFlag(false);
|
||||
super.drawButton(mc, x, y);
|
||||
mc.fontRenderer.setUnicodeFlag(unicodeBefore);
|
||||
mc.fontRendererObj.setUnicodeFlag(unicodeBefore);
|
||||
}
|
||||
};
|
||||
this.buttonList.add(this.buttonSetPage);
|
||||
|
||||
this.buttonSetPage.visible = Objects.equals(Minecraft.getMinecraft().thePlayer.getCommandSenderName(), this.theStand.assignedPlayer);
|
||||
this.buttonSetPage.visible = Objects.equals(Minecraft.getMinecraft().thePlayer.getName(), this.theStand.assignedPlayer);
|
||||
|
||||
//Open the pages the book was assigned
|
||||
BookletUtils.openIndexEntry(this, this.theStand.assignedEntry.entry, this.theStand.assignedEntry.pageInIndex, true);
|
||||
|
|
|
@ -58,8 +58,8 @@ public class BookmarkButton extends GuiButton{
|
|||
if(this.visible){
|
||||
minecraft.getTextureManager().bindTexture(GuiBooklet.resLoc);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height;
|
||||
int k = this.getHoverState(this.field_146123_n);
|
||||
this.hovered = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height;
|
||||
int k = this.getHoverState(this.hovered);
|
||||
if(k == 0){
|
||||
k = 1;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class IndexButton extends GuiButton{
|
|||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY){
|
||||
if(this.visible){
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition+this.width && mouseY < this.yPosition+this.height;
|
||||
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition+this.width && mouseY < this.yPosition+this.height;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
@ -48,9 +48,9 @@ public class IndexButton extends GuiButton{
|
|||
}
|
||||
}
|
||||
|
||||
if(this.field_146123_n){
|
||||
if(this.hovered){
|
||||
GL11.glPushMatrix();
|
||||
AssetUtil.drawHorizontalGradientRect(this.xPosition+textOffsetX-1, this.yPosition+this.height-1, this.xPosition+this.gui.getFontRenderer().getStringWidth(this.displayString)+textOffsetX+1, this.yPosition+this.height, 0x80 << 24 | 22271, 22271);
|
||||
AssetUtil.drawHorizontalGradientRect(this.xPosition+textOffsetX-1, this.yPosition+this.height-1, this.xPosition+this.gui.getFontRenderer().getStringWidth(this.displayString)+textOffsetX+1, this.yPosition+this.height, 0x80 << 24 | 22271, 22271, this.zLevel);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ public class TexturedButton extends GuiButton{
|
|||
if(this.visible){
|
||||
minecraft.getTextureManager().bindTexture(GuiBooklet.resLoc);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height;
|
||||
int k = this.getHoverState(this.field_146123_n);
|
||||
this.hovered = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height;
|
||||
int k = this.getHoverState(this.hovered);
|
||||
if(k == 0){
|
||||
k = 1;
|
||||
}
|
||||
|
|
|
@ -46,15 +46,15 @@ public class PageCoffeeRecipe extends BookletPageAA{
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||
String strg = "Coffee Machine Recipe";
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRenderer.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
||||
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
||||
|
||||
String text = gui.getCurrentEntrySet().page.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRenderer, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
|
||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
|
||||
}
|
||||
|
||||
if(this.ingredient.maxAmplifier > 0){
|
||||
Minecraft.getMinecraft().fontRenderer.drawString("Maximum Amplifier: "+this.ingredient.maxAmplifier, gui.getGuiLeft()+19+5, gui.getGuiTop()+20+60, 0);
|
||||
Minecraft.getMinecraft().fontRendererObj.drawString("Maximum Amplifier: "+this.ingredient.maxAmplifier, gui.getGuiLeft()+19+5, gui.getGuiTop()+20+60, 0);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 2; i++){
|
||||
|
|
|
@ -87,16 +87,16 @@ public class PageCrafting extends BookletPageAA{
|
|||
IRecipe recipe = this.recipes[this.recipePos];
|
||||
|
||||
if(recipe == null){
|
||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRenderer, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
|
||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
|
||||
}
|
||||
else{
|
||||
String strg = StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+"."+(recipe instanceof ShapedRecipes ? "shapedRecipe" : (recipe instanceof ShapelessRecipes ? "shapelessRecipe" : (recipe instanceof ShapelessOreRecipe ? "shapelessOreRecipe" : "shapedOreRecipe"))));
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRenderer.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
||||
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
||||
}
|
||||
|
||||
String text = gui.getCurrentEntrySet().page.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRenderer, text, gui.getGuiLeft()+14, gui.getGuiTop()+90, 115, 0, false);
|
||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+90, 115, 0, false);
|
||||
}
|
||||
|
||||
if(recipe != null){
|
||||
|
|
|
@ -37,7 +37,7 @@ public class PagePicture extends PageTextOnly{
|
|||
|
||||
String text = gui.getCurrentEntrySet().page.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRenderer, text, gui.getGuiLeft()+14, gui.getGuiTop()+textStartY, 115, 0, false);
|
||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+textStartY, 115, 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,16 +72,16 @@ public class PageReconstructor extends BookletPageAA{
|
|||
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||
LensNoneRecipe recipe = this.recipes[this.recipePos];
|
||||
if(recipe == null){
|
||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRenderer, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
|
||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
|
||||
}
|
||||
else{
|
||||
String strg = "Atomic Reconstructor";
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRenderer.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
||||
Minecraft.getMinecraft().fontRendererObj.drawString(strg, gui.getGuiLeft()+gui.getXSize()/2-Minecraft.getMinecraft().fontRendererObj.getStringWidth(strg)/2, gui.getGuiTop()+10, 0);
|
||||
}
|
||||
|
||||
String text = gui.getCurrentEntrySet().page.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRenderer, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
|
||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+100, 115, 0, false);
|
||||
}
|
||||
|
||||
if(recipe != null){
|
||||
|
|
|
@ -41,7 +41,7 @@ public class PageTextOnly extends BookletPageAA{
|
|||
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||
String text = gui.getCurrentEntrySet().page.getText();
|
||||
if(text != null && !text.isEmpty()){
|
||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRenderer, text, gui.getGuiLeft()+14, gui.getGuiTop()+9, 115, 0, false);
|
||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, text, gui.getGuiLeft()+14, gui.getGuiTop()+9, 115, 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.config;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import net.minecraftforge.fml.client.config.GuiConfig;
|
||||
import net.minecraftforge.fml.client.config.IConfigElement;
|
||||
|
@ -31,7 +30,7 @@ public class GuiConfiguration extends GuiConfig{
|
|||
for(int i = 0; i < ConfigCategories.values().length; i++){
|
||||
ConfigCategories cat = ConfigCategories.values()[i];
|
||||
ConfigurationHandler.config.setCategoryComment(cat.name, cat.comment);
|
||||
list.add(new ConfigElement<ConfigCategory>(ConfigurationHandler.config.getCategory(cat.name)));
|
||||
list.add(new ConfigElement(ConfigurationHandler.config.getCategory(cat.name)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class FoodCrafting{
|
|||
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()),
|
||||
'M', new ItemStack(Blocks.brown_mushroom),
|
||||
'C', "cropCarrot",
|
||||
'F', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD),
|
||||
'F', new ItemStack(Items.cooked_fish, 1, Util.WILDCARD),
|
||||
'K', knifeStack,
|
||||
'H', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal())));
|
||||
recipePizza = Util.GetRecipes.lastIRecipe();
|
||||
|
@ -105,7 +105,7 @@ public class FoodCrafting{
|
|||
"KCP", "FB ", "PCP",
|
||||
'P', new ItemStack(Items.paper),
|
||||
'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()),
|
||||
'F', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD),
|
||||
'F', new ItemStack(Items.cooked_fish, 1, Util.WILDCARD),
|
||||
'B', new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()),
|
||||
'K', knifeStack));
|
||||
recipeSubSandwich = Util.GetRecipes.lastIRecipe();
|
||||
|
@ -132,7 +132,7 @@ public class FoodCrafting{
|
|||
if(ConfigCrafting.FISH_N_CHIPS.isEnabled()){
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FISH_N_CHIPS.ordinal()),
|
||||
"FIF", " P ",
|
||||
'I', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD),
|
||||
'I', new ItemStack(Items.cooked_fish, 1, Util.WILDCARD),
|
||||
'P', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()),
|
||||
'F', new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal())));
|
||||
recipeFishNChips = Util.GetRecipes.lastIRecipe();
|
||||
|
|
|
@ -66,7 +66,7 @@ public class TooltipEvent{
|
|||
}
|
||||
|
||||
//Disabling Info
|
||||
event.toolTip.addAll(Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".disablingInfo.desc"), 200));
|
||||
event.toolTip.addAll(Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".disablingInfo.desc"), 200));
|
||||
}
|
||||
else{
|
||||
if(ConfigBoolValues.CTRL_INFO_FOR_EXTRA_INFO.isEnabled()){
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.event;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheWildPlants;
|
||||
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||
|
@ -18,6 +19,7 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
|||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.biome.BiomeGenOcean;
|
||||
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
|
||||
|
@ -31,7 +33,7 @@ public class WorldDecorationEvent{
|
|||
@SubscribeEvent
|
||||
public void onWorldDecoration(DecorateBiomeEvent.Decorate event){
|
||||
if((event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT)){
|
||||
if(Util.arrayContains(ConfigValues.plantDimensionBlacklist, event.world.provider.dimensionId) < 0){
|
||||
if(Util.arrayContains(ConfigValues.plantDimensionBlacklist, event.world.provider.getDimensionId()) < 0){
|
||||
this.generateRice(event);
|
||||
this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.CANOLA.ordinal(), ConfigIntValues.CANOLA_AMOUNT.getValue(), ConfigBoolValues.DO_CANOLA_GEN.isEnabled(), Material.grass, event);
|
||||
this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.FLAX.ordinal(), ConfigIntValues.FLAX_AMOUNT.getValue(), ConfigBoolValues.DO_FLAX_GEN.isEnabled(), Material.grass, event);
|
||||
|
@ -42,15 +44,14 @@ public class WorldDecorationEvent{
|
|||
//Generate Treasure Chests
|
||||
if(ConfigBoolValues.DO_TREASURE_CHEST_GEN.isEnabled()){
|
||||
if(event.rand.nextInt(300) == 0){
|
||||
int genX = event.chunkX+event.rand.nextInt(16)+8;
|
||||
int genZ = event.chunkZ+event.rand.nextInt(16)+8;
|
||||
int genY = event.world.getTopSolidOrLiquidBlock(genX, genZ);
|
||||
Position randomPos = new Position(event.pos.getX()+event.rand.nextInt(16)+8, 0, event.pos.getZ()+event.rand.nextInt(16)+8);
|
||||
randomPos = Position.fromBlockPos(event.world.getTopSolidOrLiquidBlock(randomPos));
|
||||
|
||||
if(event.world.getBiomeGenForCoords(genX, genZ) instanceof BiomeGenOcean){
|
||||
if(genY >= 25 && genY <= 45){
|
||||
if(event.world.getBlock(genX, genY, genZ).getMaterial() == Material.water){
|
||||
if(event.world.getBlock(genX, genY-1, genZ).getMaterial().isSolid()){
|
||||
event.world.setBlock(genX, genY, genZ, InitBlocks.blockTreasureChest, event.rand.nextInt(4), 2);
|
||||
if(event.world.getBiomeGenForCoords(randomPos) instanceof BiomeGenOcean){
|
||||
if(randomPos.getY() >= 25 && randomPos.getY() <= 45){
|
||||
if(randomPos.getBlock(event.world).getMaterial() == Material.water){
|
||||
if(randomPos.getOffsetPosition(0, -1, 0).getMaterial(event.world).isSolid()){
|
||||
randomPos.setBlock(event.world, InitBlocks.blockTreasureChest, event.rand.nextInt(4), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,16 +65,15 @@ public class WorldDecorationEvent{
|
|||
if(ConfigBoolValues.DO_RICE_GEN.isEnabled()){
|
||||
for(int i = 0; i < ConfigIntValues.RICE_AMOUNT.getValue(); i++){
|
||||
if(event.rand.nextInt(50) == 0){
|
||||
int genX = event.chunkX+event.rand.nextInt(16)+8;
|
||||
int genZ = event.chunkZ+event.rand.nextInt(16)+8;
|
||||
int genY = event.world.getTopSolidOrLiquidBlock(genX, genZ);
|
||||
Position randomPos = new Position(event.pos.getX()+event.rand.nextInt(16)+8, 0, event.pos.getZ()+event.rand.nextInt(16)+8);
|
||||
randomPos = Position.fromBlockPos(event.world.getTopSolidOrLiquidBlock(randomPos));
|
||||
|
||||
if(event.world.getBlock(genX, genY, genZ).getMaterial() == Material.water){
|
||||
ArrayList<Material> blocksAroundBottom = WorldUtil.getMaterialsAround(event.world, genX, genY, genZ);
|
||||
ArrayList<Material> blocksAroundTop = WorldUtil.getMaterialsAround(event.world, genX, genY+1, genZ);
|
||||
if(randomPos.getMaterial(event.world) == Material.water){
|
||||
ArrayList<Material> blocksAroundBottom = WorldUtil.getMaterialsAround(event.world, randomPos);
|
||||
ArrayList<Material> blocksAroundTop = WorldUtil.getMaterialsAround(event.world, randomPos.getOffsetPosition(0, 1, 0));
|
||||
if(blocksAroundBottom.contains(Material.grass) || blocksAroundBottom.contains(Material.ground) || blocksAroundBottom.contains(Material.rock) || blocksAroundBottom.contains(Material.sand)){
|
||||
if(!blocksAroundTop.contains(Material.water) && event.world.getBlock(genX, genY+1, genZ).getMaterial() == Material.air){
|
||||
event.world.setBlock(genX, genY+1, genZ, InitBlocks.blockWildPlant, TheWildPlants.RICE.ordinal(), 2);
|
||||
if(!blocksAroundTop.contains(Material.water) && randomPos.getMaterial(event.world) == Material.air){
|
||||
randomPos.getOffsetPosition(0, 1, 0).setBlock(event.world, InitBlocks.blockWildPlant, TheWildPlants.RICE.ordinal(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,14 +86,14 @@ public class WorldDecorationEvent{
|
|||
if(doIt){
|
||||
for(int i = 0; i < amount; i++){
|
||||
if(event.rand.nextInt(400) == 0){
|
||||
int genX = event.chunkX+event.rand.nextInt(16)+8;
|
||||
int genZ = event.chunkZ+event.rand.nextInt(16)+8;
|
||||
int genY = event.world.getTopSolidOrLiquidBlock(genX, genZ)-1;
|
||||
Position randomPos = new Position(event.pos.getX()+event.rand.nextInt(16)+8, 0, event.pos.getZ()+event.rand.nextInt(16)+8);
|
||||
randomPos = Position.fromBlockPos(event.world.getTopSolidOrLiquidBlock(randomPos));
|
||||
|
||||
if(event.world.getBlock(genX, genY, genZ).getMaterial() == blockBelow){
|
||||
event.world.setBlock(genX, genY+1, genZ, plant, meta, 2);
|
||||
if(!plant.canBlockStay(event.world, genX, genY+1, genZ)){
|
||||
event.world.setBlockToAir(genX, genY+1, genZ);
|
||||
if(randomPos.getMaterial(event.world) == blockBelow){
|
||||
Position top = randomPos.getOffsetPosition(0, 1, 0);
|
||||
top.setBlock(event.world, plant, meta, 2);
|
||||
if(plant instanceof BlockBush && !((BlockBush)plant).canBlockStay(event.world, top, top.getBlockState(event.world))){
|
||||
event.world.setBlockToAir(top);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,16 +11,8 @@
|
|||
package de.ellpeck.actuallyadditions.mod.gen;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheJams;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraft.world.gen.structure.MapGenStructureIO;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||
|
||||
public class InitVillager{
|
||||
|
||||
|
@ -38,7 +30,8 @@ public class InitVillager{
|
|||
}
|
||||
|
||||
private static void initJamVillagePart(){
|
||||
int jamID = ConfigIntValues.JAM_VILLAGER_ID.getValue();
|
||||
//TODO Fix villager
|
||||
/*int jamID = ConfigIntValues.JAM_VILLAGER_ID.getValue();
|
||||
VillagerRegistry.instance().registerVillagerId(jamID);
|
||||
VillagerRegistry.instance().registerVillageTradeHandler(jamID, new JamVillagerTradeHandler());
|
||||
|
||||
|
@ -52,12 +45,13 @@ public class InitVillager{
|
|||
ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(Items.potionitem), 1, 1, 20));
|
||||
|
||||
VillagerRegistry.instance().registerVillageCreationHandler(new VillageJamHouseHandler());
|
||||
MapGenStructureIO.func_143031_a(VillageComponentJamHouse.class, ModUtil.MOD_ID_LOWER+":jamHouseStructure");
|
||||
MapGenStructureIO.func_143031_a(VillageComponentJamHouse.class, ModUtil.MOD_ID_LOWER+":jamHouseStructure");*/
|
||||
}
|
||||
|
||||
private static void initCustomCropFieldPart(){
|
||||
VillagerRegistry.instance().registerVillageCreationHandler(new VillageCustomCropFieldHandler());
|
||||
MapGenStructureIO.func_143031_a(VillageComponentCustomCropField.class, ModUtil.MOD_ID_LOWER+":customCropFieldStructure");
|
||||
//TODO Fix village
|
||||
//VillagerRegistry.instance().registerVillageCreationHandler(new VillageCustomCropFieldHandler());
|
||||
MapGenStructureIO.registerStructureComponent(VillageComponentCustomCropField.class, ModUtil.MOD_ID_LOWER+":customCropFieldStructure");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.gen;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||
|
@ -17,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
|||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.pattern.BlockHelper;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -40,8 +42,8 @@ public class OreGen implements IWorldGenerator{
|
|||
|
||||
@Override
|
||||
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
|
||||
if(world.provider.terrainType != WorldType.FLAT && Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.dimensionId) < 0){
|
||||
switch(world.provider.dimensionId){
|
||||
if(world.getWorldType() != WorldType.FLAT && Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.getDimensionId()) < 0){
|
||||
switch(world.provider.getDimensionId()){
|
||||
case -1:
|
||||
generateNether(world, random, chunkX*16, chunkZ*16);
|
||||
//case 0:
|
||||
|
@ -77,7 +79,7 @@ public class OreGen implements IWorldGenerator{
|
|||
int posX = blockXPos+random.nextInt(16);
|
||||
int posY = minY+random.nextInt(yDiff);
|
||||
int posZ = blockZPos+random.nextInt(16);
|
||||
new WorldGenMinable(block, meta, maxVeinSize, blockIn).generate(world, random, posX, posY, posZ);
|
||||
new WorldGenMinable(block.getStateFromMeta(meta), maxVeinSize, BlockHelper.forBlock(blockIn)).generate(world, random, new Position(posX, posY, posZ));
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -10,18 +10,8 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.gen;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.structure.StructureBoundingBox;
|
||||
import net.minecraft.world.gen.structure.StructureComponent;
|
||||
import net.minecraft.world.gen.structure.StructureVillagePieces;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class VillageComponentCustomCropField extends StructureVillagePieces.House1{
|
||||
|
||||
private static final int xSize = 13;
|
||||
|
@ -35,7 +25,8 @@ public class VillageComponentCustomCropField extends StructureVillagePieces.Hous
|
|||
|
||||
}
|
||||
|
||||
public VillageComponentCustomCropField(StructureBoundingBox boundingBox, int par5){
|
||||
//TODO Fix village
|
||||
/*public VillageComponentCustomCropField(StructureBoundingBox boundingBox, int par5){
|
||||
this.coordBaseMode = par5;
|
||||
this.boundingBox = boundingBox;
|
||||
}
|
||||
|
@ -108,5 +99,5 @@ public class VillageComponentCustomCropField extends StructureVillagePieces.Hous
|
|||
default:
|
||||
return InitBlocks.blockCanola;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ package de.ellpeck.actuallyadditions.mod.gen;
|
|||
import net.minecraft.world.gen.structure.StructureVillagePieces;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class VillageCustomCropFieldHandler implements VillagerRegistry.IVillageCreationHandler{
|
||||
//TODO Fix village
|
||||
public abstract class VillageCustomCropFieldHandler implements VillagerRegistry.IVillageCreationHandler{
|
||||
|
||||
@Override
|
||||
public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int i){
|
||||
|
@ -28,8 +28,8 @@ public class VillageCustomCropFieldHandler implements VillagerRegistry.IVillageC
|
|||
return VillageComponentCustomCropField.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5){
|
||||
return VillageComponentCustomCropField.buildComponent(pieces, p1, p2, p3, p4);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public class ContainerCrafter extends Container{
|
|||
|
||||
if(!this.world.isRemote){
|
||||
for(int i = 0; i < 9; ++i){
|
||||
ItemStack stack = this.craftMatrix.getStackInSlotOnClosing(i);
|
||||
ItemStack stack = this.craftMatrix.removeStackFromSlot(i);
|
||||
if(stack != null){
|
||||
player.dropPlayerItemWithRandomChoice(stack, false);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.SlotFurnace;
|
||||
import net.minecraft.inventory.SlotFurnaceOutput;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
|
||||
|
@ -30,9 +30,9 @@ public class ContainerFurnaceDouble extends Container{
|
|||
this.tileFurnace = (TileEntityFurnaceDouble)tile;
|
||||
|
||||
this.addSlotToContainer(new Slot(this.tileFurnace, TileEntityFurnaceDouble.SLOT_INPUT_1, 51, 21));
|
||||
this.addSlotToContainer(new SlotFurnace(inventory.player, this.tileFurnace, TileEntityFurnaceDouble.SLOT_OUTPUT_1, 51, 69));
|
||||
this.addSlotToContainer(new SlotFurnaceOutput(inventory.player, this.tileFurnace, TileEntityFurnaceDouble.SLOT_OUTPUT_1, 51, 69));
|
||||
this.addSlotToContainer(new Slot(this.tileFurnace, TileEntityFurnaceDouble.SLOT_INPUT_2, 109, 21));
|
||||
this.addSlotToContainer(new SlotFurnace(inventory.player, this.tileFurnace, TileEntityFurnaceDouble.SLOT_OUTPUT_2, 108, 69));
|
||||
this.addSlotToContainer(new SlotFurnaceOutput(inventory.player, this.tileFurnace, TileEntityFurnaceDouble.SLOT_OUTPUT_2, 108, 69));
|
||||
|
||||
for(int i = 0; i < 3; i++){
|
||||
for(int j = 0; j < 9; j++){
|
||||
|
@ -67,7 +67,7 @@ public class ContainerFurnaceDouble extends Container{
|
|||
//Other Slots in Inventory excluded
|
||||
else if(slot >= inventoryStart){
|
||||
//Shift from Inventory
|
||||
if(FurnaceRecipes.smelting().getSmeltingResult(newStack) != null){
|
||||
if(FurnaceRecipes.instance().getSmeltingResult(newStack) != null){
|
||||
if(!this.mergeItemStack(newStack, TileEntityFurnaceDouble.SLOT_INPUT_1, TileEntityFurnaceDouble.SLOT_INPUT_1+1, false)){
|
||||
if(!this.mergeItemStack(newStack, TileEntityFurnaceDouble.SLOT_INPUT_2, TileEntityFurnaceDouble.SLOT_INPUT_2+1, false)){
|
||||
return null;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.inventory;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
|
||||
import de.ellpeck.actuallyadditions.mod.booklet.GuiBookletStand;
|
||||
|
@ -32,7 +33,7 @@ public class GuiHandler implements IGuiHandler{
|
|||
public Object getServerGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
|
||||
TileEntityBase tile = null;
|
||||
if(GuiTypes.values()[id].checkTileEntity){
|
||||
tile = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
tile = (TileEntityBase)world.getTileEntity(new Position(x, y, z));
|
||||
}
|
||||
switch(GuiTypes.values()[id]){
|
||||
case FEEDER:
|
||||
|
@ -96,7 +97,7 @@ public class GuiHandler implements IGuiHandler{
|
|||
public Object getClientGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
|
||||
TileEntityBase tile = null;
|
||||
if(GuiTypes.values()[id].checkTileEntity){
|
||||
tile = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
tile = (TileEntityBase)world.getTileEntity(new Position(x, y, z));
|
||||
}
|
||||
switch(GuiTypes.values()[id]){
|
||||
case FEEDER:
|
||||
|
|
|
@ -42,18 +42,18 @@ public class GuiCanolaPress extends GuiContainer{
|
|||
super.drawScreen(x, y, f);
|
||||
String text1 = this.press.storage.getEnergyStored()+"/"+this.press.storage.getMaxEnergyStored()+" RF";
|
||||
if(x >= guiLeft+43 && y >= guiTop+6 && x <= guiLeft+58 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text1), x, y);
|
||||
this.drawHoveringText(Collections.singletonList(text1), x, y);
|
||||
}
|
||||
|
||||
String text2 = StringUtil.getFluidInfo(this.press.tank);
|
||||
if(x >= guiLeft+117 && y >= guiTop+6 && x <= guiLeft+132 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text2), x, y);
|
||||
this.drawHoveringText(Collections.singletonList(text2), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.press.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.press.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,13 +41,13 @@ public class GuiCoalGenerator extends GuiContainer{
|
|||
super.drawScreen(x, y, f);
|
||||
String text1 = this.generator.storage.getEnergyStored()+"/"+this.generator.storage.getMaxEnergyStored()+" RF";
|
||||
if(x >= guiLeft+43 && y >= guiTop+6 && x <= guiLeft+58 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text1), x, y);
|
||||
this.drawHoveringText(Collections.singletonList(text1), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.generator.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.generator.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,13 +42,13 @@ public class GuiDirectionalBreaker extends GuiContainer{
|
|||
|
||||
String text1 = this.breaker.storage.getEnergyStored()+"/"+this.breaker.storage.getMaxEnergyStored()+" RF";
|
||||
if(x >= guiLeft+43 && y >= guiTop+6 && x <= guiLeft+58 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text1), x, y);
|
||||
this.drawHoveringText(Collections.singletonList(text1), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.breaker.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.breaker.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,13 +43,13 @@ public class GuiFeeder extends GuiContainer{
|
|||
super.drawScreen(x, y, f);
|
||||
if(x >= guiLeft+69 && y >= guiTop+30 && x <= guiLeft+69+10 && y <= guiTop+30+10){
|
||||
String[] array = new String[]{(this.tileFeeder.currentAnimalAmount+" "+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.animals")), ((this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD) ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.enoughToBreed") : (this.tileFeeder.currentAnimalAmount >= TileEntityFeeder.THRESHOLD ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.tooMany") : StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.notEnough")))};
|
||||
this.func_146283_a(Arrays.asList(array), x, y);
|
||||
this.drawHoveringText(Arrays.asList(array), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileFeeder.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileFeeder.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,18 +43,18 @@ public class GuiFermentingBarrel extends GuiContainer{
|
|||
|
||||
String text1 = StringUtil.getFluidInfo(this.press.canolaTank);
|
||||
if(x >= guiLeft+61 && y >= guiTop+6 && x <= guiLeft+76 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text1), x, y);
|
||||
this.drawHoveringText(Collections.singletonList(text1), x, y);
|
||||
}
|
||||
|
||||
String text2 = StringUtil.getFluidInfo(this.press.oilTank);
|
||||
if(x >= guiLeft+99 && y >= guiTop+6 && x <= guiLeft+114 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text2), x, y);
|
||||
this.drawHoveringText(Collections.singletonList(text2), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.press.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.press.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,7 +38,7 @@ public class GuiGiantChest extends GuiContainer{
|
|||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.chest.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.chest.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -48,13 +48,13 @@ public class GuiGrinder extends GuiContainer{
|
|||
super.drawScreen(x, y, f);
|
||||
String text = this.tileGrinder.storage.getEnergyStored()+"/"+this.tileGrinder.storage.getMaxEnergyStored()+" RF";
|
||||
if((this.isDouble && x >= guiLeft+14 && y >= guiTop+6 && x <= guiLeft+29 && y <= guiTop+88) || (!this.isDouble && x >= guiLeft+43 && y >= guiTop+6 && x <= guiLeft+58 && y <= guiTop+88)){
|
||||
this.func_146283_a(Collections.singletonList(text), x, y);
|
||||
this.drawHoveringText(Collections.singletonList(text), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileGrinder.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileGrinder.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -58,7 +58,7 @@ public class GuiMiner extends GuiContainer{
|
|||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.miner.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.miner.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,6 +77,6 @@ public class GuiMiner extends GuiContainer{
|
|||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button){
|
||||
PacketHandler.theNetwork.sendToServer(new PacketGuiButton(miner.xCoord, miner.yCoord, miner.zCoord, miner.getWorldObj(), button.id, Minecraft.getMinecraft().thePlayer));
|
||||
PacketHandler.theNetwork.sendToServer(new PacketGuiButton(miner.getPos().getX(), miner.getPos().getY(), miner.getPos().getZ(), miner.getWorld(), button.id, Minecraft.getMinecraft().thePlayer));
|
||||
}
|
||||
}
|
|
@ -42,17 +42,17 @@ public class GuiOilGenerator extends GuiContainer{
|
|||
super.drawScreen(x, y, f);
|
||||
String text1 = this.generator.storage.getEnergyStored()+"/"+this.generator.storage.getMaxEnergyStored()+" RF";
|
||||
if(x >= guiLeft+43 && y >= guiTop+6 && x <= guiLeft+58 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text1), x, y);
|
||||
this.drawHoveringText(Collections.singletonList(text1), x, y);
|
||||
}
|
||||
String text2 = StringUtil.getFluidInfo(this.generator.tank);
|
||||
if(x >= guiLeft+117 && y >= guiTop+6 && x <= guiLeft+132 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text2), x, y);
|
||||
this.drawHoveringText(Collections.singletonList(text2), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.generator.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.generator.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,13 +41,13 @@ public class GuiRepairer extends GuiContainer{
|
|||
super.drawScreen(x, y, f);
|
||||
String text = this.tileRepairer.storage.getEnergyStored()+"/"+this.tileRepairer.storage.getMaxEnergyStored()+" RF";
|
||||
if(x >= guiLeft+28 && y >= guiTop+6 && x <= guiLeft+43 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text), x, y);
|
||||
this.drawHoveringText(Collections.singletonList(text), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileRepairer.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileRepairer.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -81,7 +81,7 @@ public class GuiXPSolidifier extends GuiContainer{
|
|||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.solidifier.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.solidifier.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,8 +59,8 @@ public class InitForeignPaxels{
|
|||
Item shovel = ItemUtil.getItemFromName(SIMPLE_ORES+":"+SO_NAMES[i]+"_shovel");
|
||||
|
||||
if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){
|
||||
Item.ToolMaterial material = ((ItemTool)axe).func_150913_i();
|
||||
soPaxels[i] = new ItemAllToolAA(material, SO_REPAIR_NAMES[i], "paxelSO"+SO_NAMES[i], EnumRarity.rare, SO_COLORS[i]);
|
||||
Item.ToolMaterial material = ((ItemTool)axe).getToolMaterial();
|
||||
soPaxels[i] = new ItemAllToolAA(material, SO_REPAIR_NAMES[i], "paxelSO"+SO_NAMES[i], EnumRarity.RARE, SO_COLORS[i]);
|
||||
|
||||
if(ConfigCrafting.PAXELS.isEnabled()){
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(soPaxels[i], axe, pickaxe, hoe, sword, shovel));
|
||||
|
@ -87,8 +87,8 @@ public class InitForeignPaxels{
|
|||
Item shovel = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+MT_NAMES[i]+"Shovel");
|
||||
|
||||
if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){
|
||||
Item.ToolMaterial material = ((ItemTool)axe).func_150913_i();
|
||||
mtPaxels[i] = new ItemAllToolAA(material, MT_REPAIR_NAMES[i], "paxelMT"+MT_NAMES[i], EnumRarity.rare, MT_COLORS[i]);
|
||||
Item.ToolMaterial material = ((ItemTool)axe).getToolMaterial();
|
||||
mtPaxels[i] = new ItemAllToolAA(material, MT_REPAIR_NAMES[i], "paxelMT"+MT_NAMES[i], EnumRarity.RARE, MT_COLORS[i]);
|
||||
|
||||
if(ConfigCrafting.PAXELS.isEnabled()){
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(mtPaxels[i], axe, pickaxe, hoe, sword, shovel));
|
||||
|
@ -115,8 +115,8 @@ public class InitForeignPaxels{
|
|||
Item shovel = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.shovel"+TF_NAMES[i]);
|
||||
|
||||
if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){
|
||||
Item.ToolMaterial material = ((ItemTool)axe).func_150913_i();
|
||||
tfPaxels[i] = new ItemAllToolAA(material, "ingot"+TF_NAMES[i], "paxelTF"+TF_NAMES[i], EnumRarity.rare, TF_COLORS[i]);
|
||||
Item.ToolMaterial material = ((ItemTool)axe).getToolMaterial();
|
||||
tfPaxels[i] = new ItemAllToolAA(material, "ingot"+TF_NAMES[i], "paxelTF"+TF_NAMES[i], EnumRarity.RARE, TF_COLORS[i]);
|
||||
|
||||
if(ConfigCrafting.PAXELS.isEnabled()){
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(tfPaxels[i], axe, pickaxe, hoe, sword, shovel));
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
package de.ellpeck.actuallyadditions.mod.items;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.api.block.IHudDisplay;
|
||||
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||
import de.ellpeck.actuallyadditions.api.internal.EntrySet;
|
||||
|
@ -26,13 +27,13 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
@ -62,10 +63,10 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ){
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing face, float hitX, float hitY, float hitZ){
|
||||
if(player.isSneaking()){
|
||||
Block block = world.getBlock(x, y, z);
|
||||
ItemStack blockStack = new ItemStack(block, 1, world.getBlockMetadata(x, y, z));
|
||||
Block block = Position.fromBlockPos(pos).getBlock(world);
|
||||
ItemStack blockStack = new ItemStack(block, 1, Position.fromBlockPos(pos).getMetadata(world));
|
||||
if(blockStack != null){
|
||||
BookletPage page = BookletUtils.getFirstPageForStack(blockStack);
|
||||
if(page != null){
|
||||
|
@ -88,27 +89,15 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int pass){
|
||||
return this.itemIcon;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){
|
||||
if(posHit != null){
|
||||
Block block = minecraft.theWorld.getBlock(posHit.blockX, posHit.blockY, posHit.blockZ);
|
||||
if(block != null && !block.isAir(minecraft.theWorld, posHit.blockX, posHit.blockY, posHit.blockZ)){
|
||||
ItemStack blockStack = new ItemStack(block, 1, minecraft.theWorld.getBlockMetadata(posHit.blockX, posHit.blockY, posHit.blockZ));
|
||||
Block block = Position.fromBlockPos(posHit.getBlockPos()).getBlock(minecraft.theWorld);
|
||||
if(block != null && !block.isAir(minecraft.theWorld, posHit.getBlockPos())){
|
||||
ItemStack blockStack = new ItemStack(block, 1, Position.fromBlockPos(posHit.getBlockPos()).getMetadata(minecraft.theWorld));
|
||||
if(blockStack != null){
|
||||
int height = resolution.getScaledHeight()/5*3;
|
||||
if(player.isSneaking()){
|
||||
|
@ -119,18 +108,18 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
|
|||
String strg3 = "Right-Click to open...";
|
||||
|
||||
AssetUtil.renderStackToGui(page.getChapter().getDisplayItemStack() != null ? page.getChapter().getDisplayItemStack() : new ItemStack(InitItems.itemBooklet), resolution.getScaledWidth()/2-10, height+41, 1F);
|
||||
minecraft.fontRenderer.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg1, resolution.getScaledWidth()/2-minecraft.fontRenderer.getStringWidth(strg1)/2, height+20, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
minecraft.fontRenderer.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg2, resolution.getScaledWidth()/2-minecraft.fontRenderer.getStringWidth(strg2)/2, height+30, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
minecraft.fontRenderer.drawStringWithShadow(EnumChatFormatting.GOLD+strg3, resolution.getScaledWidth()/2-minecraft.fontRenderer.getStringWidth(strg3)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg1, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg1)/2, height+20, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg2, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg2)/2, height+30, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.GOLD+strg3, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg3)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
else{
|
||||
String strg = EnumChatFormatting.DARK_RED+"No Info available! Sorry :(";
|
||||
minecraft.fontRenderer.drawStringWithShadow(strg, resolution.getScaledWidth()/2-minecraft.fontRenderer.getStringWidth(strg)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
minecraft.fontRendererObj.drawStringWithShadow(strg, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
else{
|
||||
String strg = EnumChatFormatting.DARK_GREEN+""+EnumChatFormatting.ITALIC+"Sneak!";
|
||||
minecraft.fontRenderer.drawStringWithShadow(strg, resolution.getScaledWidth()/2-minecraft.fontRenderer.getStringWidth(strg)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
minecraft.fontRendererObj.drawStringWithShadow(strg, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,14 +12,11 @@ package de.ellpeck.actuallyadditions.mod.items;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockCrystal;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -27,21 +24,12 @@ import java.util.List;
|
|||
|
||||
public class ItemCrystal extends ItemBase{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon[] textures;
|
||||
|
||||
public ItemCrystal(String name){
|
||||
super(name);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int par1){
|
||||
return par1 >= this.textures.length ? null : this.textures[par1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage){
|
||||
return damage;
|
||||
|
@ -54,7 +42,7 @@ public class ItemCrystal extends ItemBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return stack.getItemDamage() >= BlockCrystal.allCrystals.length ? EnumRarity.common : BlockCrystal.allCrystals[stack.getItemDamage()].rarity;
|
||||
return stack.getItemDamage() >= BlockCrystal.allCrystals.length ? EnumRarity.COMMON : BlockCrystal.allCrystals[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
|
@ -64,13 +52,4 @@ public class ItemCrystal extends ItemBase{
|
|||
list.add(new ItemStack(this, 1, j));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.textures = new IIcon[BlockCrystal.allCrystals.length];
|
||||
for(int i = 0; i < this.textures.length; i++){
|
||||
this.textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+BlockCrystal.allCrystals[i].name);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,14 +12,11 @@ package de.ellpeck.actuallyadditions.mod.items;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheDusts;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -52,7 +49,7 @@ public class ItemDust extends ItemBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return stack.getItemDamage() >= allDusts.length ? EnumRarity.common : allDusts[stack.getItemDamage()].rarity;
|
||||
return stack.getItemDamage() >= allDusts.length ? EnumRarity.COMMON : allDusts[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
|
@ -62,16 +59,4 @@ public class ItemDust extends ItemBase{
|
|||
list.add(new ItemStack(this, 1, j));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int pass){
|
||||
return this.itemIcon;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,13 +11,8 @@
|
|||
package de.ellpeck.actuallyadditions.mod.items;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemGeneric extends ItemBase{
|
||||
|
||||
|
@ -28,18 +23,6 @@ public class ItemGeneric extends ItemBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int pass){
|
||||
return this.itemIcon;
|
||||
return EnumRarity.UNCOMMON;
|
||||
}
|
||||
}
|
|
@ -60,7 +60,7 @@ public class ItemGrowthRing extends ItemEnergy{
|
|||
int theX = MathHelper.floor_double(player.posX+x);
|
||||
int theY = MathHelper.floor_double(player.posY+y);
|
||||
int theZ = MathHelper.floor_double(player.posZ+z);
|
||||
Block theBlock = world.getBlock(theX, theY, theZ);
|
||||
Block theBlock = new Position(theX, theY, theZ).getBlock(world);
|
||||
if((theBlock instanceof IGrowable || theBlock instanceof IPlantable) && !(theBlock instanceof BlockGrass)){
|
||||
blocks.add(new Position(theX, theY, theZ));
|
||||
}
|
||||
|
@ -75,11 +75,11 @@ public class ItemGrowthRing extends ItemEnergy{
|
|||
Position pos = blocks.get(Util.RANDOM.nextInt(blocks.size()));
|
||||
|
||||
int metaBefore = pos.getMetadata(world);
|
||||
pos.getBlock(world).updateTick(world, pos.getX(), pos.getY(), pos.getZ(), Util.RANDOM);
|
||||
pos.getBlock(world).updateTick(world, pos, pos.getBlockState(world), Util.RANDOM);
|
||||
|
||||
//Show Particles if Metadata changed
|
||||
if(pos.getMetadata(world) != metaBefore){
|
||||
world.playAuxSFX(2005, pos.getX(), pos.getY(), pos.getZ(), 0);
|
||||
world.playAuxSFX(2005, pos, 0);
|
||||
}
|
||||
|
||||
if(!player.capabilities.isCreativeMode){
|
||||
|
|
|
@ -12,14 +12,11 @@ package de.ellpeck.actuallyadditions.mod.items;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -28,20 +25,12 @@ import java.util.List;
|
|||
public class ItemMisc extends ItemBase{
|
||||
|
||||
public static final TheMiscItems[] allMiscItems = TheMiscItems.values();
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon[] textures;
|
||||
|
||||
public ItemMisc(String name){
|
||||
super(name);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int par1){
|
||||
return par1 >= textures.length ? null : textures[par1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage){
|
||||
return damage;
|
||||
|
@ -54,7 +43,7 @@ public class ItemMisc extends ItemBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return stack.getItemDamage() >= allMiscItems.length ? EnumRarity.common : allMiscItems[stack.getItemDamage()].rarity;
|
||||
return stack.getItemDamage() >= allMiscItems.length ? EnumRarity.COMMON : allMiscItems[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
|
@ -64,13 +53,4 @@ public class ItemMisc extends ItemBase{
|
|||
list.add(new ItemStack(this, 1, j));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.textures = new IIcon[allMiscItems.length];
|
||||
for(int i = 0; i < textures.length; i++){
|
||||
textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName()+allMiscItems[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,7 @@ package de.ellpeck.actuallyadditions.mod.items;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.ThePotionRings;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -22,7 +20,6 @@ import net.minecraft.item.EnumRarity;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -72,11 +69,11 @@ public class ItemPotionRing extends ItemBase{
|
|||
if(!effect.needsWaitBeforeActivating || !thePlayer.isPotionActive(effect.effectID)){
|
||||
if(!((ItemPotionRing)stack.getItem()).isAdvanced){
|
||||
if(equippedStack != null && stack == equippedStack){
|
||||
thePlayer.addPotionEffect(new PotionEffect(effect.effectID, effect.activeTime, effect.normalAmplifier, true));
|
||||
thePlayer.addPotionEffect(new PotionEffect(effect.effectID, effect.activeTime, effect.normalAmplifier, true, false));
|
||||
}
|
||||
}
|
||||
else{
|
||||
thePlayer.addPotionEffect(new PotionEffect(effect.effectID, effect.activeTime, effect.advancedAmplifier, true));
|
||||
thePlayer.addPotionEffect(new PotionEffect(effect.effectID, effect.activeTime, effect.advancedAmplifier, true, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +92,7 @@ public class ItemPotionRing extends ItemBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return stack.getItemDamage() >= allRings.length ? EnumRarity.common : allRings[stack.getItemDamage()].rarity;
|
||||
return stack.getItemDamage() >= allRings.length ? EnumRarity.COMMON : allRings[stack.getItemDamage()].rarity;
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
|
@ -105,16 +102,4 @@ public class ItemPotionRing extends ItemBase{
|
|||
list.add(new ItemStack(this, 1, j));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int pass){
|
||||
return this.itemIcon;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,17 +14,15 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
|||
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemSeeds;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemSeed extends ItemSeeds{
|
||||
|
||||
|
@ -65,28 +63,11 @@ public class ItemSeed extends ItemSeeds{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.RARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int pass){
|
||||
return this.itemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getPlant(IBlockAccess world, int x, int y, int z){
|
||||
return this.plant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlantMetadata(IBlockAccess world, int x, int y, int z){
|
||||
return 0;
|
||||
public IBlockState getPlant(IBlockAccess world, BlockPos pos){
|
||||
return this.plant.getDefaultState();
|
||||
}
|
||||
}
|
|
@ -11,16 +11,11 @@
|
|||
package de.ellpeck.actuallyadditions.mod.items;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemSolidifiedExperience extends ItemBase{
|
||||
|
||||
|
@ -51,18 +46,6 @@ public class ItemSolidifiedExperience extends ItemBase{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int pass){
|
||||
return this.itemIcon;
|
||||
return EnumRarity.UNCOMMON;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,22 +11,16 @@
|
|||
package de.ellpeck.actuallyadditions.mod.items;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemTeleStaff extends ItemEnergy{
|
||||
|
||||
|
@ -40,15 +34,13 @@ public class ItemTeleStaff extends ItemEnergy{
|
|||
if(this.getWaitTime(stack) <= 0){
|
||||
MovingObjectPosition pos = WorldUtil.getNearestPositionWithAir(world, player, 100);
|
||||
if(pos != null && (pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK || player.rotationPitch >= -5)){
|
||||
int side = pos.sideHit;
|
||||
int side = pos.sideHit.ordinal();
|
||||
if(side != -1){
|
||||
ForgeDirection forgeSide = ForgeDirection.getOrientation(side);
|
||||
if(forgeSide != ForgeDirection.UNKNOWN){
|
||||
double x = pos.hitVec.xCoord-(side == 4 ? 0.5 : 0)+(side == 5 ? 0.5 : 0);
|
||||
double y = pos.hitVec.yCoord-(side == 0 ? 2.0 : 0)+(side == 1 ? 0.5 : 0);
|
||||
double z = pos.hitVec.zCoord-(side == 2 ? 0.5 : 0)+(side == 3 ? 0.5 : 0);
|
||||
int baseUse = 200;
|
||||
int use = baseUse+(int)(baseUse*pos.hitVec.distanceTo(Vec3.createVectorHelper(player.posX, player.posY+(player.getEyeHeight()-player.getDefaultEyeHeight()), player.posZ)));
|
||||
int use = baseUse+(int)(baseUse*pos.hitVec.distanceTo(new Vec3(player.posX, player.posY+(player.getEyeHeight()-player.getDefaultEyeHeight()), player.posZ)));
|
||||
if(this.getEnergyStored(stack) >= use){
|
||||
((EntityPlayerMP)player).playerNetServerHandler.setPlayerLocation(x, y, z, player.rotationYaw, player.rotationPitch);
|
||||
player.mountEntity(null);
|
||||
|
@ -62,7 +54,6 @@ public class ItemTeleStaff extends ItemEnergy{
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
player.swingItem();
|
||||
return stack;
|
||||
}
|
||||
|
@ -77,19 +68,7 @@ public class ItemTeleStaff extends ItemEnergy{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int pass){
|
||||
return this.itemIcon;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
|
||||
private int getWaitTime(ItemStack stack){
|
||||
|
|
|
@ -10,19 +10,16 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.items;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemWaterRemovalRing extends ItemEnergy{
|
||||
|
||||
|
@ -52,16 +49,18 @@ public class ItemWaterRemovalRing extends ItemEnergy{
|
|||
int theZ = MathHelper.floor_double(player.posZ+z);
|
||||
if(this.getEnergyStored(stack) >= energyUse){
|
||||
//Remove Water
|
||||
if(world.getBlock(theX, theY, theZ) == Blocks.water || world.getBlock(theX, theY, theZ) == Blocks.flowing_water){
|
||||
world.setBlockToAir(theX, theY, theZ);
|
||||
Position pos = new Position(theX, theY, theZ);
|
||||
Block block = pos.getBlock(world);
|
||||
if(block == Blocks.water || block == Blocks.flowing_water){
|
||||
world.setBlockToAir(pos);
|
||||
|
||||
if(!player.capabilities.isCreativeMode){
|
||||
this.extractEnergy(stack, energyUse, false);
|
||||
}
|
||||
}
|
||||
//Remove Lava
|
||||
else if(world.getBlock(theX, theY, theZ) == Blocks.lava || world.getBlock(theX, theY, theZ) == Blocks.flowing_lava){
|
||||
world.setBlockToAir(theX, theY, theZ);
|
||||
else if(block == Blocks.lava || block == Blocks.flowing_lava){
|
||||
world.setBlockToAir(pos);
|
||||
|
||||
if(!player.capabilities.isCreativeMode){
|
||||
this.extractEnergy(stack, energyUse*2, false);
|
||||
|
@ -76,18 +75,6 @@ public class ItemWaterRemovalRing extends ItemEnergy{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int pass){
|
||||
return this.itemIcon;
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ public abstract class ItemEnergy extends ItemEnergyContainer{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect(ItemStack stack, int pass){
|
||||
public boolean hasEffect(ItemStack stack){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,14 +13,10 @@ package de.ellpeck.actuallyadditions.mod.items.base;
|
|||
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemPickaxeAA extends ItemPickaxe{
|
||||
|
||||
|
@ -66,16 +62,4 @@ public class ItemPickaxeAA extends ItemPickaxe{
|
|||
public EnumRarity getRarity(ItemStack stack){
|
||||
return this.rarity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int pass){
|
||||
return this.itemIcon;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,14 +14,10 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase;
|
|||
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemSwordAA extends ItemSword{
|
||||
|
||||
|
@ -71,16 +67,4 @@ public class ItemSwordAA extends ItemSword{
|
|||
public EnumRarity getRarity(ItemStack stack){
|
||||
return this.rarity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER+":"+this.getBaseName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int pass){
|
||||
return this.itemIcon;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ public class LensDeath extends Lens{
|
|||
if(tile.getEnergy() >= use){
|
||||
tile.extractEnergy(use);
|
||||
|
||||
ArrayList<EntityLivingBase> entities = (ArrayList<EntityLivingBase>)tile.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1));
|
||||
ArrayList<EntityLivingBase> entities = (ArrayList<EntityLivingBase>)tile.getWorldObject().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.fromBounds(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1));
|
||||
for(EntityLivingBase entity : entities){
|
||||
entity.attackEntityFrom(DamageSources.DAMAGE_ATOMIC_RECONSTRUCTOR, 20F);
|
||||
}
|
||||
}
|
||||
|
||||
return hitBlock != null && !hitBlock.getBlock(tile.getWorld()).isAir(tile.getWorld(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ());
|
||||
return hitBlock != null && !hitBlock.getBlock(tile.getWorldObject()).isAir(tile.getWorldObject(), hitBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,10 +18,10 @@ public class LensDetonation extends Lens{
|
|||
|
||||
@Override
|
||||
public boolean invoke(Position hitBlock, IAtomicReconstructor tile){
|
||||
if(hitBlock != null && !hitBlock.getBlock(tile.getWorld()).isAir(tile.getWorld(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ())){
|
||||
if(hitBlock != null && !hitBlock.getBlock(tile.getWorldObject()).isAir(tile.getWorldObject(), hitBlock)){
|
||||
int use = 250000;
|
||||
if(tile.getEnergy() >= use){
|
||||
tile.getWorld().newExplosion(null, hitBlock.getX()+0.5, hitBlock.getY()+0.5, hitBlock.getZ()+0.5, 10F, true, true);
|
||||
tile.getWorldObject().newExplosion(null, hitBlock.getX()+0.5, hitBlock.getY()+0.5, hitBlock.getZ()+0.5, 10F, true, true);
|
||||
tile.extractEnergy(use);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -15,14 +15,14 @@ import net.minecraft.item.EnumRarity;
|
|||
|
||||
public enum TheDusts{
|
||||
|
||||
IRON("Iron", 7826534, EnumRarity.common),
|
||||
GOLD("Gold", 14335744, EnumRarity.uncommon),
|
||||
DIAMOND("Diamond", 292003, EnumRarity.rare),
|
||||
EMERALD("Emerald", 4319527, EnumRarity.epic),
|
||||
LAPIS("Lapis", 1849791, EnumRarity.uncommon),
|
||||
QUARTZ("Quartz", StringUtil.DECIMAL_COLOR_WHITE, EnumRarity.uncommon),
|
||||
COAL("Coal", 0, EnumRarity.uncommon),
|
||||
QUARTZ_BLACK("QuartzBlack", 18, EnumRarity.rare);
|
||||
IRON("Iron", 7826534, EnumRarity.COMMON),
|
||||
GOLD("Gold", 14335744, EnumRarity.UNCOMMON),
|
||||
DIAMOND("Diamond", 292003, EnumRarity.RARE),
|
||||
EMERALD("Emerald", 4319527, EnumRarity.EPIC),
|
||||
LAPIS("Lapis", 1849791, EnumRarity.UNCOMMON),
|
||||
QUARTZ("Quartz", StringUtil.DECIMAL_COLOR_WHITE, EnumRarity.UNCOMMON),
|
||||
COAL("Coal", 0, EnumRarity.UNCOMMON),
|
||||
QUARTZ_BLACK("QuartzBlack", 18, EnumRarity.RARE);
|
||||
|
||||
public final String name;
|
||||
public final int color;
|
||||
|
|
|
@ -17,27 +17,27 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
public enum TheFoods{
|
||||
|
||||
CHEESE("Cheese", 1, 0.5F, false, 3, EnumRarity.common),
|
||||
PUMPKIN_STEW("PumpkinStew", 10, 1F, true, 30, EnumRarity.common),
|
||||
CARROT_JUICE("CarrotJuice", 6, 0.6F, true, 20, EnumRarity.common),
|
||||
FISH_N_CHIPS("FishNChips", 20, 5F, false, 40, EnumRarity.uncommon),
|
||||
FRENCH_FRIES("FrenchFries", 16, 4F, false, 32, EnumRarity.common),
|
||||
FRENCH_FRY("FrenchFry", 3, 0.5F, false, 3, EnumRarity.common),
|
||||
SPAGHETTI("Spaghetti", 18, 3F, false, 38, EnumRarity.common),
|
||||
NOODLE("Noodle", 1, 0.5F, false, 3, EnumRarity.common),
|
||||
CHOCOLATE_CAKE("ChocolateCake", 16, 2F, false, 45, EnumRarity.uncommon),
|
||||
CHOCOLATE("Chocolate", 5, 1F, false, 15, EnumRarity.common),
|
||||
TOAST("Toast", 3, 0.4F, false, 25, EnumRarity.common),
|
||||
SUBMARINE_SANDWICH("SubmarineSandwich", 10, 8F, false, 40, EnumRarity.uncommon),
|
||||
BIG_COOKIE("BigCookie", 6, 1F, false, 20, EnumRarity.uncommon),
|
||||
HAMBURGER("Hamburger", 14, 6F, false, 40, EnumRarity.common),
|
||||
PIZZA("Pizza", 20, 10F, false, 45, EnumRarity.uncommon),
|
||||
BAGUETTE("Baguette", 7, 2F, false, 25, EnumRarity.common),
|
||||
RICE("Rice", 2, 1F, false, 10, EnumRarity.uncommon),
|
||||
RICE_BREAD("RiceBread", 8, 3F, false, 25, EnumRarity.uncommon),
|
||||
DOUGHNUT("Doughnut", 4, 0.5F, false, 10, EnumRarity.epic),
|
||||
CHOCOLATE_TOAST("ChocolateToast", 8, 1.4F, false, 40, EnumRarity.rare),
|
||||
BACON("Bacon", 4, 0.5F, false, 30, EnumRarity.common);
|
||||
CHEESE("Cheese", 1, 0.5F, false, 3, EnumRarity.COMMON),
|
||||
PUMPKIN_STEW("PumpkinStew", 10, 1F, true, 30, EnumRarity.COMMON),
|
||||
CARROT_JUICE("CarrotJuice", 6, 0.6F, true, 20, EnumRarity.COMMON),
|
||||
FISH_N_CHIPS("FishNChips", 20, 5F, false, 40, EnumRarity.UNCOMMON),
|
||||
FRENCH_FRIES("FrenchFries", 16, 4F, false, 32, EnumRarity.COMMON),
|
||||
FRENCH_FRY("FrenchFry", 3, 0.5F, false, 3, EnumRarity.COMMON),
|
||||
SPAGHETTI("Spaghetti", 18, 3F, false, 38, EnumRarity.COMMON),
|
||||
NOODLE("Noodle", 1, 0.5F, false, 3, EnumRarity.COMMON),
|
||||
CHOCOLATE_CAKE("ChocolateCake", 16, 2F, false, 45, EnumRarity.UNCOMMON),
|
||||
CHOCOLATE("Chocolate", 5, 1F, false, 15, EnumRarity.COMMON),
|
||||
TOAST("Toast", 3, 0.4F, false, 25, EnumRarity.COMMON),
|
||||
SUBMARINE_SANDWICH("SubmarineSandwich", 10, 8F, false, 40, EnumRarity.UNCOMMON),
|
||||
BIG_COOKIE("BigCookie", 6, 1F, false, 20, EnumRarity.UNCOMMON),
|
||||
HAMBURGER("Hamburger", 14, 6F, false, 40, EnumRarity.COMMON),
|
||||
PIZZA("Pizza", 20, 10F, false, 45, EnumRarity.UNCOMMON),
|
||||
BAGUETTE("Baguette", 7, 2F, false, 25, EnumRarity.COMMON),
|
||||
RICE("Rice", 2, 1F, false, 10, EnumRarity.UNCOMMON),
|
||||
RICE_BREAD("RiceBread", 8, 3F, false, 25, EnumRarity.UNCOMMON),
|
||||
DOUGHNUT("Doughnut", 4, 0.5F, false, 10, EnumRarity.EPIC),
|
||||
CHOCOLATE_TOAST("ChocolateToast", 8, 1.4F, false, 40, EnumRarity.RARE),
|
||||
BACON("Bacon", 4, 0.5F, false, 30, EnumRarity.COMMON);
|
||||
|
||||
public final String name;
|
||||
public final int healAmount;
|
||||
|
|
|
@ -14,13 +14,13 @@ import net.minecraft.item.EnumRarity;
|
|||
|
||||
public enum TheJams{
|
||||
|
||||
CU_BA_RA("CuBaRa", 6, 0.1F, EnumRarity.rare, 5, 12, 12595273),
|
||||
GRA_KI_BA("GraKiBa", 6, 0.1F, EnumRarity.rare, 16, 13, 5492820),
|
||||
PL_AP_LE("PlApLe", 6, 0.1F, EnumRarity.rare, 15, 3, 13226009),
|
||||
CH_AP_CI("ChApCi", 6, 0.1F, EnumRarity.rare, 10, 1, 13189222),
|
||||
HO_ME_KI("HoMeKi", 6, 0.1F, EnumRarity.rare, 10, 14, 2031360),
|
||||
PI_CO("PiCo", 6, 0.1F, EnumRarity.rare, 9, 1, 16056203),
|
||||
HO_ME_CO("HoMeCo", 6, 0.1F, EnumRarity.rare, 10, 13, 10462208);
|
||||
CU_BA_RA("CuBaRa", 6, 0.1F, EnumRarity.RARE, 5, 12, 12595273),
|
||||
GRA_KI_BA("GraKiBa", 6, 0.1F, EnumRarity.RARE, 16, 13, 5492820),
|
||||
PL_AP_LE("PlApLe", 6, 0.1F, EnumRarity.RARE, 15, 3, 13226009),
|
||||
CH_AP_CI("ChApCi", 6, 0.1F, EnumRarity.RARE, 10, 1, 13189222),
|
||||
HO_ME_KI("HoMeKi", 6, 0.1F, EnumRarity.RARE, 10, 14, 2031360),
|
||||
PI_CO("PiCo", 6, 0.1F, EnumRarity.RARE, 9, 1, 16056203),
|
||||
HO_ME_CO("HoMeCo", 6, 0.1F, EnumRarity.RARE, 10, 13, 10462208);
|
||||
|
||||
public final String name;
|
||||
public final int healAmount;
|
||||
|
|
|
@ -14,25 +14,25 @@ import net.minecraft.item.EnumRarity;
|
|||
|
||||
public enum TheMiscItems{
|
||||
|
||||
PAPER_CONE("PaperCone", EnumRarity.common),
|
||||
MASHED_FOOD("MashedFood", EnumRarity.uncommon),
|
||||
KNIFE_BLADE("KnifeBlade", EnumRarity.common),
|
||||
KNIFE_HANDLE("KnifeHandle", EnumRarity.common),
|
||||
DOUGH("Dough", EnumRarity.common),
|
||||
QUARTZ("BlackQuartz", EnumRarity.epic),
|
||||
RING("Ring", EnumRarity.uncommon),
|
||||
COIL("Coil", EnumRarity.common),
|
||||
COIL_ADVANCED("CoilAdvanced", EnumRarity.uncommon),
|
||||
RICE_DOUGH("RiceDough", EnumRarity.uncommon),
|
||||
TINY_COAL("TinyCoal", EnumRarity.common),
|
||||
TINY_CHAR("TinyCharcoal", EnumRarity.common),
|
||||
RICE_SLIME("RiceSlime", EnumRarity.uncommon),
|
||||
CANOLA("Canola", EnumRarity.uncommon),
|
||||
CUP("Cup", EnumRarity.uncommon),
|
||||
BAT_WING("BatWing", EnumRarity.rare),
|
||||
DRILL_CORE("DrillCore", EnumRarity.uncommon),
|
||||
BLACK_DYE("BlackDye", EnumRarity.epic),
|
||||
LENS("Lens", EnumRarity.uncommon);
|
||||
PAPER_CONE("PaperCone", EnumRarity.COMMON),
|
||||
MASHED_FOOD("MashedFood", EnumRarity.UNCOMMON),
|
||||
KNIFE_BLADE("KnifeBlade", EnumRarity.COMMON),
|
||||
KNIFE_HANDLE("KnifeHandle", EnumRarity.COMMON),
|
||||
DOUGH("Dough", EnumRarity.COMMON),
|
||||
QUARTZ("BlackQuartz", EnumRarity.EPIC),
|
||||
RING("Ring", EnumRarity.UNCOMMON),
|
||||
COIL("Coil", EnumRarity.COMMON),
|
||||
COIL_ADVANCED("CoilAdvanced", EnumRarity.UNCOMMON),
|
||||
RICE_DOUGH("RiceDough", EnumRarity.UNCOMMON),
|
||||
TINY_COAL("TinyCoal", EnumRarity.COMMON),
|
||||
TINY_CHAR("TinyCharcoal", EnumRarity.COMMON),
|
||||
RICE_SLIME("RiceSlime", EnumRarity.UNCOMMON),
|
||||
CANOLA("Canola", EnumRarity.UNCOMMON),
|
||||
CUP("Cup", EnumRarity.UNCOMMON),
|
||||
BAT_WING("BatWing", EnumRarity.RARE),
|
||||
DRILL_CORE("DrillCore", EnumRarity.UNCOMMON),
|
||||
BLACK_DYE("BlackDye", EnumRarity.EPIC),
|
||||
LENS("Lens", EnumRarity.UNCOMMON);
|
||||
|
||||
public final String name;
|
||||
public final EnumRarity rarity;
|
||||
|
|
|
@ -18,22 +18,22 @@ import net.minecraft.potion.Potion;
|
|||
|
||||
public enum ThePotionRings{
|
||||
|
||||
SPEED(Potion.moveSpeed.getName(), 8171462, Potion.moveSpeed.getId(), 0, 1, 10, false, EnumRarity.uncommon, new ItemStack(Items.sugar)),
|
||||
SPEED(Potion.moveSpeed.getName(), 8171462, Potion.moveSpeed.getId(), 0, 1, 10, false, EnumRarity.UNCOMMON, new ItemStack(Items.sugar)),
|
||||
//Slowness
|
||||
HASTE(Potion.digSpeed.getName(), 14270531, Potion.digSpeed.getId(), 0, 1, 10, false, EnumRarity.epic, new ItemStack(Items.repeater)),
|
||||
HASTE(Potion.digSpeed.getName(), 14270531, Potion.digSpeed.getId(), 0, 1, 10, false, EnumRarity.EPIC, new ItemStack(Items.repeater)),
|
||||
//Mining Fatigue
|
||||
STRENGTH(Potion.damageBoost.getName(), 9643043, Potion.damageBoost.getId(), 0, 1, 10, false, EnumRarity.rare, new ItemStack(Items.blaze_powder)),
|
||||
STRENGTH(Potion.damageBoost.getName(), 9643043, Potion.damageBoost.getId(), 0, 1, 10, false, EnumRarity.RARE, new ItemStack(Items.blaze_powder)),
|
||||
//Health (Not Happening)
|
||||
//Damage
|
||||
JUMP_BOOST(Potion.jump.getName(), 7889559, Potion.jump.getId(), 0, 1, 10, false, EnumRarity.rare, new ItemStack(Blocks.piston)),
|
||||
JUMP_BOOST(Potion.jump.getName(), 7889559, Potion.jump.getId(), 0, 1, 10, false, EnumRarity.RARE, new ItemStack(Blocks.piston)),
|
||||
//Nausea
|
||||
REGEN(Potion.regeneration.getName(), 13458603, Potion.regeneration.getId(), 0, 1, 50, true, EnumRarity.rare, new ItemStack(Items.ghast_tear)),
|
||||
RESISTANCE(Potion.resistance.getName(), 10044730, Potion.resistance.getId(), 0, 1, 10, false, EnumRarity.epic, new ItemStack(Items.slime_ball)),
|
||||
FIRE_RESISTANCE(Potion.fireResistance.getName(), 14981690, Potion.fireResistance.getId(), 0, 0, 10, false, EnumRarity.uncommon, new ItemStack(Items.magma_cream)),
|
||||
WATER_BREATHING(Potion.waterBreathing.getName(), 3035801, Potion.waterBreathing.getId(), 0, 0, 10, false, EnumRarity.rare, new ItemStack(Items.fish, 1, 3)),
|
||||
INVISIBILITY(Potion.invisibility.getName(), 8356754, Potion.invisibility.getId(), 0, 0, 10, false, EnumRarity.epic, new ItemStack(Items.fermented_spider_eye)),
|
||||
REGEN(Potion.regeneration.getName(), 13458603, Potion.regeneration.getId(), 0, 1, 50, true, EnumRarity.RARE, new ItemStack(Items.ghast_tear)),
|
||||
RESISTANCE(Potion.resistance.getName(), 10044730, Potion.resistance.getId(), 0, 1, 10, false, EnumRarity.EPIC, new ItemStack(Items.slime_ball)),
|
||||
FIRE_RESISTANCE(Potion.fireResistance.getName(), 14981690, Potion.fireResistance.getId(), 0, 0, 10, false, EnumRarity.UNCOMMON, new ItemStack(Items.magma_cream)),
|
||||
WATER_BREATHING(Potion.waterBreathing.getName(), 3035801, Potion.waterBreathing.getId(), 0, 0, 10, false, EnumRarity.RARE, new ItemStack(Items.fish, 1, 3)),
|
||||
INVISIBILITY(Potion.invisibility.getName(), 8356754, Potion.invisibility.getId(), 0, 0, 10, false, EnumRarity.EPIC, new ItemStack(Items.fermented_spider_eye)),
|
||||
//Blindness
|
||||
NIGHT_VISION(Potion.nightVision.getName(), 2039713, Potion.nightVision.getId(), 0, 0, 300, false, EnumRarity.rare, new ItemStack(Items.golden_carrot));
|
||||
NIGHT_VISION(Potion.nightVision.getName(), 2039713, Potion.nightVision.getId(), 0, 0, 300, false, EnumRarity.RARE, new ItemStack(Items.golden_carrot));
|
||||
//Hunger
|
||||
//Weakness
|
||||
//Poison
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.misc;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
||||
import net.minecraft.dispenser.IBlockSource;
|
||||
|
@ -22,12 +23,13 @@ public class DispenserHandlerEmptyBucket extends BehaviorDefaultDispenseItem{
|
|||
|
||||
@Override
|
||||
public ItemStack dispenseStack(IBlockSource source, ItemStack bucket){
|
||||
EnumFacing facing = BlockDispenser.func_149937_b(source.getBlockMetadata());
|
||||
int x = source.getXInt()+facing.getFrontOffsetX();
|
||||
int y = source.getYInt()+facing.getFrontOffsetY();
|
||||
int z = source.getZInt()+facing.getFrontOffsetZ();
|
||||
EnumFacing facing = BlockDispenser.getFacing(source.getBlockMetadata());
|
||||
int x = source.getBlockTileEntity().getPos().getX()+facing.getFrontOffsetX();
|
||||
int y = source.getBlockTileEntity().getPos().getY()+facing.getFrontOffsetY();
|
||||
int z = source.getBlockTileEntity().getPos().getZ()+facing.getFrontOffsetZ();
|
||||
Position pos = new Position(x, y, z);
|
||||
|
||||
if(source.getWorld().isAirBlock(x, y, z) && !source.getWorld().getBlock(x, y, z).getMaterial().isSolid() && ((ItemBucket)bucket.getItem()).tryPlaceContainedLiquid(source.getWorld(), x, y, z)){
|
||||
if(source.getWorld().isAirBlock(pos) && !pos.getMaterial(source.getWorld()).isSolid() && ((ItemBucket)bucket.getItem()).tryPlaceContainedLiquid(source.getWorld(), pos)){
|
||||
return new ItemStack(Items.bucket);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.misc;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
||||
|
@ -26,10 +27,10 @@ public class DispenserHandlerFillBucket extends BehaviorDefaultDispenseItem{
|
|||
|
||||
@Override
|
||||
public ItemStack dispenseStack(IBlockSource source, ItemStack emptyBucket){
|
||||
EnumFacing facing = BlockDispenser.func_149937_b(source.getBlockMetadata());
|
||||
int x = source.getXInt()+facing.getFrontOffsetX();
|
||||
int y = source.getYInt()+facing.getFrontOffsetY();
|
||||
int z = source.getZInt()+facing.getFrontOffsetZ();
|
||||
EnumFacing facing = BlockDispenser.getFacing(source.getBlockMetadata());
|
||||
int x = source.getBlockTileEntity().getPos().getX()+facing.getFrontOffsetX();
|
||||
int y = source.getBlockTileEntity().getPos().getY()+facing.getFrontOffsetY();
|
||||
int z = source.getBlockTileEntity().getPos().getZ()+facing.getFrontOffsetZ();
|
||||
|
||||
ItemStack filledBucket = this.tryFillBucket(source, x, y, z, emptyBucket);
|
||||
|
||||
|
@ -44,7 +45,7 @@ public class DispenserHandlerFillBucket extends BehaviorDefaultDispenseItem{
|
|||
emptyBucket = filledBucket.copy();
|
||||
}
|
||||
//Not enough space for the bucket in the inventory?
|
||||
else if(((TileEntityDispenser)source.getBlockTileEntity()).func_146019_a(filledBucket.copy()) < 0){
|
||||
else if(((TileEntityDispenser)source.getBlockTileEntity()).addItemStack(filledBucket.copy()) < 0){
|
||||
new BehaviorDefaultDispenseItem().dispense(source, filledBucket.copy());
|
||||
}
|
||||
//Filled Bucket or Empty Buckets because either they weren't filled or the full one was dispensed out because of missing space
|
||||
|
@ -52,24 +53,25 @@ public class DispenserHandlerFillBucket extends BehaviorDefaultDispenseItem{
|
|||
}
|
||||
|
||||
private ItemStack tryFillBucket(IBlockSource source, int x, int y, int z, ItemStack bucket){
|
||||
Block block = source.getWorld().getBlock(x, y, z);
|
||||
Position pos = new Position(x, y, z);
|
||||
Block block = pos.getBlock(source.getWorld());
|
||||
|
||||
if(block == Blocks.water || block == Blocks.flowing_water){
|
||||
if(source.getWorld().getBlockMetadata(x, y, z) == 0){
|
||||
source.getWorld().setBlockToAir(x, y, z);
|
||||
if(pos.getMetadata(source.getWorld()) == 0){
|
||||
source.getWorld().setBlockToAir(pos);
|
||||
return new ItemStack(Items.water_bucket);
|
||||
}
|
||||
}
|
||||
else if(block == Blocks.lava || block == Blocks.flowing_lava){
|
||||
if(source.getWorld().getBlockMetadata(x, y, z) == 0){
|
||||
source.getWorld().setBlockToAir(x, y, z);
|
||||
if(pos.getMetadata(source.getWorld()) == 0){
|
||||
source.getWorld().setBlockToAir(pos);
|
||||
return new ItemStack(Items.lava_bucket);
|
||||
}
|
||||
}
|
||||
else if(block instanceof IFluidBlock && ((IFluidBlock)block).canDrain(source.getWorld(), x, y, z)){
|
||||
ItemStack stack = FluidContainerRegistry.fillFluidContainer(((IFluidBlock)block).drain(source.getWorld(), x, y, z, false), bucket);
|
||||
else if(block instanceof IFluidBlock && ((IFluidBlock)block).canDrain(source.getWorld(), pos)){
|
||||
ItemStack stack = FluidContainerRegistry.fillFluidContainer(((IFluidBlock)block).drain(source.getWorld(), pos, false), bucket);
|
||||
if(stack != null){
|
||||
((IFluidBlock)block).drain(source.getWorld(), x, y, z, true);
|
||||
((IFluidBlock)block).drain(source.getWorld(), pos, true);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EnumPlayerModelParts;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -32,7 +33,7 @@ public class RenderSpecial{
|
|||
}
|
||||
|
||||
public void render(EntityPlayer player){
|
||||
if(player.isInvisible() || player.getHideCape()){
|
||||
if(player.isInvisible() || player.isWearing(EnumPlayerModelParts.CAPE)){
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.mod.util.Util;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
@ -48,12 +49,13 @@ public class SpecialRenderInit{
|
|||
|
||||
ItemStack stack = null;
|
||||
//Get the Item from the String
|
||||
if(Item.itemRegistry.containsKey(itemName)){
|
||||
stack = new ItemStack((Item)Item.itemRegistry.getObject(itemName), 1, meta);
|
||||
ResourceLocation resLoc = new ResourceLocation(itemName);
|
||||
if(Item.itemRegistry.containsKey(resLoc)){
|
||||
stack = new ItemStack(Item.itemRegistry.getObject(resLoc), 1, meta);
|
||||
}
|
||||
else{
|
||||
if(Block.blockRegistry.containsKey(itemName)){
|
||||
stack = new ItemStack((Block)Block.blockRegistry.getObject(itemName), 1, meta);
|
||||
if(Block.blockRegistry.containsKey(resLoc)){
|
||||
stack = new ItemStack(Block.blockRegistry.getObject(resLoc), 1, meta);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +72,7 @@ public class SpecialRenderInit{
|
|||
if(!specialList.isEmpty()){
|
||||
for(Map.Entry<String, RenderSpecial> entry : specialList.entrySet()){
|
||||
//Does the player have one of the names from the list?
|
||||
if(StringUtil.equalsToLowerCase(entry.getKey(), event.entityPlayer.getCommandSenderName())){
|
||||
if(StringUtil.equalsToLowerCase(entry.getKey(), event.entityPlayer.getName())){
|
||||
//Render the special Item/Block
|
||||
entry.getValue().render(event.entityPlayer);
|
||||
break;
|
||||
|
|
|
@ -58,7 +58,7 @@ public class PacketParticle implements IMessage{
|
|||
int difX = startX-endX;
|
||||
int difY = startY-endY;
|
||||
int difZ = startZ-endZ;
|
||||
double distance = Vec3.createVectorHelper(startX, startY, startZ).distanceTo(Vec3.createVectorHelper(endX, endY, endZ));
|
||||
double distance = new Vec3(startX, startY, startZ).distanceTo(new Vec3(endX, endY, endZ));
|
||||
|
||||
for(int times = 0; times < particleAmount/2; times++){
|
||||
for(double i = 0; i <= 1; i += 1/(distance*particleAmount)){
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.network.gui;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -38,7 +39,7 @@ public class PacketGuiNumber implements IMessage{
|
|||
this.tileX = x;
|
||||
this.tileY = y;
|
||||
this.tileZ = z;
|
||||
this.worldID = world.provider.dimensionId;
|
||||
this.worldID = world.provider.getDimensionId();
|
||||
this.text = text;
|
||||
this.textID = textID;
|
||||
this.playerID = player.getEntityId();
|
||||
|
@ -71,7 +72,7 @@ public class PacketGuiNumber implements IMessage{
|
|||
@Override
|
||||
public IMessage onMessage(PacketGuiNumber message, MessageContext ctx){
|
||||
World world = DimensionManager.getWorld(message.worldID);
|
||||
TileEntity tile = world.getTileEntity(message.tileX, message.tileY, message.tileZ);
|
||||
TileEntity tile = world.getTileEntity(new Position(message.tileX, message.tileY, message.tileZ));
|
||||
|
||||
if(tile instanceof INumberReactor){
|
||||
INumberReactor reactor = (INumberReactor)tile;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.network.gui;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -38,7 +39,7 @@ public class PacketGuiString implements IMessage{
|
|||
this.tileX = x;
|
||||
this.tileY = y;
|
||||
this.tileZ = z;
|
||||
this.worldID = world.provider.dimensionId;
|
||||
this.worldID = world.provider.getDimensionId();
|
||||
this.text = text;
|
||||
this.textID = textID;
|
||||
this.playerID = player.getEntityId();
|
||||
|
@ -82,7 +83,7 @@ public class PacketGuiString implements IMessage{
|
|||
@Override
|
||||
public IMessage onMessage(PacketGuiString message, MessageContext ctx){
|
||||
World world = DimensionManager.getWorld(message.worldID);
|
||||
TileEntity tile = world.getTileEntity(message.tileX, message.tileY, message.tileZ);
|
||||
TileEntity tile = world.getTileEntity(new Position(message.tileX, message.tileY, message.tileZ));
|
||||
|
||||
if(tile instanceof IStringReactor){
|
||||
IStringReactor reactor = (IStringReactor)tile;
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
package de.ellpeck.actuallyadditions.mod.proxy;
|
||||
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.*;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderLaserRelay;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderReconstructorLens;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderSmileyCloud;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderTileEntity;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.model.*;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||
|
@ -25,7 +28,6 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
@ -64,15 +66,6 @@ public class ClientProxy implements IProxy{
|
|||
|
||||
InitEvents.initClient();
|
||||
|
||||
AssetUtil.compostRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
AssetUtil.fishingNetRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
AssetUtil.furnaceSolarRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
AssetUtil.coffeeMachineRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
AssetUtil.phantomBoosterRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
AssetUtil.smileyCloudRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
AssetUtil.laserRelayRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
AssetUtil.bookletStandRenderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
registerRenderer(TileEntityCompost.class, new RenderTileEntity(new ModelCompost()), AssetUtil.compostRenderId);
|
||||
registerRenderer(TileEntityFishingNet.class, new RenderTileEntity(new ModelFishingNet()), AssetUtil.fishingNetRenderId);
|
||||
registerRenderer(TileEntityFurnaceSolar.class, new RenderTileEntity(new ModelFurnaceSolar()), AssetUtil.furnaceSolarRenderId);
|
||||
|
@ -95,6 +88,7 @@ public class ClientProxy implements IProxy{
|
|||
|
||||
private static void registerRenderer(Class<? extends TileEntity> tileClass, RenderTileEntity tileRender, int renderID){
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(tileClass, tileRender);
|
||||
RenderingRegistry.registerBlockHandler(new RenderInventory(tileRender, renderID));
|
||||
//TODO Fix inventory rendering
|
||||
//RenderingRegistry.registerBlockHandler(new RenderInventory(tileRender, renderID));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class CrusherRecipeRegistry{
|
|||
String output = theCase.resultPreString+ore.substring(theCase.theCase.length());
|
||||
|
||||
if(!hasOreRecipe(ore)){
|
||||
if(!OreDictionary.getOres(output, false).isEmpty() && !OreDictionary.getOres(ore, false).isEmpty()){
|
||||
if(!OreDictionary.getOres(output).isEmpty() && !OreDictionary.getOres(ore).isEmpty()){
|
||||
ActuallyAdditionsAPI.addCrusherRecipe(ore, output, theCase.resultAmount);
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -13,16 +13,18 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
|||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||
import de.ellpeck.actuallyadditions.mod.network.VanillaPacketSyncer;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public abstract class TileEntityBase extends TileEntity{
|
||||
public abstract class TileEntityBase extends TileEntity implements ITickable{
|
||||
|
||||
protected int ticksElapsed;
|
||||
public boolean isRedstonePowered;
|
||||
|
@ -89,6 +91,10 @@ public abstract class TileEntityBase extends TileEntity{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
this.updateEntity();
|
||||
}
|
||||
|
||||
public void updateEntity(){
|
||||
this.ticksElapsed++;
|
||||
}
|
||||
|
@ -97,17 +103,17 @@ public abstract class TileEntityBase extends TileEntity{
|
|||
public Packet getDescriptionPacket(){
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
this.writeSyncableNBT(tag, true);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 3, tag);
|
||||
return new S35PacketUpdateTileEntity(this.pos, 3, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){
|
||||
this.readSyncableNBT(pkt.func_148857_g(), true);
|
||||
this.readSyncableNBT(pkt.getNbtCompound(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z){
|
||||
return !(oldBlock.isAssociatedBlock(newBlock));
|
||||
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState){
|
||||
return !(oldState.getBlock().isAssociatedBlock(newState.getBlock()));
|
||||
}
|
||||
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
|
|
|
@ -18,11 +18,6 @@ public class TileEntityBookletStand extends TileEntityBase{
|
|||
public EntrySet assignedEntry = new EntrySet(null);
|
||||
public String assignedPlayer;
|
||||
|
||||
@Override
|
||||
public boolean canUpdate(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
super.writeSyncableNBT(compound, isForSync);
|
||||
|
|
|
@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.items.ItemMisc;
|
|||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public class TileEntityCompost extends TileEntityInventoryBase{
|
||||
|
||||
|
@ -79,7 +80,7 @@ public class TileEntityCompost extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
|
@ -89,7 +90,7 @@ public class TileEntityCompost extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return stack.getItem() instanceof ItemFertilizer;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,10 +75,10 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
|
|||
int meta = coordsBlock.getMetadata(worldObj);
|
||||
drops.addAll(blockToBreak.getDrops(worldObj, coordsBlock, coordsBlock.getBlockState(worldObj), 0));
|
||||
|
||||
if(WorldUtil.addToInventory(this, drops, false)){
|
||||
if(WorldUtil.addToInventory(this, drops, false, true)){
|
||||
worldObj.playAuxSFX(2001, this.getPos(), Block.getIdFromBlock(blockToBreak)+(meta << 12));
|
||||
WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, Position.fromTileEntity(this), i);
|
||||
WorldUtil.addToInventory(this, drops, true);
|
||||
WorldUtil.addToInventory(this, drops, true, true);
|
||||
this.storage.extractEnergy(ENERGY_USE, false);
|
||||
this.markDirty();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ import net.minecraft.entity.passive.EntityAnimal;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -45,7 +47,7 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
|
|||
if(!worldObj.isRemote){
|
||||
boolean theFlag = this.currentTimer > 0;
|
||||
int range = 5;
|
||||
List<EntityAnimal> animals = worldObj.getEntitiesWithinAABB(EntityAnimal.class, AxisAlignedBB.getBoundingBox(this.xCoord-range, this.yCoord-range, this.zCoord-range, this.xCoord+range, this.yCoord+range, this.zCoord+range));
|
||||
List<EntityAnimal> animals = worldObj.getEntitiesWithinAABB(EntityAnimal.class, AxisAlignedBB.fromBounds(this.pos.getX()-range, this.pos.getY()-range, this.pos.getZ()-range, this.pos.getX()+range, this.pos.getY()+range, this.pos.getZ()+range));
|
||||
if(animals != null){
|
||||
this.currentAnimalAmount = animals.size();
|
||||
if(this.currentAnimalAmount >= 2){
|
||||
|
@ -108,17 +110,17 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
public void feedAnimal(EntityAnimal animal){
|
||||
animal.func_146082_f(null);
|
||||
animal.setInLove(null);
|
||||
for(int i = 0; i < 7; i++){
|
||||
double d = Util.RANDOM.nextGaussian()*0.02D;
|
||||
double d1 = Util.RANDOM.nextGaussian()*0.02D;
|
||||
double d2 = Util.RANDOM.nextGaussian()*0.02D;
|
||||
worldObj.spawnParticle("heart", (animal.posX+(double)(Util.RANDOM.nextFloat()*animal.width*2.0F))-animal.width, animal.posY+0.5D+(double)(Util.RANDOM.nextFloat()*animal.height), (animal.posZ+(double)(Util.RANDOM.nextFloat()*animal.width*2.0F))-animal.width, d, d1, d2);
|
||||
worldObj.spawnParticle(EnumParticleTypes.HEART, (animal.posX+(double)(Util.RANDOM.nextFloat()*animal.width*2.0F))-animal.width, animal.posY+0.5D+(double)(Util.RANDOM.nextFloat()*animal.height), (animal.posZ+(double)(Util.RANDOM.nextFloat()*animal.width*2.0F))-animal.width, d, d1, d2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
|
@ -128,7 +130,7 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ import net.minecraft.item.ItemDye;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -61,9 +61,9 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyRece
|
|||
for(int i = 0; i < amount; i++){
|
||||
ItemStack firework = this.makeFirework();
|
||||
|
||||
double x = this.xCoord+MathHelper.getRandomDoubleInRange(Util.RANDOM, 0, range*2)-range;
|
||||
double z = this.zCoord+MathHelper.getRandomDoubleInRange(Util.RANDOM, 0, range*2)-range;
|
||||
EntityFireworkRocket rocket = new EntityFireworkRocket(this.worldObj, x, this.yCoord+0.5, z, firework);
|
||||
double x = this.pos.getX()+MathHelper.getRandomDoubleInRange(Util.RANDOM, 0, range*2)-range;
|
||||
double z = this.pos.getZ()+MathHelper.getRandomDoubleInRange(Util.RANDOM, 0, range*2)-range;
|
||||
EntityFireworkRocket rocket = new EntityFireworkRocket(this.worldObj, x, this.pos.getY()+0.5, z, firework);
|
||||
this.worldObj.spawnEntityInWorld(rocket);
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyRece
|
|||
|
||||
int[] colors = new int[MathHelper.getRandomIntegerInRange(Util.RANDOM, 1, 6)];
|
||||
for(int i = 0; i < colors.length; i++){
|
||||
colors[i] = ItemDye.field_150922_c[Util.RANDOM.nextInt(ItemDye.field_150922_c.length)];
|
||||
colors[i] = ItemDye.dyeColors[Util.RANDOM.nextInt(ItemDye.dyeColors.length)];
|
||||
}
|
||||
compound.setIntArray("Colors", colors);
|
||||
|
||||
|
@ -127,22 +127,22 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyRece
|
|||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate){
|
||||
return this.storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
public int getEnergyStored(EnumFacing from){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
public int getMaxEnergyStored(EnumFacing from){
|
||||
return this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
public boolean canConnectEnergy(EnumFacing from){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -54,37 +54,39 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
private void doWork(){
|
||||
ForgeDirection sideToManipulate = ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
|
||||
Position thisPos = Position.fromTileEntity(this);
|
||||
|
||||
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(thisPos.getMetadata(worldObj));
|
||||
Position coordsBlock = WorldUtil.getCoordsFromSide(sideToManipulate, Position.fromTileEntity(this), 0);
|
||||
|
||||
Position coordsBlock = WorldUtil.getCoordsFromSide(sideToManipulate, xCoord, yCoord, zCoord, 0);
|
||||
if(coordsBlock != null){
|
||||
Block blockToBreak = worldObj.getBlock(coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ());
|
||||
if(!this.isPlacer && blockToBreak != null && worldObj.getBlockMetadata(coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ()) == 0 && FluidContainerRegistry.BUCKET_VOLUME <= this.tank.getCapacity()-this.tank.getFluidAmount()){
|
||||
Block blockToBreak = coordsBlock.getBlock(worldObj);
|
||||
if(!this.isPlacer && blockToBreak != null && coordsBlock.getMetadata(worldObj) == 0 && FluidContainerRegistry.BUCKET_VOLUME <= this.tank.getCapacity()-this.tank.getFluidAmount()){
|
||||
if(blockToBreak instanceof IFluidBlock && ((IFluidBlock)blockToBreak).getFluid() != null){
|
||||
if(this.tank.fill(new FluidStack(((IFluidBlock)blockToBreak).getFluid(), FluidContainerRegistry.BUCKET_VOLUME), false) >= FluidContainerRegistry.BUCKET_VOLUME){
|
||||
this.tank.fill(new FluidStack(((IFluidBlock)blockToBreak).getFluid(), FluidContainerRegistry.BUCKET_VOLUME), true);
|
||||
WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord);
|
||||
WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, thisPos);
|
||||
}
|
||||
}
|
||||
else if(blockToBreak == Blocks.lava || blockToBreak == Blocks.flowing_lava){
|
||||
if(this.tank.fill(new FluidStack(FluidRegistry.LAVA, FluidContainerRegistry.BUCKET_VOLUME), false) >= FluidContainerRegistry.BUCKET_VOLUME){
|
||||
this.tank.fill(new FluidStack(FluidRegistry.LAVA, FluidContainerRegistry.BUCKET_VOLUME), true);
|
||||
WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord);
|
||||
WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, thisPos);
|
||||
}
|
||||
}
|
||||
else if(blockToBreak == Blocks.water || blockToBreak == Blocks.flowing_water){
|
||||
if(this.tank.fill(new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME), false) >= FluidContainerRegistry.BUCKET_VOLUME){
|
||||
this.tank.fill(new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME), true);
|
||||
WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord);
|
||||
WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, thisPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(this.isPlacer && worldObj.getBlock(coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ()).isReplaceable(worldObj, coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ())){
|
||||
else if(this.isPlacer && coordsBlock.getBlock(worldObj).isReplaceable(worldObj, coordsBlock)){
|
||||
if(this.tank.getFluidAmount() >= FluidContainerRegistry.BUCKET_VOLUME){
|
||||
if(this.tank.getFluid().getFluid().getBlock() != null){
|
||||
Block block = worldObj.getBlock(xCoord+sideToManipulate.offsetX, yCoord+sideToManipulate.offsetY, zCoord+sideToManipulate.offsetZ);
|
||||
Block block = coordsBlock.getBlock(worldObj);
|
||||
if(!(block instanceof IFluidBlock) && block != Blocks.lava && block != Blocks.water && block != Blocks.flowing_lava && block != Blocks.flowing_water){
|
||||
WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, new ItemStack(this.tank.getFluid().getFluid().getBlock()));
|
||||
WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, thisPos, new ItemStack(this.tank.getFluid().getFluid().getBlock()));
|
||||
this.tank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +96,7 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill){
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill){
|
||||
if(this.isPlacer){
|
||||
return this.tank.fill(resource, doFill);
|
||||
}
|
||||
|
@ -102,7 +104,7 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain){
|
||||
if(!this.isPlacer){
|
||||
return this.tank.drain(resource.amount, doDrain);
|
||||
}
|
||||
|
@ -110,7 +112,7 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain){
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain){
|
||||
if(!this.isPlacer){
|
||||
return this.tank.drain(maxDrain, doDrain);
|
||||
}
|
||||
|
@ -118,17 +120,17 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid){
|
||||
public boolean canFill(EnumFacing from, Fluid fluid){
|
||||
return this.isPlacer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid){
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid){
|
||||
return !this.isPlacer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from){
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from){
|
||||
return new FluidTankInfo[]{this.tank.getInfo()};
|
||||
}
|
||||
|
||||
|
@ -157,12 +159,12 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
if(!this.isPlacer && this.tank.getFluidAmount() > 0){
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.DOWN, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, Position.fromTileEntity(this), EnumFacing.DOWN, this.tank);
|
||||
if(!this.isRedstonePowered){
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.NORTH, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.EAST, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, Position.fromTileEntity(this), EnumFacing.NORTH, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, Position.fromTileEntity(this), EnumFacing.EAST, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, Position.fromTileEntity(this), EnumFacing.SOUTH, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, Position.fromTileEntity(this), EnumFacing.WEST, this.tank);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +194,7 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
|
@ -210,7 +212,7 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return slot == 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,10 +12,11 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
|||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
import de.ellpeck.actuallyadditions.api.Position;
|
||||
import de.ellpeck.actuallyadditions.api.tile.IEnergyDisplay;
|
||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -26,23 +27,23 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
|
|||
private int oldEnergy;
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){
|
||||
public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate){
|
||||
return this.storage.extractEnergy(maxExtract, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
public int getEnergyStored(EnumFacing from){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
public int getMaxEnergyStored(EnumFacing from){
|
||||
return this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
return from != ForgeDirection.UP;
|
||||
public boolean canConnectEnergy(EnumFacing from){
|
||||
return from != EnumFacing.UP;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,18 +51,14 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
|
|||
super.updateEntity();
|
||||
if(!worldObj.isRemote){
|
||||
if(!this.hasBlockAbove() && worldObj.isDaytime()){
|
||||
if(PRODUCE <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN)){
|
||||
if(PRODUCE <= this.storage.getMaxEnergyStored()-this.storage.getEnergyStored()){
|
||||
this.storage.receiveEnergy(PRODUCE, false);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
if(this.getEnergyStored(ForgeDirection.UNKNOWN) > 0){
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.DOWN, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.NORTH, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.EAST, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, storage);
|
||||
if(this.storage.getEnergyStored() > 0){
|
||||
WorldUtil.pushEnergyToAllSides(worldObj, Position.fromTileEntity(this), this.storage);
|
||||
}
|
||||
|
||||
if(this.oldEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()){
|
||||
|
@ -83,8 +80,10 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
|
|||
}
|
||||
|
||||
public boolean hasBlockAbove(){
|
||||
for(int y = yCoord+1; y <= worldObj.getHeight(); y++){
|
||||
if(!worldObj.getBlock(xCoord, y, zCoord).isAir(worldObj, xCoord, y, zCoord)){
|
||||
Position pos = Position.fromTileEntity(this);
|
||||
for(int y = 1; y <= worldObj.getHeight(); y++){
|
||||
Position offset = pos.getOffsetPosition(0, y, 0);
|
||||
if(!offset.getBlock(worldObj).isAir(worldObj, offset)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
|||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public class TileEntityGiantChest extends TileEntityInventoryBase{
|
||||
|
||||
|
@ -20,12 +21,7 @@ public class TileEntityGiantChest extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canUpdate(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
|
@ -35,7 +31,7 @@ public class TileEntityGiantChest extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,17 +26,17 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
|
|||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
if(!worldObj.isRemote){
|
||||
if(worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) && worldObj.isDaytime()){
|
||||
if(worldObj.canBlockSeeSky(this.getPos()) && worldObj.isDaytime()){
|
||||
if(this.timeUntilNextFert > 0){
|
||||
this.timeUntilNextFert--;
|
||||
if(timeUntilNextFert <= 0){
|
||||
Position blockToFert = this.blockToFertilize();
|
||||
if(blockToFert != null){
|
||||
int metaBefore = blockToFert.getMetadata(worldObj);
|
||||
worldObj.getBlock(blockToFert.getX(), blockToFert.getY(), blockToFert.getZ()).updateTick(worldObj, blockToFert.getX(), blockToFert.getY(), blockToFert.getZ(), Util.RANDOM);
|
||||
blockToFert.getBlock(worldObj).updateTick(worldObj, blockToFert, blockToFert.getBlockState(worldObj), Util.RANDOM);
|
||||
|
||||
if(blockToFert.getMetadata(worldObj) != metaBefore){
|
||||
worldObj.playAuxSFX(2005, blockToFert.getX(), blockToFert.getY(), blockToFert.getZ(), 0);
|
||||
worldObj.playAuxSFX(2005, blockToFert, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,11 +50,12 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
|
|||
}
|
||||
|
||||
public Position blockToFertilize(){
|
||||
for(int i = yCoord-1; i > 0; i--){
|
||||
Block block = worldObj.getBlock(xCoord, i, zCoord);
|
||||
if(block != null && !(worldObj.isAirBlock(xCoord, i, zCoord))){
|
||||
for(int i = -1; i > 0; i--){
|
||||
Position offset = Position.fromBlockPos(pos).getOffsetPosition(0, i, 0);
|
||||
Block block = offset.getBlock(worldObj);
|
||||
if(block != null && !(worldObj.isAirBlock(offset))){
|
||||
if((block instanceof IGrowable || block instanceof IPlantable) && !(block instanceof BlockGrass)){
|
||||
return new Position(xCoord, i, zCoord);
|
||||
return offset;
|
||||
}
|
||||
else{
|
||||
return null;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue