Changed Feeder and added Packet Handling.

Also diesieben07 made me change stuff.
This commit is contained in:
Ellpeck 2015-02-20 22:45:33 +01:00
parent e188e86d76
commit ad1fbe7101
48 changed files with 757 additions and 334 deletions

View file

@ -1,6 +1,8 @@
package ellpeck.someprettyrandomstuff; package ellpeck.someprettyrandomstuff;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent;
@ -14,25 +16,26 @@ import ellpeck.someprettyrandomstuff.gen.OreGen;
import ellpeck.someprettyrandomstuff.inventory.GuiHandler; import ellpeck.someprettyrandomstuff.inventory.GuiHandler;
import ellpeck.someprettyrandomstuff.items.InitItems; import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.material.InitItemMaterials; import ellpeck.someprettyrandomstuff.material.InitItemMaterials;
import ellpeck.someprettyrandomstuff.network.PacketHandler;
import ellpeck.someprettyrandomstuff.proxy.IProxy; import ellpeck.someprettyrandomstuff.proxy.IProxy;
import ellpeck.someprettyrandomstuff.tile.TileEntityBase; import ellpeck.someprettyrandomstuff.tile.TileEntityBase;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
@Mod(modid = Util.MOD_ID, name = Util.NAME, version = Util.VERSION) @Mod(modid = Util.MOD_ID, name = Util.NAME, version = Util.VERSION)
public class SPRS{ public class SomePrettyRandomStuff{
@Mod.Instance(Util.MOD_ID) @Instance(Util.MOD_ID)
public static SPRS instance; public static SomePrettyRandomStuff instance;
@SidedProxy(clientSide = "ellpeck.someprettyrandomstuff.proxy.ClientProxy", serverSide = "ellpeck.someprettyrandomstuff.proxy.ServerProxy") @SidedProxy(clientSide = "ellpeck.someprettyrandomstuff.proxy.ClientProxy", serverSide = "ellpeck.someprettyrandomstuff.proxy.ServerProxy")
public static IProxy proxy; public static IProxy proxy;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Mod.EventHandler() @EventHandler()
public void preInit(FMLPreInitializationEvent event){ public void preInit(FMLPreInitializationEvent event){
Util.logInfo(Util.isClientSide() ? "You're on a Client, eh?" : "You're on a Server, eh?");
Util.logInfo("Starting PreInitialization Phase..."); Util.logInfo("Starting PreInitialization Phase...");
PacketHandler.init();
ConfigurationHandler.init(event.getSuggestedConfigurationFile()); ConfigurationHandler.init(event.getSuggestedConfigurationFile());
InitItemMaterials.init(); InitItemMaterials.init();
InitBlocks.init(); InitBlocks.init();
@ -43,7 +46,7 @@ public class SPRS{
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Mod.EventHandler() @EventHandler()
public void init(FMLInitializationEvent event){ public void init(FMLInitializationEvent event){
Util.logInfo("Starting Initialization Phase..."); Util.logInfo("Starting Initialization Phase...");
@ -59,7 +62,7 @@ public class SPRS{
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Mod.EventHandler() @EventHandler()
public void postInit(FMLPostInitializationEvent event){ public void postInit(FMLPostInitializationEvent event){
Util.logInfo("Starting PostInitialization Phase..."); Util.logInfo("Starting PostInitialization Phase...");

View file

@ -74,10 +74,10 @@ public class AchievementEvent{
public static void init(){ public static void init(){
Util.logInfo("Initializing Events..."); Util.logInfo("Initializing Events...");
FMLCommonHandler.instance().bus().register(new AchievementEvent.SmeltEvent()); FMLCommonHandler.instance().bus().register(new SmeltEvent());
FMLCommonHandler.instance().bus().register(new AchievementEvent.CraftEvent()); FMLCommonHandler.instance().bus().register(new CraftEvent());
FMLCommonHandler.instance().bus().register(new AchievementEvent.PickupEvent()); FMLCommonHandler.instance().bus().register(new PickupEvent());
FMLCommonHandler.instance().bus().register(new AchievementEvent.LoginEvent()); FMLCommonHandler.instance().bus().register(new LoginEvent());
} }
} }

View file

@ -1,12 +1,13 @@
package ellpeck.someprettyrandomstuff.achievement; package ellpeck.someprettyrandomstuff.achievement;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement; import net.minecraft.stats.Achievement;
public class AchievementSPRS extends Achievement{ public class AchievementSPRS extends Achievement{
public AchievementSPRS(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore){ public AchievementSPRS(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore){
super("achievement." + name, name, x, y, displayStack, hasToHaveBefore); super("achievement." + Util.MOD_ID_LOWER + "." + name, name, x, y, displayStack, hasToHaveBefore);
InitAchievements.achievementList.add(this); InitAchievements.achievementList.add(this);
if(hasToHaveBefore == null) this.initIndependentStat(); if(hasToHaveBefore == null) this.initIndependentStat();
this.registerStat(); this.registerStat();

View file

@ -7,6 +7,8 @@ import ellpeck.someprettyrandomstuff.items.ItemFertilizer;
import ellpeck.someprettyrandomstuff.items.ItemMisc; import ellpeck.someprettyrandomstuff.items.ItemMisc;
import ellpeck.someprettyrandomstuff.items.metalists.TheMiscItems; import ellpeck.someprettyrandomstuff.items.metalists.TheMiscItems;
import ellpeck.someprettyrandomstuff.tile.TileEntityCompost; import ellpeck.someprettyrandomstuff.tile.TileEntityCompost;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util;
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.entity.Entity; import net.minecraft.entity.Entity;
@ -18,17 +20,18 @@ import net.minecraft.world.World;
import java.util.List; import java.util.List;
public class BlockCompost extends BlockContainerBase{ public class BlockCompost extends BlockContainerBase implements IName{
public BlockCompost(){ public BlockCompost(){
super(Material.wood); super(Material.wood);
this.setCreativeTab(CreativeTab.instance); this.setCreativeTab(CreativeTab.instance);
this.setBlockName("blockCompost"); this.setBlockName(Util.getNamePrefix() + this.getName());
this.setHarvestLevel("axe", 0); this.setHarvestLevel("axe", 0);
this.setHardness(1.0F); this.setHardness(1.0F);
this.setStepSound(soundTypeWood); this.setStepSound(soundTypeWood);
} }
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int f6, float f7, float f8, float f9){ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int f6, float f7, float f8, float f9){
if(!world.isRemote){ if(!world.isRemote){
ItemStack stackPlayer = player.getCurrentEquippedItem(); ItemStack stackPlayer = player.getCurrentEquippedItem();
@ -50,6 +53,7 @@ public class BlockCompost extends BlockContainerBase{
return true; return true;
} }
@Override
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB mask, List list, Entity collidingEntity){ public void addCollisionBoxesToList(World world, int x, int y, int z, 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);
super.addCollisionBoxesToList(world, x, y, z, mask, list, collidingEntity); super.addCollisionBoxesToList(world, x, y, z, mask, list, collidingEntity);
@ -65,28 +69,39 @@ public class BlockCompost extends BlockContainerBase{
this.setBlockBoundsForItemRender(); this.setBlockBoundsForItemRender();
} }
@Override
public void setBlockBoundsForItemRender(){ public void setBlockBoundsForItemRender(){
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
} }
@Override
public boolean isOpaqueCube(){ public boolean isOpaqueCube(){
return false; return false;
} }
@Override
public boolean renderAsNormalBlock(){ public boolean renderAsNormalBlock(){
return false; return false;
} }
@Override
public int getRenderType(){ public int getRenderType(){
return RenderingRegistry.getNextAvailableRenderId(); return RenderingRegistry.getNextAvailableRenderId();
} }
@Override
public TileEntity createNewTileEntity(World world, int meta){ public TileEntity createNewTileEntity(World world, int meta){
return new TileEntityCompost(); return new TileEntityCompost();
} }
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){ public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z); this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6); super.breakBlock(world, x, y, z, block, par6);
} }
@Override
public String getName(){
return "blockCompost";
}
} }

View file

@ -2,10 +2,11 @@ package ellpeck.someprettyrandomstuff.blocks;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.SPRS; import ellpeck.someprettyrandomstuff.SomePrettyRandomStuff;
import ellpeck.someprettyrandomstuff.creative.CreativeTab; import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.inventory.GuiHandler; import ellpeck.someprettyrandomstuff.inventory.GuiHandler;
import ellpeck.someprettyrandomstuff.tile.TileEntityFeeder; import ellpeck.someprettyrandomstuff.tile.TileEntityFeeder;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -15,41 +16,54 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFeeder extends BlockContainerBase{ public class BlockFeeder extends BlockContainerBase implements IName{
private IIcon topIcon; private IIcon topIcon;
public BlockFeeder(){ public BlockFeeder(){
super(Material.wood); super(Material.wood);
this.setBlockName("blockFeeder"); this.setBlockName(Util.getNamePrefix() + this.getName());
this.setCreativeTab(CreativeTab.instance); this.setCreativeTab(CreativeTab.instance);
this.setHarvestLevel("axe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeWood);
} }
@Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityFeeder(); return new TileEntityFeeder();
} }
@Override
public IIcon getIcon(int side, int metadata){ public IIcon getIcon(int side, int metadata){
return (side == 0 || side == 1) ? this.topIcon : this.blockIcon; return (side == 0 || side == 1) ? this.topIcon : this.blockIcon;
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){ public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + Util.getSubbedUnlocalized(this)); this.blockIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName());
this.topIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + Util.getSubbedUnlocalized(this) + "Top"); this.topIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + "Top");
} }
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
if(!world.isRemote){ if(!world.isRemote){
TileEntityFeeder feeder = (TileEntityFeeder)world.getTileEntity(x, y, z); TileEntityFeeder feeder = (TileEntityFeeder)world.getTileEntity(x, y, z);
if (feeder != null) player.openGui(SPRS.instance, GuiHandler.FEEDER_ID, world, x, y, z); if (feeder != null) player.openGui(SomePrettyRandomStuff.instance, GuiHandler.FEEDER_ID, world, x, y, z);
return true; return true;
} }
return true; return true;
} }
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){ public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z); this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6); super.breakBlock(world, x, y, z, block, par6);
} }
@Override
public String getName(){
return "blockFeeder";
}
} }

View file

@ -0,0 +1,69 @@
package ellpeck.someprettyrandomstuff.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.SomePrettyRandomStuff;
import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.inventory.GuiHandler;
import ellpeck.someprettyrandomstuff.tile.TileEntityGiantChest;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class BlockGiantChest extends BlockContainerBase implements IName{
private IIcon topIcon;
public BlockGiantChest(){
super(Material.wood);
this.setBlockName(Util.getNamePrefix() + this.getName());
this.setCreativeTab(CreativeTab.instance);
this.setHarvestLevel("axe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeWood);
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityGiantChest();
}
@Override
public IIcon getIcon(int side, int metadata){
return side == 1 ? this.topIcon : this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName());
this.topIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + "Top");
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityGiantChest chest = (TileEntityGiantChest)world.getTileEntity(x, y, z);
if (chest != null) player.openGui(SomePrettyRandomStuff.instance, GuiHandler.GIANT_CHEST_ID, world, x, y, z);
return true;
}
return true;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
@Override
public String getName(){
return "blockGiantChest";
}
}

View file

@ -6,6 +6,7 @@ import ellpeck.someprettyrandomstuff.blocks.metalists.TheMiscBlocks;
import ellpeck.someprettyrandomstuff.creative.CreativeTab; import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.items.InitItems; import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.items.metalists.TheMiscItems; import ellpeck.someprettyrandomstuff.items.metalists.TheMiscItems;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -21,14 +22,14 @@ import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockMisc extends Block{ public class BlockMisc extends Block implements IName{
public static final TheMiscBlocks[] allMiscBlocks = TheMiscBlocks.values(); public static final TheMiscBlocks[] allMiscBlocks = TheMiscBlocks.values();
public IIcon[] textures = new IIcon[allMiscBlocks.length]; public IIcon[] textures = new IIcon[allMiscBlocks.length];
public BlockMisc(){ public BlockMisc(){
super(Material.rock); super(Material.rock);
this.setBlockName("blockMisc"); this.setBlockName(Util.getNamePrefix() + this.getName());
this.setCreativeTab(CreativeTab.instance); this.setCreativeTab(CreativeTab.instance);
} }
@ -40,44 +41,64 @@ public class BlockMisc extends Block{
} }
} }
@Override
public Item getItemDropped(int meta, Random rand, int par3){ public Item getItemDropped(int meta, Random rand, int par3){
return meta == TheMiscBlocks.ORE_QUARTZ.ordinal() ? InitItems.itemMisc : super.getItemDropped(meta, rand, par3); return meta == TheMiscBlocks.ORE_QUARTZ.ordinal() ? InitItems.itemMisc : super.getItemDropped(meta, rand, par3);
} }
@Override
public int damageDropped(int meta){ public int damageDropped(int meta){
return meta == TheMiscBlocks.ORE_QUARTZ.ordinal() ? TheMiscItems.QUARTZ.ordinal() : super.damageDropped(meta); return meta == TheMiscBlocks.ORE_QUARTZ.ordinal() ? TheMiscItems.QUARTZ.ordinal() : super.damageDropped(meta);
} }
@Override
public int quantityDropped(int meta, int fortune, Random random){
return meta == TheMiscBlocks.ORE_QUARTZ.ordinal() ? 1+random.nextInt(2)+fortune : 1;
}
@Override
public IIcon getIcon(int side, int metadata){ public IIcon getIcon(int side, int metadata){
return textures[metadata]; return textures[metadata];
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){ public void registerBlockIcons(IIconRegister iconReg){
for(int i = 0; i < textures.length; i++){ for(int i = 0; i < textures.length; i++){
textures[i] = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + Util.getSubbedUnlocalized(this) + allMiscBlocks[i].getName()); textures[i] = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + allMiscBlocks[i].getName());
} }
} }
@Override
public String getName(){
return "blockMisc";
}
public static class ItemBlockMisc extends ItemBlock{ public static class ItemBlockMisc extends ItemBlock{
private Block theBlock;
public ItemBlockMisc(Block block){ public ItemBlockMisc(Block block){
super(block); super(block);
this.theBlock = block;
this.setHasSubtypes(true); this.setHasSubtypes(true);
this.setMaxDamage(0); this.setMaxDamage(0);
} }
@Override
public String getUnlocalizedName(ItemStack stack){ public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName() + allMiscBlocks[stack.getItemDamage()].getName(); return this.getUnlocalizedName() + allMiscBlocks[stack.getItemDamage()].getName();
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + this.getUnlocalizedName(stack).substring(5) + ".desc")); if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + allMiscBlocks[stack.getItemDamage()].getName() + ".desc"));
else list.add(Util.shiftForInfo()); else list.add(Util.shiftForInfo());
} }
@Override
public int getMetadata(int damage){ public int getMetadata(int damage){
return damage; return damage;
} }

View file

@ -2,28 +2,36 @@ package ellpeck.someprettyrandomstuff.blocks;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class DefaultItemBlock extends ItemBlock{ public class DefaultItemBlock extends ItemBlock{
Block theBlock;
public DefaultItemBlock(Block block){ public DefaultItemBlock(Block block){
super(block); super(block);
this.theBlock = block;
this.setHasSubtypes(false); this.setHasSubtypes(false);
} }
@Override
public String getUnlocalizedName(ItemStack stack){ public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName(); return this.getUnlocalizedName();
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
list.add(Util.addStandardInformation(this)); if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc"));
else list.add(Util.shiftForInfo());
} }
} }

View file

@ -2,6 +2,7 @@ package ellpeck.someprettyrandomstuff.blocks;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -10,18 +11,21 @@ public class InitBlocks{
public static Block blockCompost; public static Block blockCompost;
public static Block blockMisc; public static Block blockMisc;
public static Block blockFeeder; public static Block blockFeeder;
public static Block blockGiantChest;
public static void init(){ public static void init(){
Util.logInfo("Initializing Blocks..."); Util.logInfo("Initializing Blocks...");
blockCompost = new BlockCompost(); blockCompost = new BlockCompost();
GameRegistry.registerBlock(blockCompost, DefaultItemBlock.class, Util.getSubbedUnlocalized(blockCompost)); GameRegistry.registerBlock(blockCompost, DefaultItemBlock.class, ((IName)blockCompost).getName());
blockMisc = new BlockMisc(); blockMisc = new BlockMisc();
GameRegistry.registerBlock(blockMisc, BlockMisc.ItemBlockMisc.class, Util.getSubbedUnlocalized(blockMisc)); GameRegistry.registerBlock(blockMisc, BlockMisc.ItemBlockMisc.class, ((IName)blockMisc).getName());
blockFeeder = new BlockFeeder(); blockFeeder = new BlockFeeder();
GameRegistry.registerBlock(blockFeeder, DefaultItemBlock.class, Util.getSubbedUnlocalized(blockFeeder)); GameRegistry.registerBlock(blockFeeder, DefaultItemBlock.class, ((IName)blockFeeder).getName());
blockGiantChest = new BlockGiantChest();
GameRegistry.registerBlock(blockGiantChest, DefaultItemBlock.class, ((IName)blockGiantChest).getName());
} }
} }

View file

@ -1,8 +1,8 @@
package ellpeck.someprettyrandomstuff.blocks.metalists; package ellpeck.someprettyrandomstuff.blocks.metalists;
import ellpeck.someprettyrandomstuff.util.IItemEnum; import ellpeck.someprettyrandomstuff.util.IName;
public enum TheMiscBlocks implements IItemEnum{ public enum TheMiscBlocks implements IName{
QUARTZ_PILLAR("BlackQuartzPillar"), QUARTZ_PILLAR("BlackQuartzPillar"),
QUARTZ_CHISELED("BlackQuartzChiseled"), QUARTZ_CHISELED("BlackQuartzChiseled"),
@ -15,6 +15,7 @@ public enum TheMiscBlocks implements IItemEnum{
this.name = name; this.name = name;
} }
@Override
public String getName(){ public String getName(){
return this.name; return this.name;
} }

View file

@ -15,10 +15,12 @@ public class CreativeTab extends CreativeTabs{
super(Util.MOD_ID_LOWER); super(Util.MOD_ID_LOWER);
} }
@Override
public Item getTabIconItem(){ public Item getTabIconItem(){
return InitItems.itemFoods; return InitItems.itemFoods;
} }
@Override
public ItemStack getIconItemStack(){ public ItemStack getIconItemStack(){
return new ItemStack(this.getTabIconItem(), 1, TheFoods.SUBMARINE_SANDWICH.ordinal()); return new ItemStack(this.getTabIconItem(), 1, TheFoods.SUBMARINE_SANDWICH.ordinal());
} }

View file

@ -12,6 +12,7 @@ import java.util.Random;
public class OreGen implements IWorldGenerator{ public class OreGen implements IWorldGenerator{
@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, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
switch (world.provider.dimensionId){ switch (world.provider.dimensionId){
case -1: case -1:

View file

@ -17,7 +17,6 @@ public class ContainerFeeder extends Container{
private int lastCurrentTimer; private int lastCurrentTimer;
private int lastCurrentAnimalAmount; private int lastCurrentAnimalAmount;
private int lastIsBred;
public ContainerFeeder(InventoryPlayer inventory, TileEntityBase tile){ public ContainerFeeder(InventoryPlayer inventory, TileEntityBase tile){
this.tileFeeder = (TileEntityFeeder)tile; this.tileFeeder = (TileEntityFeeder)tile;
@ -33,13 +32,14 @@ public class ContainerFeeder extends Container{
} }
} }
@Override
public void addCraftingToCrafters(ICrafting iCraft){ public void addCraftingToCrafters(ICrafting iCraft){
super.addCraftingToCrafters(iCraft); super.addCraftingToCrafters(iCraft);
iCraft.sendProgressBarUpdate(this, 0, this.tileFeeder.currentTimer); iCraft.sendProgressBarUpdate(this, 0, this.tileFeeder.currentTimer);
iCraft.sendProgressBarUpdate(this, 1, this.tileFeeder.currentAnimalAmount); iCraft.sendProgressBarUpdate(this, 1, this.tileFeeder.currentAnimalAmount);
iCraft.sendProgressBarUpdate(this, 2, this.tileFeeder.isBred);
} }
@Override
public void detectAndSendChanges(){ public void detectAndSendChanges(){
super.detectAndSendChanges(); super.detectAndSendChanges();
for(Object crafter : this.crafters){ for(Object crafter : this.crafters){
@ -47,94 +47,26 @@ public class ContainerFeeder extends Container{
if(this.lastCurrentTimer != this.tileFeeder.currentTimer) iCraft.sendProgressBarUpdate(this, 0, this.tileFeeder.currentTimer); if(this.lastCurrentTimer != this.tileFeeder.currentTimer) iCraft.sendProgressBarUpdate(this, 0, this.tileFeeder.currentTimer);
if(this.lastCurrentAnimalAmount != this.tileFeeder.currentAnimalAmount) iCraft.sendProgressBarUpdate(this, 1, this.tileFeeder.currentAnimalAmount); if(this.lastCurrentAnimalAmount != this.tileFeeder.currentAnimalAmount) iCraft.sendProgressBarUpdate(this, 1, this.tileFeeder.currentAnimalAmount);
if(this.lastIsBred != this.tileFeeder.isBred) iCraft.sendProgressBarUpdate(this, 2, this.tileFeeder.isBred);
} }
this.lastCurrentTimer = this.tileFeeder.currentTimer; this.lastCurrentTimer = this.tileFeeder.currentTimer;
this.lastCurrentAnimalAmount = this.tileFeeder.currentAnimalAmount; this.lastCurrentAnimalAmount = this.tileFeeder.currentAnimalAmount;
this.lastIsBred = this.tileFeeder.isBred;
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void updateProgressBar(int par1, int par2){ public void updateProgressBar(int par1, int par2){
if(par1 == 0) this.tileFeeder.currentTimer = par2; if(par1 == 0) this.tileFeeder.currentTimer = par2;
if(par1 == 1) this.tileFeeder.currentAnimalAmount = par2; if(par1 == 1) this.tileFeeder.currentAnimalAmount = par2;
if(par1 == 2) this.tileFeeder.isBred = par2;
} }
@Override
public boolean canInteractWith(EntityPlayer player){ public boolean canInteractWith(EntityPlayer player){
return this.tileFeeder.isUseableByPlayer(player); return this.tileFeeder.isUseableByPlayer(player);
} }
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){ public ItemStack transferStackInSlot(EntityPlayer player, int slot){
/*ItemStack itemstack = null;
Slot slot = (Slot)this.inventorySlots.get(p_82846_2_);
if (slot != null && slot.getHasStack())
{
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (p_82846_2_ == 2)
{
if (!this.mergeItemStack(itemstack1, 3, 39, true))
{
return null;
}
slot.onSlotChange(itemstack1, itemstack);
}
else if (p_82846_2_ != 1 && p_82846_2_ != 0)
{
if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null)
{
if (!this.mergeItemStack(itemstack1, 0, 1, false))
{
return null;
}
}
else if (TileEntityFurnace.isItemFuel(itemstack1))
{
if (!this.mergeItemStack(itemstack1, 1, 2, false))
{
return null;
}
}
else if (p_82846_2_ >= 3 && p_82846_2_ < 30)
{
if (!this.mergeItemStack(itemstack1, 30, 39, false))
{
return null;
}
}
else if (p_82846_2_ >= 30 && p_82846_2_ < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
{
return null;
}
}
else if (!this.mergeItemStack(itemstack1, 3, 39, false))
{
return null;
}
if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack)null);
}
else
{
slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize)
{
return null;
}
slot.onPickupFromSlot(p_82846_1_, itemstack1);
}
return itemstack;*/
return null; return null;
} }
} }

View file

@ -0,0 +1,43 @@
package ellpeck.someprettyrandomstuff.inventory;
import ellpeck.someprettyrandomstuff.tile.TileEntityBase;
import ellpeck.someprettyrandomstuff.tile.TileEntityGiantChest;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerGiantChest extends Container{
public TileEntityGiantChest tileChest;
public ContainerGiantChest(InventoryPlayer inventory, TileEntityBase tile){
this.tileChest = (TileEntityGiantChest)tile;
for (int i = 0; i < 13; i++){
for (int j = 0; j < 13; j++){
this.addSlotToContainer(new Slot(this.tileChest, j + (i*13), 5 + j * 18, 5 + i * 18));
}
}
for (int i = 0; i < 3; i++){
for (int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 33 + 8 + j * 18, 244 + 4 + i * 18));
}
}
for (int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 33 + 8 + i * 18, 244 + 62));
}
}
@Override
public boolean canInteractWith(EntityPlayer player){
return this.tileChest.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
return null;
}
}

View file

@ -19,38 +19,46 @@ public class GuiFeeder extends GuiContainer{
private static final ResourceLocation resLoc = Util.getGuiLocation("guiFeeder"); private static final ResourceLocation resLoc = Util.getGuiLocation("guiFeeder");
private TileEntityFeeder tileFeeder; private TileEntityFeeder tileFeeder;
public int loveCounter;
public GuiFeeder(InventoryPlayer inventory, TileEntityBase tile){ public GuiFeeder(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerFeeder(inventory, tile)); super(new ContainerFeeder(inventory, tile));
this.tileFeeder = (TileEntityFeeder)tile; this.tileFeeder = (TileEntityFeeder)tile;
this.xSize = 176; this.xSize = 176;
this.ySize = 156; this.ySize = 70+86;
}
public void drawGuiContainerForegroundLayer(int x, int y){
} }
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){ public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(Util.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+70, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(resLoc); this.mc.getTextureManager().bindTexture(resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 70);
if(this.tileFeeder.currentTimer > 0){ if(this.tileFeeder.currentTimer > 0){
int i = this.tileFeeder.getCurrentTimerToScale(22); int i = this.tileFeeder.getCurrentTimerToScale(22);
this.drawTexturedModalRect(guiLeft+80, guiTop+42-i, 176, 16+22-i, 16, 22); this.drawTexturedModalRect(guiLeft + 80, guiTop + 42 - i, 176, 16 + 22 - i, 16, 22);
} }
if(this.tileFeeder.isBred == 1) this.drawTexturedModalRect(guiLeft+76, guiTop+4, 176, 0, 25, 16);
if(this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < this.tileFeeder.animalThreshold) this.drawTexturedModalRect(guiLeft + 70, guiTop + 31, 192, 16, 8, 8); if(this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < this.tileFeeder.animalThreshold) this.drawTexturedModalRect(guiLeft + 70, guiTop + 31, 192, 16, 8, 8);
if(this.tileFeeder.currentAnimalAmount >= this.tileFeeder.animalThreshold) this.drawTexturedModalRect(guiLeft + 70, guiTop + 31, 192, 24, 8, 8); if(this.tileFeeder.currentAnimalAmount >= this.tileFeeder.animalThreshold) this.drawTexturedModalRect(guiLeft + 70, guiTop + 31, 192, 24, 8, 8);
if(this.loveCounter > 0){
this.loveCounter++;
if(this.loveCounter >= 15){
this.loveCounter = 0;
}
this.drawTexturedModalRect(guiLeft + 76, guiTop + 4, 176, 0, 25, 16);
}
} }
@Override
public void drawScreen(int x, int y, float f){ public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f); super.drawScreen(x, y, f);
if(x >= guiLeft+69 && y >= guiTop+30 && x <= guiLeft+69+10 && y <= guiTop+30+10){ if(x >= guiLeft+69 && y >= guiTop+30 && x <= guiLeft+69+10 && y <= guiTop+30+10){
String[] array = new String[]{(this.tileFeeder.currentAnimalAmount + " " + StatCollector.translateToLocal("feeder.animal.desc") + (this.tileFeeder.currentAnimalAmount == 1 ? "" : StatCollector.translateToLocal("feeder.animalsSuffix.desc"))), ((this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < this.tileFeeder.animalThreshold) ? StatCollector.translateToLocal("feeder.enoughToBreed.desc") : (this.tileFeeder.currentAnimalAmount >= this.tileFeeder.animalThreshold ? StatCollector.translateToLocal("feeder.tooMany.desc") : StatCollector.translateToLocal("feeder.notEnough.desc")))}; String[] array = new String[]{(this.tileFeeder.currentAnimalAmount + " " + StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".feeder.animal.desc") + (this.tileFeeder.currentAnimalAmount == 1 ? "" : StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".feeder.animalsSuffix.desc"))), ((this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < this.tileFeeder.animalThreshold) ? StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".feeder.enoughToBreed.desc") : (this.tileFeeder.currentAnimalAmount >= this.tileFeeder.animalThreshold ? StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".feeder.tooMany.desc") : StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".feeder.notEnough.desc")))};
this.func_146283_a(Arrays.asList(array), x, y); this.func_146283_a(Arrays.asList(array), x, y);
} }
} }

View file

@ -0,0 +1,32 @@
package ellpeck.someprettyrandomstuff.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.tile.TileEntityBase;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class GuiGiantChest extends GuiContainer{
private static final ResourceLocation resLoc = Util.getGuiLocation("guiGiantChest");
public GuiGiantChest(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerGiantChest(inventory, tile));
this.xSize = 242;
this.ySize = 244+86;
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 242, 244);
this.mc.getTextureManager().bindTexture(Util.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft+33, this.guiTop+244, 0, 0, 176, 86);
}
}

View file

@ -2,7 +2,7 @@ package ellpeck.someprettyrandomstuff.inventory;
import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
import ellpeck.someprettyrandomstuff.SPRS; import ellpeck.someprettyrandomstuff.SomePrettyRandomStuff;
import ellpeck.someprettyrandomstuff.tile.TileEntityBase; import ellpeck.someprettyrandomstuff.tile.TileEntityBase;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -10,30 +10,37 @@ import net.minecraft.world.World;
public class GuiHandler implements IGuiHandler{ public class GuiHandler implements IGuiHandler{
@Override
public Object getServerGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){ public Object getServerGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
TileEntityBase tile = (TileEntityBase)world.getTileEntity(x, y, z); TileEntityBase tile = (TileEntityBase)world.getTileEntity(x, y, z);
switch (id){ switch (id){
case FEEDER_ID: case FEEDER_ID:
return new ContainerFeeder(entityPlayer.inventory, tile); return new ContainerFeeder(entityPlayer.inventory, tile);
case GIANT_CHEST_ID:
return new ContainerGiantChest(entityPlayer.inventory, tile);
default: default:
return null; return null;
} }
} }
@Override
public Object getClientGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){ public Object getClientGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
TileEntityBase tile = (TileEntityBase)world.getTileEntity(x, y, z); TileEntityBase tile = (TileEntityBase)world.getTileEntity(x, y, z);
switch (id){ switch (id){
case FEEDER_ID: case FEEDER_ID:
return new GuiFeeder(entityPlayer.inventory, tile); return new GuiFeeder(entityPlayer.inventory, tile);
case GIANT_CHEST_ID:
return new GuiGiantChest(entityPlayer.inventory, tile);
default: default:
return null; return null;
} }
} }
public static final int FEEDER_ID = 0; public static final int FEEDER_ID = 0;
public static final int GIANT_CHEST_ID = 1;
public static void init(){ public static void init(){
Util.logInfo("Initializing GuiHandler..."); Util.logInfo("Initializing GuiHandler...");
NetworkRegistry.INSTANCE.registerGuiHandler(SPRS.instance, new GuiHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(SomePrettyRandomStuff.instance, new GuiHandler());
} }
} }

View file

@ -3,6 +3,7 @@ package ellpeck.someprettyrandomstuff.items;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.someprettyrandomstuff.items.tools.*; import ellpeck.someprettyrandomstuff.items.tools.*;
import ellpeck.someprettyrandomstuff.material.InitItemMaterials; import ellpeck.someprettyrandomstuff.material.InitItemMaterials;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -29,16 +30,16 @@ public class InitItems{
Util.logInfo("Initializing Items..."); Util.logInfo("Initializing Items...");
itemFertilizer = new ItemFertilizer(); itemFertilizer = new ItemFertilizer();
GameRegistry.registerItem(itemFertilizer, Util.getSubbedUnlocalized(itemFertilizer)); GameRegistry.registerItem(itemFertilizer, ((IName)itemFertilizer).getName());
itemMisc = new ItemMisc(); itemMisc = new ItemMisc();
GameRegistry.registerItem(itemMisc, Util.getSubbedUnlocalized(itemMisc)); GameRegistry.registerItem(itemMisc, ((IName)itemMisc).getName());
itemFoods = new ItemFoods(); itemFoods = new ItemFoods();
GameRegistry.registerItem(itemFoods, Util.getSubbedUnlocalized(itemFoods)); GameRegistry.registerItem(itemFoods, ((IName)itemFoods).getName());
itemKnife = new ItemKnife(); itemKnife = new ItemKnife();
GameRegistry.registerItem(itemKnife, Util.getSubbedUnlocalized(itemKnife)); GameRegistry.registerItem(itemKnife, ((IName)itemKnife).getName());
itemPickaxeEmerald = new ItemPickaxeSPRS(InitItemMaterials.toolMaterialEmerald, "itemPickaxeEmerald"); itemPickaxeEmerald = new ItemPickaxeSPRS(InitItemMaterials.toolMaterialEmerald, "itemPickaxeEmerald");
itemAxeEmerald = new ItemAxeSPRS(InitItemMaterials.toolMaterialEmerald, "itemAxeEmerald"); itemAxeEmerald = new ItemAxeSPRS(InitItemMaterials.toolMaterialEmerald, "itemAxeEmerald");

View file

@ -3,6 +3,7 @@ package ellpeck.someprettyrandomstuff.items;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.creative.CreativeTab; import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -14,13 +15,14 @@ import net.minecraft.world.World;
import java.util.List; import java.util.List;
public class ItemFertilizer extends Item{ public class ItemFertilizer extends Item implements IName{
public ItemFertilizer(){ public ItemFertilizer(){
this.setUnlocalizedName("itemFertilizer"); this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.setCreativeTab(CreativeTab.instance); this.setCreativeTab(CreativeTab.instance);
} }
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10){ public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10){
if(ItemDye.applyBonemeal(stack, world, x, y, z, player)){ if(ItemDye.applyBonemeal(stack, world, x, y, z, player)){
if(!world.isRemote) world.playAuxSFX(2005, x, y, z, 0); if(!world.isRemote) world.playAuxSFX(2005, x, y, z, 0);
@ -29,18 +31,26 @@ public class ItemFertilizer extends Item{
return super.onItemUse(stack, player, world, x, y, z, par7, par8, par9, par10); return super.onItemUse(stack, player, world, x, y, z, par7, par8, par9, par10);
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
list.add(Util.addStandardInformation(this)); list.add(Util.addStandardInformation(this));
} }
@Override
public IIcon getIcon(ItemStack stack, int pass){ public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon; return this.itemIcon;
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){ public void registerIcons(IIconRegister iconReg){
this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + Util.getSubbedUnlocalized(this)); this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName());
}
@Override
public String getName(){
return "itemFertilizer";
} }
} }

View file

@ -4,6 +4,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.creative.CreativeTab; import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.items.metalists.TheFoods; import ellpeck.someprettyrandomstuff.items.metalists.TheFoods;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
@ -19,14 +20,14 @@ import net.minecraft.world.World;
import java.util.List; import java.util.List;
public class ItemFoods extends ItemFood{ public class ItemFoods extends ItemFood implements IName{
public static final TheFoods[] allFoods = TheFoods.values(); public static final TheFoods[] allFoods = TheFoods.values();
public IIcon[] textures = new IIcon[allFoods.length]; public IIcon[] textures = new IIcon[allFoods.length];
public ItemFoods(){ public ItemFoods(){
super(0, 0.0F, false); super(0, 0.0F, false);
this.setUnlocalizedName("itemFood"); this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.setHasSubtypes(true); this.setHasSubtypes(true);
this.setMaxDamage(0); this.setMaxDamage(0);
this.setCreativeTab(CreativeTab.instance); this.setCreativeTab(CreativeTab.instance);
@ -34,22 +35,27 @@ public class ItemFoods extends ItemFood{
TheFoods.setReturnItems(); TheFoods.setReturnItems();
} }
@Override
public int func_150905_g(ItemStack stack){ public int func_150905_g(ItemStack stack){
return allFoods[stack.getItemDamage()].healAmount; return allFoods[stack.getItemDamage()].healAmount;
} }
@Override
public float func_150906_h(ItemStack stack){ public float func_150906_h(ItemStack stack){
return allFoods[stack.getItemDamage()].saturation; return allFoods[stack.getItemDamage()].saturation;
} }
@Override
public EnumAction getItemUseAction(ItemStack stack){ public EnumAction getItemUseAction(ItemStack stack){
return allFoods[stack.getItemDamage()].getsDrunken ? EnumAction.drink : EnumAction.eat; return allFoods[stack.getItemDamage()].getsDrunken ? EnumAction.drink : EnumAction.eat;
} }
@Override
public int getMaxItemUseDuration(ItemStack stack){ public int getMaxItemUseDuration(ItemStack stack){
return allFoods[stack.getItemDamage()].useDuration; return allFoods[stack.getItemDamage()].useDuration;
} }
@Override
public int getMetadata(int damage){ public int getMetadata(int damage){
return damage; return damage;
} }
@ -62,10 +68,12 @@ public class ItemFoods extends ItemFood{
} }
} }
@Override
public String getUnlocalizedName(ItemStack stack){ public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName() + allFoods[stack.getItemDamage()].name; return this.getUnlocalizedName() + allFoods[stack.getItemDamage()].getName();
} }
@Override
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player){ public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player){
ItemStack stackToReturn = super.onEaten(stack, world, player); ItemStack stackToReturn = super.onEaten(stack, world, player);
ItemStack returnItem = allFoods[stack.getItemDamage()].returnItem; ItemStack returnItem = allFoods[stack.getItemDamage()].returnItem;
@ -81,25 +89,33 @@ public class ItemFoods extends ItemFood{
return stackToReturn; return stackToReturn;
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
if(Util.isShiftPressed()){ if(Util.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip." + this.getUnlocalizedName(stack).substring(5) + ".desc")); list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + this.getName() + allFoods[stack.getItemDamage()].getName() + ".desc"));
list.add(StatCollector.translateToLocal("tooltip.hunger.desc") + ": " + allFoods[stack.getItemDamage()].healAmount); list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + ".hunger.desc") + ": " + allFoods[stack.getItemDamage()].healAmount);
list.add(StatCollector.translateToLocal("tooltip.saturation.desc") + ": " + allFoods[stack.getItemDamage()].saturation); list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + ".saturation.desc") + ": " + allFoods[stack.getItemDamage()].saturation);
} }
else list.add(Util.shiftForInfo()); else list.add(Util.shiftForInfo());
} }
@Override
public IIcon getIconFromDamage(int par1){ public IIcon getIconFromDamage(int par1){
return textures[par1]; return textures[par1];
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){ public void registerIcons(IIconRegister iconReg){
for(int i = 0; i < textures.length; i++){ for(int i = 0; i < textures.length; i++){
textures[i] = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + Util.getSubbedUnlocalized(this) + allFoods[i].getName()); textures[i] = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + allFoods[i].getName());
} }
} }
@Override
public String getName(){
return "itemFood";
}
} }

View file

@ -4,6 +4,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.config.ConfigValues; import ellpeck.someprettyrandomstuff.config.ConfigValues;
import ellpeck.someprettyrandomstuff.creative.CreativeTab; import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -13,16 +14,17 @@ import net.minecraft.util.IIcon;
import java.util.List; import java.util.List;
public class ItemKnife extends Item{ public class ItemKnife extends Item implements IName{
public ItemKnife(){ public ItemKnife(){
this.setUnlocalizedName("itemKnife"); this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.setMaxDamage(ConfigValues.itemKnifeMaxDamage); this.setMaxDamage(ConfigValues.itemKnifeMaxDamage);
this.setCreativeTab(CreativeTab.instance); this.setCreativeTab(CreativeTab.instance);
this.setMaxStackSize(1); this.setMaxStackSize(1);
this.setContainerItem(this); this.setContainerItem(this);
} }
@Override
public ItemStack getContainerItem(ItemStack stack){ public ItemStack getContainerItem(ItemStack stack){
ItemStack theStack = stack.copy(); ItemStack theStack = stack.copy();
theStack.setItemDamage(theStack.getItemDamage() + 1); theStack.setItemDamage(theStack.getItemDamage() + 1);
@ -30,22 +32,31 @@ public class ItemKnife extends Item{
return theStack; return theStack;
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
list.add(Util.addStandardInformation(this)); list.add(Util.addStandardInformation(this));
} }
@Override
public boolean getShareTag(){ public boolean getShareTag(){
return true; return true;
} }
@Override
public IIcon getIcon(ItemStack stack, int pass){ public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon; return this.itemIcon;
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){ public void registerIcons(IIconRegister iconReg){
this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + Util.getSubbedUnlocalized(this)); this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName());
}
@Override
public String getName(){
return "itemKnife";
} }
} }

View file

@ -4,6 +4,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.creative.CreativeTab; import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.items.metalists.TheMiscItems; import ellpeck.someprettyrandomstuff.items.metalists.TheMiscItems;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
@ -15,17 +16,23 @@ import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class ItemMisc extends Item{ public class ItemMisc extends Item implements IName{
public static final TheMiscItems[] allMiscItems = TheMiscItems.values(); public static final TheMiscItems[] allMiscItems = TheMiscItems.values();
public IIcon[] textures = new IIcon[allMiscItems.length]; public IIcon[] textures = new IIcon[allMiscItems.length];
public ItemMisc(){ public ItemMisc(){
this.setUnlocalizedName("itemMisc"); this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.setHasSubtypes(true); this.setHasSubtypes(true);
this.setCreativeTab(CreativeTab.instance); this.setCreativeTab(CreativeTab.instance);
} }
@Override
public String getName(){
return "itemMisc";
}
@Override
public int getMetadata(int damage){ public int getMetadata(int damage){
return damage; return damage;
} }
@ -38,25 +45,29 @@ public class ItemMisc extends Item{
} }
} }
@Override
public String getUnlocalizedName(ItemStack stack){ public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName() + allMiscItems[stack.getItemDamage()].name; return this.getUnlocalizedName() + allMiscItems[stack.getItemDamage()].name;
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + this.getUnlocalizedName(stack).substring(5) + ".desc")); if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + this.getName() + allMiscItems[stack.getItemDamage()].getName() + ".desc"));
else list.add(Util.shiftForInfo()); else list.add(Util.shiftForInfo());
} }
@Override
public IIcon getIconFromDamage(int par1){ public IIcon getIconFromDamage(int par1){
return textures[par1]; return textures[par1];
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){ public void registerIcons(IIconRegister iconReg){
for(int i = 0; i < textures.length; i++){ for(int i = 0; i < textures.length; i++){
textures[i] = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + Util.getSubbedUnlocalized(this) + allMiscItems[i].getName()); textures[i] = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + allMiscItems[i].getName());
} }
} }
} }

View file

@ -1,11 +1,11 @@
package ellpeck.someprettyrandomstuff.items.metalists; package ellpeck.someprettyrandomstuff.items.metalists;
import ellpeck.someprettyrandomstuff.items.InitItems; import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.util.IItemEnum; import ellpeck.someprettyrandomstuff.util.IName;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public enum TheFoods implements IItemEnum{ public enum TheFoods implements IName{
CHEESE("Cheese", 1, 0.1F, false, 3), CHEESE("Cheese", 1, 0.1F, false, 3),
PUMPKIN_STEW("PumpkinStew", 10, 0.4F, true, 30), PUMPKIN_STEW("PumpkinStew", 10, 0.4F, true, 30),
@ -47,6 +47,7 @@ public enum TheFoods implements IItemEnum{
this.useDuration = useDuration; this.useDuration = useDuration;
} }
@Override
public String getName(){ public String getName(){
return this.name; return this.name;
} }

View file

@ -1,8 +1,8 @@
package ellpeck.someprettyrandomstuff.items.metalists; package ellpeck.someprettyrandomstuff.items.metalists;
import ellpeck.someprettyrandomstuff.util.IItemEnum; import ellpeck.someprettyrandomstuff.util.IName;
public enum TheMiscItems implements IItemEnum{ public enum TheMiscItems implements IName{
PAPER_CONE("PaperCone"), PAPER_CONE("PaperCone"),
MASHED_FOOD("MashedFood"), MASHED_FOOD("MashedFood"),
@ -21,6 +21,7 @@ public enum TheMiscItems implements IItemEnum{
this.name = name; this.name = name;
} }
@Override
public String getName(){ public String getName(){
return this.name; return this.name;
} }

View file

@ -3,6 +3,7 @@ package ellpeck.someprettyrandomstuff.items.tools;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.creative.CreativeTab; import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -13,29 +14,40 @@ import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class ItemAxeSPRS extends ItemAxe{ public class ItemAxeSPRS extends ItemAxe implements IName{
private String name;
public ItemAxeSPRS(ToolMaterial toolMat, String unlocalizedName){ public ItemAxeSPRS(ToolMaterial toolMat, String unlocalizedName){
super(toolMat); super(toolMat);
this.setUnlocalizedName(unlocalizedName); this.name = unlocalizedName;
this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.setCreativeTab(CreativeTab.instance); this.setCreativeTab(CreativeTab.instance);
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
list.add(Util.addStandardInformation(this)); list.add(Util.addStandardInformation(this));
if(Util.isShiftPressed()){ if(Util.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip.durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage());
} }
} }
@Override
public IIcon getIcon(ItemStack stack, int pass){ public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon; return this.itemIcon;
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){ public void registerIcons(IIconRegister iconReg){
this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + Util.getSubbedUnlocalized(this)); this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName());
}
@Override
public String getName(){
return name;
} }
} }

View file

@ -3,6 +3,7 @@ package ellpeck.someprettyrandomstuff.items.tools;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.creative.CreativeTab; import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -13,29 +14,40 @@ import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class ItemHoeSPRS extends ItemHoe{ public class ItemHoeSPRS extends ItemHoe implements IName{
private String name;
public ItemHoeSPRS(ToolMaterial toolMat, String unlocalizedName){ public ItemHoeSPRS(ToolMaterial toolMat, String unlocalizedName){
super(toolMat); super(toolMat);
this.setUnlocalizedName(unlocalizedName); this.name = unlocalizedName;
this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.setCreativeTab(CreativeTab.instance); this.setCreativeTab(CreativeTab.instance);
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
list.add(Util.addStandardInformation(this)); list.add(Util.addStandardInformation(this));
if(Util.isShiftPressed()){ if(Util.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip.durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage());
} }
} }
@Override
public IIcon getIcon(ItemStack stack, int pass){ public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon; return this.itemIcon;
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){ public void registerIcons(IIconRegister iconReg){
this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + Util.getSubbedUnlocalized(this)); this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName());
}
@Override
public String getName(){
return name;
} }
} }

View file

@ -3,6 +3,7 @@ package ellpeck.someprettyrandomstuff.items.tools;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.creative.CreativeTab; import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -13,29 +14,40 @@ import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class ItemPickaxeSPRS extends ItemPickaxe{ public class ItemPickaxeSPRS extends ItemPickaxe implements IName{
private String name;
public ItemPickaxeSPRS(ToolMaterial toolMat, String unlocalizedName){ public ItemPickaxeSPRS(ToolMaterial toolMat, String unlocalizedName){
super(toolMat); super(toolMat);
this.setUnlocalizedName(unlocalizedName); this.name = unlocalizedName;
this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.setCreativeTab(CreativeTab.instance); this.setCreativeTab(CreativeTab.instance);
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
list.add(Util.addStandardInformation(this)); list.add(Util.addStandardInformation(this));
if(Util.isShiftPressed()){ if(Util.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip.durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage());
} }
} }
@Override
public IIcon getIcon(ItemStack stack, int pass){ public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon; return this.itemIcon;
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){ public void registerIcons(IIconRegister iconReg){
this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + Util.getSubbedUnlocalized(this)); this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName());
}
@Override
public String getName(){
return name;
} }
} }

View file

@ -3,6 +3,7 @@ package ellpeck.someprettyrandomstuff.items.tools;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.creative.CreativeTab; import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -13,29 +14,40 @@ import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class ItemShovelSPRS extends ItemSpade{ public class ItemShovelSPRS extends ItemSpade implements IName{
private String name;
public ItemShovelSPRS(ToolMaterial toolMat, String unlocalizedName){ public ItemShovelSPRS(ToolMaterial toolMat, String unlocalizedName){
super(toolMat); super(toolMat);
this.setUnlocalizedName(unlocalizedName); this.name = unlocalizedName;
this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.setCreativeTab(CreativeTab.instance); this.setCreativeTab(CreativeTab.instance);
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
list.add(Util.addStandardInformation(this)); list.add(Util.addStandardInformation(this));
if(Util.isShiftPressed()){ if(Util.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip.durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage());
} }
} }
@Override
public IIcon getIcon(ItemStack stack, int pass){ public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon; return this.itemIcon;
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){ public void registerIcons(IIconRegister iconReg){
this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + Util.getSubbedUnlocalized(this)); this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName());
}
@Override
public String getName(){
return name;
} }
} }

View file

@ -3,6 +3,7 @@ package ellpeck.someprettyrandomstuff.items.tools;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.creative.CreativeTab; import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -13,29 +14,40 @@ import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class ItemSwordSPRS extends ItemSword{ public class ItemSwordSPRS extends ItemSword implements IName{
private String name;
public ItemSwordSPRS(ToolMaterial toolMat, String unlocalizedName){ public ItemSwordSPRS(ToolMaterial toolMat, String unlocalizedName){
super(toolMat); super(toolMat);
this.setUnlocalizedName(unlocalizedName); this.name = unlocalizedName;
this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.setCreativeTab(CreativeTab.instance); this.setCreativeTab(CreativeTab.instance);
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
list.add(Util.addStandardInformation(this)); list.add(Util.addStandardInformation(this));
if(Util.isShiftPressed()){ if(Util.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip.durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage());
} }
} }
@Override
public IIcon getIcon(ItemStack stack, int pass){ public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon; return this.itemIcon;
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){ public void registerIcons(IIconRegister iconReg){
this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + Util.getSubbedUnlocalized(this)); this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName());
}
@Override
public String getName(){
return name;
} }
} }

View file

@ -0,0 +1,18 @@
package ellpeck.someprettyrandomstuff.network;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;
import ellpeck.someprettyrandomstuff.util.Util;
public class PacketHandler{
public static SimpleNetworkWrapper theNetwork;
public static void init(){
theNetwork = NetworkRegistry.INSTANCE.newSimpleChannel(Util.MOD_ID + "Channel");
theNetwork.registerMessage(PacketTileEntityFeeder.Handler.class, PacketTileEntityFeeder.class, 0, Side.CLIENT);
}
}

View file

@ -0,0 +1,69 @@
package ellpeck.someprettyrandomstuff.network;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import ellpeck.someprettyrandomstuff.inventory.GuiFeeder;
import ellpeck.someprettyrandomstuff.tile.TileEntityFeeder;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class PacketTileEntityFeeder implements IMessage{
private int tileX;
private int tileY;
private int tileZ;
private int animalID;
@SuppressWarnings("unused")
public PacketTileEntityFeeder(){
}
public PacketTileEntityFeeder(TileEntityFeeder tile, int animalID){
this.tileX = tile.xCoord;
this.tileY = tile.yCoord;
this.tileZ = tile.zCoord;
this.animalID = animalID;
}
@Override
public void fromBytes(ByteBuf buf){
this.tileX = buf.readInt();
this.tileY = buf.readInt();
this.tileZ = buf.readInt();
this.animalID = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf){
buf.writeInt(this.tileX);
buf.writeInt(this.tileY);
buf.writeInt(this.tileZ);
buf.writeInt(this.animalID);
}
public static class Handler implements IMessageHandler<PacketTileEntityFeeder, IMessage>{
@Override
public IMessage onMessage(PacketTileEntityFeeder message, MessageContext ctx){
World world = FMLClientHandler.instance().getClient().theWorld;
TileEntity tile = world.getTileEntity(message.tileX, message.tileY, message.tileZ);
if(tile instanceof TileEntityFeeder){
TileEntityFeeder tileFeeder = (TileEntityFeeder)tile;
tileFeeder.feedAnimal((EntityAnimal)world.getEntityByID(message.animalID));
}
if(Minecraft.getMinecraft().currentScreen instanceof GuiFeeder){
((GuiFeeder)Minecraft.getMinecraft().currentScreen).loveCounter++;
}
return null;
}
}
}

View file

@ -1,14 +1,21 @@
package ellpeck.someprettyrandomstuff.proxy; package ellpeck.someprettyrandomstuff.proxy;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class ClientProxy implements IProxy{ public class ClientProxy implements IProxy{
@Override
public void preInit(){ public void preInit(){
} }
@Override
public void init(){ public void init(){
} }
@Override
public void postInit(){ public void postInit(){
} }
} }

View file

@ -1,6 +1,6 @@
package ellpeck.someprettyrandomstuff.proxy; package ellpeck.someprettyrandomstuff.proxy;
public interface IProxy { public interface IProxy{
public abstract void preInit(); public abstract void preInit();

View file

@ -5,14 +5,17 @@ import ellpeck.someprettyrandomstuff.util.Util;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class ServerProxy implements IProxy{ public class ServerProxy implements IProxy{
@Override
public void preInit(){ public void preInit(){
Util.logInfo("PreInitializing ServerProxy..."); Util.logInfo("PreInitializing ServerProxy...");
} }
@Override
public void init(){ public void init(){
Util.logInfo("Initializing ServerProxy..."); Util.logInfo("Initializing ServerProxy...");
} }
@Override
public void postInit(){ public void postInit(){
Util.logInfo("PostInitializing ServerProxy..."); Util.logInfo("PostInitializing ServerProxy...");
} }

View file

@ -2,34 +2,31 @@ package ellpeck.someprettyrandomstuff.tile;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.someprettyrandomstuff.util.Util; import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager; import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public abstract class TileEntityBase extends TileEntity{ public abstract class TileEntityBase extends TileEntity{
@Override
public Packet getDescriptionPacket(){ public Packet getDescriptionPacket(){
NBTTagCompound compound = new NBTTagCompound(); NBTTagCompound compound = new NBTTagCompound();
this.writeToNBT(compound); this.writeToNBT(compound);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata(), compound); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata(), compound);
} }
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet){ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet){
super.onDataPacket(net, packet); super.onDataPacket(net, packet);
this.readFromNBT(packet.func_148857_g()); this.readFromNBT(packet.func_148857_g());
} }
public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z){
return false;
}
public static void init(){ public static void init(){
Util.logInfo("Registering TileEntities..."); Util.logInfo("Registering TileEntities...");
GameRegistry.registerTileEntity(TileEntityCompost.class, Util.MOD_ID_LOWER + ":tileEntityCompost"); GameRegistry.registerTileEntity(TileEntityCompost.class, Util.MOD_ID_LOWER + ":tileEntityCompost");
GameRegistry.registerTileEntity(TileEntityFeeder.class, Util.MOD_ID_LOWER + ":tileEntityFeeder"); GameRegistry.registerTileEntity(TileEntityFeeder.class, Util.MOD_ID_LOWER + ":tileEntityFeeder");
GameRegistry.registerTileEntity(TileEntityGiantChest.class, Util.MOD_ID_LOWER + ":tileEntityGiantChest");
} }
} }

View file

@ -17,6 +17,7 @@ public class TileEntityCompost extends TileEntityInventoryBase{
super(1, "tileEntityCompost"); super(1, "tileEntityCompost");
} }
@Override
public void updateEntity(){ public void updateEntity(){
if(!worldObj.isRemote){ if(!worldObj.isRemote){
if(this.slots[0] != null && !(this.slots[0].getItem() instanceof ItemFertilizer) && this.slots[0].stackSize >= this.amountNeededToConvert){ if(this.slots[0] != null && !(this.slots[0].getItem() instanceof ItemFertilizer) && this.slots[0].stackSize >= this.amountNeededToConvert){
@ -29,11 +30,13 @@ public class TileEntityCompost extends TileEntityInventoryBase{
} }
} }
@Override
public void writeToNBT(NBTTagCompound compound){ public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound); super.writeToNBT(compound);
compound.setInteger("ConversionTime", this.conversionTime); compound.setInteger("ConversionTime", this.conversionTime);
} }
@Override
public void readFromNBT(NBTTagCompound compound){ public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound); super.readFromNBT(compound);
this.conversionTime = compound.getInteger("ConversionTime"); this.conversionTime = compound.getInteger("ConversionTime");

View file

@ -1,8 +1,11 @@
package ellpeck.someprettyrandomstuff.tile; package ellpeck.someprettyrandomstuff.tile;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.config.ConfigValues; import ellpeck.someprettyrandomstuff.config.ConfigValues;
import ellpeck.someprettyrandomstuff.network.PacketHandler;
import ellpeck.someprettyrandomstuff.network.PacketTileEntityFeeder;
import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
@ -18,13 +21,12 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
public int currentTimer; public int currentTimer;
public int currentAnimalAmount; public int currentAnimalAmount;
//Is 0 or 1, gets sent to the GUI for display
public int isBred;
public TileEntityFeeder(){ public TileEntityFeeder(){
super(1, "tileEntityFeeder"); super(1, "tileEntityFeeder");
} }
@Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void updateEntity(){ public void updateEntity(){
if(!worldObj.isRemote){ if(!worldObj.isRemote){
@ -37,35 +39,31 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
this.currentTimer = 0; this.currentTimer = 0;
EntityAnimal randomAnimal = animals.get(new Random().nextInt(this.currentAnimalAmount)); EntityAnimal randomAnimal = animals.get(new Random().nextInt(this.currentAnimalAmount));
if(!randomAnimal.isInLove() && randomAnimal.getGrowingAge() == 0 && randomAnimal.isBreedingItem(this.slots[0])){ if(!randomAnimal.isInLove() && randomAnimal.getGrowingAge() == 0 && randomAnimal.isBreedingItem(this.slots[0])){
randomAnimal.func_146082_f(null);
PacketHandler.theNetwork.sendToAllAround(new PacketTileEntityFeeder(this, randomAnimal.getEntityId()), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 80));
this.feedAnimal(randomAnimal);
this.slots[0].stackSize--; this.slots[0].stackSize--;
if(this.slots[0].stackSize == 0) this.slots[0] = this.slots[0].getItem().getContainerItem(this.slots[0]); if(this.slots[0].stackSize == 0) this.slots[0] = this.slots[0].getItem().getContainerItem(this.slots[0]);
}
}
else this.currentTimer++;
}
else this.currentTimer = 0;
}
else this.currentTimer = 0;
}
}
}
this.isBred = 1; public void feedAnimal(EntityAnimal animal){
animal.func_146082_f(null);
Random rand = new Random(); Random rand = new Random();
for(int i = 0; i < 7; i++){ for(int i = 0; i < 7; i++){
double d = rand.nextGaussian() * 0.02D; double d = rand.nextGaussian() * 0.02D;
double d1 = rand.nextGaussian() * 0.02D; double d1 = rand.nextGaussian() * 0.02D;
double d2 = rand.nextGaussian() * 0.02D; double d2 = rand.nextGaussian() * 0.02D;
worldObj.spawnParticle("heart", (randomAnimal.posX + (double)(rand.nextFloat() * randomAnimal.width * 2.0F)) - randomAnimal.width, randomAnimal.posY + 0.5D + (double)(rand.nextFloat() * randomAnimal.height), (randomAnimal.posZ + (double)(rand.nextFloat() * randomAnimal.width * 2.0F)) - randomAnimal.width, d, d1, d2); worldObj.spawnParticle("heart", (animal.posX + (double)(rand.nextFloat() * animal.width * 2.0F)) - animal.width, animal.posY + 0.5D + (double)(rand.nextFloat() * animal.height), (animal.posZ + (double)(rand.nextFloat() * animal.width * 2.0F)) - animal.width, d, d1, d2);
}
}
}
else{
if(this.currentTimer == timerGoal/10) this.isBred = 0;
this.currentTimer++;
}
}
else{
this.currentTimer = 0;
this.isBred = 0;
}
}
else{
this.currentTimer = 0;
this.isBred = 0;
}
}
} }
} }
@ -74,11 +72,13 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
return this.currentTimer * i / this.timerGoal; return this.currentTimer * i / this.timerGoal;
} }
@Override
public void writeToNBT(NBTTagCompound compound){ public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound); super.writeToNBT(compound);
compound.setInteger("Timer", this.currentTimer); compound.setInteger("Timer", this.currentTimer);
} }
@Override
public void readFromNBT(NBTTagCompound compound){ public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound); super.readFromNBT(compound);
this.currentTimer = compound.getInteger("Timer"); this.currentTimer = compound.getInteger("Timer");

View file

@ -0,0 +1,43 @@
package ellpeck.someprettyrandomstuff.tile;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
public class TileEntityGiantChest extends TileEntityInventoryBase{
public TileEntityGiantChest(){
super(169, "tileEntityGiantChest");
}
@Override
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
NBTTagList tagList = new NBTTagList();
for(int currentIndex = 0; currentIndex < slots.length; ++currentIndex){
if (slots[currentIndex] != null){
NBTTagCompound tagCompound = new NBTTagCompound();
//Too many slots to get saved as Byte
tagCompound.setShort("Slot", (short)currentIndex);
slots[currentIndex].writeToNBT(tagCompound);
tagList.appendTag(tagCompound);
}
}
compound.setTag("Items", tagList);
}
@Override
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
NBTTagList tagList = compound.getTagList("Items", 10);
for (int i = 0; i < tagList.tagCount(); ++i){
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
//Too many slots to get saved as Byte
short slotIndex = tagCompound.getShort("Slot");
if (slotIndex >= 0 && slotIndex < slots.length){
slots[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
}
}
}
}

View file

@ -16,6 +16,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
this.name = name; this.name = name;
} }
@Override
public void writeToNBT(NBTTagCompound compound){ public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound); super.writeToNBT(compound);
NBTTagList tagList = new NBTTagList(); NBTTagList tagList = new NBTTagList();
@ -30,6 +31,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
compound.setTag("Items", tagList); compound.setTag("Items", tagList);
} }
@Override
public void readFromNBT(NBTTagCompound compound){ public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound); super.readFromNBT(compound);
NBTTagList tagList = compound.getTagList("Items", 10); NBTTagList tagList = compound.getTagList("Items", 10);
@ -42,34 +44,42 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
} }
} }
@Override
public int getInventoryStackLimit(){ public int getInventoryStackLimit(){
return 64; return 64;
} }
@Override
public boolean isUseableByPlayer(EntityPlayer player){ public boolean isUseableByPlayer(EntityPlayer player){
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64; return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
} }
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){ public boolean isItemValidForSlot(int i, ItemStack stack){
return false; return false;
} }
@Override
public ItemStack getStackInSlotOnClosing(int i){ public ItemStack getStackInSlotOnClosing(int i){
return getStackInSlot(i); return getStackInSlot(i);
} }
@Override
public void setInventorySlotContents(int i, ItemStack stack){ public void setInventorySlotContents(int i, ItemStack stack){
this.slots[i] = stack; this.slots[i] = stack;
} }
@Override
public int getSizeInventory(){ public int getSizeInventory(){
return slots.length; return slots.length;
} }
@Override
public ItemStack getStackInSlot(int i){ public ItemStack getStackInSlot(int i){
return slots[i]; return slots[i];
} }
@Override
public ItemStack decrStackSize(int i, int j){ public ItemStack decrStackSize(int i, int j){
if (slots[i] != null) { if (slots[i] != null) {
ItemStack stackAt; ItemStack stackAt;
@ -91,18 +101,22 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
this.slots = new ItemStack[itemAmount]; this.slots = new ItemStack[itemAmount];
} }
@Override
public String getInventoryName(){ public String getInventoryName(){
return this.name; return this.name;
} }
@Override
public boolean hasCustomInventoryName(){ public boolean hasCustomInventoryName(){
return false; return false;
} }
@Override
public void openInventory(){ public void openInventory(){
} }
@Override
public void closeInventory(){ public void closeInventory(){
} }

View file

@ -1,6 +1,6 @@
package ellpeck.someprettyrandomstuff.util; package ellpeck.someprettyrandomstuff.util;
public interface IItemEnum{ public interface IName{
public abstract String getName(); public abstract String getName();

View file

@ -1,9 +1,6 @@
package ellpeck.someprettyrandomstuff.util; package ellpeck.someprettyrandomstuff.util;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.block.Block;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
@ -25,6 +22,7 @@ public class Util{
public static final Logger SPRS_LOGGER = LogManager.getLogger(MOD_ID); public static final Logger SPRS_LOGGER = LogManager.getLogger(MOD_ID);
public static final int WILDCARD = OreDictionary.WILDCARD_VALUE; public static final int WILDCARD = OreDictionary.WILDCARD_VALUE;
public static final ResourceLocation GUI_INVENTORY_LOCATION = getGuiLocation("guiInventory");
public static final String BLACK = (char)167 + "0"; public static final String BLACK = (char)167 + "0";
public static final String BLUE = (char)167 + "1"; public static final String BLUE = (char)167 + "1";
@ -56,37 +54,34 @@ public class Util{
} }
public static String shiftForInfo(){ public static String shiftForInfo(){
return GREEN + ITALIC + StatCollector.translateToLocal("tooltip.shiftForInfo.desc"); return GREEN + ITALIC + StatCollector.translateToLocal("tooltip." + MOD_ID_LOWER + ".shiftForInfo.desc");
} }
public static String addStandardInformation(Item item){ public static String addStandardInformation(Item item){
if(isShiftPressed()) return StatCollector.translateToLocal("tooltip." + getSubbedUnlocalized(item) + ".desc"); if(item instanceof IName){
if(isShiftPressed()) return StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)item).getName() + ".desc");
else return shiftForInfo(); else return shiftForInfo();
} }
return null;
}
public static void logInfo(String text){ public static void logInfo(String text){
SPRS_LOGGER.log(Level.INFO, text); SPRS_LOGGER.log(Level.INFO, text);
} }
public static boolean isClientSide(){
return FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT;
}
public static String getSubbedUnlocalized(Item item){
return item.getUnlocalizedName().substring(5);
}
public static String getSubbedUnlocalized(Block block){
return block.getUnlocalizedName().substring(5);
}
public static void registerItems(Item[] items){ public static void registerItems(Item[] items){
for(Item item : items){ for(Item item : items){
GameRegistry.registerItem(item, getSubbedUnlocalized(item)); if(item instanceof IName){
GameRegistry.registerItem(item, ((IName)item).getName());
}
} }
} }
public static ResourceLocation getGuiLocation(String file){ public static ResourceLocation getGuiLocation(String file){
return new ResourceLocation(MOD_ID_LOWER, "textures/gui/" + file + ".png"); return new ResourceLocation(MOD_ID_LOWER, "textures/gui/" + file + ".png");
} }
public static String getNamePrefix(){
return MOD_ID_LOWER + ".";
}
} }

View file

@ -1,134 +1,136 @@
itemGroup.someprettyrandomstuff=SomePrettyRandomStuff itemGroup.someprettyrandomstuff=SomePrettyRandomStuff
achievement.page.someprettyrandomstuff=SomePrettyRandomStuff achievement.page.someprettyrandomstuff=SomePrettyRandomStuff
tile.blockCompost.name=Compost tile.someprettyrandomstuff.blockCompost.name=Compost
tile.blockMiscOreBlackQuartz.name=Black Quartz Ore tile.someprettyrandomstuff.blockMiscOreBlackQuartz.name=Black Quartz Ore
tile.blockMiscBlackQuartz.name=Block of Black Quartz tile.someprettyrandomstuff.blockMiscBlackQuartz.name=Block of Black Quartz
tile.blockMiscBlackQuartzChiseled.name=Chiseled Block of Black Quartz tile.someprettyrandomstuff.blockMiscBlackQuartzChiseled.name=Chiseled Block of Black Quartz
tile.blockMiscBlackQuartzPillar.name=Pillar of Black Quartz tile.someprettyrandomstuff.blockMiscBlackQuartzPillar.name=Pillar of Black Quartz
tile.blockFeeder.name=Automatic Feeder tile.someprettyrandomstuff.blockFeeder.name=Automatic Feeder
tile.someprettyrandomstuff.blockGiantChest.name=Giant Chest
item.itemMiscMashedFood.name=Mashed Food item.someprettyrandomstuff.itemMiscMashedFood.name=Mashed Food
item.itemMiscRefinedIron.name=Refined Iron item.someprettyrandomstuff.itemMiscRefinedIron.name=Refined Iron
item.itemMiscRefinedRedstone.name=Refined Redstone item.someprettyrandomstuff.itemMiscRefinedRedstone.name=Refined Redstone
item.itemMiscCompressedIron.name=Compressed Iron item.someprettyrandomstuff.itemMiscCompressedIron.name=Compressed Iron
item.itemMiscSteel.name=Steel item.someprettyrandomstuff.itemMiscSteel.name=Steel
item.itemFertilizer.name=Fertilizer item.someprettyrandomstuff.itemFertilizer.name=Fertilizer
item.itemMiscDough.name=Dough item.someprettyrandomstuff.itemMiscDough.name=Dough
item.itemMiscPaperCone.name=Paper Cone item.someprettyrandomstuff.itemMiscPaperCone.name=Paper Cone
item.itemMiscKnifeBlade.name=Knife Blade item.someprettyrandomstuff.itemMiscKnifeBlade.name=Knife Blade
item.itemMiscKnifeHandle.name=Knife Handle item.someprettyrandomstuff.itemMiscKnifeHandle.name=Knife Handle
item.itemMiscBlackQuartz.name=Black Quartz item.someprettyrandomstuff.itemMiscBlackQuartz.name=Black Quartz
item.itemKnife.name=Knife item.someprettyrandomstuff.itemKnife.name=Knife
item.itemPickaxeEmerald.name=Emerald Pickaxe item.someprettyrandomstuff.itemPickaxeEmerald.name=Emerald Pickaxe
item.itemAxeEmerald.name=Emerald Axe item.someprettyrandomstuff.itemAxeEmerald.name=Emerald Axe
item.itemShovelEmerald.name=Emerald Shovel item.someprettyrandomstuff.itemShovelEmerald.name=Emerald Shovel
item.itemHoeEmerald.name=Emerald Hoe item.someprettyrandomstuff.itemHoeEmerald.name=Emerald Hoe
item.itemSwordEmerald.name=Emerald Sword item.someprettyrandomstuff.itemSwordEmerald.name=Emerald Sword
item.itemPickaxeObsidian.name=Obsidian Pickaxe item.someprettyrandomstuff.itemPickaxeObsidian.name=Obsidian Pickaxe
item.itemAxeObsidian.name=Obsidian Axe item.someprettyrandomstuff.itemAxeObsidian.name=Obsidian Axe
item.itemShovelObsidian.name=Obsidian Shovel item.someprettyrandomstuff.itemShovelObsidian.name=Obsidian Shovel
item.itemHoeObsidian.name=Obsidian Hoe item.someprettyrandomstuff.itemHoeObsidian.name=Obsidian Hoe
item.itemSwordObsidian.name=Obsidian Sword item.someprettyrandomstuff.itemSwordObsidian.name=Obsidian Sword
item.itemFoodBaguette.name=Baguette item.someprettyrandomstuff.itemFoodBaguette.name=Baguette
item.itemFoodPizza.name=Pizza item.someprettyrandomstuff.itemFoodPizza.name=Pizza
item.itemFoodHamburger.name=Hamburger item.someprettyrandomstuff.itemFoodHamburger.name=Hamburger
item.itemFoodBigCookie.name=Big Cookie item.someprettyrandomstuff.itemFoodBigCookie.name=Big Cookie
item.itemFoodSubmarineSandwich.name=Submarine Sandwich item.someprettyrandomstuff.itemFoodSubmarineSandwich.name=Submarine Sandwich
item.itemFoodToast.name=Toast item.someprettyrandomstuff.itemFoodToast.name=Toast
item.itemFoodChocolate.name=Chocolate item.someprettyrandomstuff.itemFoodChocolate.name=Chocolate
item.itemFoodChocolateCake.name=Chocolate Cake item.someprettyrandomstuff.itemFoodChocolateCake.name=Chocolate Cake
item.itemFoodNoodle.name=Noodle item.someprettyrandomstuff.itemFoodNoodle.name=Noodle
item.itemFoodSpaghetti.name=Spaghetti item.someprettyrandomstuff.itemFoodSpaghetti.name=Spaghetti
item.itemFoodFrenchFry.name=French Fry item.someprettyrandomstuff.itemFoodFrenchFry.name=French Fry
item.itemFoodFrenchFries.name=French Fries item.someprettyrandomstuff.itemFoodFrenchFries.name=French Fries
item.itemFoodFishNChips.name=Fish 'N' Chips item.someprettyrandomstuff.itemFoodFishNChips.name=Fish 'N' Chips
item.itemFoodCarrotJuice.name=Carrot Juice item.someprettyrandomstuff.itemFoodCarrotJuice.name=Carrot Juice
item.itemFoodPumpkinStew.name=Pumpkin Stew item.someprettyrandomstuff.itemFoodPumpkinStew.name=Pumpkin Stew
item.itemFoodCheese.name=Cheese item.someprettyrandomstuff.itemFoodCheese.name=Cheese
tooltip.shiftForInfo.desc=Press Shift for Info tooltip.someprettyrandomstuff.shiftForInfo.desc=Press Shift for Info
tooltip.hunger.desc=Fills tooltip.someprettyrandomstuff.hunger.desc=Fills
tooltip.saturation.desc=Saturation tooltip.someprettyrandomstuff.saturation.desc=Saturation
tooltip.durability.desc=Durability tooltip.someprettyrandomstuff.durability.desc=Durability
tooltip.blockCompost.desc=Used to make Fertilizer with Mashed Food tooltip.someprettyrandomstuff.blockCompost.desc=Used to make Fertilizer with Mashed Food
tooltip.blockMiscOreBlackQuartz.desc=The darkest form of Quartz. Also: You had Silk Touch! tooltip.someprettyrandomstuff.blockMiscOreBlackQuartz.desc=The darkest form of Quartz. Also: You had Silk Touch!
tooltip.blockMiscBlackQuartz.desc=Black, eerie Quartz! Nice for decorating. tooltip.someprettyrandomstuff.blockMiscBlackQuartz.desc=Black, eerie Quartz! Nice for decorating.
tooltip.blockMiscBlackQuartzChiseled.desc=Black, eerie chiseled Quartz! Nice for decorating. tooltip.someprettyrandomstuff.blockMiscBlackQuartzChiseled.desc=Black, eerie chiseled Quartz! Nice for decorating.
tooltip.blockMiscBlackQuartzPillar.desc=Kind of a pillar. Not really, though. It's fake! Fake I say! tooltip.someprettyrandomstuff.blockMiscBlackQuartzPillar.desc=Kind of a pillar. Not really, though. It's fake! Fake I say!
tooltip.blockFeeder.desc=Feeds Animals on its own! tooltip.someprettyrandomstuff.blockFeeder.desc=Feeds Animals on its own!
tooltip.someprettyrandomstuff.blockGiantChest.desc=GUI Scale on 'Auto'? That's a problem!
tooltip.itemMiscMashedFood.desc=Used to make Fertilizer tooltip.someprettyrandomstuff.itemMiscMashedFood.desc=Used to make Fertilizer
tooltip.itemMiscRefinedIron.desc=Iron, but better tooltip.someprettyrandomstuff.itemMiscRefinedIron.desc=Iron, but better
tooltip.itemMiscRefinedRedstone.desc=Redstone, but better tooltip.someprettyrandomstuff.itemMiscRefinedRedstone.desc=Redstone, but better
tooltip.itemMiscCompressedIron.desc=Iron, but compressed tooltip.someprettyrandomstuff.itemMiscCompressedIron.desc=Iron, but compressed
tooltip.itemMiscSteel.desc=Like Iron, but stronger. Much stronger. tooltip.someprettyrandomstuff.itemMiscSteel.desc=Like Iron, but stronger. Much stronger.
tooltip.itemFertilizer.desc=Om nom nom. Don't eat it. tooltip.someprettyrandomstuff.itemFertilizer.desc=Om nom nom. Don't eat it.
tooltip.itemMiscDough.desc=Used to make things that involve dough. tooltip.someprettyrandomstuff.itemMiscDough.desc=Used to make things that involve dough.
tooltip.itemMiscPaperCone.desc=Used to store foodstuffs! tooltip.someprettyrandomstuff.itemMiscPaperCone.desc=Used to store foodstuffs!
tooltip.itemMiscKnifeBlade.desc=Sharp like a tooth! A whale's tooth! tooltip.someprettyrandomstuff.itemMiscKnifeBlade.desc=Sharp like a tooth! A whale's tooth!
tooltip.itemMiscKnifeHandle.desc=Fits comfortably in your hand. tooltip.someprettyrandomstuff.itemMiscKnifeHandle.desc=Fits comfortably in your hand.
tooltip.itemMiscBlackQuartz.desc=Used in the Quartz Enchanter! tooltip.someprettyrandomstuff.itemMiscBlackQuartz.desc=Used in the Quartz Enchanter!
tooltip.itemKnife.desc=Cuts things! Only food though, don't think of stuff... tooltip.someprettyrandomstuff.itemKnife.desc=Cuts things! Only food though, don't think of stuff...
tooltip.itemPickaxeEmerald.desc=Mines Stone. tooltip.someprettyrandomstuff.itemPickaxeEmerald.desc=Mines Stone.
tooltip.itemAxeEmerald.desc=Mines Wood. tooltip.someprettyrandomstuff.itemAxeEmerald.desc=Mines Wood.
tooltip.itemShovelEmerald.desc=Mines Dirt. tooltip.someprettyrandomstuff.itemShovelEmerald.desc=Mines Dirt.
tooltip.itemHoeEmerald.desc=Mines... uhm... yea. tooltip.someprettyrandomstuff.itemHoeEmerald.desc=Mines... uhm... yea.
tooltip.itemSwordEmerald.desc=Mines... mobs? tooltip.someprettyrandomstuff.itemSwordEmerald.desc=Mines... mobs?
tooltip.itemPickaxeObsidian.desc=Mines Stone. Slooooowly. tooltip.someprettyrandomstuff.itemPickaxeObsidian.desc=Mines Stone. Slooooowly.
tooltip.itemAxeObsidian.desc=Mines Wood. Slooooowly. tooltip.someprettyrandomstuff.itemAxeObsidian.desc=Mines Wood. Slooooowly.
tooltip.itemShovelObsidian.desc=Mines Dirt. Slooooowly. tooltip.someprettyrandomstuff.itemShovelObsidian.desc=Mines Dirt. Slooooowly.
tooltip.itemHoeObsidian.desc=Mines... uhm... yea. tooltip.someprettyrandomstuff.itemHoeObsidian.desc=Mines... uhm... yea.
tooltip.itemSwordObsidian.desc=Mines... mobs? tooltip.someprettyrandomstuff.itemSwordObsidian.desc=Mines... mobs?
tooltip.itemFoodBaguette.desc=It's french. It's noms. tooltip.someprettyrandomstuff.itemFoodBaguette.desc=It's french. It's noms.
tooltip.itemFoodPizza.desc=Who doesn't like it? tooltip.someprettyrandomstuff.itemFoodPizza.desc=Who doesn't like it?
tooltip.itemFoodHamburger.desc=It's from a german city! tooltip.someprettyrandomstuff.itemFoodHamburger.desc=It's from a german city!
tooltip.itemFoodBigCookie.desc=Do you know? The Subway Thing? tooltip.someprettyrandomstuff.itemFoodBigCookie.desc=Do you know? The Subway Thing?
tooltip.itemFoodSubmarineSandwich.desc=Do you know? The Subway and everything else Thing? tooltip.someprettyrandomstuff.itemFoodSubmarineSandwich.desc=Do you know? The Subway and everything else Thing?
tooltip.itemFoodToast.desc="GHOSTS! GHOSTS! TOASTS!" tooltip.someprettyrandomstuff.itemFoodToast.desc="GHOSTS! GHOSTS! TOASTS!"
tooltip.itemFoodChocolate.desc=Lari likes. tooltip.someprettyrandomstuff.itemFoodChocolate.desc=Lari likes.
tooltip.itemFoodChocolateCake.desc=Looks delicious. With redberries. Or something. tooltip.someprettyrandomstuff.itemFoodChocolateCake.desc=Looks delicious. With redberries. Or something.
tooltip.itemFoodNoodle.desc=Just one. Like... that's not much. tooltip.someprettyrandomstuff.itemFoodNoodle.desc=Just one. Like... that's not much.
tooltip.itemFoodSpaghetti.desc=The most generic food ever. So clichée. tooltip.someprettyrandomstuff.itemFoodSpaghetti.desc=The most generic food ever. So clichée.
tooltip.itemFoodFrenchFry.desc=French. Fry. tooltip.someprettyrandomstuff.itemFoodFrenchFry.desc=French. Fry.
tooltip.itemFoodFrenchFries.desc=Much like French Fires, but actually taste good. tooltip.someprettyrandomstuff.itemFoodFrenchFries.desc=Much like French Fires, but actually taste good.
tooltip.itemFoodFishNChips.desc=It's Fish. It's Chips. Or French Fries. Whatevs. tooltip.someprettyrandomstuff.itemFoodFishNChips.desc=It's Fish. It's Chips. Or French Fries. Whatevs.
tooltip.itemFoodCarrotJuice.desc=Carrots, but pressed! tooltip.someprettyrandomstuff.itemFoodCarrotJuice.desc=Carrots, but pressed!
tooltip.itemFoodPumpkinStew.desc=Like Mushroom Stew or Rabbit Stew, but pumpykinny. tooltip.someprettyrandomstuff.itemFoodPumpkinStew.desc=Like Mushroom Stew or Rabbit Stew, but pumpykinny.
tooltip.itemFoodCheese.desc=Cheese. tooltip.someprettyrandomstuff.itemFoodCheese.desc=Cheese.
achievement.smeltBaguette=Better than Bread! achievement.someprettyrandomstuff.smeltBaguette=Better than Bread!
achievement.smeltBaguette.desc=Bake a Baguette achievement.someprettyrandomstuff.smeltBaguette.desc=Bake a Baguette
achievement.craftDough=Knead, knead! achievement.someprettyrandomstuff.craftDough=Knead, knead!
achievement.craftDough.desc=Craft some Dough achievement.someprettyrandomstuff.craftDough.desc=Craft some Dough
achievement.craftCompost=Throw it all in! achievement.someprettyrandomstuff.craftCompost=Throw it all in!
achievement.craftCompost.desc=Craft a Compost achievement.someprettyrandomstuff.craftCompost.desc=Craft a Compost
achievement.craftFertilizer=Better than Bone Meal! achievement.someprettyrandomstuff.craftFertilizer=Better than Bone Meal!
achievement.craftFertilizer.desc=Make Fertilizer achievement.someprettyrandomstuff.craftFertilizer.desc=Make Fertilizer
achievement.craftSubSandwich=Metro, Underground, Tube, Nom! achievement.someprettyrandomstuff.craftSubSandwich=Metro, Underground, Tube, Nom!
achievement.craftSubSandwich.desc=Craft a Submarine Sandwich achievement.someprettyrandomstuff.craftSubSandwich.desc=Craft a Submarine Sandwich
achievement.craftPaperCone=Witch's hat! achievement.someprettyrandomstuff.craftPaperCone=Witch's hat!
achievement.craftPaperCone.desc=Craft a Paper Cone achievement.someprettyrandomstuff.craftPaperCone.desc=Craft a Paper Cone
achievement.craftFrenchFry=Just the single one... achievement.someprettyrandomstuff.craftFrenchFry=Just the single one...
achievement.craftFrenchFry.desc=Craft a French Fry achievement.someprettyrandomstuff.craftFrenchFry.desc=Craft a French Fry
achievement.craftFrenchFries=French Fires? achievement.someprettyrandomstuff.craftFrenchFries=French Fires?
achievement.craftFrenchFries.desc=Craft French Fries achievement.someprettyrandomstuff.craftFrenchFries.desc=Craft French Fries
achievement.craftFishNChips=It's Fish! It's Chips! achievement.someprettyrandomstuff.craftFishNChips=It's Fish! It's Chips!
achievement.craftFishNChips.desc=Craft Fish 'N' Chips achievement.someprettyrandomstuff.craftFishNChips.desc=Craft Fish 'N' Chips
achievement.craftMashedFood=Munch munch munch! achievement.someprettyrandomstuff.craftMashedFood=Munch munch munch!
achievement.craftMashedFood.desc=Craft Mashed Food achievement.someprettyrandomstuff.craftMashedFood.desc=Craft Mashed Food
achievement.craftKnifeBlade=Sharp! So sharp! achievement.someprettyrandomstuff.craftKnifeBlade=Sharp! So sharp!
achievement.craftKnifeBlade.desc=Craft a Knife Blade achievement.someprettyrandomstuff.craftKnifeBlade.desc=Craft a Knife Blade
achievement.craftKnife=Sharper! Even sharper! achievement.someprettyrandomstuff.craftKnife=Sharper! Even sharper!
achievement.craftKnife.desc=Craft a Knife achievement.someprettyrandomstuff.craftKnife.desc=Craft a Knife
feeder.animal.desc=Animal info.someprettyrandomstuff.feeder.animal.desc=Animal
feeder.animalsSuffix.desc=s info.someprettyrandomstuff.feeder.animalsSuffix.desc=s
feeder.enoughToBreed.desc=Enough to breed! info.someprettyrandomstuff.feeder.enoughToBreed.desc=Enough to breed!
feeder.tooMany.desc=Too many to breed! info.someprettyrandomstuff.feeder.tooMany.desc=Too many to breed!
feeder.notEnough.desc=Not enough to breed! info.someprettyrandomstuff.feeder.notEnough.desc=Not enough to breed!

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 608 B

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB