Merge pull request #83 from Ellpeck/1.9

1.9
This commit is contained in:
canitzp 2016-04-01 21:58:22 +02:00
commit d25ca685cd
163 changed files with 1379 additions and 1195 deletions

View file

@ -17,12 +17,12 @@ group = "de.ellpeck.actuallyadditions"
archivesBaseName = "ActuallyAdditions" archivesBaseName = "ActuallyAdditions"
minecraft { minecraft {
version = "1.8.9-11.15.1.1764" version = "1.9-12.16.0.1767-1.9"
runDir = "idea" runDir = "idea"
mappings = "stable_22" mappings = "snapshot_20160312"
makeObfSourceJar = false makeObfSourceJar = false
useDepAts = true //useDepAts = true
replaceIn "ModUtil.java" replaceIn "ModUtil.java"
replace "@VERSION@", project.version.toString() replace "@VERSION@", project.version.toString()
@ -42,7 +42,7 @@ dependencies {
//compile "codechicken:CodeChickenCore:1.8-1.0.5.36:dev" //compile "codechicken:CodeChickenCore:1.8-1.0.5.36:dev"
//compile "codechicken:NotEnoughItems:1.8-1.0.5.104:dev" //compile "codechicken:NotEnoughItems:1.8-1.0.5.104:dev"
deobfCompile "mezz.jei:jei_1.8.9:2.28.6.173" //deobfCompile "mezz.jei:jei_1.8.9:2.28.6.173"
} }
processResources { processResources {

View file

@ -11,8 +11,9 @@
package de.ellpeck.actuallyadditions.api.lens; package de.ellpeck.actuallyadditions.api.lens;
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
/** /**
* This is the base class for a Reconstructor Lens Type (NOT THE ITEM!) * This is the base class for a Reconstructor Lens Type (NOT THE ITEM!)
@ -32,7 +33,7 @@ public abstract class Lens{
* @param tile The tile the lens was invoked from * @param tile The tile the lens was invoked from
* @return If the Reconstructor should stop continuing (return false if you want it to go through blocks) * @return If the Reconstructor should stop continuing (return false if you want it to go through blocks)
*/ */
public abstract boolean invoke(BlockPos hitBlock, IAtomicReconstructor tile); public abstract boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile);
/** /**
* Returns the color in an array of 3 float values that are r, g, b * Returns the color in an array of 3 float values that are r, g, b
@ -40,12 +41,12 @@ public abstract class Lens{
public abstract float[] getColor(); public abstract float[] getColor();
/** /**
* Gets the maximum distance the beam goes with this lense * Gets the maximum distance the beam goes with this lens
*/ */
public abstract int getDistance(); public abstract int getDistance();
/** /**
* Sets the item corresponding to the lense * Sets the item corresponding to the lens
*/ */
public void setLensItem(Item item){ public void setLensItem(Item item){
this.lensItem = item; this.lensItem = item;

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.api.recipe.coffee;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import java.util.ArrayList; import java.util.ArrayList;
@ -49,7 +50,7 @@ public class CoffeeBrewing{
PotionEffect[] effectsStack = getEffectsFromStack(stack); PotionEffect[] effectsStack = getEffectsFromStack(stack);
if(effectsStack != null && effectsStack.length > 0){ if(effectsStack != null && effectsStack.length > 0){
for(PotionEffect effectStack : effectsStack){ for(PotionEffect effectStack : effectsStack){
if(effect.getPotionID() == effectStack.getPotionID()){ if(effect.getPotion() == effectStack.getPotion()){
return effectStack; return effectStack;
} }
} }
@ -61,8 +62,8 @@ public class CoffeeBrewing{
PotionEffect[] effects = getEffectsFromStack(stack); PotionEffect[] effects = getEffectsFromStack(stack);
stack.setTagCompound(new NBTTagCompound()); stack.setTagCompound(new NBTTagCompound());
for(int i = 0; i < effects.length; i++){ for(int i = 0; i < effects.length; i++){
if(effects[i].getPotionID() == effect.getPotionID()){ if(effects[i].getPotion() == effect.getPotion()){
effects[i] = new PotionEffect(effects[i].getPotionID(), effects[i].getDuration()+(addDur ? effect.getDuration() : 0), effects[i].getAmplifier()+(addAmp ? (effect.getAmplifier() > 0 ? effect.getAmplifier() : 1) : 0)); effects[i] = new PotionEffect(effects[i].getPotion(), effects[i].getDuration()+(addDur ? effect.getDuration() : 0), effects[i].getAmplifier()+(addAmp ? (effect.getAmplifier() > 0 ? effect.getAmplifier() : 1) : 0));
} }
addEffectToStack(stack, effects[i]); addEffectToStack(stack, effects[i]);
} }
@ -76,7 +77,7 @@ public class CoffeeBrewing{
int prevCounter = tag.getInteger("Counter"); int prevCounter = tag.getInteger("Counter");
NBTTagCompound compound = new NBTTagCompound(); NBTTagCompound compound = new NBTTagCompound();
compound.setInteger("ID", effect.getPotionID()); compound.setInteger("ID", Potion.getIdFromPotion(effect.getPotion()));
compound.setInteger("Duration", effect.getDuration()); compound.setInteger("Duration", effect.getDuration());
compound.setInteger("Amplifier", effect.getAmplifier()); compound.setInteger("Amplifier", effect.getAmplifier());
@ -94,10 +95,8 @@ public class CoffeeBrewing{
int counter = tag.getInteger("Counter"); int counter = tag.getInteger("Counter");
while(counter > 0){ while(counter > 0){
NBTTagCompound compound = (NBTTagCompound)tag.getTag(counter+""); NBTTagCompound compound = (NBTTagCompound)tag.getTag(counter+"");
PotionEffect effect = new PotionEffect(compound.getInteger("ID"), compound.getInteger("Duration"), compound.getByte("Amplifier")); PotionEffect effect = new PotionEffect(Potion.getPotionById(compound.getInteger("ID")), compound.getInteger("Duration"), compound.getByte("Amplifier"));
if(effect.getPotionID() > 0){
effects.add(effect); effects.add(effect);
}
counter--; counter--;
} }
} }

View file

@ -10,7 +10,7 @@
package de.ellpeck.actuallyadditions.api.tile; package de.ellpeck.actuallyadditions.api.tile;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
/** /**
* Extending this will cause a TileEntity to be able to be connected via a Phantom Connector * Extending this will cause a TileEntity to be able to be connected via a Phantom Connector

View file

@ -121,11 +121,8 @@ public class ActuallyAdditions{
Util.registerDispenserHandler(InitItems.itemBucketCanolaOil, new DispenserHandlerEmptyBucket()); Util.registerDispenserHandler(InitItems.itemBucketCanolaOil, new DispenserHandlerEmptyBucket());
Util.registerDispenserHandler(Items.bucket, new DispenserHandlerFillBucket()); Util.registerDispenserHandler(Items.bucket, new DispenserHandlerFillBucket());
Util.registerDispenserHandler(InitItems.itemFertilizer, new DispenserHandlerFertilize()); Util.registerDispenserHandler(InitItems.itemFertilizer, new DispenserHandlerFertilize());
}
@EventHandler WorldData.init(event.getServer());
public void serverStarted(FMLServerStartedEvent event){
WorldData.init();
} }
@EventHandler @EventHandler

View file

@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
import de.ellpeck.actuallyadditions.mod.util.*; import de.ellpeck.actuallyadditions.mod.util.*;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase; import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -28,10 +29,11 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler; import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -49,23 +51,22 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(10F); this.setHardness(10F);
this.setResistance(80F); this.setResistance(80F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
public boolean isOpaqueCube(){ public boolean isOpaqueCube(IBlockState state){
return false; return false;
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing par6, float par7, float par8, float par9){
if(this.tryToggleRedstone(world, pos, player)){ if(this.tryToggleRedstone(world, pos, player)){
return true; return true;
} }
if(!world.isRemote){ if(!world.isRemote){
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor)world.getTileEntity(pos); TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor)world.getTileEntity(pos);
if(reconstructor != null){ if(reconstructor != null){
ItemStack heldItem = player.getCurrentEquippedItem();
if(heldItem != null){ if(heldItem != null){
if(heldItem.getItem() instanceof ILensItem && reconstructor.getStackInSlot(0) == null){ if(heldItem.getItem() instanceof ILensItem && reconstructor.getStackInSlot(0) == null){
ItemStack toPut = heldItem.copy(); ItemStack toPut = heldItem.copy();
@ -98,7 +99,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(tile instanceof TileEntityAtomicReconstructor){ if(tile instanceof TileEntityAtomicReconstructor){
ItemStack slot = ((TileEntityAtomicReconstructor)tile).getStackInSlot(0); ItemStack slot = ((TileEntityAtomicReconstructor)tile).getStackInSlot(0);
@ -111,7 +112,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
AssetUtil.renderStackToGui(slot, resolution.getScaledWidth()/2+15, resolution.getScaledHeight()/2-29, 1F); AssetUtil.renderStackToGui(slot, resolution.getScaledWidth()/2+15, resolution.getScaledHeight()/2-29, 1F);
} }
minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE); minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE);
} }
} }
@ -127,7 +128,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal(); int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
PosUtil.setMetadata(pos, world, rotation, 2); PosUtil.setMetadata(pos, world, rotation, 2);
super.onBlockPlacedBy(world, pos, state, player, stack); super.onBlockPlacedBy(world, pos, state, player, stack);

View file

@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.BlockPistonBase; import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -25,8 +26,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockBreaker extends BlockContainerBase{ public class BlockBreaker extends BlockContainerBase{
@ -40,7 +42,7 @@ public class BlockBreaker extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
@ -49,7 +51,7 @@ public class BlockBreaker extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(this.tryToggleRedstone(world, pos, player)){ if(this.tryToggleRedstone(world, pos, player)){
return true; return true;
} }
@ -70,7 +72,7 @@ public class BlockBreaker extends BlockContainerBase{
@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal(); int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
PosUtil.setMetadata(pos, world, rotation, 2); PosUtil.setMetadata(pos, world, rotation, 2);
super.onBlockPlacedBy(world, pos, state, player, stack); super.onBlockPlacedBy(world, pos, state, player, stack);

View file

@ -14,14 +14,16 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockCanolaPress extends BlockContainerBase{ public class BlockCanolaPress extends BlockContainerBase{
@ -31,7 +33,7 @@ public class BlockCanolaPress extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
@ -40,7 +42,7 @@ public class BlockCanolaPress extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityCanolaPress press = (TileEntityCanolaPress)world.getTileEntity(pos); TileEntityCanolaPress press = (TileEntityCanolaPress)world.getTileEntity(pos);
if(press != null){ if(press != null){

View file

@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy; import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -24,9 +25,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -42,7 +44,7 @@ public class BlockCoalGenerator extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@ -53,7 +55,7 @@ public class BlockCoalGenerator extends BlockContainerBase{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){ public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
int meta = PosUtil.getMetadata(state); int meta = PosUtil.getMetadata(state);
if(meta == 1){ if(meta == 1){
@ -64,7 +66,7 @@ public class BlockCoalGenerator extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityCoalGenerator press = (TileEntityCoalGenerator)world.getTileEntity(pos); TileEntityCoalGenerator press = (TileEntityCoalGenerator)world.getTileEntity(pos);
if(press != null){ if(press != null){

View file

@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -23,11 +24,13 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper; import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
//TODO Fix bounding box
public class BlockCoffeeMachine extends BlockContainerBase{ public class BlockCoffeeMachine extends BlockContainerBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3); private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3);
@ -37,24 +40,21 @@ public class BlockCoffeeMachine extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
float f = 1/16F;
this.setBlockBounds(f, 0F, f, 1F-f, 1F-2*f, 1F-f);
} }
@Override @Override
public boolean isFullCube(){ public boolean isFullCube(IBlockState state){
return false; return false;
} }
@Override @Override
public boolean isOpaqueCube(){ public boolean isOpaqueCube(IBlockState state){
return false; return false;
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing f6, float f7, float f8, float f9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing f6, float f7, float f8, float f9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine)world.getTileEntity(pos); TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine)world.getTileEntity(pos);
if(machine != null){ if(machine != null){

View file

@ -27,9 +27,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -64,7 +65,7 @@ public class BlockColoredLamp extends BlockBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ){
//Turning On //Turning On
if(player.isSneaking()){ if(player.isSneaking()){
if(!world.isRemote){ if(!world.isRemote){
@ -73,7 +74,6 @@ public class BlockColoredLamp extends BlockBase{
return true; return true;
} }
ItemStack stack = player.getCurrentEquippedItem();
if(stack != null){ if(stack != null){
//Changing Colors //Changing Colors
int[] oreIDs = OreDictionary.getOreIDs(stack); int[] oreIDs = OreDictionary.getOreIDs(stack);
@ -104,12 +104,6 @@ public class BlockColoredLamp extends BlockBase{
return new ItemStack(InitBlocks.blockColoredLamp, 1, this.getMetaFromState(state)); return new ItemStack(InitBlocks.blockColoredLamp, 1, this.getMetaFromState(state));
} }
@Override
@SideOnly(Side.CLIENT)
public Item getItem(World world, BlockPos pos){
return Item.getItemFromBlock(InitBlocks.blockColoredLamp);
}
@SuppressWarnings("all") @SuppressWarnings("all")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list){ public void getSubBlocks(Item item, CreativeTabs tab, List list){
@ -119,7 +113,7 @@ public class BlockColoredLamp extends BlockBase{
} }
@Override @Override
public int getLightValue(IBlockAccess world, BlockPos pos){ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
return this.isOn ? 15 : 0; return this.isOn ? 15 : 0;
} }

View file

@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -28,12 +29,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler; import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
public class BlockCompost extends BlockContainerBase implements IHudDisplay{ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
public BlockCompost(String name){ public BlockCompost(String name){
@ -41,11 +43,17 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
this.setHarvestLevel("axe", 0); this.setHarvestLevel("axe", 0);
this.setHardness(0.5F); this.setHardness(0.5F);
this.setResistance(5.0F); this.setResistance(5.0F);
this.setStepSound(soundTypeWood); this.setStepSound(SoundType.WOOD);
this.setBlockBoundsForItemRender(); //this.setBlockBoundsForItemRender();
} }
//TODO Fix bounding box
/*@Override
public void setBlockBoundsForItemRender(){
float f = 1.0F/16.0F;
this.setBlockBounds(f, 0.0F, f, 1.0F-f, 11*f, 1.0F-f);
}
@Override @Override
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity){ public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity){
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.3125F, 1.0F); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.3125F, 1.0F);
@ -60,22 +68,21 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
this.setBlockBounds(0.0F, 0.0F, 1.0F-f, 1.0F, y, 1.0F); this.setBlockBounds(0.0F, 0.0F, 1.0F-f, 1.0F, y, 1.0F);
super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity); super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity);
this.setBlockBoundsForItemRender(); this.setBlockBoundsForItemRender();
} }*/
@Override @Override
public boolean isOpaqueCube(){ public boolean isOpaqueCube(IBlockState state){
return false; return false;
} }
@Override @Override
public boolean isFullCube(){ public boolean isFullCube(IBlockState state){
return false; return false;
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing f6, float f7, float f8, float f9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stackPlayer, EnumFacing f6, float f7, float f8, float f9){
if(!world.isRemote){ if(!world.isRemote){
ItemStack stackPlayer = player.getCurrentEquippedItem();
TileEntityCompost tile = (TileEntityCompost)world.getTileEntity(pos); TileEntityCompost tile = (TileEntityCompost)world.getTileEntity(pos);
//Add items to be composted //Add items to be composted
if(stackPlayer != null && stackPlayer.getItem() instanceof ItemMisc && stackPlayer.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal() && (tile.slots[0] == null || (!(tile.slots[0].getItem() instanceof ItemFertilizer) && tile.slots[0].stackSize < TileEntityCompost.AMOUNT))){ if(stackPlayer != null && stackPlayer.getItem() instanceof ItemMisc && stackPlayer.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal() && (tile.slots[0] == null || (!(tile.slots[0].getItem() instanceof ItemFertilizer) && tile.slots[0].stackSize < TileEntityCompost.AMOUNT))){
@ -97,7 +104,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
player.inventory.setInventorySlotContents(player.inventory.currentItem, tile.slots[0].copy()); player.inventory.setInventorySlotContents(player.inventory.currentItem, tile.slots[0].copy());
} }
else{ else{
player.getCurrentEquippedItem().stackSize += tile.slots[0].stackSize; player.getActiveItemStack().stackSize += tile.slots[0].stackSize;
} }
tile.slots[0] = null; tile.slots[0] = null;
tile.markDirty(); tile.markDirty();
@ -106,12 +113,6 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
return true; return true;
} }
@Override
public void setBlockBoundsForItemRender(){
float f = 1.0F/16.0F;
this.setBlockBounds(f, 0.0F, f, 1.0F-f, 11*f, 1.0F-f);
}
@Override @Override
public TileEntity createNewTileEntity(World world, int meta){ public TileEntity createNewTileEntity(World world, int meta){
return new TileEntityCompost(); return new TileEntityCompost();
@ -130,7 +131,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(tile instanceof TileEntityCompost){ if(tile instanceof TileEntityCompost){
ItemStack slot = ((TileEntityCompost)tile).getStackInSlot(0); ItemStack slot = ((TileEntityCompost)tile).getStackInSlot(0);
@ -143,7 +144,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
AssetUtil.renderStackToGui(slot, resolution.getScaledWidth()/2+15, resolution.getScaledHeight()/2-29, 1F); AssetUtil.renderStackToGui(slot, resolution.getScaledWidth()/2+15, resolution.getScaledHeight()/2-29, 1F);
} }
minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE); minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE);
} }
} }
} }

View file

@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.BlockPistonBase; import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -25,8 +26,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockDirectionalBreaker extends BlockContainerBase{ public class BlockDirectionalBreaker extends BlockContainerBase{
@ -38,7 +40,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
@ -47,7 +49,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(this.tryToggleRedstone(world, pos, player)){ if(this.tryToggleRedstone(world, pos, player)){
return true; return true;
} }
@ -68,7 +70,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase{
@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal(); int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
PosUtil.setMetadata(pos, world, rotation, 2); PosUtil.setMetadata(pos, world, rotation, 2);
super.onBlockPlacedBy(world, pos, state, player, stack); super.onBlockPlacedBy(world, pos, state, player, stack);

View file

@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.BlockPistonBase; import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -24,8 +25,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockDropper extends BlockContainerBase{ public class BlockDropper extends BlockContainerBase{
@ -37,7 +39,7 @@ public class BlockDropper extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
@ -46,7 +48,7 @@ public class BlockDropper extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(this.tryToggleRedstone(world, pos, player)){ if(this.tryToggleRedstone(world, pos, player)){
return true; return true;
} }
@ -67,7 +69,7 @@ public class BlockDropper extends BlockContainerBase{
@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal(); int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
PosUtil.setMetadata(pos, world, rotation, 2); PosUtil.setMetadata(pos, world, rotation, 2);
super.onBlockPlacedBy(world, pos, state, player, stack); super.onBlockPlacedBy(world, pos, state, player, stack);

View file

@ -15,14 +15,16 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockEnergizer extends BlockContainerBase{ public class BlockEnergizer extends BlockContainerBase{
@ -35,7 +37,7 @@ public class BlockEnergizer extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(2.0F); this.setHardness(2.0F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
@ -44,7 +46,7 @@ public class BlockEnergizer extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
if(this.isEnergizer){ if(this.isEnergizer){
TileEntityEnergizer energizer = (TileEntityEnergizer)world.getTileEntity(pos); TileEntityEnergizer energizer = (TileEntityEnergizer)world.getTileEntity(pos);

View file

@ -14,14 +14,16 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFeeder extends BlockContainerBase{ public class BlockFeeder extends BlockContainerBase{
@ -31,7 +33,7 @@ public class BlockFeeder extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(0.5F); this.setHardness(0.5F);
this.setResistance(6.0F); this.setResistance(6.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
@ -40,7 +42,7 @@ public class BlockFeeder extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityFeeder feeder = (TileEntityFeeder)world.getTileEntity(pos); TileEntityFeeder feeder = (TileEntityFeeder)world.getTileEntity(pos);
if(feeder != null){ if(feeder != null){

View file

@ -14,14 +14,16 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFermentingBarrel extends BlockContainerBase{ public class BlockFermentingBarrel extends BlockContainerBase{
@ -31,7 +33,7 @@ public class BlockFermentingBarrel extends BlockContainerBase{
this.setHarvestLevel("axe", 0); this.setHarvestLevel("axe", 0);
this.setHardness(0.5F); this.setHardness(0.5F);
this.setResistance(5.0F); this.setResistance(5.0F);
this.setStepSound(soundTypeWood); this.setStepSound(SoundType.WOOD);
} }
@Override @Override
@ -46,7 +48,7 @@ public class BlockFermentingBarrel extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel)world.getTileEntity(pos); TileEntityFermentingBarrel press = (TileEntityFermentingBarrel)world.getTileEntity(pos);
if(press != null){ if(press != null){

View file

@ -13,14 +13,16 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFireworkBox extends BlockContainerBase{ public class BlockFireworkBox extends BlockContainerBase{
@ -30,7 +32,7 @@ public class BlockFireworkBox extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
@ -39,7 +41,7 @@ public class BlockFireworkBox extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
return this.tryToggleRedstone(world, pos, player); return this.tryToggleRedstone(world, pos, player);
} }

View file

@ -12,7 +12,9 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFishingNet; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFishingNet;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -25,8 +27,9 @@ public class BlockFishingNet extends BlockContainerBase{
this.setHarvestLevel("axe", 0); this.setHarvestLevel("axe", 0);
this.setHardness(0.5F); this.setHardness(0.5F);
this.setResistance(3.0F); this.setResistance(3.0F);
this.setStepSound(soundTypeWood); this.setStepSound(SoundType.WOOD);
this.setBlockBounds(0F, 0F, 0F, 1F, 1F/16F, 1F); //TODO Fix block bounds
//this.setBlockBounds(0F, 0F, 0F, 1F, 1F/16F, 1F);
} }
@Override @Override
@ -35,12 +38,12 @@ public class BlockFishingNet extends BlockContainerBase{
} }
@Override @Override
public boolean isFullCube(){ public boolean isFullCube(IBlockState state){
return false; return false;
} }
@Override @Override
public boolean isOpaqueCube(){ public boolean isOpaqueCube(IBlockState state){
return false; return false;
} }

View file

@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.BlockPistonBase; import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -25,8 +26,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFluidCollector extends BlockContainerBase{ public class BlockFluidCollector extends BlockContainerBase{
@ -41,7 +43,7 @@ public class BlockFluidCollector extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
@ -50,7 +52,7 @@ public class BlockFluidCollector extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(this.tryToggleRedstone(world, pos, player)){ if(this.tryToggleRedstone(world, pos, player)){
return true; return true;
} }
@ -71,7 +73,7 @@ public class BlockFluidCollector extends BlockContainerBase{
@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal(); int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
PosUtil.setMetadata(pos, world, rotation, 2); PosUtil.setMetadata(pos, world, rotation, 2);
super.onBlockPlacedBy(world, pos, state, player, stack); super.onBlockPlacedBy(world, pos, state, player, stack);

View file

@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy; import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -24,10 +25,11 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -44,7 +46,7 @@ public class BlockFurnaceDouble extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@ -55,7 +57,7 @@ public class BlockFurnaceDouble extends BlockContainerBase{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){ public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
int meta = PosUtil.getMetadata(state); int meta = PosUtil.getMetadata(state);
if(meta > 3){ if(meta > 3){
@ -89,7 +91,7 @@ public class BlockFurnaceDouble extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble)world.getTileEntity(pos); TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble)world.getTileEntity(pos);
if(furnace != null){ if(furnace != null){
@ -101,8 +103,8 @@ public class BlockFurnaceDouble extends BlockContainerBase{
} }
@Override @Override
public int getLightValue(IBlockAccess world, BlockPos pos){ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
return PosUtil.getMetadata(pos, world) > 3 ? 12 : 0; return PosUtil.getMetadata(state) > 3 ? 12 : 0;
} }
@Override @Override

View file

@ -12,7 +12,9 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceSolar; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceSolar;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -25,8 +27,10 @@ public class BlockFurnaceSolar extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
this.setBlockBounds(0F, 0F, 0F, 1F, 6F/16F, 1F);
//TODO Block bounds
//this.setBlockBounds(0F, 0F, 0F, 1F, 6F/16F, 1F);
} }
@Override @Override
@ -35,12 +39,12 @@ public class BlockFurnaceSolar extends BlockContainerBase{
} }
@Override @Override
public boolean isFullCube(){ public boolean isFullCube(IBlockState state){
return false; return false;
} }
@Override @Override
public boolean isOpaqueCube(){ public boolean isOpaqueCube(IBlockState state){
return false; return false;
} }

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.blocks; package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -22,7 +23,7 @@ public class BlockGeneric extends BlockBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override

View file

@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
@ -25,8 +26,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -39,7 +41,7 @@ public class BlockGiantChest extends BlockContainerBase{
this.setHarvestLevel("axe", 0); this.setHarvestLevel("axe", 0);
this.setHardness(0.5F); this.setHardness(0.5F);
this.setResistance(15.0F); this.setResistance(15.0F);
this.setStepSound(soundTypeWood); this.setStepSound(SoundType.WOOD);
} }
@Override @Override
@ -48,7 +50,7 @@ public class BlockGiantChest extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityGiantChest chest = (TileEntityGiantChest)world.getTileEntity(pos); TileEntityGiantChest chest = (TileEntityGiantChest)world.getTileEntity(pos);
if(chest != null){ if(chest != null){

View file

@ -13,14 +13,15 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGreenhouseGlass; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGreenhouseGlass;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -33,32 +34,31 @@ public class BlockGreenhouseGlass extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(0.5F); this.setHardness(0.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
public boolean isFullCube(){ public boolean isFullCube(IBlockState state){
return false; return false;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){ public boolean shouldSideBeRendered(IBlockState state, IBlockAccess worldIn, BlockPos pos, EnumFacing side){
IBlockState state = worldIn.getBlockState(pos);
Block block = state.getBlock(); Block block = state.getBlock();
return worldIn.getBlockState(pos.offset(side.getOpposite())) != state || block != this && block != this && super.shouldSideBeRendered(worldIn, pos, side); return worldIn.getBlockState(pos.offset(side.getOpposite())) != state || block != this && block != this && super.shouldSideBeRendered(state, worldIn, pos, side);
} }
@Override @Override
public boolean isOpaqueCube(){ public boolean isOpaqueCube(IBlockState state){
return false; return false;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public EnumWorldBlockLayer getBlockLayer(){ public BlockRenderLayer getBlockLayer(){
return EnumWorldBlockLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@Override @Override

View file

@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy; import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -23,9 +24,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -44,7 +46,7 @@ public class BlockGrinder extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@ -55,7 +57,7 @@ public class BlockGrinder extends BlockContainerBase{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){ public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
int meta = PosUtil.getMetadata(state); int meta = PosUtil.getMetadata(state);
if(meta == 1){ if(meta == 1){
@ -69,7 +71,7 @@ public class BlockGrinder extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityGrinder grinder = (TileEntityGrinder)world.getTileEntity(pos); TileEntityGrinder grinder = (TileEntityGrinder)world.getTileEntity(pos);
if(grinder != null){ if(grinder != null){
@ -81,7 +83,7 @@ public class BlockGrinder extends BlockContainerBase{
} }
@Override @Override
public int getLightValue(IBlockAccess world, BlockPos pos){ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0; return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0;
} }

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityHeatCollector; import de.ellpeck.actuallyadditions.mod.tile.TileEntityHeatCollector;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -25,7 +26,7 @@ public class BlockHeatCollector extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(2.5F); this.setHardness(2.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override

View file

@ -21,14 +21,16 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockInputter extends BlockContainerBase{ public class BlockInputter extends BlockContainerBase{
@ -42,7 +44,7 @@ public class BlockInputter extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
this.setTickRandomly(true); this.setTickRandomly(true);
this.isAdvanced = isAdvanced; this.isAdvanced = isAdvanced;
} }
@ -53,7 +55,7 @@ public class BlockInputter extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityInputter inputter = (TileEntityInputter)world.getTileEntity(pos); TileEntityInputter inputter = (TileEntityInputter)world.getTileEntity(pos);
if(inputter != null){ if(inputter != null){

View file

@ -16,14 +16,16 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemRepairer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemRepairer;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -34,7 +36,7 @@ public class BlockItemRepairer extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(20.0F); this.setHardness(20.0F);
this.setResistance(15.0F); this.setResistance(15.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@ -44,7 +46,7 @@ public class BlockItemRepairer extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityItemRepairer repairer = (TileEntityItemRepairer)world.getTileEntity(pos); TileEntityItemRepairer repairer = (TileEntityItemRepairer)world.getTileEntity(pos);
if(repairer != null){ if(repairer != null){
@ -56,7 +58,7 @@ public class BlockItemRepairer extends BlockContainerBase{
} }
@Override @Override
public int getLightValue(IBlockAccess world, BlockPos pos){ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){
return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0; return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0;
} }

View file

@ -16,13 +16,14 @@ import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase; import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockLampPowerer extends BlockBase{ public class BlockLampPowerer extends BlockBase{
@ -34,7 +35,7 @@ public class BlockLampPowerer extends BlockBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
@ -49,7 +50,7 @@ public class BlockLampPowerer extends BlockBase{
@Override @Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){
int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal(); int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal();
PosUtil.setMetadata(pos, world, rotation, 2); PosUtil.setMetadata(pos, world, rotation, 2);
super.onBlockPlacedBy(world, pos, state, player, stack); super.onBlockPlacedBy(world, pos, state, player, stack);

View file

@ -13,22 +13,19 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.List; //TODO Fix bounding box
public class BlockLaserRelay extends BlockContainerBase{ public class BlockLaserRelay extends BlockContainerBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5); private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);
@ -38,22 +35,16 @@ public class BlockLaserRelay extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
public boolean isFullCube(){ public boolean isFullCube(IBlockState state){
return false; return false;
} }
@Override @Override
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){ public boolean isOpaqueCube(IBlockState state){
this.setBlockBoundsBasedOnState(world, pos);
super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
}
@Override
public boolean isOpaqueCube(){
return false; return false;
} }
@ -62,31 +53,6 @@ public class BlockLaserRelay extends BlockContainerBase{
return this.getStateFromMeta(side.ordinal()); return this.getStateFromMeta(side.ordinal());
} }
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){
int meta = PosUtil.getMetadata(pos, world);
float pixel = 1F/16F;
if(meta == 0){
this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F-3*pixel, 1F, 1F-3*pixel);
}
else if(meta == 1){
this.setBlockBounds(3*pixel, 0F, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel);
}
else if(meta == 2){
this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F);
}
else if(meta == 3){
this.setBlockBounds(3*pixel, 3*pixel, 0F, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel);
}
else if(meta == 4){
this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F, 1F-3*pixel, 1F-3*pixel);
}
else if(meta == 5){
this.setBlockBounds(0F, 3*pixel, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel);
}
}
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return EnumRarity.EPIC; return EnumRarity.EPIC;

View file

@ -14,6 +14,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLavaFactoryController; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLavaFactoryController;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.ScaledResolution;
@ -22,7 +23,7 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler; import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -34,7 +35,7 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IH
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(4.5F); this.setHardness(4.5F);
this.setResistance(20.0F); this.setResistance(20.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
@ -49,7 +50,7 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IH
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){
TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController)minecraft.theWorld.getTileEntity(posHit.getBlockPos()); TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController)minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(factory != null){ if(factory != null){
int state = factory.isMultiblock(); int state = factory.isMultiblock();

View file

@ -12,12 +12,13 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLeafGenerator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLeafGenerator;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockLeafGenerator extends BlockContainerBase{ public class BlockLeafGenerator extends BlockContainerBase{
@ -27,7 +28,7 @@ public class BlockLeafGenerator extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(5.0F); this.setHardness(5.0F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeMetal); this.setStepSound(SoundType.METAL);
} }
@Override @Override

View file

@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner; import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -25,9 +26,10 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler; import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -39,16 +41,16 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(8F); this.setHardness(8F);
this.setResistance(30F); this.setResistance(30F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
public boolean isOpaqueCube(){ public boolean isOpaqueCube(IBlockState state){
return false; return false;
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
TileEntity tile = world.getTileEntity(pos); TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileEntityMiner){ if(tile instanceof TileEntityMiner){
@ -76,7 +78,7 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(tile instanceof TileEntityMiner){ if(tile instanceof TileEntityMiner){
String info = ((TileEntityMiner)tile).layerAt <= 0 ? "Done Mining!" : "Mining at Y = "+((TileEntityMiner)tile).layerAt+"."; String info = ((TileEntityMiner)tile).layerAt <= 0 ? "Done Mining!" : "Mining at Y = "+((TileEntityMiner)tile).layerAt+".";

View file

@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy; import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator; import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -24,9 +25,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -42,7 +44,7 @@ public class BlockOilGenerator extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@ -53,7 +55,7 @@ public class BlockOilGenerator extends BlockContainerBase{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){ public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
if(PosUtil.getMetadata(state) == 1){ if(PosUtil.getMetadata(state) == 1){
for(int i = 0; i < 5; i++){ for(int i = 0; i < 5; i++){
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); 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);
@ -62,7 +64,7 @@ public class BlockOilGenerator extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityOilGenerator generator = (TileEntityOilGenerator)world.getTileEntity(pos); TileEntityOilGenerator generator = (TileEntityOilGenerator)world.getTileEntity(pos);
if(generator != null){ if(generator != null){

View file

@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.tile.*;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -28,6 +29,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler; import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -43,7 +48,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(4.5F); this.setHardness(4.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
if(type == Type.FACE || type == Type.LIQUIFACE || type == Type.ENERGYFACE){ if(type == Type.FACE || type == Type.LIQUIFACE || type == Type.ENERGYFACE){
this.range = TileEntityPhantomface.RANGE; this.range = TileEntityPhantomface.RANGE;
@ -78,7 +83,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ){
if(this.tryToggleRedstone(world, pos, player)){ if(this.tryToggleRedstone(world, pos, player)){
return true; return true;
} }
@ -98,27 +103,27 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
if(tile != null){ if(tile != null){
if(tile instanceof IPhantomTile){ if(tile instanceof IPhantomTile){
IPhantomTile phantom = (IPhantomTile)tile; IPhantomTile phantom = (IPhantomTile)tile;
minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.GOLD+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc")+": "+phantom.getRange(), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-40, StringUtil.DECIMAL_COLOR_WHITE); minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.GOLD+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc")+": "+phantom.getRange(), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-40, StringUtil.DECIMAL_COLOR_WHITE);
if(phantom.hasBoundPosition()){ if(phantom.hasBoundPosition()){
int distance = (int)new Vec3(posHit.getBlockPos()).distanceTo(new Vec3(phantom.getBoundPosition())); int distance = (int)new Vec3d(posHit.getBlockPos()).distanceTo(new Vec3d(phantom.getBoundPosition()));
Item item = PosUtil.getItemBlock(phantom.getBoundPosition(), minecraft.theWorld); Item item = PosUtil.getItemBlock(phantom.getBoundPosition(), minecraft.theWorld);
String name = item == null ? "Absolutely Nothing" : item.getItemStackDisplayName(new ItemStack(PosUtil.getBlock(phantom.getBoundPosition(), minecraft.theWorld), 1, PosUtil.getMetadata(phantom.getBoundPosition(), minecraft.theWorld))); String name = item == null ? "Absolutely Nothing" : item.getItemStackDisplayName(new ItemStack(PosUtil.getBlock(phantom.getBoundPosition(), minecraft.theWorld), 1, PosUtil.getMetadata(phantom.getBoundPosition(), minecraft.theWorld)));
StringUtil.drawSplitString(minecraft.fontRendererObj, StringUtil.localizeFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-30, 200, StringUtil.DECIMAL_COLOR_WHITE, true); StringUtil.drawSplitString(minecraft.fontRendererObj, StringUtil.localizeFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-30, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
if(phantom.isBoundThingInRange()){ if(phantom.isBoundThingInRange()){
StringUtil.drawSplitString(minecraft.fontRendererObj, EnumChatFormatting.DARK_GREEN+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true); StringUtil.drawSplitString(minecraft.fontRendererObj, TextFormatting.DARK_GREEN+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
} }
else{ else{
StringUtil.drawSplitString(minecraft.fontRendererObj, EnumChatFormatting.DARK_RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true); StringUtil.drawSplitString(minecraft.fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true);
} }
} }
else{ else{
minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, StringUtil.DECIMAL_COLOR_WHITE); minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, StringUtil.DECIMAL_COLOR_WHITE);
} }
} }
} }

View file

@ -12,7 +12,9 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBooster; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBooster;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -25,19 +27,20 @@ public class BlockPhantomBooster extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
float f = 1F/16F; //TODO Fix block bounds
this.setBlockBounds(2*f, 0F, 2*f, 1-2*f, 1F, 1-2*f); //float f = 1F/16F;
//this.setBlockBounds(2*f, 0F, 2*f, 1-2*f, 1F, 1-2*f);
} }
@Override @Override
public boolean isFullCube(){ public boolean isFullCube(IBlockState state){
return false; return false;
} }
@Override @Override
public boolean isOpaqueCube(){ public boolean isOpaqueCube(IBlockState state){
return false; return false;
} }

View file

@ -14,14 +14,16 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector; import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockRangedCollector extends BlockContainerBase{ public class BlockRangedCollector extends BlockContainerBase{
@ -31,7 +33,7 @@ public class BlockRangedCollector extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
@ -40,7 +42,7 @@ public class BlockRangedCollector extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityRangedCollector breaker = (TileEntityRangedCollector)world.getTileEntity(pos); TileEntityRangedCollector breaker = (TileEntityRangedCollector)world.getTileEntity(pos);
if(breaker != null){ if(breaker != null){

View file

@ -21,9 +21,11 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumActionResult;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -40,35 +42,19 @@ public class BlockSlabs extends BlockBase{
} }
public BlockSlabs(String name, Block fullBlock, int meta){ public BlockSlabs(String name, Block fullBlock, int meta){
super(fullBlock.getMaterial(), name); super(fullBlock.getMaterial(fullBlock.getDefaultState()), name);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.fullBlock = fullBlock; this.fullBlock = fullBlock;
this.meta = meta; this.meta = meta;
} }
@Override /*@Override
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){ public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
this.setBlockBoundsBasedOnState(world, pos); this.setBlockBoundsBasedOnState(world, pos);
super.addCollisionBoxesToList(world, pos, state, axis, list, entity); super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
} }
@Override
public boolean isOpaqueCube(){
return false;
}
@Override
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer){
if(facing.ordinal() == 1){
return this.getStateFromMeta(meta);
}
if(facing.ordinal() == 0 || hitY >= 0.5F){
return this.getStateFromMeta(meta+1);
}
return this.getStateFromMeta(meta);
}
@Override @Override
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){ public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){
int meta = PosUtil.getMetadata(pos, world); int meta = PosUtil.getMetadata(pos, world);
@ -80,6 +66,22 @@ public class BlockSlabs extends BlockBase{
@Override @Override
public void setBlockBoundsForItemRender(){ public void setBlockBoundsForItemRender(){
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
}*/
@Override
public boolean isOpaqueCube(IBlockState state){
return false;
}
@Override
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer){
if(facing.ordinal() == 1){
return this.getStateFromMeta(meta);
}
if(facing.ordinal() == 0 || hitY >= 0.5F){
return this.getStateFromMeta(meta+1);
}
return this.getStateFromMeta(meta);
} }
@Override @Override
@ -106,15 +108,16 @@ public class BlockSlabs extends BlockBase{
} }
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ){
if(PosUtil.getBlock(pos, world) == this.block && ((side.ordinal() == 1 && PosUtil.getMetadata(pos, world) == 0) || (side.ordinal() == 0 && PosUtil.getMetadata(pos, world) == 1))){ if(PosUtil.getBlock(pos, world) == this.block && ((side.ordinal() == 1 && PosUtil.getMetadata(pos, world) == 0) || (side.ordinal() == 0 && PosUtil.getMetadata(pos, world) == 1))){
if(PosUtil.setBlock(pos, world, ((BlockSlabs)this.block).fullBlock, ((BlockSlabs)this.block).meta, 3)){ if(PosUtil.setBlock(pos, world, ((BlockSlabs)this.block).fullBlock, ((BlockSlabs)this.block).meta, 3)){
world.playSoundEffect(pos.getX()+0.5F, pos.getY()+0.5F, pos.getZ()+0.5F, this.block.stepSound.getBreakSound(), (this.block.stepSound.getVolume()+1.0F)/2.0F, this.block.stepSound.frequency*0.8F); //TODO Fix sounds
//world.playSoundEffect(pos.getX()+0.5F, pos.getY()+0.5F, pos.getZ()+0.5F, this.block.stepSound.getBreakSound(), (this.block.stepSound.getVolume()+1.0F)/2.0F, this.block.stepSound.frequency*0.8F);
stack.stackSize--; stack.stackSize--;
return true; return EnumActionResult.SUCCESS;
} }
} }
return super.onItemUse(stack, player, world, pos, side, hitX, hitY, hitZ); return super.onItemUse(stack, player, world, pos, hand, side, hitX, hitY, hitZ);
} }
@Override @Override

View file

@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud; import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -28,6 +29,9 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -44,53 +48,17 @@ public class BlockSmileyCloud extends BlockContainerBase{
super(Material.cloth, name); super(Material.cloth, name);
this.setHardness(0.5F); this.setHardness(0.5F);
this.setResistance(5.0F); this.setResistance(5.0F);
this.setStepSound(soundTypeCloth); this.setStepSound(SoundType.CLOTH);
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@Override @Override
public boolean isFullCube(){ public boolean isFullCube(IBlockState state){
return false; return false;
} }
@Override //TODO Fix bounding box
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){ /*@Override
this.setBlockBoundsBasedOnState(world, pos);
super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
}
@Override
public boolean isOpaqueCube(){
return false;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){
if(Util.RANDOM.nextInt(30) == 0){
for(int i = 0; i < 2; i++){
double d = Util.RANDOM.nextGaussian()*0.02D;
double d1 = Util.RANDOM.nextGaussian()*0.02D;
double d2 = Util.RANDOM.nextGaussian()*0.02D;
world.spawnParticle(EnumParticleTypes.HEART, pos.getX()+Util.RANDOM.nextFloat(), pos.getY()+0.65+Util.RANDOM.nextFloat(), pos.getZ()+Util.RANDOM.nextFloat(), d, d1, d2);
}
}
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing f6, float f7, float f8, float f9){
if(!world.isRemote){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileEntitySmileyCloud){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CLOUD.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
player.triggerAchievement(TheAchievements.NAME_SMILEY_CLOUD.ach);
}
}
return true;
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){ public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){
int meta = PosUtil.getMetadata(pos, world); int meta = PosUtil.getMetadata(pos, world);
float f = 0.0625F; float f = 0.0625F;
@ -109,6 +77,43 @@ public class BlockSmileyCloud extends BlockContainerBase{
} }
} }
@Override
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
this.setBlockBoundsBasedOnState(world, pos);
super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
}*/
@Override
public boolean isOpaqueCube(IBlockState state){
return false;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
if(Util.RANDOM.nextInt(30) == 0){
for(int i = 0; i < 2; i++){
double d = Util.RANDOM.nextGaussian()*0.02D;
double d1 = Util.RANDOM.nextGaussian()*0.02D;
double d2 = Util.RANDOM.nextGaussian()*0.02D;
world.spawnParticle(EnumParticleTypes.HEART, pos.getX()+Util.RANDOM.nextFloat(), pos.getY()+0.65+Util.RANDOM.nextFloat(), pos.getZ()+Util.RANDOM.nextFloat(), d, d1, d2);
}
}
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing f6, float f7, float f8, float f9){
if(!world.isRemote){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileEntitySmileyCloud){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CLOUD.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
player.addStat(TheAchievements.NAME_SMILEY_CLOUD.ach);
}
}
return true;
}
@Override @Override
public TileEntity createNewTileEntity(World world, int meta){ public TileEntity createNewTileEntity(World world, int meta){
return new TileEntitySmileyCloud(); return new TileEntitySmileyCloud();

View file

@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -27,6 +28,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -42,13 +45,13 @@ public class BlockTreasureChest extends BlockBase{
this.setHarvestLevel("axe", 0); this.setHarvestLevel("axe", 0);
this.setHardness(300.0F); this.setHardness(300.0F);
this.setResistance(50.0F); this.setResistance(50.0F);
this.setStepSound(soundTypeWood); this.setStepSound(SoundType.WOOD);
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){ public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){
for(int i = 0; i < 2; i++){ for(int i = 0; i < 2; i++){
for(float f = 0; f <= 3; f += 0.5){ for(float f = 0; f <= 3; f += 0.5){
float particleX = rand.nextFloat(); float particleX = rand.nextFloat();
@ -64,13 +67,14 @@ public class BlockTreasureChest extends BlockBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
world.playSoundAtEntity(player, "random.chestopen", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F); //TODO Fix sounds
//world.playSoundAtEntity(player, "random.chestopen", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F);
this.dropItems(world, pos); this.dropItems(world, pos);
world.setBlockToAir(pos); world.setBlockToAir(pos);
player.triggerAchievement(TheAchievements.OPEN_TREASURE_CHEST.ach); //player.triggerAchievement(TheAchievements.OPEN_TREASURE_CHEST.ach);
} }
return true; return true;
} }

View file

@ -16,15 +16,16 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockFenceGate; import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.BlockWall; import net.minecraft.block.BlockWall;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockState; import net.minecraft.block.state.BlockStateBase;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -40,13 +41,17 @@ public class BlockWallAA extends BlockBase{
this(name, base, 0); this(name, base, 0);
} }
protected static final AxisAlignedBB[] field_185751_g = new AxisAlignedBB[]{new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.3125D, 0.0D, 0.0D, 0.6875D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.3125D, 1.0D, 0.875D, 0.6875D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)};
protected static final AxisAlignedBB[] field_185750_B = new AxisAlignedBB[]{field_185751_g[0].setMaxY(1.5D), field_185751_g[1].setMaxY(1.5D), field_185751_g[2].setMaxY(1.5D), field_185751_g[3].setMaxY(1.5D), field_185751_g[4].setMaxY(1.5D), field_185751_g[5].setMaxY(1.5D), field_185751_g[6].setMaxY(1.5D), field_185751_g[7].setMaxY(1.5D), field_185751_g[8].setMaxY(1.5D), field_185751_g[9].setMaxY(1.5D), field_185751_g[10].setMaxY(1.5D), field_185751_g[11].setMaxY(1.5D), field_185751_g[12].setMaxY(1.5D), field_185751_g[13].setMaxY(1.5D), field_185751_g[14].setMaxY(1.5D), field_185751_g[15].setMaxY(1.5D)};
public BlockWallAA(String name, Block base, int meta){ public BlockWallAA(String name, Block base, int meta){
super(base.getMaterial(), name); super(base.getMaterial(base.getDefaultState()), name);
this.meta = meta; this.meta = meta;
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10F); this.setResistance(10F);
this.setStepSound(base.stepSound); this.setStepSound(base.getStepSound());
this.setDefaultState(this.blockState.getBaseState().withProperty(BlockWall.UP, false).withProperty(BlockWall.NORTH, false).withProperty(BlockWall.EAST, false).withProperty(BlockWall.SOUTH, false).withProperty(BlockWall.WEST, false)); this.setDefaultState(this.blockState.getBaseState().withProperty(BlockWall.UP, false).withProperty(BlockWall.NORTH, false).withProperty(BlockWall.EAST, false).withProperty(BlockWall.SOUTH, false).withProperty(BlockWall.WEST, false));
} }
@ -57,7 +62,7 @@ public class BlockWallAA extends BlockBase{
} }
@Override @Override
public boolean isFullCube(){ public boolean isFullCube(IBlockState state){
return false; return false;
} }
@ -68,19 +73,44 @@ public class BlockWallAA extends BlockBase{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){ public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side){
return side != EnumFacing.DOWN || super.shouldSideBeRendered(worldIn, pos, side); return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
}
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
state = this.getActualState(state, source, pos);
return field_185751_g[figureOutSomeWallStuff(state)];
}
public AxisAlignedBB getSelectedBoundingBox(IBlockState blockState, World worldIn, BlockPos pos){
blockState = this.getActualState(blockState, worldIn, pos);
return field_185750_B[figureOutSomeWallStuff(blockState)];
}
private static int figureOutSomeWallStuff(IBlockState state){
int i = 0;
if(state.getValue(BlockWall.NORTH)){
i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
}
if(state.getValue(BlockWall.EAST)){
i |= 1 << EnumFacing.EAST.getHorizontalIndex();
}
if(state.getValue(BlockWall.SOUTH)){
i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
}
if(state.getValue(BlockWall.WEST)){
i |= 1 << EnumFacing.WEST.getHorizontalIndex();
}
return i;
} }
@Override @Override
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state){ public boolean isOpaqueCube(IBlockState state){
this.setBlockBoundsBasedOnState(worldIn, pos);
this.maxY = 1.5D;
return super.getCollisionBoundingBox(worldIn, pos, state);
}
@Override
public boolean isOpaqueCube(){
return false; return false;
} }
@ -89,45 +119,6 @@ public class BlockWallAA extends BlockBase{
return meta; return meta;
} }
@Override
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos){
boolean flag = this.canConnectTo(worldIn, pos.north());
boolean flag1 = this.canConnectTo(worldIn, pos.south());
boolean flag2 = this.canConnectTo(worldIn, pos.west());
boolean flag3 = this.canConnectTo(worldIn, pos.east());
float f = 0.25F;
float f1 = 0.75F;
float f2 = 0.25F;
float f3 = 0.75F;
float f4 = 1.0F;
if(flag){
f2 = 0.0F;
}
if(flag1){
f3 = 1.0F;
}
if(flag2){
f = 0.0F;
}
if(flag3){
f1 = 1.0F;
}
if(flag && flag1 && !flag2 && !flag3){
f4 = 0.8125F;
f = 0.3125F;
f1 = 0.6875F;
}
else if(!flag && !flag1 && flag2 && flag3){
f4 = 0.8125F;
f2 = 0.3125F;
f3 = 0.6875F;
}
this.setBlockBounds(f, 0.0F, f2, f1, f4, f3);
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -137,7 +128,8 @@ public class BlockWallAA extends BlockBase{
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos){ public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos){
Block block = PosUtil.getBlock(pos, worldIn); Block block = PosUtil.getBlock(pos, worldIn);
return block != Blocks.barrier && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial().isOpaque() && block.isFullCube()) && block.getMaterial() != Material.gourd)); IBlockState state = worldIn.getBlockState(pos);
return block != Blocks.barrier && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial(state).isOpaque() && block.isFullCube(state)) && block.getMaterial(state) != Material.gourd));
} }
@Override @Override
@ -151,7 +143,7 @@ public class BlockWallAA extends BlockBase{
} }
@Override @Override
protected BlockState createBlockState(){ protected BlockStateContainer createBlockState(){
return new BlockState(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH); return new BlockStateContainer(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH);
} }
} }

View file

@ -20,6 +20,7 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -28,9 +29,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -45,20 +47,20 @@ public class BlockWildPlant extends BlockBushBase{
public BlockWildPlant(String name){ public BlockWildPlant(String name){
super(name); super(name);
this.setStepSound(soundTypeGrass); this.setStepSound(SoundType.PLANT);
} }
@Override @Override
public boolean canBlockStay(World world, BlockPos pos, IBlockState state){ public boolean canBlockStay(World world, BlockPos pos, IBlockState state){
BlockPos offset = PosUtil.offset(pos, 0, -1, 0); BlockPos offset = PosUtil.offset(pos, 0, -1, 0);
return PosUtil.getMetadata(state) == TheWildPlants.RICE.ordinal() ? PosUtil.getMaterial(offset, world) == Material.water : PosUtil.getBlock(offset, world).canSustainPlant(world, offset, EnumFacing.UP, this); return PosUtil.getMetadata(state) == TheWildPlants.RICE.ordinal() ? PosUtil.getMaterial(offset, world) == Material.water : PosUtil.getBlock(offset, world).canSustainPlant(world.getBlockState(offset), world, offset, EnumFacing.UP, this);
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public Item getItem(World world, BlockPos pos){ public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player){
int metadata = PosUtil.getMetadata(pos, world); int metadata = PosUtil.getMetadata(pos, world);
return metadata >= allWildPlants.length ? null : ((BlockPlant)allWildPlants[metadata].wildVersionOf).seedItem; return metadata >= allWildPlants.length ? null : new ItemStack(((BlockPlant)allWildPlants[metadata].wildVersionOf).seedItem);
} }
@SuppressWarnings("all") @SuppressWarnings("all")

View file

@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier; import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -27,9 +28,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper; import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockXPSolidifier extends BlockContainerBase{ public class BlockXPSolidifier extends BlockContainerBase{
@ -41,7 +43,7 @@ public class BlockXPSolidifier extends BlockContainerBase{
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(2.5F); this.setHardness(2.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setStepSound(soundTypeStone); this.setStepSound(SoundType.STONE);
} }
@Override @Override
@ -50,7 +52,7 @@ public class BlockXPSolidifier extends BlockContainerBase{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)world.getTileEntity(pos); TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)world.getTileEntity(pos);
if(solidifier != null){ if(solidifier != null){

View file

@ -15,13 +15,13 @@ import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler; import net.minecraft.profiler.Profiler;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.math.RayTraceResult;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
public interface IHudDisplay{ public interface IHudDisplay{
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution); void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution);
} }

View file

@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockState; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -70,8 +70,8 @@ public class BlockBase extends Block{
} }
@Override @Override
protected BlockState createBlockState(){ protected BlockStateContainer createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty()); return this.getMetaProperty() == null ? super.createBlockState() : new BlockStateContainer(this, this.getMetaProperty());
} }
protected PropertyInteger getMetaProperty(){ protected PropertyInteger getMetaProperty(){

View file

@ -14,8 +14,9 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.block.BlockBush; import net.minecraft.block.BlockBush;
import net.minecraft.block.SoundType;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockState; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -27,7 +28,7 @@ public class BlockBushBase extends BlockBush{
public BlockBushBase(String name){ public BlockBushBase(String name){
this.name = name; this.name = name;
this.setStepSound(soundTypeGrass); this.setStepSound(SoundType.PLANT);
this.register(); this.register();
} }
@ -69,8 +70,8 @@ public class BlockBushBase extends BlockBush{
} }
@Override @Override
protected BlockState createBlockState(){ protected BlockStateContainer createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty()); return this.getMetaProperty() == null ? super.createBlockState() : new BlockStateContainer(this, this.getMetaProperty());
} }
protected PropertyInteger getMetaProperty(){ protected PropertyInteger getMetaProperty(){

View file

@ -20,7 +20,8 @@ import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockRedstoneTorch; import net.minecraft.block.BlockRedstoneTorch;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockState; import net.minecraft.block.state.BlockStateBase;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
@ -31,8 +32,9 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
@ -118,7 +120,7 @@ public abstract class BlockContainerBase extends BlockContainer{
} }
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player){ public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player){
ItemStack stack = player.getCurrentEquippedItem(); ItemStack stack = player.getActiveItemStack();
if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){ if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
TileEntity tile = world.getTileEntity(pos); TileEntity tile = world.getTileEntity(pos);
if(tile instanceof IRedstoneToggle){ if(tile instanceof IRedstoneToggle){
@ -224,12 +226,12 @@ public abstract class BlockContainerBase extends BlockContainer{
} }
@Override @Override
public boolean hasComparatorInputOverride(){ public boolean hasComparatorInputOverride(IBlockState state){
return true; return true;
} }
@Override @Override
public int getComparatorInputOverride(World world, BlockPos pos){ public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos){
TileEntity tile = world.getTileEntity(pos); TileEntity tile = world.getTileEntity(pos);
if(tile instanceof IInventory){ if(tile instanceof IInventory){
return Container.calcRedstoneFromInventory((IInventory)tile); return Container.calcRedstoneFromInventory((IInventory)tile);
@ -238,8 +240,8 @@ public abstract class BlockContainerBase extends BlockContainer{
} }
@Override @Override
protected BlockState createBlockState(){ protected BlockStateContainer createBlockState(){
return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty()); return this.getMetaProperty() == null ? super.createBlockState() : new BlockStateContainer(this, this.getMetaProperty());
} }
@Override @Override
@ -290,7 +292,7 @@ public abstract class BlockContainerBase extends BlockContainer{
} }
@Override @Override
public int getRenderType(){ public EnumBlockRenderType getRenderType(IBlockState state){
return 3; return EnumBlockRenderType.MODEL;
} }
} }

View file

@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.BlockFluidClassic;

View file

@ -20,9 +20,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.EnumPlantType;
@ -83,21 +84,21 @@ public class BlockPlant extends BlockCrops{
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing facing, float hitX, float hitY, float hitZ){ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing facing, float hitX, float hitY, float hitZ){
if(getMetaFromState(state) >= 7){ if(getMetaFromState(state) >= 7){
if(!world.isRemote){ if(!world.isRemote){
List<ItemStack> drops = getDrops(world, pos, state, 0); List<ItemStack> drops = getDrops(world, pos, state, 0);
boolean deductedSeedSize = false; boolean deductedSeedSize = false;
for(ItemStack stack : drops){ for(ItemStack drop : drops){
if(stack != null){ if(drop != null){
if(stack.getItem() == this.seedItem && !deductedSeedSize){ if(drop.getItem() == this.seedItem && !deductedSeedSize){
stack.stackSize--; drop.stackSize--;
deductedSeedSize = true; deductedSeedSize = true;
} }
if(stack.stackSize > 0){ if(drop.stackSize > 0){
EntityItem entity = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); EntityItem entity = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, drop);
world.spawnEntityInWorld(entity); world.spawnEntityInWorld(entity);
} }
} }
@ -110,11 +111,6 @@ public class BlockPlant extends BlockCrops{
return false; return false;
} }
@Override
public int getDamageValue(World world, BlockPos pos){
return 0;
}
@Override @Override
public Item getSeed(){ public Item getSeed(){
return this.seedItem; return this.seedItem;

View file

@ -29,7 +29,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement; import net.minecraft.stats.Achievement;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.text.TextFormatting;
import java.awt.*; import java.awt.*;
import java.net.URI; import java.net.URI;
@ -80,9 +80,9 @@ public class BookletUtils{
//Draw No Entry title //Draw No Entry title
if(booklet.currentEntrySet.entry == null){ if(booklet.currentEntrySet.entry == null){
String strg = EnumChatFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.manualName.1"); String strg = TextFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.manualName.1");
booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+12, 0); booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+12, 0);
strg = EnumChatFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.manualName.2"); strg = TextFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.manualName.2");
booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+12+booklet.getFontRenderer().FONT_HEIGHT, 0); booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+12+booklet.getFontRenderer().FONT_HEIGHT, 0);
String version; String version;
@ -105,7 +105,7 @@ public class BookletUtils{
else{ else{
version = StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.edition")+" "+ModUtil.VERSION.substring(ModUtil.VERSION.indexOf("r")+1); version = StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.edition")+" "+ModUtil.VERSION.substring(ModUtil.VERSION.indexOf("r")+1);
} }
strg = EnumChatFormatting.GOLD+EnumChatFormatting.ITALIC.toString()+"-"+version+"-"; strg = TextFormatting.GOLD+TextFormatting.ITALIC.toString()+"-"+version+"-";
booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+33, 0); booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+33, 0);
} }
@ -139,10 +139,10 @@ public class BookletUtils{
if(mouseX >= booklet.guiLeft+booklet.xSize+1 && mouseX < booklet.guiLeft+booklet.xSize+1+22 && mouseY >= booklet.guiTop-18 && mouseY < booklet.guiTop-18+21){ if(mouseX >= booklet.guiLeft+booklet.xSize+1 && mouseX < booklet.guiLeft+booklet.xSize+1+22 && mouseY >= booklet.guiTop-18 && mouseY < booklet.guiTop-18+21){
if(infoList == null){ if(infoList == null){
infoList = new ArrayList<String>(); infoList = new ArrayList<String>();
infoList.add(EnumChatFormatting.GOLD+"Achievements related to this chapter:"); infoList.add(TextFormatting.GOLD+"Achievements related to this chapter:");
} }
infoList.add("-"+StringUtil.localize(achievement.statId)); infoList.add("-"+StringUtil.localize(achievement.statId));
infoList.add(EnumChatFormatting.GRAY+"("+achievement.getDescription()+")"); infoList.add(TextFormatting.GRAY+"("+achievement.getDescription()+")");
} }
} }
} }
@ -178,10 +178,10 @@ public class BookletUtils{
//Renders the amount of words and chars the book has //Renders the amount of words and chars the book has
else{ else{
String wordCountString = StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".amountOfWords", ClientProxy.bookletWordCount); String wordCountString = StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".amountOfWords", ClientProxy.bookletWordCount);
booklet.getFontRenderer().drawString(EnumChatFormatting.ITALIC+wordCountString, booklet.guiLeft+booklet.xSize-booklet.getFontRenderer().getStringWidth(wordCountString)-15, booklet.guiTop+booklet.ySize-18-booklet.getFontRenderer().FONT_HEIGHT, 0); booklet.getFontRenderer().drawString(TextFormatting.ITALIC+wordCountString, booklet.guiLeft+booklet.xSize-booklet.getFontRenderer().getStringWidth(wordCountString)-15, booklet.guiTop+booklet.ySize-18-booklet.getFontRenderer().FONT_HEIGHT, 0);
String charCountString = StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".amountOfChars", ClientProxy.bookletCharCount); String charCountString = StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".amountOfChars", ClientProxy.bookletCharCount);
booklet.getFontRenderer().drawString(EnumChatFormatting.ITALIC+charCountString, booklet.guiLeft+booklet.xSize-booklet.getFontRenderer().getStringWidth(charCountString)-15, booklet.guiTop+booklet.ySize-18, 0); booklet.getFontRenderer().drawString(TextFormatting.ITALIC+charCountString, booklet.guiLeft+booklet.xSize-booklet.getFontRenderer().getStringWidth(charCountString)-15, booklet.guiTop+booklet.ySize-18, 0);
} }
} }

View file

@ -34,9 +34,9 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
@ -164,7 +164,8 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
public void keyTyped(char theChar, int key){ public void keyTyped(char theChar, int key){
if(AND_HIS_NAME_IS.length > this.hisNameIsAt && AND_HIS_NAME_IS[this.hisNameIsAt] == key){ if(AND_HIS_NAME_IS.length > this.hisNameIsAt && AND_HIS_NAME_IS[this.hisNameIsAt] == key){
if(this.hisNameIsAt+1 >= AND_HIS_NAME_IS.length){ if(this.hisNameIsAt+1 >= AND_HIS_NAME_IS.length){
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation(ModUtil.MOD_ID_LOWER, "duhDuhDuhDuuuh"))); //TODO Fix sound
//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"); ModUtil.LOGGER.info("AND HIS NAME IS JOHN CENA DUH DUH DUH DUUUH");
this.hisNameIsAt = 0; this.hisNameIsAt = 0;
} }
@ -274,46 +275,46 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
this.guiLeft = (this.width-this.xSize)/2; this.guiLeft = (this.width-this.xSize)/2;
this.guiTop = (this.height-this.ySize)/2; this.guiTop = (this.height-this.ySize)/2;
this.buttonForward = new TexturedButton(0, this.guiLeft+this.xSize-26, this.guiTop+this.ySize+1, 164, 0, 18, 10, Collections.singletonList(EnumChatFormatting.GOLD+"Next Page")); this.buttonForward = new TexturedButton(0, this.guiLeft+this.xSize-26, this.guiTop+this.ySize+1, 164, 0, 18, 10, Collections.singletonList(TextFormatting.GOLD+"Next Page"));
this.buttonList.add(this.buttonForward); this.buttonList.add(this.buttonForward);
this.buttonBackward = new TexturedButton(1, this.guiLeft+8, this.guiTop+this.ySize+1, 146, 0, 18, 10, Collections.singletonList(EnumChatFormatting.GOLD+"Previous Page")); this.buttonBackward = new TexturedButton(1, this.guiLeft+8, this.guiTop+this.ySize+1, 146, 0, 18, 10, Collections.singletonList(TextFormatting.GOLD+"Previous Page"));
this.buttonList.add(this.buttonBackward); this.buttonList.add(this.buttonBackward);
this.buttonPreviousScreen = new TexturedButton(2, this.guiLeft+this.xSize/2-7, this.guiTop+this.ySize+1, 182, 0, 15, 10, Collections.singletonList(EnumChatFormatting.GOLD+"Back")); this.buttonPreviousScreen = new TexturedButton(2, this.guiLeft+this.xSize/2-7, this.guiTop+this.ySize+1, 182, 0, 15, 10, Collections.singletonList(TextFormatting.GOLD+"Back"));
this.buttonList.add(this.buttonPreviousScreen); this.buttonList.add(this.buttonPreviousScreen);
ArrayList updateHover = new ArrayList(); ArrayList updateHover = new ArrayList();
if(UpdateChecker.checkFailed){ if(UpdateChecker.checkFailed){
updateHover.add(IChatComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.failed")).getFormattedText()); updateHover.add(ITextComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.failed")).getFormattedText());
} }
else if(UpdateChecker.needsUpdateNotify){ else if(UpdateChecker.needsUpdateNotify){
updateHover.add(IChatComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.generic")).getFormattedText()); updateHover.add(ITextComponent.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.updateVersionString)).getFormattedText()); updateHover.add(ITextComponent.Serializer.jsonToComponent(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".update.versionCompare", ModUtil.VERSION, UpdateChecker.updateVersionString)).getFormattedText());
updateHover.add(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.buttonOptions")); 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); this.buttonUpdate = new TexturedButton(4, this.guiLeft-11, this.guiTop-11, 245, 0, 11, 11, updateHover);
this.buttonUpdate.visible = UpdateChecker.needsUpdateNotify; this.buttonUpdate.visible = UpdateChecker.needsUpdateNotify;
this.buttonList.add(this.buttonUpdate); this.buttonList.add(this.buttonUpdate);
this.buttonTwitter = new TexturedButton(5, this.guiLeft, this.guiTop, 213, 0, 8, 8, Collections.singletonList(EnumChatFormatting.GOLD+"Open @ActAddMod on Twitter in Browser")); this.buttonTwitter = new TexturedButton(5, this.guiLeft, this.guiTop, 213, 0, 8, 8, Collections.singletonList(TextFormatting.GOLD+"Open @ActAddMod on Twitter in Browser"));
this.buttonList.add(this.buttonTwitter); this.buttonList.add(this.buttonTwitter);
this.buttonForum = new TexturedButton(6, this.guiLeft, this.guiTop+10, 221, 0, 8, 8, Collections.singletonList(EnumChatFormatting.GOLD+"Open Minecraft Forum Post in Browser")); this.buttonForum = new TexturedButton(6, this.guiLeft, this.guiTop+10, 221, 0, 8, 8, Collections.singletonList(TextFormatting.GOLD+"Open Minecraft Forum Post in Browser"));
this.buttonList.add(this.buttonForum); this.buttonList.add(this.buttonForum);
this.buttonAchievements = new TexturedButton(7, this.guiLeft+138, this.guiTop, 205, 0, 8, 8, Collections.singletonList(EnumChatFormatting.GOLD+"Show Achievements")); this.buttonAchievements = new TexturedButton(7, this.guiLeft+138, this.guiTop, 205, 0, 8, 8, Collections.singletonList(TextFormatting.GOLD+"Show Achievements"));
this.buttonList.add(this.buttonAchievements); this.buttonList.add(this.buttonAchievements);
ArrayList websiteHover = new ArrayList(); ArrayList websiteHover = new ArrayList();
websiteHover.add(EnumChatFormatting.GOLD+"Open Author's Website"); websiteHover.add(TextFormatting.GOLD+"Open Author's Website");
websiteHover.add("(There's some cool stuff there!)"); websiteHover.add("(There's some cool stuff there!)");
websiteHover.add(EnumChatFormatting.GRAY+""+EnumChatFormatting.ITALIC+"Would you call this Product Placement?"); websiteHover.add(TextFormatting.GRAY+""+TextFormatting.ITALIC+"Would you call this Product Placement?");
this.buttonWebsite = new TexturedButton(-99, this.guiLeft, this.guiTop+20, 228, 0, 8, 8, websiteHover); this.buttonWebsite = new TexturedButton(-99, this.guiLeft, this.guiTop+20, 228, 0, 8, 8, websiteHover);
this.buttonList.add(this.buttonWebsite); this.buttonList.add(this.buttonWebsite);
ArrayList configHover = new ArrayList(); ArrayList configHover = new ArrayList();
configHover.add(EnumChatFormatting.GOLD+"Show Configuration GUI"); configHover.add(TextFormatting.GOLD+"Show Configuration GUI");
configHover.addAll(this.fontRendererObj.listFormattedStringToWidth("It is highly recommended that you restart your game after changing anything as that prevents possible bugs occuring!", 200)); configHover.addAll(this.fontRendererObj.listFormattedStringToWidth("It is highly recommended that you restart your game after changing anything as that prevents possible bugs occuring!", 200));
this.buttonConfig = new TexturedButton(8, this.guiLeft+138, this.guiTop+10, 197, 0, 8, 8, configHover); this.buttonConfig = new TexturedButton(8, this.guiLeft+138, this.guiTop+10, 197, 0, 8, 8, configHover);
this.buttonList.add(this.buttonConfig); this.buttonList.add(this.buttonConfig);
@ -416,7 +417,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
list.set(k, stack.getRarity().rarityColor+(String)list.get(k)); list.set(k, stack.getRarity().rarityColor+(String)list.get(k));
} }
else{ else{
list.set(k, EnumChatFormatting.GRAY+(String)list.get(k)); list.set(k, TextFormatting.GRAY+(String)list.get(k));
} }
} }
@ -428,7 +429,8 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
if(mousePressed){ if(mousePressed){
BookletUtils.openIndexEntry(this, page.getChapter().getEntry(), ActuallyAdditionsAPI.bookletEntries.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true); BookletUtils.openIndexEntry(this, page.getChapter().getEntry(), ActuallyAdditionsAPI.bookletEntries.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true);
BookletUtils.openChapter(this, page.getChapter(), page); BookletUtils.openChapter(this, page.getChapter(), page);
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); //TODO Fix sound
//Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
} }
} }
} }

View file

@ -20,7 +20,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.text.TextFormatting;
import java.util.ArrayList; import java.util.ArrayList;
@ -83,16 +83,16 @@ public class BookmarkButton extends GuiButton{
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
if(this.assignedEntry.entry != null){ if(this.assignedEntry.entry != null){
if(this.assignedEntry.chapter != null){ if(this.assignedEntry.chapter != null){
list.add(EnumChatFormatting.GOLD+this.assignedEntry.chapter.getLocalizedName()+", Page "+this.assignedEntry.page.getID()); list.add(TextFormatting.GOLD+this.assignedEntry.chapter.getLocalizedName()+", Page "+this.assignedEntry.page.getID());
} }
else{ else{
list.add(EnumChatFormatting.GOLD+this.assignedEntry.entry.getLocalizedName()+", Page "+this.assignedEntry.pageInIndex); list.add(TextFormatting.GOLD+this.assignedEntry.entry.getLocalizedName()+", Page "+this.assignedEntry.pageInIndex);
} }
list.add("Click to open"); list.add("Click to open");
list.add(EnumChatFormatting.ITALIC+"Shift-Click to remove"); list.add(TextFormatting.ITALIC+"Shift-Click to remove");
} }
else{ else{
list.add(EnumChatFormatting.GOLD+"None"); list.add(TextFormatting.GOLD+"None");
list.add("Click to save current page"); list.add("Click to save current page");
} }
this.booklet.drawHoveringText(list, mouseX, mouseY); this.booklet.drawHoveringText(list, mouseX, mouseY);

View file

@ -19,7 +19,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.text.TextFormatting;
public class IndexButton extends GuiButton{ public class IndexButton extends GuiButton{
@ -63,7 +63,7 @@ public class IndexButton extends GuiButton{
public void drawHover(int mouseX, int mouseY){ public void drawHover(int mouseX, int mouseY){
if(this.chap instanceof BookletChapter && ((BookletChapter)this.chap).isIncomplete){ if(this.chap instanceof BookletChapter && ((BookletChapter)this.chap).isIncomplete){
this.gui.drawHoveringText(this.gui.getFontRenderer().listFormattedStringToWidth(EnumChatFormatting.RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".unavailable"), 250), mouseX, mouseY); this.gui.drawHoveringText(this.gui.getFontRenderer().listFormattedStringToWidth(TextFormatting.RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".unavailable"), 250), mouseX, mouseY);
} }
} }
} }

View file

@ -17,7 +17,7 @@ import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.text.TextFormatting;
public class BookletChapter implements IBookletChapter{ public class BookletChapter implements IBookletChapter{
@ -25,7 +25,7 @@ public class BookletChapter implements IBookletChapter{
public final IBookletEntry entry; public final IBookletEntry entry;
public final ItemStack displayStack; public final ItemStack displayStack;
private final String unlocalizedName; private final String unlocalizedName;
public EnumChatFormatting color; public TextFormatting color;
public boolean isIncomplete; public boolean isIncomplete;
@ -42,7 +42,7 @@ public class BookletChapter implements IBookletChapter{
page.setChapter(this); page.setChapter(this);
} }
this.color = EnumChatFormatting.RESET; this.color = TextFormatting.RESET;
} }
@Override @Override
@ -81,12 +81,12 @@ public class BookletChapter implements IBookletChapter{
} }
public BookletChapter setImportant(){ public BookletChapter setImportant(){
this.color = EnumChatFormatting.DARK_GREEN; this.color = TextFormatting.DARK_GREEN;
return this; return this;
} }
public BookletChapter setSpecial(){ public BookletChapter setSpecial(){
this.color = EnumChatFormatting.DARK_PURPLE; this.color = TextFormatting.DARK_PURPLE;
return this; return this;
} }
} }

View file

@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.text.TextFormatting;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -24,13 +24,13 @@ public class BookletEntry implements IBookletEntry{
private final String unlocalizedName; private final String unlocalizedName;
public List<IBookletChapter> chapters = new ArrayList<IBookletChapter>(); public List<IBookletChapter> chapters = new ArrayList<IBookletChapter>();
private EnumChatFormatting color; private TextFormatting color;
public BookletEntry(String unlocalizedName){ public BookletEntry(String unlocalizedName){
this.unlocalizedName = unlocalizedName; this.unlocalizedName = unlocalizedName;
ActuallyAdditionsAPI.addBookletEntry(this); ActuallyAdditionsAPI.addBookletEntry(this);
this.color = EnumChatFormatting.RESET; this.color = TextFormatting.RESET;
} }
@Override @Override
@ -64,12 +64,12 @@ public class BookletEntry implements IBookletEntry{
} }
public BookletEntry setImportant(){ public BookletEntry setImportant(){
this.color = EnumChatFormatting.DARK_GREEN; this.color = TextFormatting.DARK_GREEN;
return this; return this;
} }
public BookletEntry setSpecial(){ public BookletEntry setSpecial(){
this.color = EnumChatFormatting.DARK_PURPLE; this.color = TextFormatting.DARK_PURPLE;
return this; return this;
} }

View file

@ -17,7 +17,7 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.text.TextFormatting;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -44,12 +44,12 @@ public class BookletPageAA extends BookletPage{
} }
String base = StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".chapter."+this.chapter.getUnlocalizedName()+".text."+this.localizationKey); String base = StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".chapter."+this.chapter.getUnlocalizedName()+".text."+this.localizationKey);
base = base.replaceAll("<imp>", EnumChatFormatting.DARK_GREEN+""); base = base.replaceAll("<imp>", TextFormatting.DARK_GREEN+"");
base = base.replaceAll("<item>", EnumChatFormatting.BLUE+""); base = base.replaceAll("<item>", TextFormatting.BLUE+"");
base = base.replaceAll("<r>", EnumChatFormatting.BLACK+""); base = base.replaceAll("<r>", TextFormatting.BLACK+"");
base = base.replaceAll("<n>", "\n"); base = base.replaceAll("<n>", "\n");
base = base.replaceAll("<i>", EnumChatFormatting.ITALIC+""); base = base.replaceAll("<i>", TextFormatting.ITALIC+"");
base = base.replaceAll("<tifisgrin>", EnumChatFormatting.DARK_RED+""+EnumChatFormatting.UNDERLINE); //This is fucking important so go read it now base = base.replaceAll("<tifisgrin>", TextFormatting.DARK_RED+""+TextFormatting.UNDERLINE); //This is fucking important so go read it now
for(Object o : this.textReplacements.entrySet()){ for(Object o : this.textReplacements.entrySet()){
Map.Entry e = (Map.Entry)o; Map.Entry e = (Map.Entry)o;
@ -80,7 +80,7 @@ public class BookletPageAA extends BookletPage{
@Override @Override
public String getClickToSeeRecipeString(){ public String getClickToSeeRecipeString(){
return EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe"); return TextFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe");
} }
public BookletPage setNoText(){ public BookletPage setNoText(){

View file

@ -22,7 +22,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.ReflectionHelper; import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -64,7 +64,7 @@ public class PageCrafting extends BookletPageAA{
IRecipe recipe = this.recipes[this.recipePos]; IRecipe recipe = this.recipes[this.recipePos];
if(recipe == null){ if(recipe == null){
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); StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
} }
else{ else{
String strg = StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+"."+(recipe instanceof ShapedRecipes ? "shapedRecipe" : (recipe instanceof ShapelessRecipes ? "shapelessRecipe" : (recipe instanceof ShapelessOreRecipe ? "shapelessOreRecipe" : "shapedOreRecipe")))); String strg = StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+"."+(recipe instanceof ShapedRecipes ? "shapedRecipe" : (recipe instanceof ShapelessRecipes ? "shapelessRecipe" : (recipe instanceof ShapelessOreRecipe ? "shapelessOreRecipe" : "shapedOreRecipe"))));

View file

@ -20,7 +20,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -53,7 +53,7 @@ public class PageCrusherRecipe extends BookletPageAA{
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
if(recipe == null){ if(recipe == null){
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); StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
} }
else{ else{
String strg = "Crusher Recipe"; String strg = "Crusher Recipe";

View file

@ -20,7 +20,7 @@ import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -57,7 +57,7 @@ public class PageFurnace extends BookletPageAA{
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
ItemStack input = this.input != null ? this.input : this.getInputForOutput(this.result); ItemStack input = this.input != null ? this.input : this.getInputForOutput(this.result);
if(input == null){ if(input == null){
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); StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
} }
else{ else{
String strg = "Furnace Recipe"; String strg = "Furnace Recipe";

View file

@ -21,7 +21,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -58,7 +58,7 @@ public class PageReconstructor extends BookletPageAA{
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
LensNoneRecipe recipe = this.recipes[this.recipePos]; LensNoneRecipe recipe = this.recipes[this.recipePos];
if(recipe == null){ if(recipe == null){
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); StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
} }
else{ else{
String strg = "Atomic Reconstructor"; String strg = "Atomic Reconstructor";

View file

@ -44,7 +44,7 @@ public class CreativeTab extends CreativeTabs{
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void displayAllReleventItems(List list){ public void displayAllRelevantItems(List<ItemStack> list){
this.list = list; this.list = list;
add(InitItems.itemBooklet); add(InitItems.itemBooklet);

View file

@ -30,10 +30,10 @@ public class BucketFillEvent{
} }
private void fillBucket(FillBucketEvent event, Item item, Block fluid){ private void fillBucket(FillBucketEvent event, Item item, Block fluid){
Block block = PosUtil.getBlock(event.target.getBlockPos(), event.world); Block block = PosUtil.getBlock(event.getTarget().getBlockPos(), event.getWorld());
if(block == fluid){ if(block == fluid){
event.world.setBlockToAir(event.target.getBlockPos()); event.getWorld().setBlockToAir(event.getTarget().getBlockPos());
event.result = new ItemStack(item); event.setFilledBucket(new ItemStack(item));
event.setResult(Event.Result.ALLOW); event.setResult(Event.Result.ALLOW);
} }
} }

View file

@ -24,8 +24,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler; import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@ -37,9 +37,9 @@ public class HudEvent{
Minecraft minecraft = Minecraft.getMinecraft(); Minecraft minecraft = Minecraft.getMinecraft();
Profiler profiler = minecraft.mcProfiler; Profiler profiler = minecraft.mcProfiler;
EntityPlayer player = minecraft.thePlayer; EntityPlayer player = minecraft.thePlayer;
MovingObjectPosition posHit = minecraft.objectMouseOver; RayTraceResult posHit = minecraft.objectMouseOver;
FontRenderer font = minecraft.fontRendererObj; FontRenderer font = minecraft.fontRendererObj;
ItemStack stack = player.getCurrentEquippedItem(); ItemStack stack = player.getActiveItemStack();
profiler.startSection(ModUtil.MOD_ID+"Hud"); profiler.startSection(ModUtil.MOD_ID+"Hud");
@ -64,11 +64,11 @@ public class HudEvent{
if(tileHit instanceof IRedstoneToggle){ if(tileHit instanceof IRedstoneToggle){
profiler.startSection("RedstoneToggleHudDisplay"); profiler.startSection("RedstoneToggleHudDisplay");
String strg = "Redstone Mode: "+EnumChatFormatting.DARK_RED+(((IRedstoneToggle)tileHit).isPulseMode() ? "Pulse" : "Deactivation")+EnumChatFormatting.RESET; String strg = "Redstone Mode: "+TextFormatting.DARK_RED+(((IRedstoneToggle)tileHit).isPulseMode() ? "Pulse" : "Deactivation")+TextFormatting.RESET;
font.drawStringWithShadow(strg, event.resolution.getScaledWidth()/2+5, event.resolution.getScaledHeight()/2+5, StringUtil.DECIMAL_COLOR_WHITE); font.drawStringWithShadow(strg, event.resolution.getScaledWidth()/2+5, event.resolution.getScaledHeight()/2+5, StringUtil.DECIMAL_COLOR_WHITE);
if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){ if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
String expl = EnumChatFormatting.GREEN+"Right-Click to toggle!"; String expl = TextFormatting.GREEN+"Right-Click to toggle!";
font.drawStringWithShadow(expl, event.resolution.getScaledWidth()/2+5, event.resolution.getScaledHeight()/2+15, StringUtil.DECIMAL_COLOR_WHITE); font.drawStringWithShadow(expl, event.resolution.getScaledWidth()/2+5, event.resolution.getScaledHeight()/2+15, StringUtil.DECIMAL_COLOR_WHITE);
} }
@ -78,7 +78,7 @@ public class HudEvent{
if(tileHit instanceof IEnergyDisplay){ if(tileHit instanceof IEnergyDisplay){
profiler.startSection("EnergyDisplay"); profiler.startSection("EnergyDisplay");
String strg = ((IEnergyDisplay)tileHit).getEnergy()+"/"+((IEnergyDisplay)tileHit).getMaxEnergy()+" RF"; String strg = ((IEnergyDisplay)tileHit).getEnergy()+"/"+((IEnergyDisplay)tileHit).getMaxEnergy()+" RF";
font.drawStringWithShadow(EnumChatFormatting.GOLD+strg, event.resolution.getScaledWidth()/2+5, event.resolution.getScaledHeight()/2-10, StringUtil.DECIMAL_COLOR_WHITE); font.drawStringWithShadow(TextFormatting.GOLD+strg, event.resolution.getScaledWidth()/2+5, event.resolution.getScaledHeight()/2-10, StringUtil.DECIMAL_COLOR_WHITE);
profiler.endSection(); profiler.endSection();
} }
} }

View file

@ -17,7 +17,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
@ -26,8 +26,8 @@ import java.util.List;
public class TooltipEvent{ public class TooltipEvent{
private static final String ADVANCED_INFO_TEXT_PRE = EnumChatFormatting.DARK_GRAY+" "; private static final String ADVANCED_INFO_TEXT_PRE = TextFormatting.DARK_GRAY+" ";
private static final String ADVANCED_INFO_HEADER_PRE = EnumChatFormatting.GRAY+" -"; private static final String ADVANCED_INFO_HEADER_PRE = TextFormatting.GRAY+" -";
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SubscribeEvent @SubscribeEvent
@ -36,7 +36,7 @@ public class TooltipEvent{
if(event.itemStack.getItem() != null){ if(event.itemStack.getItem() != null){
if(ConfigBoolValues.CTRL_EXTRA_INFO.isEnabled()){ if(ConfigBoolValues.CTRL_EXTRA_INFO.isEnabled()){
if(GuiScreen.isCtrlKeyDown()){ if(GuiScreen.isCtrlKeyDown()){
event.toolTip.add(EnumChatFormatting.DARK_GRAY+""+EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".extraInfo.desc")+":"); event.toolTip.add(TextFormatting.DARK_GRAY+""+TextFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".extraInfo.desc")+":");
//OreDict Names //OreDict Names
int[] oreIDs = OreDictionary.getOreIDs(event.itemStack); int[] oreIDs = OreDictionary.getOreIDs(event.itemStack);
@ -84,17 +84,17 @@ public class TooltipEvent{
} }
} }
else{ else{
event.toolTip.add(ADVANCED_INFO_TEXT_PRE+EnumChatFormatting.ITALIC+"["+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".pressShift.desc")+"]"); event.toolTip.add(ADVANCED_INFO_TEXT_PRE+TextFormatting.ITALIC+"["+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".pressShift.desc")+"]");
} }
} }
//Disabling Info //Disabling Info
event.toolTip.addAll(Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".disablingInfo.desc"), 200)); event.toolTip.addAll(Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(TextFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".disablingInfo.desc"), 200));
} }
else{ else{
if(ConfigBoolValues.CTRL_INFO_FOR_EXTRA_INFO.isEnabled()){ if(ConfigBoolValues.CTRL_INFO_FOR_EXTRA_INFO.isEnabled()){
event.toolTip.add(EnumChatFormatting.DARK_GRAY+""+EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".ctrlForMoreInfo.desc")); event.toolTip.add(TextFormatting.DARK_GRAY+""+TextFormatting .ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".ctrlForMoreInfo.desc"));
} }
} }
} }

View file

@ -21,7 +21,7 @@ import de.ellpeck.actuallyadditions.mod.util.Util;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.BiomeGenOcean; import net.minecraft.world.biome.BiomeGenOcean;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.common.eventhandler.Event;
@ -34,7 +34,7 @@ public class WorldDecorationEvent{
@SubscribeEvent @SubscribeEvent
public void onWorldDecoration(DecorateBiomeEvent.Decorate event){ public void onWorldDecoration(DecorateBiomeEvent.Decorate event){
if((event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT)){ if((event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT)){
if(Util.arrayContains(ConfigValues.plantDimensionBlacklist, event.world.provider.getDimensionId()) < 0){ if(Util.arrayContains(ConfigValues.plantDimensionBlacklist, event.world.provider.getDimension()) < 0){
this.generateRice(event); 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.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); this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.FLAX.ordinal(), ConfigIntValues.FLAX_AMOUNT.getValue(), ConfigBoolValues.DO_FLAX_GEN.isEnabled(), Material.grass, event);
@ -50,7 +50,7 @@ public class WorldDecorationEvent{
if(event.world.getBiomeGenForCoords(randomPos) instanceof BiomeGenOcean){ if(event.world.getBiomeGenForCoords(randomPos) instanceof BiomeGenOcean){
if(randomPos.getY() >= 25 && randomPos.getY() <= 45){ if(randomPos.getY() >= 25 && randomPos.getY() <= 45){
if(PosUtil.getBlock(randomPos, event.world).getMaterial() == Material.water){ if(PosUtil.getBlock(randomPos, event.world).getMaterial(event.world.getBlockState(randomPos)) == Material.water){
if(PosUtil.getMaterial(PosUtil.offset(randomPos, 0, -1, 0), event.world).isSolid()){ if(PosUtil.getMaterial(PosUtil.offset(randomPos, 0, -1, 0), event.world).isSolid()){
PosUtil.setBlock(randomPos, event.world, InitBlocks.blockTreasureChest, event.rand.nextInt(4), 2); PosUtil.setBlock(randomPos, event.world, InitBlocks.blockTreasureChest, event.rand.nextInt(4), 2);
} }

View file

@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheJams;
import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList; import net.minecraft.village.MerchantRecipeList;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;

View file

@ -17,12 +17,13 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.pattern.BlockHelper; import net.minecraft.block.state.pattern.BlockMatcher;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldType; import net.minecraft.world.WorldType;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraftforge.fml.common.IWorldGenerator; import net.minecraftforge.fml.common.IWorldGenerator;
@ -41,9 +42,9 @@ public class OreGen implements IWorldGenerator{
} }
@Override @Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){
if(world.getWorldType() != WorldType.FLAT && Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.getDimensionId()) < 0){ if(world.getWorldType() != WorldType.FLAT && Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.getDimension()) < 0){
switch(world.provider.getDimensionId()){ switch(world.provider.getDimension()){
case -1: case -1:
generateNether(world, random, chunkX*16, chunkZ*16); generateNether(world, random, chunkX*16, chunkZ*16);
//case 0: //case 0:
@ -79,7 +80,7 @@ public class OreGen implements IWorldGenerator{
int posX = blockXPos+random.nextInt(16); int posX = blockXPos+random.nextInt(16);
int posY = minY+random.nextInt(yDiff); int posY = minY+random.nextInt(yDiff);
int posZ = blockZPos+random.nextInt(16); int posZ = blockZPos+random.nextInt(16);
new WorldGenMinable(block.getStateFromMeta(meta), maxVeinSize, BlockHelper.forBlock(blockIn)).generate(world, random, new BlockPos(posX, posY, posZ)); new WorldGenMinable(block.getStateFromMeta(meta), maxVeinSize, BlockMatcher.forBlock(blockIn)).generate(world, random, new BlockPos(posX, posY, posZ));
} }
} }
else{ else{

View file

@ -21,7 +21,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IChatComponent; import net.minecraft.util.text.ITextComponent;
@InventoryContainer @InventoryContainer
public class ContainerDrill extends Container{ public class ContainerDrill extends Container{
@ -119,7 +119,8 @@ public class ContainerDrill extends Container{
return null; return null;
} }
@Override //TODO Fix slotClick()
/*@Override
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){ public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){
//par3 appears to be the type of clicking //par3 appears to be the type of clicking
//par3 == 2 appears to be one of the number keys being hit //par3 == 2 appears to be one of the number keys being hit
@ -129,7 +130,7 @@ public class ContainerDrill extends Container{
else{ else{
return super.slotClick(par1, par2, par3, player); return super.slotClick(par1, par2, par3, player);
} }
} }*/
@Override @Override
public void onContainerClosed(EntityPlayer player){ public void onContainerClosed(EntityPlayer player){
@ -160,7 +161,7 @@ public class ContainerDrill extends Container{
} }
@Override @Override
public IChatComponent getDisplayName(){ public ITextComponent getDisplayName(){
return null; return null;
} }

View file

@ -50,7 +50,7 @@ public class ContainerEnergizer extends Container{
this.addSlotToContainer(new Slot(inventory, inventory.getSizeInventory()-1-i, 102, 19+i*18){ this.addSlotToContainer(new Slot(inventory, inventory.getSizeInventory()-1-i, 102, 19+i*18){
@Override @Override
public boolean isItemValid(ItemStack stack){ public boolean isItemValid(ItemStack stack){
return stack != null && stack.getItem().isValidArmor(stack, finalI, finalPlayer); return stack != null && stack.getItem().isValidArmor(stack, ContainerEnervator.ARMOR_SLOTS[finalI], finalPlayer);
} }
@Override @Override

View file

@ -18,6 +18,7 @@ import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -29,6 +30,8 @@ public class ContainerEnervator extends Container{
private TileEntityEnervator enervator; private TileEntityEnervator enervator;
public static final EntityEquipmentSlot[] ARMOR_SLOTS = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET};
public ContainerEnervator(EntityPlayer player, TileEntityBase tile){ public ContainerEnervator(EntityPlayer player, TileEntityBase tile){
this.enervator = (TileEntityEnervator)tile; this.enervator = (TileEntityEnervator)tile;
InventoryPlayer inventory = player.inventory; InventoryPlayer inventory = player.inventory;
@ -50,7 +53,7 @@ public class ContainerEnervator extends Container{
this.addSlotToContainer(new Slot(inventory, inventory.getSizeInventory()-1-i, 102, 19+i*18){ this.addSlotToContainer(new Slot(inventory, inventory.getSizeInventory()-1-i, 102, 19+i*18){
@Override @Override
public boolean isItemValid(ItemStack stack){ public boolean isItemValid(ItemStack stack){
return stack != null && stack.getItem().isValidArmor(stack, finalI, finalPlayer); return stack != null && stack.getItem().isValidArmor(stack, ARMOR_SLOTS[finalI], finalPlayer);
} }
@Override @Override

View file

@ -103,7 +103,8 @@ public class ContainerInputter extends Container{
return null; return null;
} }
@Override //TODO slotClick()
/*@Override
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){ public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){
if(par1 >= 0 && par1 < this.inventorySlots.size() && this.getSlot(par1) instanceof SlotFilter){ if(par1 >= 0 && par1 < this.inventorySlots.size() && this.getSlot(par1) instanceof SlotFilter){
//Calls the Filter's SlotClick function //Calls the Filter's SlotClick function
@ -112,7 +113,7 @@ public class ContainerInputter extends Container{
else{ else{
return super.slotClick(par1, par2, par3, player); return super.slotClick(par1, par2, par3, player);
} }
} }*/
@Override @Override
public boolean canInteractWith(EntityPlayer player){ public boolean canInteractWith(EntityPlayer player){

View file

@ -98,7 +98,8 @@ public class ContainerRangedCollector extends Container{
return null; return null;
} }
@Override //TODO Find a replacement for slotClick()
/*@Override
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){ public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){
if(par1 >= 0 && par1 < this.inventorySlots.size() && this.getSlot(par1) instanceof SlotFilter){ if(par1 >= 0 && par1 < this.inventorySlots.size() && this.getSlot(par1) instanceof SlotFilter){
//Calls the Filter's SlotClick function //Calls the Filter's SlotClick function
@ -107,7 +108,7 @@ public class ContainerRangedCollector extends Container{
else{ else{
return super.slotClick(par1, par2, par3, player); return super.slotClick(par1, par2, par3, player);
} }
} }*/
@Override @Override
public boolean canInteractWith(EntityPlayer player){ public boolean canInteractWith(EntityPlayer player){

View file

@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.gui.*;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler; import net.minecraftforge.fml.common.network.IGuiHandler;
import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.NetworkRegistry;

View file

@ -25,8 +25,8 @@ import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -128,14 +128,14 @@ public class GuiInputter extends GuiContainer{
String text1 = this.tileInputter.isPullWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.blacklist"); String text1 = this.tileInputter.isPullWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.blacklist");
if(x >= guiLeft+3 && y >= guiTop+16 && x <= guiLeft+18 && y <= guiTop+31){ if(x >= guiLeft+3 && y >= guiTop+16 && x <= guiLeft+18 && y <= guiTop+31){
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
list.add(EnumChatFormatting.BOLD+text1); list.add(TextFormatting.BOLD+text1);
list.addAll(infoList); list.addAll(infoList);
this.drawHoveringText(list, x, y); this.drawHoveringText(list, x, y);
} }
String text2 = this.tileInputter.isPutWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.blacklist"); String text2 = this.tileInputter.isPutWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.blacklist");
if(x >= guiLeft+157 && y >= guiTop+16 && x <= guiLeft+172 && y <= guiTop+31){ if(x >= guiLeft+157 && y >= guiTop+16 && x <= guiLeft+172 && y <= guiTop+31){
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
list.add(EnumChatFormatting.BOLD+text2); list.add(TextFormatting.BOLD+text2);
list.addAll(infoList); list.addAll(infoList);
this.drawHoveringText(list, x, y); this.drawHoveringText(list, x, y);
} }

View file

@ -22,8 +22,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -75,7 +75,7 @@ public class GuiSmileyCloud extends GuiContainer{
@Override @Override
public void drawGuiContainerForegroundLayer(int x, int y){ public void drawGuiContainerForegroundLayer(int x, int y){
String name = cloud.name == null || cloud.name.isEmpty() ? "" : EnumChatFormatting.GOLD+cloud.name+EnumChatFormatting.RESET+" "+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.the")+" "; String name = cloud.name == null || cloud.name.isEmpty() ? "" : TextFormatting.GOLD+cloud.name+TextFormatting.RESET+" "+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.the")+" ";
String localizedName = name+StringUtil.localize("container."+ModUtil.MOD_ID_LOWER+".cloud.name"); String localizedName = name+StringUtil.localize("container."+ModUtil.MOD_ID_LOWER+".cloud.name");
this.fontRendererObj.drawString(localizedName, xSize/2-this.fontRendererObj.getStringWidth(localizedName)/2, -10, StringUtil.DECIMAL_COLOR_WHITE); this.fontRendererObj.drawString(localizedName, xSize/2-this.fontRendererObj.getStringWidth(localizedName)/2, -10, StringUtil.DECIMAL_COLOR_WHITE);
} }

View file

@ -14,7 +14,6 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigCrafting; import de.ellpeck.actuallyadditions.mod.config.values.ConfigCrafting;
import de.ellpeck.actuallyadditions.mod.crafting.ToolCrafting; import de.ellpeck.actuallyadditions.mod.crafting.ToolCrafting;
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab; import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
import de.ellpeck.actuallyadditions.mod.items.base.ItemAllToolAA;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.RecipeUtil; import de.ellpeck.actuallyadditions.mod.util.RecipeUtil;

View file

@ -220,18 +220,18 @@ public class InitItems{
itemGrowthRing = new ItemGrowthRing("itemGrowthRing"); itemGrowthRing = new ItemGrowthRing("itemGrowthRing");
itemMagnetRing = new ItemMagnetRing("itemSuctionRing"); itemMagnetRing = new ItemMagnetRing("itemSuctionRing");
itemWaterRemovalRing = new ItemWaterRemovalRing("itemWaterRemovalRing"); itemWaterRemovalRing = new ItemWaterRemovalRing("itemWaterRemovalRing");
itemHelmEmerald = new ItemArmorAA("itemHelmEmerald", InitArmorMaterials.armorMaterialEmerald, 0, new ItemStack(Items.emerald), "armorEmerald"); itemHelmEmerald = new ItemArmorAA("itemHelmEmerald", InitArmorMaterials.armorMaterialEmerald, 0, new ItemStack(Items.emerald));
itemChestEmerald = new ItemArmorAA("itemChestEmerald", InitArmorMaterials.armorMaterialEmerald, 1, new ItemStack(Items.emerald), "armorEmerald"); itemChestEmerald = new ItemArmorAA("itemChestEmerald", InitArmorMaterials.armorMaterialEmerald, 1, new ItemStack(Items.emerald));
itemPantsEmerald = new ItemArmorAA("itemPantsEmerald", InitArmorMaterials.armorMaterialEmerald, 2, new ItemStack(Items.emerald), "armorEmerald"); itemPantsEmerald = new ItemArmorAA("itemPantsEmerald", InitArmorMaterials.armorMaterialEmerald, 2, new ItemStack(Items.emerald));
itemBootsEmerald = new ItemArmorAA("itemBootsEmerald", InitArmorMaterials.armorMaterialEmerald, 3, new ItemStack(Items.emerald), "armorEmerald"); itemBootsEmerald = new ItemArmorAA("itemBootsEmerald", InitArmorMaterials.armorMaterialEmerald, 3, new ItemStack(Items.emerald));
itemHelmObsidian = new ItemArmorAA("itemHelmObsidian", InitArmorMaterials.armorMaterialObsidian, 0, new ItemStack(Blocks.obsidian), "armorObsidian"); itemHelmObsidian = new ItemArmorAA("itemHelmObsidian", InitArmorMaterials.armorMaterialObsidian, 0, new ItemStack(Blocks.obsidian));
itemChestObsidian = new ItemArmorAA("itemChestObsidian", InitArmorMaterials.armorMaterialObsidian, 1, new ItemStack(Blocks.obsidian), "armorObsidian"); itemChestObsidian = new ItemArmorAA("itemChestObsidian", InitArmorMaterials.armorMaterialObsidian, 1, new ItemStack(Blocks.obsidian));
itemPantsObsidian = new ItemArmorAA("itemPantsObsidian", InitArmorMaterials.armorMaterialObsidian, 2, new ItemStack(Blocks.obsidian), "armorObsidian"); itemPantsObsidian = new ItemArmorAA("itemPantsObsidian", InitArmorMaterials.armorMaterialObsidian, 2, new ItemStack(Blocks.obsidian));
itemBootsObsidian = new ItemArmorAA("itemBootsObsidian", InitArmorMaterials.armorMaterialObsidian, 3, new ItemStack(Blocks.obsidian), "armorObsidian"); itemBootsObsidian = new ItemArmorAA("itemBootsObsidian", InitArmorMaterials.armorMaterialObsidian, 3, new ItemStack(Blocks.obsidian));
itemHelmQuartz = new ItemArmorAA("itemHelmQuartz", InitArmorMaterials.armorMaterialQuartz, 0, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz"); itemHelmQuartz = new ItemArmorAA("itemHelmQuartz", InitArmorMaterials.armorMaterialQuartz, 0, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()));
itemChestQuartz = new ItemArmorAA("itemChestQuartz", InitArmorMaterials.armorMaterialQuartz, 1, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz"); itemChestQuartz = new ItemArmorAA("itemChestQuartz", InitArmorMaterials.armorMaterialQuartz, 1, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()));
itemPantsQuartz = new ItemArmorAA("itemPantsQuartz", InitArmorMaterials.armorMaterialQuartz, 2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz"); itemPantsQuartz = new ItemArmorAA("itemPantsQuartz", InitArmorMaterials.armorMaterialQuartz, 2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()));
itemBootsQuartz = new ItemArmorAA("itemBootsQuartz", InitArmorMaterials.armorMaterialQuartz, 3, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz"); itemBootsQuartz = new ItemArmorAA("itemBootsQuartz", InitArmorMaterials.armorMaterialQuartz, 3, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()));
itemTeleStaff = new ItemTeleStaff("itemTeleStaff"); itemTeleStaff = new ItemTeleStaff("itemTeleStaff");
itemWingsOfTheBats = new ItemWingsOfTheBats("itemWingsOfTheBats"); itemWingsOfTheBats = new ItemWingsOfTheBats("itemWingsOfTheBats");
itemDrill = new ItemDrill("itemDrill"); itemDrill = new ItemDrill("itemDrill");
@ -296,7 +296,7 @@ public class InitItems{
stonePaxel = new ItemAllToolAA(Item.ToolMaterial.STONE, new ItemStack(Blocks.cobblestone), "stonePaxel", EnumRarity.UNCOMMON, 7040621); stonePaxel = new ItemAllToolAA(Item.ToolMaterial.STONE, new ItemStack(Blocks.cobblestone), "stonePaxel", EnumRarity.UNCOMMON, 7040621);
ironPaxel = new ItemAllToolAA(Item.ToolMaterial.IRON, new ItemStack(Items.iron_ingot), "ironPaxel", EnumRarity.RARE, 10920613); ironPaxel = new ItemAllToolAA(Item.ToolMaterial.IRON, new ItemStack(Items.iron_ingot), "ironPaxel", EnumRarity.RARE, 10920613);
goldPaxel = new ItemAllToolAA(Item.ToolMaterial.GOLD, new ItemStack(Items.gold_ingot), "goldPaxel", EnumRarity.RARE, 16770048); goldPaxel = new ItemAllToolAA(Item.ToolMaterial.GOLD, new ItemStack(Items.gold_ingot), "goldPaxel", EnumRarity.RARE, 16770048);
diamondPaxel = new ItemAllToolAA(Item.ToolMaterial.EMERALD, new ItemStack(Items.diamond), "diamondPaxel", EnumRarity.EPIC, 3250376); diamondPaxel = new ItemAllToolAA(Item.ToolMaterial.DIAMOND, new ItemStack(Items.diamond), "diamondPaxel", EnumRarity.EPIC, 3250376);
emeraldPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "emeraldPaxel", EnumRarity.EPIC, 7723338); emeraldPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "emeraldPaxel", EnumRarity.EPIC, 7723338);
obsidianPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "obsidianPaxel", EnumRarity.EPIC, 4166); obsidianPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "obsidianPaxel", EnumRarity.EPIC, 4166);
quartzPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialQuartz, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "quartzPaxel", EnumRarity.RARE, 1710103); quartzPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialQuartz, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "quartzPaxel", EnumRarity.RARE, 1710103);
@ -306,10 +306,10 @@ public class InitItems{
itemShovelCrystalRed = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemShovelCrystalRed", Util.CRYSTAL_RED_RARITY); itemShovelCrystalRed = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemShovelCrystalRed", Util.CRYSTAL_RED_RARITY);
itemSwordCrystalRed = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemSwordCrystalRed", Util.CRYSTAL_RED_RARITY); itemSwordCrystalRed = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemSwordCrystalRed", Util.CRYSTAL_RED_RARITY);
itemHoeCrystalRed = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemHoeCrystalRed", Util.CRYSTAL_RED_RARITY); itemHoeCrystalRed = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemHoeCrystalRed", Util.CRYSTAL_RED_RARITY);
itemHelmCrystalRed = new ItemArmorAA("itemHelmCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "armorCrystalRed", Util.CRYSTAL_RED_RARITY); itemHelmCrystalRed = new ItemArmorAA("itemHelmCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), Util.CRYSTAL_RED_RARITY);
itemChestCrystalRed = new ItemArmorAA("itemChestCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "armorCrystalRed", Util.CRYSTAL_RED_RARITY); itemChestCrystalRed = new ItemArmorAA("itemChestCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), Util.CRYSTAL_RED_RARITY);
itemPantsCrystalRed = new ItemArmorAA("itemPantsCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "armorCrystalRed", Util.CRYSTAL_RED_RARITY); itemPantsCrystalRed = new ItemArmorAA("itemPantsCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), Util.CRYSTAL_RED_RARITY);
itemBootsCrystalRed = new ItemArmorAA("itemBootsCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "armorCrystalRed", Util.CRYSTAL_RED_RARITY); itemBootsCrystalRed = new ItemArmorAA("itemBootsCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), Util.CRYSTAL_RED_RARITY);
itemPaxelCrystalRed = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemPaxelCrystalRed", Util.CRYSTAL_RED_RARITY, 16711689); itemPaxelCrystalRed = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemPaxelCrystalRed", Util.CRYSTAL_RED_RARITY, 16711689);
itemPickaxeCrystalBlue = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemPickaxeCrystalBlue", Util.CRYSTAL_BLUE_RARITY); itemPickaxeCrystalBlue = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemPickaxeCrystalBlue", Util.CRYSTAL_BLUE_RARITY);
@ -317,10 +317,10 @@ public class InitItems{
itemShovelCrystalBlue = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemShovelCrystalBlue", Util.CRYSTAL_BLUE_RARITY); itemShovelCrystalBlue = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemShovelCrystalBlue", Util.CRYSTAL_BLUE_RARITY);
itemSwordCrystalBlue = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemSwordCrystalBlue", Util.CRYSTAL_BLUE_RARITY); itemSwordCrystalBlue = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemSwordCrystalBlue", Util.CRYSTAL_BLUE_RARITY);
itemHoeCrystalBlue = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemHoeCrystalBlue", Util.CRYSTAL_BLUE_RARITY); itemHoeCrystalBlue = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemHoeCrystalBlue", Util.CRYSTAL_BLUE_RARITY);
itemHelmCrystalBlue = new ItemArmorAA("itemHelmCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "armorCrystalBlue", Util.CRYSTAL_BLUE_RARITY); itemHelmCrystalBlue = new ItemArmorAA("itemHelmCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), Util.CRYSTAL_BLUE_RARITY);
itemChestCrystalBlue = new ItemArmorAA("itemChestCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "armorCrystalBlue", Util.CRYSTAL_BLUE_RARITY); itemChestCrystalBlue = new ItemArmorAA("itemChestCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), Util.CRYSTAL_BLUE_RARITY);
itemPantsCrystalBlue = new ItemArmorAA("itemPantsCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "armorCrystalBlue", Util.CRYSTAL_BLUE_RARITY); itemPantsCrystalBlue = new ItemArmorAA("itemPantsCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), Util.CRYSTAL_BLUE_RARITY);
itemBootsCrystalBlue = new ItemArmorAA("itemBootsCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "armorCrystalBlue", Util.CRYSTAL_BLUE_RARITY); itemBootsCrystalBlue = new ItemArmorAA("itemBootsCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), Util.CRYSTAL_BLUE_RARITY);
itemPaxelCrystalBlue = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemPaxelCrystalBlue", Util.CRYSTAL_BLUE_RARITY, 3014911); itemPaxelCrystalBlue = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemPaxelCrystalBlue", Util.CRYSTAL_BLUE_RARITY, 3014911);
itemPickaxeCrystalLightBlue = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemPickaxeCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); itemPickaxeCrystalLightBlue = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemPickaxeCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY);
@ -328,10 +328,10 @@ public class InitItems{
itemShovelCrystalLightBlue = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemShovelCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); itemShovelCrystalLightBlue = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemShovelCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY);
itemSwordCrystalLightBlue = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemSwordCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); itemSwordCrystalLightBlue = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemSwordCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY);
itemHoeCrystalLightBlue = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemHoeCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); itemHoeCrystalLightBlue = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemHoeCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY);
itemHelmCrystalLightBlue = new ItemArmorAA("itemHelmCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "armorCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); itemHelmCrystalLightBlue = new ItemArmorAA("itemHelmCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), Util.CRYSTAL_LIGHT_BLUE_RARITY);
itemChestCrystalLightBlue = new ItemArmorAA("itemChestCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "armorCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); itemChestCrystalLightBlue = new ItemArmorAA("itemChestCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), Util.CRYSTAL_LIGHT_BLUE_RARITY);
itemPantsCrystalLightBlue = new ItemArmorAA("itemPantsCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "armorCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); itemPantsCrystalLightBlue = new ItemArmorAA("itemPantsCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), Util.CRYSTAL_LIGHT_BLUE_RARITY);
itemBootsCrystalLightBlue = new ItemArmorAA("itemBootsCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "armorCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); itemBootsCrystalLightBlue = new ItemArmorAA("itemBootsCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), Util.CRYSTAL_LIGHT_BLUE_RARITY);
itemPaxelCrystalLightBlue = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemPaxelCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY, 4093108); itemPaxelCrystalLightBlue = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemPaxelCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY, 4093108);
itemPickaxeCrystalBlack = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemPickaxeCrystalBlack", Util.CRYSTAL_BLACK_RARITY); itemPickaxeCrystalBlack = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemPickaxeCrystalBlack", Util.CRYSTAL_BLACK_RARITY);
@ -339,10 +339,10 @@ public class InitItems{
itemShovelCrystalBlack = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemShovelCrystalBlack", Util.CRYSTAL_BLACK_RARITY); itemShovelCrystalBlack = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemShovelCrystalBlack", Util.CRYSTAL_BLACK_RARITY);
itemSwordCrystalBlack = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemSwordCrystalBlack", Util.CRYSTAL_BLACK_RARITY); itemSwordCrystalBlack = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemSwordCrystalBlack", Util.CRYSTAL_BLACK_RARITY);
itemHoeCrystalBlack = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemHoeCrystalBlack", Util.CRYSTAL_BLACK_RARITY); itemHoeCrystalBlack = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemHoeCrystalBlack", Util.CRYSTAL_BLACK_RARITY);
itemHelmCrystalBlack = new ItemArmorAA("itemHelmCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "armorCrystalBlack", Util.CRYSTAL_BLACK_RARITY); itemHelmCrystalBlack = new ItemArmorAA("itemHelmCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), Util.CRYSTAL_BLACK_RARITY);
itemChestCrystalBlack = new ItemArmorAA("itemChestCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "armorCrystalBlack", Util.CRYSTAL_BLACK_RARITY); itemChestCrystalBlack = new ItemArmorAA("itemChestCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), Util.CRYSTAL_BLACK_RARITY);
itemPantsCrystalBlack = new ItemArmorAA("itemPantsCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "armorCrystalBlack", Util.CRYSTAL_BLACK_RARITY); itemPantsCrystalBlack = new ItemArmorAA("itemPantsCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), Util.CRYSTAL_BLACK_RARITY);
itemBootsCrystalBlack = new ItemArmorAA("itemBootsCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "armorCrystalBlack", Util.CRYSTAL_BLACK_RARITY); itemBootsCrystalBlack = new ItemArmorAA("itemBootsCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), Util.CRYSTAL_BLACK_RARITY);
itemPaxelCrystalBlack = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemPaxelCrystalBlack", Util.CRYSTAL_BLACK_RARITY, 2631982); itemPaxelCrystalBlack = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemPaxelCrystalBlack", Util.CRYSTAL_BLACK_RARITY, 2631982);
itemPickaxeCrystalGreen = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemPickaxeCrystalGreen", Util.CRYSTAL_GREEN_RARITY); itemPickaxeCrystalGreen = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemPickaxeCrystalGreen", Util.CRYSTAL_GREEN_RARITY);
@ -350,10 +350,10 @@ public class InitItems{
itemShovelCrystalGreen = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemShovelCrystalGreen", Util.CRYSTAL_GREEN_RARITY); itemShovelCrystalGreen = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemShovelCrystalGreen", Util.CRYSTAL_GREEN_RARITY);
itemSwordCrystalGreen = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemSwordCrystalGreen", Util.CRYSTAL_GREEN_RARITY); itemSwordCrystalGreen = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemSwordCrystalGreen", Util.CRYSTAL_GREEN_RARITY);
itemHoeCrystalGreen = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemHoeCrystalGreen", Util.CRYSTAL_GREEN_RARITY); itemHoeCrystalGreen = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemHoeCrystalGreen", Util.CRYSTAL_GREEN_RARITY);
itemHelmCrystalGreen = new ItemArmorAA("itemHelmCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "armorCrystalGreen", Util.CRYSTAL_GREEN_RARITY); itemHelmCrystalGreen = new ItemArmorAA("itemHelmCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), Util.CRYSTAL_GREEN_RARITY);
itemChestCrystalGreen = new ItemArmorAA("itemChestCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "armorCrystalGreen", Util.CRYSTAL_GREEN_RARITY); itemChestCrystalGreen = new ItemArmorAA("itemChestCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), Util.CRYSTAL_GREEN_RARITY);
itemPantsCrystalGreen = new ItemArmorAA("itemPantsCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "armorCrystalGreen", Util.CRYSTAL_GREEN_RARITY); itemPantsCrystalGreen = new ItemArmorAA("itemPantsCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), Util.CRYSTAL_GREEN_RARITY);
itemBootsCrystalGreen = new ItemArmorAA("itemBootsCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "armorCrystalGreen", Util.CRYSTAL_GREEN_RARITY); itemBootsCrystalGreen = new ItemArmorAA("itemBootsCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), Util.CRYSTAL_GREEN_RARITY);
itemPaxelCrystalGreen = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemPaxelCrystalGreen", Util.CRYSTAL_GREEN_RARITY, 46848); itemPaxelCrystalGreen = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemPaxelCrystalGreen", Util.CRYSTAL_GREEN_RARITY, 46848);
itemPickaxeCrystalWhite = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemPickaxeCrystalWhite", Util.CRYSTAL_WHITE_RARITY); itemPickaxeCrystalWhite = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemPickaxeCrystalWhite", Util.CRYSTAL_WHITE_RARITY);
@ -361,10 +361,10 @@ public class InitItems{
itemShovelCrystalWhite = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemShovelCrystalWhite", Util.CRYSTAL_WHITE_RARITY); itemShovelCrystalWhite = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemShovelCrystalWhite", Util.CRYSTAL_WHITE_RARITY);
itemSwordCrystalWhite = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemSwordCrystalWhite", Util.CRYSTAL_WHITE_RARITY); itemSwordCrystalWhite = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemSwordCrystalWhite", Util.CRYSTAL_WHITE_RARITY);
itemHoeCrystalWhite = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemHoeCrystalWhite", Util.CRYSTAL_WHITE_RARITY); itemHoeCrystalWhite = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemHoeCrystalWhite", Util.CRYSTAL_WHITE_RARITY);
itemHelmCrystalWhite = new ItemArmorAA("itemHelmCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "armorCrystalWhite", Util.CRYSTAL_WHITE_RARITY); itemHelmCrystalWhite = new ItemArmorAA("itemHelmCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),Util.CRYSTAL_WHITE_RARITY);
itemChestCrystalWhite = new ItemArmorAA("itemChestCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "armorCrystalWhite", Util.CRYSTAL_WHITE_RARITY); itemChestCrystalWhite = new ItemArmorAA("itemChestCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), Util.CRYSTAL_WHITE_RARITY);
itemPantsCrystalWhite = new ItemArmorAA("itemPantsCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "armorCrystalWhite", Util.CRYSTAL_WHITE_RARITY); itemPantsCrystalWhite = new ItemArmorAA("itemPantsCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), Util.CRYSTAL_WHITE_RARITY);
itemBootsCrystalWhite = new ItemArmorAA("itemBootsCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "armorCrystalWhite", Util.CRYSTAL_WHITE_RARITY); itemBootsCrystalWhite = new ItemArmorAA("itemBootsCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), Util.CRYSTAL_WHITE_RARITY);
itemPaxelCrystalWhite = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemPaxelCrystalWhite", Util.CRYSTAL_WHITE_RARITY, 14606302); itemPaxelCrystalWhite = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemPaxelCrystalWhite", Util.CRYSTAL_WHITE_RARITY, 14606302);
} }
} }

View file

@ -0,0 +1,108 @@
/*
* This file ("ItemAllToolAA.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense/
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA;
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.HashSet;
import java.util.Set;
@SuppressWarnings("unchecked")
public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem{
public final int color;
public ItemAllToolAA(ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity, int color){
super(4.0F, -2F, toolMat, repairItem, unlocalizedName, rarity, new HashSet<Block>());
this.color = color;
}
public ItemAllToolAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity, int color){
super(4.0F, -2F, toolMat, repairItem, unlocalizedName, rarity, new HashSet<Block>());
this.color = color;
}
protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID_LOWER, "itemPaxel"));
ActuallyAdditions.proxy.addRenderVariant(this, new ResourceLocation(ModUtil.MOD_ID_LOWER, "itemPaxel"));
}
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ){
return Items.iron_hoe.onItemUse(stack, playerIn, worldIn, pos, hand, side, hitX, hitY, hitZ);
}
@Override
public boolean canHarvestBlock(IBlockState state, ItemStack stack){
return this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getMaterial(state).isToolNotRequired() || (state.getBlock() == Blocks.snow_layer || state.getBlock()== Blocks.snow || (state.getBlock()== Blocks.obsidian ? this.toolMaterial.getHarvestLevel() >= 3 : (state.getBlock()!= Blocks.diamond_block && state.getBlock()!= Blocks.diamond_ore ? (state.getBlock()!= Blocks.emerald_ore && state.getBlock()!= Blocks.emerald_block? (state.getBlock()!= Blocks.gold_block&& state.getBlock()!= Blocks.gold_ore ? (state.getBlock()!= Blocks.iron_block&& state.getBlock()!= Blocks.iron_ore ? (state.getBlock()!= Blocks.lapis_block&& state.getBlock()!= Blocks.lapis_ore ? (state.getBlock()!= Blocks.redstone_ore && state.getBlock()!= Blocks.lit_redstone_ore ? (state.getBlock().getMaterial(state) == Material.rock || (state.getBlock().getMaterial(state) == Material.iron || state.getBlock().getMaterial(state) == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2)));
}
private boolean hasExtraWhitelist(Block block){
String name = block.getRegistryName();
if(name != null){
for(String list : ConfigValues.paxelExtraMiningWhitelist){
if(list.equals(name)){
return true;
}
}
}
return false;
}
@Override
public Set<String> getToolClasses(ItemStack stack){
HashSet<String> hashSet = new HashSet<String>();
hashSet.add("pickaxe");
hashSet.add("axe");
hashSet.add("shovel");
return hashSet;
}
@Override
public float getStrVsBlock(ItemStack stack, IBlockState state){
return this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state)) ? this.efficiencyOnProperMaterial : 1.0F;
}
@SideOnly(Side.CLIENT)
@Override
public IItemColor getColor(){
return new IItemColor(){
@Override
public int getColorFromItemstack(ItemStack stack, int pass){
return pass > 0 ? color : 0xFFFFFF;
}
};
}
}

View file

@ -0,0 +1,41 @@
/*
* This file ("ItemAxeAA.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense/
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
import com.google.common.collect.Sets;
import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
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.ItemStack;
import java.util.Set;
public class ItemAxeAA extends ItemToolAA{
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.log2, Blocks.chest, Blocks.pumpkin, Blocks.lit_pumpkin, Blocks.melon_block, Blocks.ladder, Blocks.wooden_button, Blocks.wooden_pressure_plate);
public ItemAxeAA(Item.ToolMaterial material, String repairItem, String unlocalizedName, EnumRarity rarity){
super(6.0F, -3.0F, material, repairItem, unlocalizedName, rarity, EFFECTIVE_ON);
}
public ItemAxeAA(Item.ToolMaterial material, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
super(6.0F, -3.0F, material, repairItem, unlocalizedName, rarity, EFFECTIVE_ON);
}
public float getStrVsBlock(ItemStack stack, IBlockState state){
Material material = state.getMaterial();
return material != Material.wood && material != Material.plants && material != Material.vine ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
}
}

View file

@ -31,10 +31,13 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler; import net.minecraft.profiler.Profiler;
import net.minecraft.util.BlockPos; import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -53,7 +56,7 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
} }
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing face, float hitX, float hitY, float hitZ){ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitX, float hitY, float hitZ){
if(player.isSneaking()){ if(player.isSneaking()){
Block block = PosUtil.getBlock(pos, world); Block block = PosUtil.getBlock(pos, world);
ItemStack blockStack = new ItemStack(block, 1, PosUtil.getMetadata(pos, world)); ItemStack blockStack = new ItemStack(block, 1, PosUtil.getMetadata(pos, world));
@ -63,22 +66,22 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
if(world.isRemote){ if(world.isRemote){
forcedEntry = new EntrySet(page, page.getChapter(), page.getChapter().getEntry(), ActuallyAdditionsAPI.bookletEntries.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1); forcedEntry = new EntrySet(page, page.getChapter(), page.getChapter().getEntry(), ActuallyAdditionsAPI.bookletEntries.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1);
} }
this.onItemRightClick(stack, world, player); this.onItemRightClick(stack, world, player, hand);
return true; return EnumActionResult.SUCCESS;
} }
} }
} }
return false; return EnumActionResult.FAIL;
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ); player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ);
if(!world.isRemote){ if(!world.isRemote){
player.triggerAchievement(TheAchievements.OPEN_BOOKLET.ach); player.addStat(TheAchievements.OPEN_BOOKLET.ach);
} }
return stack; return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -93,10 +96,10 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
} }
@Override @Override
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){ public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){
if(posHit != null){ if(posHit != null){
Block block = PosUtil.getBlock(posHit.getBlockPos(), minecraft.theWorld); Block block = PosUtil.getBlock(posHit.getBlockPos(), minecraft.theWorld);
if(block != null && !block.isAir(minecraft.theWorld, posHit.getBlockPos())){ if(block != null && !block.isAir(minecraft.theWorld.getBlockState(posHit.getBlockPos()), minecraft.theWorld, posHit.getBlockPos())){
ItemStack blockStack = new ItemStack(block, 1, PosUtil.getMetadata(posHit.getBlockPos(), minecraft.theWorld)); ItemStack blockStack = new ItemStack(block, 1, PosUtil.getMetadata(posHit.getBlockPos(), minecraft.theWorld));
if(blockStack != null){ if(blockStack != null){
int height = resolution.getScaledHeight()/5*3; int height = resolution.getScaledHeight()/5*3;
@ -108,17 +111,17 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{
String strg3 = "Right-Click to open..."; 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); AssetUtil.renderStackToGui(page.getChapter().getDisplayItemStack() != null ? page.getChapter().getDisplayItemStack() : new ItemStack(InitItems.itemBooklet), resolution.getScaledWidth()/2-10, height+41, 1F);
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(TextFormatting.YELLOW+""+TextFormatting.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(TextFormatting.YELLOW+""+TextFormatting.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); minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.GOLD+strg3, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg3)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE);
} }
else{ else{
String strg = EnumChatFormatting.DARK_RED+"No Info available! Sorry :("; String strg = TextFormatting.DARK_RED+"No Info available! Sorry :(";
minecraft.fontRendererObj.drawStringWithShadow(strg, resolution.getScaledWidth()/2-minecraft.fontRendererObj.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{ else{
String strg = EnumChatFormatting.DARK_GREEN+""+EnumChatFormatting.ITALIC+"Sneak!"; String strg = TextFormatting.DARK_GREEN+""+TextFormatting.ITALIC+"Sneak!";
minecraft.fontRendererObj.drawStringWithShadow(strg, resolution.getScaledWidth()/2-minecraft.fontRendererObj.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);
} }
} }

View file

@ -22,8 +22,10 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.BlockPos; import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class ItemChestToCrateUpgrade extends ItemBase{ public class ItemChestToCrateUpgrade extends ItemBase{
@ -33,7 +35,7 @@ public class ItemChestToCrateUpgrade extends ItemBase{
} }
@Override @Override
public boolean onItemUse(ItemStack heldStack, EntityPlayer player, World world, BlockPos pos, EnumFacing facing, float par8, float par9, float par10){ public EnumActionResult onItemUse(ItemStack heldStack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float par8, float par9, float par10){
if(player.isSneaking()){ if(player.isSneaking()){
TileEntity tileHit = world.getTileEntity(pos); TileEntity tileHit = world.getTileEntity(pos);
Block block = PosUtil.getBlock(pos, world); Block block = PosUtil.getBlock(pos, world);
@ -74,11 +76,11 @@ public class ItemChestToCrateUpgrade extends ItemBase{
heldStack.stackSize--; heldStack.stackSize--;
} }
} }
return true; return EnumActionResult.SUCCESS;
} }
} }
return super.onItemUse(heldStack, player, world, pos, facing, par8, par9, par10); return super.onItemUse(heldStack, player, world, pos, hand, facing, par8, par9, par10);
} }
@Override @Override

View file

@ -18,8 +18,10 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.init.MobEffects;
import net.minecraft.item.EnumAction; import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -54,13 +56,13 @@ public class ItemCoffee extends ItemFoodBase{
} }
} }
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.sugar), new PotionEffect[]{new PotionEffect(Potion.moveSpeed.getId(), 30, 0)}, 4)); ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.sugar), new PotionEffect[]{new PotionEffect(MobEffects.moveSpeed, 30, 0)}, 4));
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.magma_cream), new PotionEffect[]{new PotionEffect(Potion.fireResistance.getId(), 20, 0)}, 2)); ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.magma_cream), new PotionEffect[]{new PotionEffect(MobEffects.fireResistance, 20, 0)}, 2));
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.fish, 1, 3), new PotionEffect[]{new PotionEffect(Potion.waterBreathing.getId(), 10, 0)}, 2)); ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.fish, 1, 3), new PotionEffect[]{new PotionEffect(MobEffects.waterBreathing, 10, 0)}, 2));
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.golden_carrot), new PotionEffect[]{new PotionEffect(Potion.nightVision.getId(), 30, 0)}, 2)); ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.golden_carrot), new PotionEffect[]{new PotionEffect(MobEffects.nightVision, 30, 0)}, 2));
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.ghast_tear), new PotionEffect[]{new PotionEffect(Potion.regeneration.getId(), 5, 0)}, 3)); ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.ghast_tear), new PotionEffect[]{new PotionEffect(MobEffects.regeneration, 5, 0)}, 3));
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.blaze_powder), new PotionEffect[]{new PotionEffect(Potion.damageBoost.getId(), 15, 0)}, 4)); ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.blaze_powder), new PotionEffect[]{new PotionEffect(MobEffects.damageBoost, 15, 0)}, 4));
ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.fermented_spider_eye), new PotionEffect[]{new PotionEffect(Potion.invisibility.getId(), 25, 0)}, 2)); ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.fermented_spider_eye), new PotionEffect[]{new PotionEffect(MobEffects.invisibility, 25, 0)}, 2));
} }
public static CoffeeIngredient getIngredientFromStack(ItemStack stack){ public static CoffeeIngredient getIngredientFromStack(ItemStack stack){
@ -72,17 +74,17 @@ public class ItemCoffee extends ItemFoodBase{
return null; return null;
} }
public static void applyPotionEffectsFromStack(ItemStack stack, EntityPlayer player){ public static void applyPotionEffectsFromStack(ItemStack stack, EntityLivingBase player){
PotionEffect[] effects = CoffeeBrewing.getEffectsFromStack(stack); PotionEffect[] effects = CoffeeBrewing.getEffectsFromStack(stack);
if(effects != null && effects.length > 0){ if(effects != null && effects.length > 0){
for(PotionEffect effect : effects){ for(PotionEffect effect : effects){
player.addPotionEffect(new PotionEffect(effect.getPotionID(), effect.getDuration()*20, effect.getAmplifier())); player.addPotionEffect(new PotionEffect(effect.getPotion(), effect.getDuration()*20, effect.getAmplifier()));
} }
} }
} }
@Override @Override
public ItemStack onItemUseFinish(ItemStack stack, World world, EntityPlayer player){ public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player){
ItemStack theStack = stack.copy(); ItemStack theStack = stack.copy();
super.onItemUseFinish(stack, world, player); super.onItemUseFinish(stack, world, player);
applyPotionEffectsFromStack(stack, player); applyPotionEffectsFromStack(stack, player);
@ -142,7 +144,7 @@ public class ItemCoffee extends ItemFoodBase{
if(effects != null && effects.length > 0){ if(effects != null && effects.length > 0){
for(PotionEffect effect : effects){ for(PotionEffect effect : effects){
if(effect.getAmplifier() > 0){ if(effect.getAmplifier() > 0){
effectsNew.add(new PotionEffect(effect.getPotionID(), effect.getDuration()+120, effect.getAmplifier()-1)); effectsNew.add(new PotionEffect(effect.getPotion(), effect.getDuration()+120, effect.getAmplifier()-1));
} }
} }
stack.setTagCompound(new NBTTagCompound()); stack.setTagCompound(new NBTTagCompound());

View file

@ -16,6 +16,9 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World; import net.minecraft.world.World;
public class ItemCrafterOnAStick extends ItemBase{ public class ItemCrafterOnAStick extends ItemBase{
@ -26,11 +29,11 @@ public class ItemCrafterOnAStick extends ItemBase{
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
if(!world.isRemote){ if(!world.isRemote){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CRAFTER.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ); player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CRAFTER.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ);
} }
return stack; return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
} }
@Override @Override

View file

@ -25,7 +25,6 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
@ -33,12 +32,17 @@ import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Enchantments;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -71,7 +75,7 @@ public class ItemDrill extends ItemEnergy{
@Override @Override
//Places Blocks if the Placing Upgrade is installed //Places Blocks if the Placing Upgrade is installed
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ){
ItemStack upgrade = this.getHasUpgradeAsStack(stack, ItemDrillUpgrade.UpgradeType.PLACER); ItemStack upgrade = this.getHasUpgradeAsStack(stack, ItemDrillUpgrade.UpgradeType.PLACER);
if(upgrade != null){ if(upgrade != null){
int slot = ItemDrillUpgrade.getSlotToPlaceFrom(upgrade); int slot = ItemDrillUpgrade.getSlotToPlaceFrom(upgrade);
@ -83,28 +87,28 @@ public class ItemDrill extends ItemEnergy{
//tryPlaceItemIntoWorld could throw an Exception //tryPlaceItemIntoWorld could throw an Exception
try{ try{
//Places the Block into the World //Places the Block into the World
if(equip.onItemUse(player, world, pos, side, hitX, hitY, hitZ)){ if(equip.onItemUse(player, world, pos, hand, side, hitX, hitY, hitZ) != EnumActionResult.FAIL){
if(!player.capabilities.isCreativeMode){ if(!player.capabilities.isCreativeMode){
player.inventory.setInventorySlotContents(slot, equip.stackSize <= 0 ? null : equip.copy()); player.inventory.setInventorySlotContents(slot, equip.stackSize <= 0 ? null : equip.copy());
} }
//Synchronizes the Client //Synchronizes the Client
player.inventoryContainer.detectAndSendChanges(); player.inventoryContainer.detectAndSendChanges();
return true; return EnumActionResult.SUCCESS;
} }
} }
//Notify the Player and log the Exception //Notify the Player and log the Exception
catch(Exception e){ catch(Exception e){
player.addChatComponentMessage(new ChatComponentText("Ouch! That really hurt! You must have done something wrong, don't do that again please!")); player.addChatComponentMessage(new TextComponentString("Ouch! That really hurt! You must have done something wrong, don't do that again please!"));
ModUtil.LOGGER.error("Player "+player.getName()+" who should place a Block using a Drill at "+player.posX+", "+player.posY+", "+player.posZ+" in World "+world.provider.getDimensionId()+" threw an Exception! Don't let that happen again!"); ModUtil.LOGGER.error("Player "+player.getName()+" who should place a Block using a Drill at "+player.posX+", "+player.posY+", "+player.posZ+" in World "+world.provider.getDimension()+" threw an Exception! Don't let that happen again!");
} }
} }
else{ else{
return true; return EnumActionResult.SUCCESS;
} }
} }
} }
} }
return false; return EnumActionResult.FAIL;
} }
/** /**
@ -162,11 +166,11 @@ public class ItemDrill extends ItemEnergy{
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
if(!world.isRemote && player.isSneaking() && stack == player.getCurrentEquippedItem()){ if(!world.isRemote && player.isSneaking() && stack == player.getActiveItemStack()){
player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.DRILL.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ); player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.DRILL.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ);
} }
return stack; return new ActionResult<ItemStack>(EnumActionResult.PASS, stack);
} }
@Override @Override
@ -210,15 +214,19 @@ public class ItemDrill extends ItemEnergy{
return EnumRarity.EPIC; return EnumRarity.EPIC;
} }
@Override public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack){
public Multimap getAttributeModifiers(ItemStack stack){ Multimap<String, AttributeModifier> map = super.getAttributeModifiers(slot, stack);
Multimap map = super.getAttributeModifiers(stack);
map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Drill Modifier", this.getEnergyStored(stack) >= ENERGY_USE ? 8.0F : 0.1F, 0)); if(slot == EntityEquipmentSlot.MAINHAND){
map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Drill Modifier", this.getEnergyStored(stack) >= ENERGY_USE ? 8.0F : 0.1F, 0));
map.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool Modifier", -2.5F, 0));
}
return map; return map;
} }
@Override @Override
public float getDigSpeed(ItemStack stack, IBlockState state){ public float getStrVsBlock(ItemStack stack, IBlockState state){
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) ? (this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state)) ? this.getEfficiencyFromUpgrade(stack) : 1.0F) : 0.1F; return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) ? (this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state)) ? this.getEfficiencyFromUpgrade(stack) : 1.0F) : 0.1F;
} }
@ -229,11 +237,11 @@ public class ItemDrill extends ItemEnergy{
if(this.getEnergyStored(stack) >= use){ if(this.getEnergyStored(stack) >= use){
//Enchants the Drill depending on the Upgrades it has //Enchants the Drill depending on the Upgrades it has
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SILK_TOUCH)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SILK_TOUCH)){
ItemUtil.addEnchantment(stack, Enchantment.silkTouch, 1); ItemUtil.addEnchantment(stack, Enchantments.silkTouch, 1);
} }
else{ else{
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE)){ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE)){
ItemUtil.addEnchantment(stack, Enchantment.fortune, this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) ? 3 : 1); ItemUtil.addEnchantment(stack, Enchantments.fortune, this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) ? 3 : 1);
} }
} }
@ -251,16 +259,17 @@ public class ItemDrill extends ItemEnergy{
} }
//Removes Enchantments added above //Removes Enchantments added above
ItemUtil.removeEnchantment(stack, Enchantment.silkTouch); ItemUtil.removeEnchantment(stack, Enchantments.silkTouch);
ItemUtil.removeEnchantment(stack, Enchantment.fortune); ItemUtil.removeEnchantment(stack, Enchantments.fortune);
} }
return toReturn; return toReturn;
} }
@Override @Override
public boolean canHarvestBlock(Block block, ItemStack stack){ public boolean canHarvestBlock(IBlockState state, ItemStack stack){
int harvestLevel = this.getHarvestLevel(stack, ""); int harvestLevel = this.getHarvestLevel(stack, "");
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || block.getMaterial().isToolNotRequired() || (block == Blocks.snow_layer || block == Blocks.snow || (block == Blocks.obsidian ? harvestLevel >= 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial() == Material.rock || (block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil)) : harvestLevel >= 2) : harvestLevel >= 1) : harvestLevel >= 1) : harvestLevel >= 2) : harvestLevel >= 2) : harvestLevel >= 2)))); Block block = state.getBlock();
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || block.getMaterial(state).isToolNotRequired() || (block == Blocks.snow_layer || block == Blocks.snow || (block == Blocks.obsidian ? harvestLevel >= 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial(state) == Material.rock || (block.getMaterial(state) == Material.iron || block.getMaterial(state) == Material.anvil)) : harvestLevel >= 2) : harvestLevel >= 1) : harvestLevel >= 1) : harvestLevel >= 2) : harvestLevel >= 2) : harvestLevel >= 2))));
} }
@Override @Override
@ -428,7 +437,7 @@ public class ItemDrill extends ItemEnergy{
int zRange = 0; int zRange = 0;
//Block hit //Block hit
MovingObjectPosition pos = WorldUtil.getNearestBlockWithDefaultReachDistance(world, player); RayTraceResult pos = WorldUtil.getNearestBlockWithDefaultReachDistance(world, player);
if(pos == null){ if(pos == null){
return false; return false;
} }
@ -445,7 +454,7 @@ public class ItemDrill extends ItemEnergy{
} }
//Not defined later because main Block is getting broken below //Not defined later because main Block is getting broken below
float mainHardness = PosUtil.getBlock(aPos, world).getBlockHardness(world, aPos); float mainHardness = PosUtil.getBlock(aPos, world).getBlockHardness(world.getBlockState(aPos), world, aPos);
//Break Middle Block first //Break Middle Block first
int use = this.getEnergyUsePerBlock(stack); int use = this.getEnergyUsePerBlock(stack);
@ -467,7 +476,7 @@ public class ItemDrill extends ItemEnergy{
if(this.getEnergyStored(stack) >= use){ if(this.getEnergyStored(stack) >= use){
//Only break Blocks around that are (about) as hard or softer //Only break Blocks around that are (about) as hard or softer
BlockPos thePos = new BlockPos(xPos, yPos, zPos); BlockPos thePos = new BlockPos(xPos, yPos, zPos);
if(PosUtil.getBlock(thePos, world).getBlockHardness(world, thePos) <= mainHardness+5.0F){ if(PosUtil.getBlock(thePos, world).getBlockHardness(world.getBlockState(thePos), world, thePos) <= mainHardness+5.0F){
this.tryHarvestBlock(world, thePos, true, stack, player, use); this.tryHarvestBlock(world, thePos, true, stack, player, use);
} }
} }
@ -495,8 +504,9 @@ public class ItemDrill extends ItemEnergy{
*/ */
private boolean tryHarvestBlock(World world, BlockPos pos, boolean isExtra, ItemStack stack, EntityPlayer player, int use){ private boolean tryHarvestBlock(World world, BlockPos pos, boolean isExtra, ItemStack stack, EntityPlayer player, int use){
Block block = PosUtil.getBlock(pos, world); Block block = PosUtil.getBlock(pos, world);
float hardness = block.getBlockHardness(world, pos); IBlockState state = world.getBlockState(pos);
boolean canHarvest = (ForgeHooks.canHarvestBlock(block, player, world, pos) || this.canHarvestBlock(block, stack)) && (!isExtra || this.getDigSpeed(stack, world.getBlockState(pos)) > 1.0F); float hardness = block.getBlockHardness(state, world, pos);
boolean canHarvest = (ForgeHooks.canHarvestBlock(block, player, world, pos) || this.canHarvestBlock(state, stack)) && (!isExtra || this.getStrVsBlock(stack, world.getBlockState(pos)) > 1.0F);
if(hardness >= 0.0F && (!isExtra || (canHarvest && !block.hasTileEntity(world.getBlockState(pos))))){ if(hardness >= 0.0F && (!isExtra || (canHarvest && !block.hasTileEntity(world.getBlockState(pos))))){
this.extractEnergy(stack, use, false); this.extractEnergy(stack, use, false);
//Break the Block //Break the Block

View file

@ -14,6 +14,9 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World; import net.minecraft.world.World;
public class ItemDrillUpgrade extends ItemBase{ public class ItemDrillUpgrade extends ItemBase{
@ -35,11 +38,12 @@ public class ItemDrillUpgrade extends ItemBase{
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
if(!world.isRemote && this.type == UpgradeType.PLACER){ if(!world.isRemote && this.type == UpgradeType.PLACER){
this.setSlotToPlaceFrom(stack, player.inventory.currentItem); this.setSlotToPlaceFrom(stack, player.inventory.currentItem);
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
} }
return stack; return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack);
} }
public void setSlotToPlaceFrom(ItemStack stack, int slot){ public void setSlotToPlaceFrom(ItemStack stack, int slot){

View file

@ -13,8 +13,10 @@ package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheDusts; import de.ellpeck.actuallyadditions.mod.items.metalists.TheDusts;
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -25,7 +27,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List; import java.util.List;
public class ItemDust extends ItemBase{ public class ItemDust extends ItemBase implements IColorProvidingItem{
public static final TheDusts[] allDusts = TheDusts.values(); public static final TheDusts[] allDusts = TheDusts.values();
@ -44,12 +46,6 @@ public class ItemDust extends ItemBase{
return stack.getItemDamage() >= allDusts.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allDusts[stack.getItemDamage()].name; return stack.getItemDamage() >= allDusts.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allDusts[stack.getItemDamage()].name;
} }
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass){
return stack.getItemDamage() >= allDusts.length ? 0 : allDusts[stack.getItemDamage()].color;
}
@Override @Override
public EnumRarity getRarity(ItemStack stack){ 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;
@ -69,4 +65,15 @@ public class ItemDust extends ItemBase{
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
} }
} }
@SideOnly(Side.CLIENT)
@Override
public IItemColor getColor(){
return new IItemColor(){
@Override
public int getColorFromItemstack(ItemStack stack, int pass){
return stack.getItemDamage() >= allDusts.length ? 0xFFFFFF : allDusts[stack.getItemDamage()].color;
}
};
}
} }

View file

@ -15,8 +15,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemDye; import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos; import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class ItemFertilizer extends ItemBase{ public class ItemFertilizer extends ItemBase{
@ -26,14 +28,14 @@ public class ItemFertilizer extends ItemBase{
} }
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float par8, float par9, float par10){ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float par8, float par9, float par10){
if(ItemDye.applyBonemeal(stack, world, pos, player)){ if(ItemDye.applyBonemeal(stack, world, pos, player)){
if(!world.isRemote){ if(!world.isRemote){
world.playAuxSFX(2005, pos, 0); world.playAuxSFX(2005, pos, 0);
} }
return true; return EnumActionResult.SUCCESS;
} }
return super.onItemUse(stack, player, world, pos, side, par8, par9, par10); return super.onItemUse(stack, player, world, pos, hand, side, par8, par9, par10);
} }
@Override @Override

View file

@ -16,12 +16,14 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction; import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -41,11 +43,11 @@ public class ItemFoods extends ItemFoodBase{
} }
@Override @Override
public ItemStack onItemUseFinish(ItemStack stack, World world, EntityPlayer player){ public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player){
ItemStack stackToReturn = super.onItemUseFinish(stack, world, player); ItemStack stackToReturn = super.onItemUseFinish(stack, world, player);
ItemStack returnItem = stack.getItemDamage() >= allFoods.length ? null : allFoods[stack.getItemDamage()].returnItem; ItemStack returnItem = stack.getItemDamage() >= allFoods.length ? null : allFoods[stack.getItemDamage()].returnItem;
if(returnItem != null){ if(returnItem != null && player instanceof EntityPlayer){
if(!player.inventory.addItemStackToInventory(returnItem.copy())){ if(!((EntityPlayer)player).inventory.addItemStackToInventory(returnItem.copy())){
if(!world.isRemote){ if(!world.isRemote){
EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, returnItem.copy()); EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, returnItem.copy());
entityItem.setPickupDelay(0); entityItem.setPickupDelay(0);

View file

@ -21,12 +21,13 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.IPlantable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
public class ItemGrowthRing extends ItemEnergy{ public class ItemGrowthRing extends ItemEnergy{
@ -41,11 +42,11 @@ public class ItemGrowthRing extends ItemEnergy{
} }
EntityPlayer player = (EntityPlayer)entity; EntityPlayer player = (EntityPlayer)entity;
ItemStack equipped = player.getCurrentEquippedItem(); ItemStack equipped = player.getActiveItemStack();
int energyUse = 300; int energyUse = 300;
if(equipped != null && equipped == stack && this.getEnergyStored(stack) >= energyUse){ if(equipped != null && equipped == stack && this.getEnergyStored(stack) >= energyUse){
ArrayList<BlockPos> blocks = new ArrayList<BlockPos>(); List<BlockPos> blocks = new ArrayList<BlockPos>();
if(stack.getTagCompound() == null){ if(stack.getTagCompound() == null){
stack.setTagCompound(new NBTTagCompound()); stack.setTagCompound(new NBTTagCompound());

View file

@ -11,13 +11,15 @@
package de.ellpeck.actuallyadditions.mod.items; package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.recipe.BallOfFurReturn;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.WeightedRandom; import net.minecraft.util.WeightedRandom;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -28,7 +30,7 @@ public class ItemHairyBall extends ItemBase{
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
if(!world.isRemote){ if(!world.isRemote){
ItemStack returnItem = this.getRandomReturnItem(); ItemStack returnItem = this.getRandomReturnItem();
if(!player.inventory.addItemStackToInventory(returnItem)){ if(!player.inventory.addItemStackToInventory(returnItem)){
@ -37,13 +39,15 @@ public class ItemHairyBall extends ItemBase{
player.worldObj.spawnEntityInWorld(entityItem); player.worldObj.spawnEntityInWorld(entityItem);
} }
stack.stackSize--; stack.stackSize--;
world.playSoundAtEntity(player, "random.pop", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F);
//TODO Sound
//world.playSoundAtEntity(player, "random.pop", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F);
} }
return stack; return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
} }
public ItemStack getRandomReturnItem(){ public ItemStack getRandomReturnItem(){
return ((BallOfFurReturn)WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.ballOfFurReturnItems)).returnItem.copy(); return WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.ballOfFurReturnItems).returnItem.copy();
} }
@Override @Override

View file

@ -13,15 +13,19 @@ package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.items.base.ItemFoodBase; import de.ellpeck.actuallyadditions.mod.items.base.ItemFoodBase;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheJams; import de.ellpeck.actuallyadditions.mod.items.metalists.TheJams;
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -30,7 +34,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List; import java.util.List;
public class ItemJams extends ItemFoodBase{ public class ItemJams extends ItemFoodBase implements IColorProvidingItem{
public static final TheJams[] allJams = TheJams.values(); public static final TheJams[] allJams = TheJams.values();
@ -51,12 +55,6 @@ public class ItemJams extends ItemFoodBase{
return stack.getItemDamage() >= allJams.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allJams[stack.getItemDamage()].name; return stack.getItemDamage() >= allJams.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allJams[stack.getItemDamage()].name;
} }
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass){
return pass > 0 ? (stack.getItemDamage() >= allJams.length ? 0 : allJams[stack.getItemDamage()].color) : super.getColorFromItemStack(stack, pass);
}
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return stack.getItemDamage() >= allJams.length ? EnumRarity.COMMON : allJams[stack.getItemDamage()].rarity; return stack.getItemDamage() >= allJams.length ? EnumRarity.COMMON : allJams[stack.getItemDamage()].rarity;
@ -71,18 +69,18 @@ public class ItemJams extends ItemFoodBase{
} }
@Override @Override
public ItemStack onItemUseFinish(ItemStack stack, World world, EntityPlayer player){ public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player){
ItemStack stackToReturn = super.onItemUseFinish(stack, world, player); ItemStack stackToReturn = super.onItemUseFinish(stack, world, player);
if(!world.isRemote && stack.getItemDamage() < allJams.length){ if(player instanceof EntityPlayer && !world.isRemote && stack.getItemDamage() < allJams.length){
PotionEffect firstEffectToGet = new PotionEffect(allJams[stack.getItemDamage()].firstEffectToGet, 200); PotionEffect firstEffectToGet = new PotionEffect(Potion.getPotionById(allJams[stack.getItemDamage()].firstEffectToGet), 200);
player.addPotionEffect(firstEffectToGet); player.addPotionEffect(firstEffectToGet);
PotionEffect secondEffectToGet = new PotionEffect(allJams[stack.getItemDamage()].secondEffectToGet, 600); PotionEffect secondEffectToGet = new PotionEffect(Potion.getPotionById(allJams[stack.getItemDamage()].secondEffectToGet), 600);
player.addPotionEffect(secondEffectToGet); player.addPotionEffect(secondEffectToGet);
ItemStack returnItem = new ItemStack(Items.glass_bottle); ItemStack returnItem = new ItemStack(Items.glass_bottle);
if(!player.inventory.addItemStackToInventory(returnItem.copy())){ if(!((EntityPlayer)player).inventory.addItemStackToInventory(returnItem.copy())){
EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, returnItem.copy()); EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, returnItem.copy());
entityItem.setPickupDelay(0); entityItem.setPickupDelay(0);
player.worldObj.spawnEntityInWorld(entityItem); player.worldObj.spawnEntityInWorld(entityItem);
@ -107,4 +105,15 @@ public class ItemJams extends ItemFoodBase{
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
} }
} }
@Override
@SideOnly(Side.CLIENT)
public IItemColor getColor(){
return new IItemColor(){
@Override
public int getColorFromItemstack(ItemStack stack, int pass){
return pass > 0 ? (stack.getItemDamage() >= allJams.length ? 0xFFFFFF : allJams[stack.getItemDamage()].color) : 0xFFFFFF;
}
};
}
} }

View file

@ -14,6 +14,7 @@ import com.google.common.collect.Multimap;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -39,9 +40,9 @@ public class ItemKnife extends ItemBase{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public Multimap getAttributeModifiers(ItemStack stack){ public Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack){
Multimap map = super.getAttributeModifiers(stack); Multimap map = super.getAttributeModifiers(slot, stack);
map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Knife Modifier", 3, 0)); map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Knife Modifier", 3, 0));
return map; return map;
} }

View file

@ -20,10 +20,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.EnumActionResult;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -38,13 +40,13 @@ public class ItemLaserWrench extends ItemBase{
} }
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing par7, float par8, float par9, float par10){ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing par7, float par8, float par9, float par10){
if(!world.isRemote){ if(!world.isRemote){
TileEntity tile = world.getTileEntity(pos); TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileEntityLaserRelay){ if(tile instanceof TileEntityLaserRelay){
if(ItemPhantomConnector.getStoredPosition(stack) == null){ if(ItemPhantomConnector.getStoredPosition(stack) == null){
ItemPhantomConnector.storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), world); ItemPhantomConnector.storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), world);
player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.stored.desc"))); player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.stored.desc")));
} }
else{ else{
BlockPos savedPos = ItemPhantomConnector.getStoredPosition(stack); BlockPos savedPos = ItemPhantomConnector.getStoredPosition(stack);
@ -54,16 +56,17 @@ public class ItemLaserWrench extends ItemBase{
((TileEntityLaserRelay)world.getTileEntity(savedPos)).sendUpdate(); ((TileEntityLaserRelay)world.getTileEntity(savedPos)).sendUpdate();
((TileEntityLaserRelay)world.getTileEntity(pos)).sendUpdate(); ((TileEntityLaserRelay)world.getTileEntity(pos)).sendUpdate();
player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.connected.desc"))); player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.connected.desc")));
} }
else{ else{
player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.cantConnect.desc"))); player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.cantConnect.desc")));
ItemPhantomConnector.clearStorage(stack); ItemPhantomConnector.clearStorage(stack);
} }
} }
return EnumActionResult.SUCCESS;
} }
} }
return false; return EnumActionResult.FAIL;
} }
@Override @Override
@ -88,7 +91,7 @@ public class ItemLaserWrench extends ItemBase{
list.add("X: "+coords.getX()); list.add("X: "+coords.getX());
list.add("Y: "+coords.getY()); list.add("Y: "+coords.getY());
list.add("Z: "+coords.getZ()); list.add("Z: "+coords.getZ());
list.add(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".clearStorage.desc")); list.add(TextFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".clearStorage.desc"));
} }
} }

View file

@ -15,13 +15,17 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockBush; import net.minecraft.block.BlockBush;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction; import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos; import net.minecraft.util.ActionResult;
import net.minecraft.util.MathHelper; import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.ArrayList; import java.util.ArrayList;
@ -38,9 +42,9 @@ public class ItemLeafBlower extends ItemBase{
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); player.setActiveHand(hand);
return stack; return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
} }
@Override @Override
@ -60,14 +64,15 @@ public class ItemLeafBlower extends ItemBase{
} }
@Override @Override
public void onUsingTick(ItemStack stack, EntityPlayer player, int time){ public void onUsingTick(ItemStack stack, EntityLivingBase player, int time){
if(!player.worldObj.isRemote){ if(!player.worldObj.isRemote){
if(time <= getMaxItemUseDuration(stack) && (this.isAdvanced || time%3 == 0)){ if(time <= getMaxItemUseDuration(stack) && (this.isAdvanced || time%3 == 0)){
//Breaks the Blocks //Breaks the Blocks
this.breakStuff(player.worldObj, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ)); this.breakStuff(player.worldObj, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ));
//Plays a Minecart sounds (It really sounds like a Leaf Blower!) //Plays a Minecart sounds (It really sounds like a Leaf Blower!)
if(!ConfigValues.lessSound){ if(!ConfigValues.lessSound){
player.worldObj.playSoundAtEntity(player, "minecart.base", 0.3F, 0.001F); //TODO Fix sound
//player.worldObj.playSoundAtEntity(player, "minecart.base", 0.3F, 0.001F);
} }
} }
} }
@ -92,7 +97,7 @@ public class ItemLeafBlower extends ItemBase{
//The current Block to break //The current Block to break
BlockPos pos = new BlockPos(x+reachX, y+reachY, z+reachZ); BlockPos pos = new BlockPos(x+reachX, y+reachY, z+reachZ);
Block block = PosUtil.getBlock(pos, world); Block block = PosUtil.getBlock(pos, world);
if(block != null && (block instanceof BlockBush || (this.isAdvanced && block.isLeaves(world, pos)))){ if(block != null && (block instanceof BlockBush || (this.isAdvanced && block.isLeaves(world.getBlockState(pos), world, pos)))){
breakPositions.add(pos); breakPositions.add(pos);
} }
} }

View file

@ -16,8 +16,8 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.Vec3; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.ArrayList; import java.util.ArrayList;
@ -35,13 +35,13 @@ public class ItemMagnetRing extends ItemEnergy{
if(!entity.isSneaking()){ if(!entity.isSneaking()){
//Get all the Items in the area //Get all the Items in the area
int range = 5; int range = 5;
ArrayList<EntityItem> items = (ArrayList<EntityItem>)world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.fromBounds(entity.posX-range, entity.posY-range, entity.posZ-range, entity.posX+range, entity.posY+range, entity.posZ+range)); ArrayList<EntityItem> items = (ArrayList<EntityItem>)world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(entity.posX-range, entity.posY-range, entity.posZ-range, entity.posX+range, entity.posY+range, entity.posZ+range));
if(!items.isEmpty()){ if(!items.isEmpty()){
for(EntityItem item : items){ for(EntityItem item : items){
if(this.getEnergyStored(stack) >= energyUse){ if(this.getEnergyStored(stack) >= energyUse){
//If the Item is near enough to get picked up //If the Item is near enough to get picked up
//(So it doesn't bounce around until it notices itself..) //(So it doesn't bounce around until it notices itself..)
if(new Vec3(entity.posX, entity.posY, entity.posZ).distanceTo(new Vec3(item.posX, item.posY, item.posZ)) <= 1.5){ if(new Vec3d(entity.posX, entity.posY, entity.posZ).distanceTo(new Vec3d(item.posX, item.posY, item.posZ)) <= 1.5){
item.onCollideWithPlayer((EntityPlayer)entity); item.onCollideWithPlayer((EntityPlayer)entity);
} }
else{ else{

View file

@ -21,10 +21,12 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.EnumActionResult;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -73,13 +75,13 @@ public class ItemPhantomConnector extends ItemBase{
tag.setInteger("XCoordOfTileStored", x); tag.setInteger("XCoordOfTileStored", x);
tag.setInteger("YCoordOfTileStored", y); tag.setInteger("YCoordOfTileStored", y);
tag.setInteger("ZCoordOfTileStored", z); tag.setInteger("ZCoordOfTileStored", z);
tag.setInteger("WorldOfTileStored", world.provider.getDimensionId()); tag.setInteger("WorldOfTileStored", world.provider.getDimension());
stack.setTagCompound(tag); stack.setTagCompound(tag);
} }
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing par7, float par8, float par9, float par10){ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing par7, float par8, float par9, float par10){
if(!world.isRemote){ if(!world.isRemote){
//Passing Data to Phantoms //Passing Data to Phantoms
TileEntity tile = world.getTileEntity(pos); TileEntity tile = world.getTileEntity(pos);
@ -92,17 +94,17 @@ public class ItemPhantomConnector extends ItemBase{
((TileEntityBase)tile).sendUpdate(); ((TileEntityBase)tile).sendUpdate();
} }
clearStorage(stack); clearStorage(stack);
player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc"))); player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc")));
return true; return EnumActionResult.SUCCESS;
} }
return false; return EnumActionResult.FAIL;
} }
} }
//Storing Connections //Storing Connections
storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), world); storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), world);
player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.stored.desc"))); player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.stored.desc")));
} }
return true; return EnumActionResult.SUCCESS;
} }
public boolean checkHasConnection(ItemStack stack, EntityPlayer player, TileEntity tile){ public boolean checkHasConnection(ItemStack stack, EntityPlayer player, TileEntity tile){
@ -113,7 +115,7 @@ public class ItemPhantomConnector extends ItemBase{
if(tile instanceof IPhantomTile){ if(tile instanceof IPhantomTile){
((IPhantomTile)tile).setBoundPosition(null); ((IPhantomTile)tile).setBoundPosition(null);
} }
player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.unbound.desc"))); player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.unbound.desc")));
return false; return false;
} }
} }
@ -140,7 +142,7 @@ public class ItemPhantomConnector extends ItemBase{
list.add("X: "+coords.getX()); list.add("X: "+coords.getX());
list.add("Y: "+coords.getY()); list.add("Y: "+coords.getY());
list.add("Z: "+coords.getZ()); list.add("Z: "+coords.getZ());
list.add(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".clearStorage.desc")); list.add(TextFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".clearStorage.desc"));
} }
} }

View file

@ -0,0 +1,47 @@
/*
* This file ("ItemPickaxeAA.java") is part of the Actually Additions Mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense/
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.items;
import com.google.common.collect.Sets;
import de.ellpeck.actuallyadditions.mod.items.base.ItemToolAA;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
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.ItemStack;
import java.util.Set;
public class ItemPickaxeAA extends ItemToolAA{
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.activator_rail, Blocks.coal_ore, Blocks.cobblestone, Blocks.detector_rail, Blocks.diamond_block, Blocks.diamond_ore, Blocks.double_stone_slab, Blocks.golden_rail, Blocks.gold_block, Blocks.gold_ore, Blocks.ice, Blocks.iron_block, Blocks.iron_ore, Blocks.lapis_block, Blocks.lapis_ore, Blocks.lit_redstone_ore, Blocks.mossy_cobblestone, Blocks.netherrack, Blocks.packed_ice, Blocks.rail, Blocks.redstone_ore, Blocks.sandstone, Blocks.red_sandstone, Blocks.stone, Blocks.stone_slab, Blocks.stone_button, Blocks.stone_pressure_plate);
public ItemPickaxeAA(Item.ToolMaterial material, String repairItem, String unlocalizedName, EnumRarity rarity){
super(1.0F, -2.8F, material, repairItem, unlocalizedName, rarity, EFFECTIVE_ON);
}
public ItemPickaxeAA(Item.ToolMaterial material, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
super(1.0F, -2.8F, material, repairItem, unlocalizedName, rarity, EFFECTIVE_ON);
}
@Override
public boolean canHarvestBlock(IBlockState state) {
Block blockIn = state.getBlock();
return blockIn == Blocks.obsidian ? toolMaterial.getHarvestLevel() == 3 : blockIn != Blocks.diamond_block && blockIn != Blocks.diamond_ore ? blockIn != Blocks.emerald_ore && blockIn != Blocks.emerald_block ? blockIn != Blocks.gold_block && blockIn != Blocks.gold_ore ? blockIn != Blocks.iron_block && blockIn != Blocks.iron_ore ? blockIn != Blocks.lapis_block && blockIn != Blocks.lapis_ore ? blockIn != Blocks.redstone_ore && blockIn != Blocks.lit_redstone_ore ? state.getMaterial() == Material.rock || (state.getMaterial() == Material.iron || state.getMaterial() == Material.anvil) : toolMaterial.getHarvestLevel() >= 2 : toolMaterial.getHarvestLevel() >= 1 : toolMaterial.getHarvestLevel() >= 1 : toolMaterial.getHarvestLevel() >= 2 : toolMaterial.getHarvestLevel() >= 2 : toolMaterial.getHarvestLevel() >= 2;
}
public float getStrVsBlock(ItemStack stack, IBlockState state){
Material material = state.getMaterial();
return material != Material.iron && material != Material.anvil && material != Material.rock ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
}
}

View file

@ -13,14 +13,17 @@ package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.items.metalists.ThePotionRings; import de.ellpeck.actuallyadditions.mod.items.metalists.ThePotionRings;
import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -29,7 +32,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List; import java.util.List;
public class ItemPotionRing extends ItemBase{ public class ItemPotionRing extends ItemBase implements IColorProvidingItem{
public static final ThePotionRings[] allRings = ThePotionRings.values(); public static final ThePotionRings[] allRings = ThePotionRings.values();
@ -52,12 +55,6 @@ public class ItemPotionRing extends ItemBase{
return stack.getItemDamage() >= allRings.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allRings[stack.getItemDamage()].name; return stack.getItemDamage() >= allRings.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allRings[stack.getItemDamage()].name;
} }
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass){
return stack.getItemDamage() >= allRings.length ? 0 : allRings[stack.getItemDamage()].color;
}
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5){ public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5){
@ -66,17 +63,18 @@ public class ItemPotionRing extends ItemBase{
if(!world.isRemote && stack.getItemDamage() < allRings.length){ if(!world.isRemote && stack.getItemDamage() < allRings.length){
if(player instanceof EntityPlayer){ if(player instanceof EntityPlayer){
EntityPlayer thePlayer = (EntityPlayer)player; EntityPlayer thePlayer = (EntityPlayer)player;
ItemStack equippedStack = ((EntityPlayer)player).getCurrentEquippedItem(); ItemStack equippedStack = ((EntityPlayer)player).getActiveItemStack();
ThePotionRings effect = ThePotionRings.values()[stack.getItemDamage()]; ThePotionRings effect = ThePotionRings.values()[stack.getItemDamage()];
if(!effect.needsWaitBeforeActivating || !thePlayer.isPotionActive(effect.effectID)){ Potion potion = Potion.getPotionById(effect.effectID);
if(!effect.needsWaitBeforeActivating || !thePlayer.isPotionActive(potion)){
if(!((ItemPotionRing)stack.getItem()).isAdvanced){ if(!((ItemPotionRing)stack.getItem()).isAdvanced){
if(equippedStack != null && stack == equippedStack){ if(equippedStack != null && stack == equippedStack){
thePlayer.addPotionEffect(new PotionEffect(effect.effectID, effect.activeTime, effect.normalAmplifier, true, false)); thePlayer.addPotionEffect(new PotionEffect(potion, effect.activeTime, effect.normalAmplifier, true, false));
} }
} }
else{ else{
thePlayer.addPotionEffect(new PotionEffect(effect.effectID, effect.activeTime, effect.advancedAmplifier, true, false)); thePlayer.addPotionEffect(new PotionEffect(potion, effect.activeTime, effect.advancedAmplifier, true, false));
} }
} }
} }
@ -112,4 +110,15 @@ public class ItemPotionRing extends ItemBase{
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName())); ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this, 1, i), new ResourceLocation(ModUtil.MOD_ID_LOWER, this.getBaseName()));
} }
} }
@Override
@SideOnly(Side.CLIENT)
public IItemColor getColor(){
return new IItemColor(){
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex){
return stack.getItemDamage() >= allRings.length ? 0xFFFFFF : allRings[stack.getItemDamage()].color;
}
};
}
} }

View file

@ -11,9 +11,13 @@
package de.ellpeck.actuallyadditions.mod.items; package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World; import net.minecraft.world.World;
public class ItemResonantRice extends ItemBase{ public class ItemResonantRice extends ItemBase{
@ -23,12 +27,12 @@ public class ItemResonantRice extends ItemBase{
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){
if(!world.isRemote){ if(!world.isRemote){
stack.stackSize--; stack.stackSize--;
world.createExplosion(null, player.posX, player.posY, player.posZ, 0.5F, true); world.createExplosion(null, player.posX, player.posY, player.posZ, 0.5F, true);
} }
return stack; return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
} }
@Override @Override

Some files were not shown because too many files have changed in this diff Show more