Almost ready to release for Beta!

Crafting, Textures, In- and Output etc. done!
This commit is contained in:
Ellpeck 2015-03-07 02:23:31 +01:00
parent ad1fbe7101
commit 3f70981076
97 changed files with 2802 additions and 388 deletions

View file

@ -17,7 +17,7 @@ buildscript {
apply plugin: 'forge'
version = "1.8-0.0.1"
version = "1.7.10-0.0.1"
group = "ellpeck.someprettyrandomstuff"
archivesBaseName = "SomePrettyRandomStuff"

View file

@ -7,16 +7,17 @@ import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import ellpeck.someprettyrandomstuff.achievement.AchievementEvent;
import ellpeck.someprettyrandomstuff.achievement.InitAchievements;
import ellpeck.someprettyrandomstuff.blocks.InitBlocks;
import ellpeck.someprettyrandomstuff.config.ConfigurationHandler;
import ellpeck.someprettyrandomstuff.crafting.InitCrafting;
import ellpeck.someprettyrandomstuff.event.InitEvents;
import ellpeck.someprettyrandomstuff.gen.OreGen;
import ellpeck.someprettyrandomstuff.inventory.GuiHandler;
import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.material.InitItemMaterials;
import ellpeck.someprettyrandomstuff.network.PacketHandler;
import ellpeck.someprettyrandomstuff.oredict.OreDictRegistry;
import ellpeck.someprettyrandomstuff.proxy.IProxy;
import ellpeck.someprettyrandomstuff.tile.TileEntityBase;
import ellpeck.someprettyrandomstuff.util.Util;
@ -30,7 +31,6 @@ public class SomePrettyRandomStuff{
@SidedProxy(clientSide = "ellpeck.someprettyrandomstuff.proxy.ClientProxy", serverSide = "ellpeck.someprettyrandomstuff.proxy.ServerProxy")
public static IProxy proxy;
@SuppressWarnings("unused")
@EventHandler()
public void preInit(FMLPreInitializationEvent event){
Util.logInfo("Starting PreInitialization Phase...");
@ -40,6 +40,7 @@ public class SomePrettyRandomStuff{
InitItemMaterials.init();
InitBlocks.init();
InitItems.init();
OreDictRegistry.init();
proxy.preInit();
Util.logInfo("PreInitialization Finished.");
@ -51,11 +52,11 @@ public class SomePrettyRandomStuff{
Util.logInfo("Starting Initialization Phase...");
InitAchievements.init();
InitCrafting.init();
GuiHandler.init();
OreGen.init();
TileEntityBase.init();
AchievementEvent.init();
InitEvents.init();
InitCrafting.init();
proxy.init();
Util.logInfo("Initialization Finished.");

View file

@ -1,83 +0,0 @@
package ellpeck.someprettyrandomstuff.achievement;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import ellpeck.someprettyrandomstuff.blocks.InitBlocks;
import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.items.metalists.TheFoods;
import ellpeck.someprettyrandomstuff.items.metalists.TheMiscItems;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.item.Item;
public class AchievementEvent{
public static class SmeltEvent{
@SubscribeEvent
public void onSmeltedEvent(PlayerEvent.ItemSmeltedEvent event){
if(event.smelting.getItem() == InitItems.itemFoods && event.smelting.getItemDamage() == TheFoods.BAGUETTE.ordinal()){
event.player.addStat(InitAchievements.achievementSmeltBaguette, 1);
}
}
}
public static class CraftEvent{
@SubscribeEvent
public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event){
if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.DOUGH.ordinal()){
event.player.addStat(InitAchievements.achievementCraftDough, 1);
}
if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal()){
event.player.addStat(InitAchievements.achievementCraftMashedFood, 1);
}
if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.KNIFE_BLADE.ordinal()){
event.player.addStat(InitAchievements.achievementCraftKnifeBlade, 1);
}
if(event.crafting.getItem() == InitItems.itemKnife){
event.player.addStat(InitAchievements.achievementCraftKnife, 1);
}
if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.SUBMARINE_SANDWICH.ordinal()){
event.player.addStat(InitAchievements.achievementCraftSubSandwich, 1);
}
if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.PAPER_CONE.ordinal()){
event.player.addStat(InitAchievements.achievementCraftPaperCone, 1);
}
if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.FRENCH_FRY.ordinal()){
event.player.addStat(InitAchievements.achievementCraftFrenchFry, 1);
}
if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.FRENCH_FRIES.ordinal()){
event.player.addStat(InitAchievements.achievementCraftFrenchFries, 1);
}
if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.FISH_N_CHIPS.ordinal()){
event.player.addStat(InitAchievements.achievementCraftFishNChips, 1);
}
if(event.crafting.getItem()== Item.getItemFromBlock(InitBlocks.blockCompost)){
event.player.addStat(InitAchievements.achievementCraftCompost, 1);
}
}
}
public static class PickupEvent{
@SubscribeEvent
public void onItemPickupEvent(PlayerEvent.ItemPickupEvent event){
}
}
public static class LoginEvent{
@SubscribeEvent
public void onPlayerLoggingInEvent(PlayerEvent.PlayerLoggedInEvent event){
}
}
public static void init(){
Util.logInfo("Initializing Events...");
FMLCommonHandler.instance().bus().register(new SmeltEvent());
FMLCommonHandler.instance().bus().register(new CraftEvent());
FMLCommonHandler.instance().bus().register(new PickupEvent());
FMLCommonHandler.instance().bus().register(new LoginEvent());
}
}

View file

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

View file

@ -1,6 +1,8 @@
package ellpeck.someprettyrandomstuff.blocks;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.achievement.InitAchievements;
import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.items.ItemFertilizer;
@ -11,11 +13,17 @@ 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.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;
@ -25,7 +33,7 @@ public class BlockCompost extends BlockContainerBase implements IName{
public BlockCompost(){
super(Material.wood);
this.setCreativeTab(CreativeTab.instance);
this.setBlockName(Util.getNamePrefix() + this.getName());
this.setBlockName(Util.setUnlocalizedName(this));
this.setHarvestLevel("axe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeWood);
@ -69,9 +77,21 @@ public class BlockCompost extends BlockContainerBase implements IName{
this.setBlockBoundsForItemRender();
}
@Override
public IIcon getIcon(int side, int metadata){
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = Blocks.planks.getIcon(0, 0);
}
@Override
public void setBlockBoundsForItemRender(){
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
float f = 1.0F/16.0F;
this.setBlockBounds(f, 0.0F, f, 1.0F-f, 1.0F, 1.0F-f);
}
@Override
@ -104,4 +124,43 @@ public class BlockCompost extends BlockContainerBase implements IName{
public String getName(){
return "blockCompost";
}
public static class TheItemBlock extends ItemBlock{
private Block theBlock;
public TheItemBlock(Block block){
super(block);
this.theBlock = block;
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.uncommon;
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
if(Util.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc.1"));
//TODO Remove second info
list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc.2"));
}
else list.add(Util.shiftForInfo());
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -6,23 +6,30 @@ import ellpeck.someprettyrandomstuff.SomePrettyRandomStuff;
import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.inventory.GuiHandler;
import ellpeck.someprettyrandomstuff.tile.TileEntityFeeder;
import ellpeck.someprettyrandomstuff.util.IInformation;
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.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
public class BlockFeeder extends BlockContainerBase implements IName{
import java.util.List;
public class BlockFeeder extends BlockContainerBase implements IName, IInformation{
private IIcon topIcon;
public BlockFeeder(){
super(Material.wood);
this.setBlockName(Util.getNamePrefix() + this.getName());
this.setBlockName(Util.setUnlocalizedName(this));
this.setCreativeTab(CreativeTab.instance);
this.setHarvestLevel("axe", 0);
this.setHardness(1.0F);
@ -66,4 +73,44 @@ public class BlockFeeder extends BlockContainerBase implements IName{
public String getName(){
return "blockFeeder";
}
@Override
public String[] getInformationString(){
return new String[]{"This is a thing and it is a test and bla bla bla"};
}
public static class TheItemBlock extends ItemBlock{
private Block theBlock;
public TheItemBlock(Block block){
super(block);
this.theBlock = block;
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc"));
else list.add(Util.shiftForInfo());
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -0,0 +1,192 @@
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.TileEntityFurnaceDouble;
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.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.List;
import java.util.Random;
public class BlockFurnaceDouble extends BlockContainerBase implements IName{
private IIcon topIcon;
private IIcon onIcon;
private IIcon frontIcon;
public BlockFurnaceDouble(){
super(Material.wood);
this.setBlockName(Util.setUnlocalizedName(this));
this.setCreativeTab(CreativeTab.instance);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeStone);
this.setTickRandomly(true);
}
@Override
public void onBlockAdded(World world, int x, int y, int z){
super.onBlockAdded(world, x, y, z);
if (!world.isRemote){
Block block1 = world.getBlock(x, y, z-1);
Block block2 = world.getBlock(x, y, z+1);
Block block3 = world.getBlock(x-1, y, z);
Block block4 = world.getBlock(x+1, y, z);
int metaToSet = 1;
if (block1.func_149730_j() && !block2.func_149730_j()) metaToSet = 0;
if (block2.func_149730_j() && !block1.func_149730_j()) metaToSet = 1;
if (block3.func_149730_j() && !block4.func_149730_j()) metaToSet = 2;
if (block4.func_149730_j() && !block3.func_149730_j()) metaToSet = 3;
world.setBlockMetadataWithNotify(x, y, z, metaToSet, 2);
}
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
int rotation = MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 0, 2);
if (rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 3, 2);
if (rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 1, 2);
if (rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityFurnaceDouble();
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z){
return world.getBlockMetadata(x, y, z) > 3 ? 12 : 0;
}
@Override
public IIcon getIcon(int side, int meta){
if(side == 1) return this.topIcon;
if(side == meta+2 && meta <= 3) return this.frontIcon;
else if(side == meta-2 && meta > 3) return this.onIcon;
return 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");
this.onIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + "On");
this.frontIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + "Front");
}
@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){
TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble)world.getTileEntity(x, y, z);
if (furnace != null) player.openGui(SomePrettyRandomStuff.instance, GuiHandler.FURNACE_DOUBLE_ID, world, x, y, z);
return true;
}
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
int meta = world.getBlockMetadata(x, y, z);
if (meta > 3){
float f = (float)x + 0.5F;
float f1 = (float)y + 0.0F + rand.nextFloat() * 6.0F / 16.0F;
float f2 = (float)z + 0.5F;
float f3 = 0.52F;
float f4 = rand.nextFloat() * 0.6F - 0.3F;
if(meta == 6){
world.spawnParticle("smoke", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
}
if(meta == 7){
world.spawnParticle("smoke", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
}
if(meta == 4){
world.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D);
}
if(meta == 5){
world.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D);
}
for(int i = 0; i < 5; i++){
world.spawnParticle("smoke", (double)x+0.5F, (double)y + 1.0F, (double)z+0.5F, 0.0D, 0.0D, 0.0D);
}
}
}
@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 "blockFurnaceDouble";
}
public static class TheItemBlock extends ItemBlock{
private Block theBlock;
public TheItemBlock(Block block){
super(block);
this.theBlock = block;
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc"));
else list.add(Util.shiftForInfo());
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -12,17 +12,23 @@ 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.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;
public class BlockGiantChest extends BlockContainerBase implements IName{
private IIcon topIcon;
public BlockGiantChest(){
super(Material.wood);
this.setBlockName(Util.getNamePrefix() + this.getName());
this.setBlockName(Util.setUnlocalizedName(this));
this.setCreativeTab(CreativeTab.instance);
this.setHarvestLevel("axe", 0);
this.setHardness(1.0F);
@ -66,4 +72,41 @@ public class BlockGiantChest extends BlockContainerBase implements IName{
public String getName(){
return "blockGiantChest";
}
public static class TheItemBlock extends ItemBlock{
private Block theBlock;
public TheItemBlock(Block block){
super(block);
this.theBlock = block;
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.uncommon;
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc"));
else list.add(Util.shiftForInfo());
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -0,0 +1,147 @@
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.TileEntityGrinder;
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.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.List;
import java.util.Random;
public class BlockGrinder extends BlockContainerBase implements IName{
private IIcon topIcon;
private IIcon onIcon;
private IIcon bottomIcon;
private boolean isDouble;
public BlockGrinder(boolean isDouble){
super(Material.wood);
this.isDouble = isDouble;
this.setBlockName(Util.setUnlocalizedName(this));
this.setCreativeTab(CreativeTab.instance);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeStone);
this.setTickRandomly(true);
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityGrinder(this.isDouble);
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z){
return world.getBlockMetadata(x, y, z) == 1 ? 12 : 0;
}
@Override
public IIcon getIcon(int side, int meta){
if(side == 1 && meta != 1) return this.topIcon;
if(side == 1) return this.onIcon;
if(side == 0) return this.bottomIcon;
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
int meta = world.getBlockMetadata(x, y, z);
if (meta == 1){
for(int i = 0; i < 5; i++){
double xRand = new Random().nextDouble()/0.75D - 0.5D;
double zRand = new Random().nextDouble()/0.75D - 0.5D;
world.spawnParticle("crit", (double)x+0.4F, (double)y + 0.8F, (double)z+0.4F, xRand, 0.5D, zRand);
}
world.spawnParticle("smoke", (double)x+0.5F, (double)y + 1.0F, (double)z+0.5F, 0.0D, 0.0D, 0.0D);
}
}
@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 + ":blockGrinderTop");
this.onIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":blockGrinderOn");
this.bottomIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":blockGrinderBottom");
}
@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){
TileEntityGrinder grinder = (TileEntityGrinder)world.getTileEntity(x, y, z);
if (grinder != null) player.openGui(SomePrettyRandomStuff.instance, this.isDouble ? GuiHandler.GRINDER_DOUBLE_ID : GuiHandler.GRINDER_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 isDouble ? "blockGrinderDouble" : "blockGrinder";
}
public static class TheItemBlock extends ItemBlock{
private Block theBlock;
public TheItemBlock(Block block){
super(block);
this.theBlock = block;
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public EnumRarity getRarity(ItemStack stack){
return ((BlockGrinder)theBlock).isDouble ? EnumRarity.epic : EnumRarity.rare;
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
if(Util.isShiftPressed()){
for(int i = 0; i < (((BlockGrinder)theBlock).isDouble ? 3 : 4); i++){
list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + (i+1)));
}
}
else list.add(Util.shiftForInfo());
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -13,6 +13,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@ -29,7 +30,7 @@ public class BlockMisc extends Block implements IName{
public BlockMisc(){
super(Material.rock);
this.setBlockName(Util.getNamePrefix() + this.getName());
this.setBlockName(Util.setUnlocalizedName(this));
this.setCreativeTab(CreativeTab.instance);
}
@ -74,17 +75,22 @@ public class BlockMisc extends Block implements IName{
return "blockMisc";
}
public static class ItemBlockMisc extends ItemBlock{
public static class TheItemBlock extends ItemBlock{
private Block theBlock;
public ItemBlockMisc(Block block){
public TheItemBlock(Block block){
super(block);
this.theBlock = block;
this.setHasSubtypes(true);
this.setMaxDamage(0);
}
@Override
public EnumRarity getRarity(ItemStack stack){
return allMiscBlocks[stack.getItemDamage()].rarity;
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName() + allMiscBlocks[stack.getItemDamage()].getName();

View file

@ -1,8 +1,5 @@
package ellpeck.someprettyrandomstuff.blocks;
import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.block.Block;
@ -13,19 +10,32 @@ public class InitBlocks{
public static Block blockFeeder;
public static Block blockGiantChest;
public static Block blockGrinder;
public static Block blockGrinderDouble;
public static Block blockFurnaceDouble;
public static void init(){
Util.logInfo("Initializing Blocks...");
blockCompost = new BlockCompost();
GameRegistry.registerBlock(blockCompost, DefaultItemBlock.class, ((IName)blockCompost).getName());
Util.register(blockCompost, BlockCompost.TheItemBlock.class);
blockMisc = new BlockMisc();
GameRegistry.registerBlock(blockMisc, BlockMisc.ItemBlockMisc.class, ((IName)blockMisc).getName());
Util.register(blockMisc, BlockMisc.TheItemBlock.class);
blockFeeder = new BlockFeeder();
GameRegistry.registerBlock(blockFeeder, DefaultItemBlock.class, ((IName)blockFeeder).getName());
Util.register(blockFeeder, BlockFeeder.TheItemBlock.class);
blockGiantChest = new BlockGiantChest();
GameRegistry.registerBlock(blockGiantChest, DefaultItemBlock.class, ((IName)blockGiantChest).getName());
Util.register(blockGiantChest, BlockGiantChest.TheItemBlock.class);
blockGrinder = new BlockGrinder(false);
Util.register(blockGrinder, BlockGrinder.TheItemBlock.class);
blockGrinderDouble = new BlockGrinder(true);
Util.register(blockGrinderDouble, BlockGrinder.TheItemBlock.class);
blockFurnaceDouble = new BlockFurnaceDouble();
Util.register(blockFurnaceDouble, BlockFurnaceDouble.TheItemBlock.class);
}
}

View file

@ -1,18 +1,21 @@
package ellpeck.someprettyrandomstuff.blocks.metalists;
import ellpeck.someprettyrandomstuff.util.IName;
import net.minecraft.item.EnumRarity;
public enum TheMiscBlocks implements IName{
QUARTZ_PILLAR("BlackQuartzPillar"),
QUARTZ_CHISELED("BlackQuartzChiseled"),
QUARTZ("BlackQuartz"),
ORE_QUARTZ("OreBlackQuartz");
QUARTZ_PILLAR("BlackQuartzPillar", EnumRarity.rare),
QUARTZ_CHISELED("BlackQuartzChiseled", EnumRarity.rare),
QUARTZ("BlackQuartz", EnumRarity.rare),
ORE_QUARTZ("OreBlackQuartz", EnumRarity.epic);
public final String name;
public final EnumRarity rarity;
private TheMiscBlocks(String name){
private TheMiscBlocks(String name, EnumRarity rarity){
this.name = name;
this.rarity = rarity;
}
@Override

View file

@ -0,0 +1,14 @@
package ellpeck.someprettyrandomstuff.blocks.render;
import net.minecraft.client.model.ModelBase;
public class ModelBaseSPRS extends ModelBase{
public void render(float f){
}
public String getName(){
return null;
}
}

View file

@ -0,0 +1,46 @@
package ellpeck.someprettyrandomstuff.blocks.render;
import net.minecraft.client.model.ModelRenderer;
public class ModelCompost extends ModelBaseSPRS{
public ModelRenderer floor;
public ModelRenderer wallOne;
public ModelRenderer wallTwo;
public ModelRenderer wallThree;
public ModelRenderer wallFour;
public ModelCompost(){
this.textureWidth = 64;
this.textureHeight = 64;
this.wallThree = new ModelRenderer(this, 0, 0);
this.wallThree.setRotationPoint(-6.0F, 8.0F, 6.0F);
this.wallThree.addBox(0.0F, 0.0F, 0.0F, 12, 15, 1, 0.0F);
this.wallFour = new ModelRenderer(this, 0, 0);
this.wallFour.setRotationPoint(-6.0F, 8.0F, -7.0F);
this.wallFour.addBox(0.0F, 0.0F, 0.0F, 12, 15, 1, 0.0F);
this.wallOne = new ModelRenderer(this, 0, 0);
this.wallOne.setRotationPoint(-7.0F, 8.0F, -7.0F);
this.wallOne.addBox(0.0F, 0.0F, 0.0F, 1, 15, 14, 0.0F);
this.wallTwo = new ModelRenderer(this, 0, 0);
this.wallTwo.setRotationPoint(6.0F, 8.0F, -7.0F);
this.wallTwo.addBox(0.0F, 0.0F, 0.0F, 1, 15, 14, 0.0F);
this.floor = new ModelRenderer(this, 0, 0);
this.floor.setRotationPoint(-7.0F, 23.0F, -7.0F);
this.floor.addBox(0.0F, 0.0F, 0.0F, 14, 1, 14, 0.0F);
}
@Override
public void render(float f){
this.wallThree.render(f);
this.wallFour.render(f);
this.wallOne.render(f);
this.wallTwo.render(f);
this.floor.render(f);
}
@Override
public String getName(){
return "modelCompost";
}
}

View file

@ -0,0 +1,74 @@
package ellpeck.someprettyrandomstuff.blocks.render;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
public class RenderItems implements IItemRenderer{
ModelBaseSPRS theModel;
ResourceLocation theTexture;
public RenderItems(ModelBaseSPRS model){
this.theModel = model;
this.theTexture = new ResourceLocation(Util.MOD_ID_LOWER, "textures/blocks/models/" + this.theModel.getName() + ".png");
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type){
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper){
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data){
switch(type){
case INVENTORY:
GL11.glPushMatrix();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.5F, -1.27F, 0.5F);
Minecraft.getMinecraft().renderEngine.bindTexture(theTexture);
theModel.render(0.0625F);
GL11.glPopMatrix();
break;
case EQUIPPED:
GL11.glPushMatrix();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.6F, -1.2F, -0.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(theTexture);
theModel.render(0.0625F);
GL11.glPopMatrix();
break;
case EQUIPPED_FIRST_PERSON:
GL11.glPushMatrix();
GL11.glScalef(1.2F, 1.2F, 1.2F);
GL11.glRotatef(180, 2F, -0F, 0.1F);
GL11.glTranslatef(1.5F, -1.2F, -0.3F);
Minecraft.getMinecraft().renderEngine.bindTexture(theTexture);
theModel.render(0.0625F);
GL11.glPopMatrix();
break;
default:
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, -1.27F, 0.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(theTexture);
theModel.render(0.0625F);
GL11.glPopMatrix();
break;
}
}
}

View file

@ -0,0 +1,28 @@
package ellpeck.someprettyrandomstuff.blocks.render;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class RenderTileEntity extends TileEntitySpecialRenderer{
ModelBaseSPRS theModel;
public RenderTileEntity(ModelBaseSPRS model){
this.theModel = model;
}
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){
GL11.glPushMatrix();
GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, -2.0F, 0.0F);
this.bindTexture(new ResourceLocation(Util.MOD_ID_LOWER, "textures/blocks/models/" + this.theModel.getName() + ".png"));
theModel.render(0.0625F);
GL11.glPopMatrix();
}
}

View file

@ -10,6 +10,12 @@ public class ConfigValues{
public static boolean[] enabledMiscRecipes = new boolean[TheMiscItems.values().length];
public static boolean enableCompostRecipe;
public static boolean enableKnifeRecipe;
public static boolean enableCrusherRecipe;
public static boolean enableCrusherDoubleRecipe;
public static boolean enableFurnaceDoubleRecipe;
public static boolean enableGiantChestRecipe;
public static boolean enableFeederRecipe;
public static boolean enableCrafterRecipe;
public static int tileEntityCompostAmountNeededToConvert;
public static int tileEntityCompostConversionTimeNeeded;
@ -25,46 +31,79 @@ public class ConfigValues{
public static float toolEmeraldEfficiency;
public static float toolEmeraldDamage;
public static int toolEmeraldEnchantability;
public static boolean enableToolEmeraldRecipe;
public static int toolObsidianHarvestLevel;
public static int toolObsidianMaxUses;
public static float toolObsidianEfficiency;
public static float toolObsidianDamage;
public static int toolObsidianEnchantability;
public static boolean enableToolObsidianRecipe;
public static int furnaceDoubleSmeltTime;
public static int grinderDoubleCrushTime;
public static int grinderCrushTime;
public static boolean enableExperienceDrop;
public static boolean enableBloodDrop;
public static boolean enableHeartDrop;
public static boolean enableSubstanceDrop;
public static boolean enablePearlShardDrop;
public static boolean enableEmeraldShardDrop;
public static void defineConfigValues(Configuration config){
for(int i = 0; i < enabledFoodRecipes.length; i++){
enabledFoodRecipes[i] = config.getBoolean("isItemFood" + TheFoods.values()[i].name + "CraftingRecipeEnabled", ConfigurationHandler.CATEGORY_FOOD_CRAFTING, true, "If the Crafting Recipe for " + TheFoods.values()[i].name + " is Enabled");
enabledFoodRecipes[i] = config.getBoolean(TheFoods.values()[i].name, ConfigurationHandler.CATEGORY_FOOD_CRAFTING, true, "If the Crafting Recipe for " + TheFoods.values()[i].name + " is Enabled");
}
for(int i = 0; i < enabledMiscRecipes.length; i++){
enabledMiscRecipes[i] = config.getBoolean("isItemMisc" + TheMiscItems.values()[i].name + "CraftingRecipeEnabled", ConfigurationHandler.CATEGORY_MISC_CRAFTING, true, "If the Crafting Recipe for " + TheMiscItems.values()[i].name + " is Enabled");
if(i != TheMiscItems.QUARTZ.ordinal()){
enabledMiscRecipes[i] = config.getBoolean(TheMiscItems.values()[i].name, ConfigurationHandler.CATEGORY_MISC_CRAFTING, true, "If the Crafting Recipe for " + TheMiscItems.values()[i].name + " is Enabled");
}
}
enableCompostRecipe = config.getBoolean("isCompostCraftingRecipeEnabled", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Compost is Enabled");
enableKnifeRecipe = config.getBoolean("isKnifeCraftingRecipeEnabled", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for the Knife is Enabled");
//TODO CHANGE TO BE TRUE BY DEFAULT
enableExperienceDrop = config.getBoolean("Solidified Experience", ConfigurationHandler.CATEGORY_MOB_DROPS, false, "If the Solidified Experience drops from Mobs");
enableBloodDrop = config.getBoolean("Blood Fragments", ConfigurationHandler.CATEGORY_MOB_DROPS, false, "If the Blood Fragments drop from Mobs");
enableHeartDrop = config.getBoolean("Heart Parts", ConfigurationHandler.CATEGORY_MOB_DROPS, false, "If the Heart Parts drop from Mobs");
enableSubstanceDrop = config.getBoolean("Unknown Substance", ConfigurationHandler.CATEGORY_MOB_DROPS, false, "If the Unknown Substance drops from Mobs");
enablePearlShardDrop = config.getBoolean("Ender Pearl Shard", ConfigurationHandler.CATEGORY_MOB_DROPS, false, "If the Ender Pearl Shard drops from Mobs");
enableEmeraldShardDrop = config.getBoolean("Emerald Shard", ConfigurationHandler.CATEGORY_MOB_DROPS, false, "If the Emerald Shard drops from Mobs");
tileEntityCompostAmountNeededToConvert = config.getInt("tileEntityCompostAmountNeededToConvert", ConfigurationHandler.CATEGORY_COMPOST_VALUES, 10, 1, 64, "How many items are needed in the Compost to convert to Fertilizer");
tileEntityCompostConversionTimeNeeded = config.getInt("tileEntityCompostConversionTimeNeeded", ConfigurationHandler.CATEGORY_COMPOST_VALUES, 1000, 30, 10000, "How long the Compost needs to convert to Fertilizer");
enableCompostRecipe = config.getBoolean("Compost", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Compost is Enabled");
enableKnifeRecipe = config.getBoolean("Knife", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for the Knife is Enabled");
enableCrusherDoubleRecipe = config.getBoolean("Double Crusher", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Double Crusher is Enabled");
enableCrusherRecipe = config.getBoolean("Crusher", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Crusher is Enabled");
enableFurnaceDoubleRecipe = config.getBoolean("Double Furnace", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Double Furnace is Enabled");
enableGiantChestRecipe = config.getBoolean("Giant Chest", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Giant Chest is Enabled");
enableFeederRecipe = config.getBoolean("Feeder", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Feeder is Enabled");
enableCrafterRecipe = config.getBoolean("Crafting Table On A Stick", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for the Crafting Table On A Stick is Enabled");
tileEntityFeederReach = config.getInt("tileEntityFeederReach", ConfigurationHandler.CATEGORY_FEEDER_VALUES, 5, 1, 20, "The Radius of Action of the Feeder");
tileEntityFeederTimeNeeded = config.getInt("tileEntityFeederTimeNeeded", ConfigurationHandler.CATEGORY_FEEDER_VALUES, 100, 50, 5000, "The time spent between feeding animals with the Feeder");
tileEntityFeederThreshold = config.getInt("tileEntityFeederThreshold", ConfigurationHandler.CATEGORY_FEEDER_VALUES, 30, 3, 500, "How many animals need to be in the area for the Feeder to stop");
tileEntityCompostAmountNeededToConvert = config.getInt("Compost: Amount Needed To Convert", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 10, 1, 64, "How many items are needed in the Compost to convert to Fertilizer");
tileEntityCompostConversionTimeNeeded = config.getInt("Compost: Conversion Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 1000, 30, 10000, "How long the Compost needs to convert to Fertilizer");
itemKnifeMaxDamage = config.getInt("itemKnifeMaxDamage", ConfigurationHandler.CATEGORY_ITEM_DAMAGE_VALUES, 100, 5, 5000, "How often the Knife can be crafted with");
tileEntityFeederReach = config.getInt("Feeder: Reach", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 5, 1, 20, "The Radius of Action of the Feeder");
tileEntityFeederTimeNeeded = config.getInt("Feeder: Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 100, 50, 5000, "The time spent between feeding animals with the Feeder");
tileEntityFeederThreshold = config.getInt("Feeder: Threshold", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 30, 3, 500, "How many animals need to be in the area for the Feeder to stop");
toolEmeraldHarvestLevel = config.getInt("toolEmeraldHarvestLevel", ConfigurationHandler.CATEGORY_TOOL_VALUES, 3, 0, 3, "What Harvest Level Emerald Tools have (0 = Wood, 1 = Stone, 2 = Iron, 3 = Diamond)");
toolEmeraldMaxUses = config.getInt("toolEmeraldMaxUses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 2000, 50, 10000, "How often Emerald Tools can be used");
toolEmeraldEfficiency = config.getFloat("toolEmeraldEfficiency", ConfigurationHandler.CATEGORY_TOOL_VALUES, 9.0F, 1.0F, 20.0F, "How fast Emerald Tools are");
toolEmeraldDamage = config.getFloat("toolEmeraldDamage", ConfigurationHandler.CATEGORY_TOOL_VALUES, 5.0F, 0.1F, 50.0F, "How much damage an Emerald Tool deals");
toolEmeraldEnchantability = config.getInt("toolEmeraldEnchantability", ConfigurationHandler.CATEGORY_TOOL_VALUES, 15, 1, 30, "How enchantable an Emerald Tool is");
itemKnifeMaxDamage = config.getInt("Knife: Max Uses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 100, 5, 5000, "How often the Knife can be crafted with");
toolObsidianHarvestLevel = config.getInt("toolObsidianHarvestLevel", ConfigurationHandler.CATEGORY_TOOL_VALUES, 3, 0, 3, "What Harvest Level Obsidian Tools have (0 = Wood, 1 = Stone, 2 = Iron, 3 = Diamond)");
toolObsidianMaxUses = config.getInt("toolObsidianMaxUses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 8000, 50, 20000, "How often Obsidian Tools can be used");
toolObsidianEfficiency = config.getFloat("toolObsidianEfficiency", ConfigurationHandler.CATEGORY_TOOL_VALUES, 4.0F, 1.0F, 20.0F, "How fast Obsidian Tools are");
toolObsidianDamage = config.getFloat("toolObsidianDamage", ConfigurationHandler.CATEGORY_TOOL_VALUES, 2.0F, 0.1F, 50.0F, "How much damage an Obsidian Tool deals");
toolObsidianEnchantability = config.getInt("toolObsidianEnchantability", ConfigurationHandler.CATEGORY_TOOL_VALUES, 15, 1, 30, "How enchantable an Obsidian Tool is");
toolEmeraldHarvestLevel = config.getInt("Emerald: Harvest Level", ConfigurationHandler.CATEGORY_TOOL_VALUES, 3, 0, 3, "What Harvest Level Emerald Tools have (0 = Wood, 1 = Stone, 2 = Iron, 3 = Diamond)");
toolEmeraldMaxUses = config.getInt("Emerald: Max Uses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 2000, 50, 10000, "How often Emerald Tools can be used");
toolEmeraldEfficiency = config.getFloat("Emerald: Efficiency", ConfigurationHandler.CATEGORY_TOOL_VALUES, 9.0F, 1.0F, 20.0F, "How fast Emerald Tools are");
toolEmeraldDamage = config.getFloat("Emerald: Damage", ConfigurationHandler.CATEGORY_TOOL_VALUES, 5.0F, 0.1F, 50.0F, "How much damage an Emerald Tool deals");
toolEmeraldEnchantability = config.getInt("Emerald: Enchantability", ConfigurationHandler.CATEGORY_TOOL_VALUES, 15, 1, 30, "How enchantable an Emerald Tool is");
enableToolEmeraldRecipe = config.getBoolean("Emerald Tools", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for Emerald Tools is Enabled");
toolObsidianHarvestLevel = config.getInt("Obsidian: Harvest Level", ConfigurationHandler.CATEGORY_TOOL_VALUES, 3, 0, 3, "What Harvest Level Obsidian Tools have (0 = Wood, 1 = Stone, 2 = Iron, 3 = Diamond)");
toolObsidianMaxUses = config.getInt("Obsidian: Max Uses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 8000, 50, 20000, "How often Obsidian Tools can be used");
toolObsidianEfficiency = config.getFloat("Obsidian: Efficiency", ConfigurationHandler.CATEGORY_TOOL_VALUES, 4.0F, 1.0F, 20.0F, "How fast Obsidian Tools are");
toolObsidianDamage = config.getFloat("Obsidian: Damage", ConfigurationHandler.CATEGORY_TOOL_VALUES, 2.0F, 0.1F, 50.0F, "How much damage an Obsidian Tool deals");
toolObsidianEnchantability = config.getInt("Obsidian: Enchantability", ConfigurationHandler.CATEGORY_TOOL_VALUES, 15, 1, 30, "How enchantable an Obsidian Tool is");
enableToolObsidianRecipe = config.getBoolean("Obsidian Tools", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for Obsidian Tools is Enabled");
grinderCrushTime = config.getInt("Crusher: Crush Time", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 200, 10, 1000, "How long the Crusher takes to crush an item");
grinderDoubleCrushTime = config.getInt("Double Crusher: Crush Time", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 300, 10, 1000, "How long the Double Crusher takes to crush an item");
furnaceDoubleSmeltTime = config.getInt("Double Furnace: Smelt Time", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 300, 10, 1000, "How long the Double Furnace takes to crush an item");
}
}

View file

@ -9,14 +9,12 @@ public class ConfigurationHandler{
public static final String CATEGORY_FOOD_CRAFTING = "food crafting";
public static final String CATEGORY_MISC_CRAFTING = "misc crafting";
public static final String CATEGORY_COMPOST_VALUES = "compost values";
public static final String CATEGORY_BLOCKS_CRAFTING = "block crafting";
public static final String CATEGORY_ITEMS_CRAFTING = "items crafting";
public static final String CATEGORY_ITEM_DAMAGE_VALUES = "item damage values";
public static final String CATEGORY_TOOL_VALUES = "tool values";
public static final String CATEGORY_FEEDER_VALUES = "feeder values";
public static final String CATEGORY_MACHINE_VALUES = "machine values";
public static final String CATEGORY_MOB_DROPS = "mob drops";
public static Configuration config;
public static void init(File configFile){
Util.logInfo("Grabbing Configurations...");

View file

@ -0,0 +1,65 @@
package ellpeck.someprettyrandomstuff.crafting;
import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.someprettyrandomstuff.blocks.InitBlocks;
import ellpeck.someprettyrandomstuff.config.ConfigValues;
import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.items.metalists.TheMiscItems;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
public class BlockCrafting{
public static void init(){
//Compost
if(ConfigValues.enableCompostRecipe)
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockCompost),
"W W", "WFW", "WWW",
'W', new ItemStack(Blocks.planks, 1, Util.WILDCARD),
'F', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.MASHED_FOOD.ordinal()));
//Crusher
if(ConfigValues.enableCrusherRecipe)
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockGrinder),
"CFC", "CPC", "CFC",
'C', new ItemStack(Blocks.cobblestone),
'P', new ItemStack(Blocks.piston),
'F', new ItemStack(Items.flint));
//Double Crusher
if(ConfigValues.enableCrusherDoubleRecipe)
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockGrinderDouble),
"CCC", "RPR", "CCC",
'C', new ItemStack(Blocks.cobblestone),
'R', new ItemStack(InitBlocks.blockGrinder),
'P', new ItemStack(Blocks.piston));
//Double Furnace
if(ConfigValues.enableFurnaceDoubleRecipe)
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockFurnaceDouble),
"CCC", "RPR", "CCC",
'C', new ItemStack(Blocks.cobblestone),
'R', new ItemStack(Blocks.furnace),
'P', new ItemStack(Items.brick));
//Feeder
if(ConfigValues.enableFeederRecipe)
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockFeeder),
"WCW", "WHW", "WCW",
'W', new ItemStack(Blocks.planks, 1, Util.WILDCARD),
'C', new ItemStack(Items.golden_carrot),
'H', new ItemStack(Items.wheat));
//Giant Chest
if(ConfigValues.enableGiantChestRecipe)
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockGiantChest),
"CWC", "W W", "CWC",
'C', new ItemStack(Blocks.chest),
'W', new ItemStack(Blocks.planks, 1, Util.WILDCARD));
}
}

View file

@ -0,0 +1,132 @@
package ellpeck.someprettyrandomstuff.crafting;
import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.someprettyrandomstuff.config.ConfigValues;
import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.items.metalists.TheFoods;
import ellpeck.someprettyrandomstuff.items.metalists.TheMiscItems;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
public class FoodCrafting{
public static void init(){
//Baguette
if(ConfigValues.enabledFoodRecipes[TheFoods.BAGUETTE.ordinal()])
GameRegistry.addSmelting(new ItemStack(InitItems.itemMisc, 1,
TheMiscItems.DOUGH.ordinal()), new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()), 1F);
//Pizza
if(ConfigValues.enabledFoodRecipes[TheFoods.PIZZA.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.PIZZA.ordinal()),
"HKH", "MCF", " D ",
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()),
'M', new ItemStack(Blocks.brown_mushroom),
'C', new ItemStack(Items.carrot),
'F', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD),
'K', new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD),
'H', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()));
//Hamburger
if(ConfigValues.enabledFoodRecipes[TheFoods.HAMBURGER.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()),
"KT ", "CB ", " T ",
'T', new ItemStack(InitItems.itemFoods, 1, TheFoods.TOAST.ordinal()),
'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()),
'K', new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD),
'B', new ItemStack(Items.cooked_beef));
//Big Cookie
if(ConfigValues.enabledFoodRecipes[TheFoods.BIG_COOKIE.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.BIG_COOKIE.ordinal()),
"DCD", "CDC", "DCD",
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()),
'C', new ItemStack(Items.dye, 1, 3));
//Sub Sandwich
if(ConfigValues.enabledFoodRecipes[TheFoods.SUBMARINE_SANDWICH.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.SUBMARINE_SANDWICH.ordinal()),
"KCP", "FB ", "PCP",
'P', new ItemStack(Items.paper),
'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()),
'F', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD),
'B', new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()),
'K', new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD));
//French Fry
if(ConfigValues.enabledFoodRecipes[TheFoods.FRENCH_FRY.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal()),
new ItemStack(Items.baked_potato),
new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD));
//French Fries
if(ConfigValues.enabledFoodRecipes[TheFoods.FRENCH_FRIES.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRIES.ordinal()),
"FFF", " P ",
'P', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()),
'F', new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal()));
//Fish N Chips
if(ConfigValues.enabledFoodRecipes[TheFoods.FISH_N_CHIPS.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FISH_N_CHIPS.ordinal()),
"FIF", " P ",
'I', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD),
'P', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()),
'F', new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal()));
//Cheese
if(ConfigValues.enabledFoodRecipes[TheFoods.CHEESE.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()),
new ItemStack(Items.milk_bucket));
//Pumpkin Stew
if(ConfigValues.enabledFoodRecipes[TheFoods.PUMPKIN_STEW.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.PUMPKIN_STEW.ordinal()),
"P", "B",
'P', new ItemStack(Blocks.pumpkin),
'B', new ItemStack(Items.bowl));
//Carrot Juice
if(ConfigValues.enabledFoodRecipes[TheFoods.CARROT_JUICE.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CARROT_JUICE.ordinal()),
new ItemStack(Items.glass_bottle), new ItemStack(Items.carrot), new ItemStack(InitItems.itemKnife));
//Spaghetti
if(ConfigValues.enabledFoodRecipes[TheFoods.SPAGHETTI.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.SPAGHETTI.ordinal()),
"NNN", " B ",
'N', new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()),
'B', new ItemStack(Items.bowl));
//Noodle
if(ConfigValues.enabledFoodRecipes[TheFoods.NOODLE.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()),
new ItemStack(Items.wheat), new ItemStack(InitItems.itemKnife));
//Chocolate
if(ConfigValues.enabledFoodRecipes[TheFoods.CHOCOLATE.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHOCOLATE.ordinal()),
"C C", "CMC", "C C",
'C', new ItemStack(Items.dye, 1, 3),
'M', new ItemStack(Items.milk_bucket));
//Chocolate Cake
if(ConfigValues.enabledFoodRecipes[TheFoods.CHOCOLATE_CAKE.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHOCOLATE_CAKE.ordinal()),
"MMM", "CCC", "EDS",
'M', new ItemStack(Items.milk_bucket),
'E', new ItemStack(Items.egg),
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()),
'S', new ItemStack(Items.sugar),
'C', new ItemStack(Items.dye, 1, 3));
//Toast
if(ConfigValues.enabledFoodRecipes[TheFoods.TOAST.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 2, TheFoods.TOAST.ordinal()),
new ItemStack(Items.bread));
}
}

View file

@ -0,0 +1,54 @@
package ellpeck.someprettyrandomstuff.crafting;
import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.items.metalists.TheDusts;
import ellpeck.someprettyrandomstuff.recipe.GrinderRecipes;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import org.apache.logging.log4j.Level;
import java.util.ArrayList;
public class GrinderCrafting{
public static void init(){
GrinderRecipes.instance().registerRecipe(new ItemStack(Blocks.iron_ore), new ItemStack(InitItems.itemDust, 2, TheDusts.IRON.ordinal()), new ItemStack(InitItems.itemDust, 1, TheDusts.GOLD.ordinal()), 10);
GrinderRecipes.instance().registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10), null, 0);
GrinderRecipes.instance().registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(Items.dye, 15, 4), null, 0);
registerFinally();
}
public static void registerFinally(){
String[] names = OreDictionary.getOreNames();
for(String name : names){
if(name.contains("ore")){
String nameOfOre = name.substring(3);
ArrayList<ItemStack> allDusts = OreDictionary.getOres("dust" + nameOfOre);
if(allDusts != null && allDusts.size() > 0){
ItemStack output = allDusts.get(0);
output.stackSize = 2;
ArrayList<ItemStack> allOresOfName = OreDictionary.getOres(name);
if(allOresOfName != null && allOresOfName.size() > 0){
for(ItemStack input : allOresOfName){
if(GrinderRecipes.instance().getOutput(input, false) == null){
//Special Second Outputs
if(name.equals("oreNickel")) GrinderRecipes.instance().registerRecipe(input, output, OreDictionary.getOres("dustPlatinum").get(0), 10);
else GrinderRecipes.instance().registerRecipe(input, output, null, 0);
}
}
}
else Util.SPRS_LOGGER.log(Level.ERROR, "Couldn't register Crusher Recipe! Didn't find Items registered as '" + name + "'! This shouldn't happen as there is something registered as '" + name + "' that doesn't exist!");
}
else Util.SPRS_LOGGER.log(Level.WARN, "Couldn't register Crusher Recipe! An Item with OreDictionary Registry 'dust" + nameOfOre + "' doesn't exist! This is not an Error, just a bit sad :(");
}
}
}
}

View file

@ -1,166 +1,19 @@
package ellpeck.someprettyrandomstuff.crafting;
import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.someprettyrandomstuff.blocks.InitBlocks;
import ellpeck.someprettyrandomstuff.config.ConfigValues;
import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.items.metalists.TheFoods;
import ellpeck.someprettyrandomstuff.items.metalists.TheMiscItems;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
public class InitCrafting {
public static void init(){
Util.logInfo("Initializing Crafting Recipes...");
//Baguette
if(ConfigValues.enabledFoodRecipes[TheFoods.BAGUETTE.ordinal()])
GameRegistry.addSmelting(new ItemStack(InitItems.itemMisc, 1,
TheMiscItems.DOUGH.ordinal()), new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()), 1F);
ItemCrafting.init();
BlockCrafting.init();
MiscCrafting.init();
FoodCrafting.init();
ToolCrafting.init();
GrinderCrafting.init();
//Dough
if(ConfigValues.enabledMiscRecipes[TheMiscItems.DOUGH.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 2, TheMiscItems.DOUGH.ordinal()),
new ItemStack(Items.wheat), new ItemStack(Items.wheat));
//Pizza
if(ConfigValues.enabledFoodRecipes[TheFoods.PIZZA.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.PIZZA.ordinal()),
"HKH", "MCF", " D ",
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()),
'M', new ItemStack(Blocks.brown_mushroom),
'C', new ItemStack(Items.carrot),
'F', new ItemStack(Items.fish, 1, Util.WILDCARD),
'K', new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD),
'H', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()));
//Hamburger
if(ConfigValues.enabledFoodRecipes[TheFoods.HAMBURGER.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()),
"KT ", "CBS", " T ",
'T', new ItemStack(InitItems.itemFoods, 1, TheFoods.TOAST.ordinal()),
'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()),
'S', new ItemStack(Blocks.leaves, 1, Util.WILDCARD),
'K', new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD),
'B', new ItemStack(Items.cooked_beef));
//Big Cookie
if(ConfigValues.enabledFoodRecipes[TheFoods.BIG_COOKIE.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.BIG_COOKIE.ordinal()),
"DCD", "CDC", "DCD",
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()),
'C', new ItemStack(Items.dye, 1, 3));
//Sub Sandwich
if(ConfigValues.enabledFoodRecipes[TheFoods.SUBMARINE_SANDWICH.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.SUBMARINE_SANDWICH.ordinal()),
"KCP", "FBS", "PCP",
'P', new ItemStack(Items.paper),
'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()),
'F', new ItemStack(Items.fish, 1, Util.WILDCARD),
'B', new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()),
'K', new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD),
'S', new ItemStack(Blocks.leaves, 1, Util.WILDCARD));
//Paper Cone
if(ConfigValues.enabledMiscRecipes[TheMiscItems.PAPER_CONE.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()),
"P P", " P ",
'P', new ItemStack(Items.paper));
//French Fry
if(ConfigValues.enabledFoodRecipes[TheFoods.FRENCH_FRY.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal()),
new ItemStack(Items.baked_potato),
new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD));
//Knife Handle
if(ConfigValues.enabledMiscRecipes[TheMiscItems.KNIFE_HANDLE.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_HANDLE.ordinal()),
new ItemStack(Items.stick),
new ItemStack(Items.slime_ball));
//Knife Blade
if(ConfigValues.enabledMiscRecipes[TheMiscItems.KNIFE_BLADE.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()),
new ItemStack(Items.iron_ingot),
new ItemStack(Items.slime_ball));
//Knife
if(ConfigValues.enableKnifeRecipe)
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemKnife),
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()),
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_HANDLE.ordinal()));
//French Fries
if(ConfigValues.enabledFoodRecipes[TheFoods.FRENCH_FRIES.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRIES.ordinal()),
"FFF", " P ",
'P', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()),
'F', new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal()));
//Fish N Chips
if(ConfigValues.enabledFoodRecipes[TheFoods.FISH_N_CHIPS.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FISH_N_CHIPS.ordinal()),
"FIF", " P ",
'I', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD),
'P', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()),
'F', new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal()));
//Compost
if(ConfigValues.enableCompostRecipe)
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockCompost),
"W W", "WFW", "WWW",
'W', new ItemStack(Blocks.planks, 1, Util.WILDCARD),
'F', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.MASHED_FOOD.ordinal()));
//Cheese
if(ConfigValues.enabledFoodRecipes[TheFoods.CHEESE.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()),
new ItemStack(Items.milk_bucket));
//Pumpkin Stew
if(ConfigValues.enabledFoodRecipes[TheFoods.PUMPKIN_STEW.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.PUMPKIN_STEW.ordinal()),
"P", "B",
'P', new ItemStack(Blocks.pumpkin),
'B', new ItemStack(Items.bowl));
//Carrot Juice
if(ConfigValues.enabledFoodRecipes[TheFoods.CARROT_JUICE.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CARROT_JUICE.ordinal()),
new ItemStack(Items.glass_bottle), new ItemStack(Items.carrot), new ItemStack(InitItems.itemKnife));
//Spaghetti
if(ConfigValues.enabledFoodRecipes[TheFoods.SPAGHETTI.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.SPAGHETTI.ordinal()),
"NNN", "B",
'N', new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()),
'B', new ItemStack(Items.bowl));
//Noodle
if(ConfigValues.enabledFoodRecipes[TheFoods.NOODLE.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()),
new ItemStack(Items.wheat), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()), new ItemStack(InitItems.itemKnife));
//Mashed Food
if(ConfigValues.enabledMiscRecipes[TheMiscItems.MASHED_FOOD.ordinal()])
initMashedFoodRecipes();
}
public static void initMashedFoodRecipes(){
for(Object nextIterator : Item.itemRegistry){
if(nextIterator instanceof ItemFood){
ItemStack ingredient = new ItemStack((Item)nextIterator, 1, Util.WILDCARD);
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 4, TheMiscItems.MASHED_FOOD.ordinal()), ingredient, ingredient, ingredient, ingredient, new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD));
}
}
}
}

View file

@ -0,0 +1,45 @@
package ellpeck.someprettyrandomstuff.crafting;
import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.someprettyrandomstuff.config.ConfigValues;
import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.items.metalists.TheMiscItems;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
public class ItemCrafting{
public static void init(){
//Knife
if(ConfigValues.enableKnifeRecipe)
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemKnife),
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()),
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_HANDLE.ordinal()));
//Crafter on a Stick
if(ConfigValues.enableCrafterRecipe)
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemCrafterOnAStick),
new ItemStack(Blocks.crafting_table),
new ItemStack(Items.sign),
new ItemStack(Items.slime_ball));
//Mashed Food
if(ConfigValues.enabledMiscRecipes[TheMiscItems.MASHED_FOOD.ordinal()])
initMashedFoodRecipes();
}
public static void initMashedFoodRecipes(){
for(Object nextIterator : Item.itemRegistry){
if(nextIterator instanceof ItemFood){
ItemStack ingredient = new ItemStack((Item)nextIterator, 1, Util.WILDCARD);
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 4, TheMiscItems.MASHED_FOOD.ordinal()), ingredient, ingredient, ingredient, ingredient, new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD));
}
}
}
}

View file

@ -0,0 +1,39 @@
package ellpeck.someprettyrandomstuff.crafting;
import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.someprettyrandomstuff.config.ConfigValues;
import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.items.metalists.TheMiscItems;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
public class MiscCrafting{
public static void init(){
//Dough
if(ConfigValues.enabledMiscRecipes[TheMiscItems.DOUGH.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 2, TheMiscItems.DOUGH.ordinal()),
new ItemStack(Items.wheat), new ItemStack(Items.wheat));
//Paper Cone
if(ConfigValues.enabledMiscRecipes[TheMiscItems.PAPER_CONE.ordinal()])
GameRegistry.addRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()),
"P P", " P ",
'P', new ItemStack(Items.paper));
//Knife Handle
if(ConfigValues.enabledMiscRecipes[TheMiscItems.KNIFE_HANDLE.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_HANDLE.ordinal()),
new ItemStack(Items.stick),
new ItemStack(Items.leather));
//Knife Blade
if(ConfigValues.enabledMiscRecipes[TheMiscItems.KNIFE_BLADE.ordinal()])
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()),
new ItemStack(Items.iron_ingot),
new ItemStack(Items.flint));
}
}

View file

@ -0,0 +1,79 @@
package ellpeck.someprettyrandomstuff.crafting;
import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.someprettyrandomstuff.config.ConfigValues;
import ellpeck.someprettyrandomstuff.items.InitItems;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
public class ToolCrafting{
public static void init(){
if(ConfigValues.enableToolEmeraldRecipe){
//Pickaxe
GameRegistry.addRecipe(new ItemStack(InitItems.itemPickaxeEmerald),
"EEE", " S ", " S ",
'E', new ItemStack(Items.emerald),
'S', new ItemStack(Items.stick));
//Sword
GameRegistry.addRecipe(new ItemStack(InitItems.itemSwordEmerald),
"E", "E", "S",
'E', new ItemStack(Items.emerald),
'S', new ItemStack(Items.stick));
//Axe
GameRegistry.addRecipe(new ItemStack(InitItems.itemAxeEmerald),
"EE", "ES", " S",
'E', new ItemStack(Items.emerald),
'S', new ItemStack(Items.stick));
//Shovel
GameRegistry.addRecipe(new ItemStack(InitItems.itemShovelEmerald),
"E", "S", "S",
'E', new ItemStack(Items.emerald),
'S', new ItemStack(Items.stick));
//Hoe
GameRegistry.addRecipe(new ItemStack(InitItems.itemHoeEmerald),
"EE", " S", " S",
'E', new ItemStack(Items.emerald),
'S', new ItemStack(Items.stick));
}
if(ConfigValues.enableToolObsidianRecipe){
//Pickaxe
GameRegistry.addRecipe(new ItemStack(InitItems.itemPickaxeObsidian),
"EEE", " S ", " S ",
'E', new ItemStack(Blocks.obsidian),
'S', new ItemStack(Items.stick));
//Sword
GameRegistry.addRecipe(new ItemStack(InitItems.itemSwordObsidian),
"E", "E", "S",
'E', new ItemStack(Blocks.obsidian),
'S', new ItemStack(Items.stick));
//Axe
GameRegistry.addRecipe(new ItemStack(InitItems.itemAxeObsidian),
"EE", "ES", " S",
'E', new ItemStack(Blocks.obsidian),
'S', new ItemStack(Items.stick));
//Shovel
GameRegistry.addRecipe(new ItemStack(InitItems.itemShovelObsidian),
"E", "S", "S",
'E', new ItemStack(Blocks.obsidian),
'S', new ItemStack(Items.stick));
//Hoe
GameRegistry.addRecipe(new ItemStack(InitItems.itemHoeObsidian),
"EE", " S", " S",
'E', new ItemStack(Blocks.obsidian),
'S', new ItemStack(Items.stick));
}
}
}

View file

@ -0,0 +1,46 @@
package ellpeck.someprettyrandomstuff.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import ellpeck.someprettyrandomstuff.achievement.InitAchievements;
import ellpeck.someprettyrandomstuff.blocks.InitBlocks;
import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.items.metalists.TheFoods;
import ellpeck.someprettyrandomstuff.items.metalists.TheMiscItems;
import net.minecraft.item.Item;
public class CraftEvent{
@SubscribeEvent
public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event){
if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.DOUGH.ordinal()){
event.player.addStat(InitAchievements.achievementCraftDough, 1);
}
if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal()){
event.player.addStat(InitAchievements.achievementCraftMashedFood, 1);
}
if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.KNIFE_BLADE.ordinal()){
event.player.addStat(InitAchievements.achievementCraftKnifeBlade, 1);
}
if(event.crafting.getItem() == InitItems.itemKnife){
event.player.addStat(InitAchievements.achievementCraftKnife, 1);
}
if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.SUBMARINE_SANDWICH.ordinal()){
event.player.addStat(InitAchievements.achievementCraftSubSandwich, 1);
}
if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.PAPER_CONE.ordinal()){
event.player.addStat(InitAchievements.achievementCraftPaperCone, 1);
}
if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.FRENCH_FRY.ordinal()){
event.player.addStat(InitAchievements.achievementCraftFrenchFry, 1);
}
if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.FRENCH_FRIES.ordinal()){
event.player.addStat(InitAchievements.achievementCraftFrenchFries, 1);
}
if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.FISH_N_CHIPS.ordinal()){
event.player.addStat(InitAchievements.achievementCraftFishNChips, 1);
}
if(event.crafting.getItem()== Item.getItemFromBlock(InitBlocks.blockCompost)){
event.player.addStat(InitAchievements.achievementCraftCompost, 1);
}
}
}

View file

@ -0,0 +1,15 @@
package ellpeck.someprettyrandomstuff.event;
import ellpeck.someprettyrandomstuff.util.Util;
public class InitEvents{
public static void init(){
Util.logInfo("Initializing Events...");
Util.registerEvent(new SmeltEvent());
Util.registerEvent(new CraftEvent());
Util.registerEvent(new KilledEvent());
}
}

View file

@ -0,0 +1,30 @@
package ellpeck.someprettyrandomstuff.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.items.metalists.TheSpecialDrops;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import java.util.Random;
public class KilledEvent{
@SubscribeEvent
public void onEntityDropEvent(LivingDropsEvent event){
if(event.source.getEntity() instanceof EntityPlayer){
for(int i = 0; i < TheSpecialDrops.values().length; i++){
TheSpecialDrops theDrop = TheSpecialDrops.values()[i];
if(theDrop.canDrop && event.entityLiving.getClass() == theDrop.dropFrom || (event.entityLiving instanceof EntityCreature && theDrop.dropFrom == EntityCreature.class) || (event.entityLiving instanceof EntityMob && theDrop.dropFrom == EntityMob.class) || (event.entityLiving instanceof EntityAnimal && theDrop.dropFrom == EntityAnimal.class)){
if(new Random().nextInt(100) + 1 <= theDrop.chance){
event.entityLiving.entityDropItem(new ItemStack(InitItems.itemSpecialDrop, new Random().nextInt(theDrop.maxAmount) + 1, theDrop.ordinal()), 0);
}
}
}
}
}
}

View file

@ -0,0 +1,16 @@
package ellpeck.someprettyrandomstuff.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import ellpeck.someprettyrandomstuff.achievement.InitAchievements;
import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.items.metalists.TheFoods;
public class SmeltEvent{
@SubscribeEvent
public void onSmeltedEvent(PlayerEvent.ItemSmeltedEvent event){
if(event.smelting.getItem() == InitItems.itemFoods && event.smelting.getItemDamage() == TheFoods.BAGUETTE.ordinal()){
event.player.addStat(InitAchievements.achievementSmeltBaguette, 1);
}
}
}

View file

@ -0,0 +1,95 @@
package ellpeck.someprettyrandomstuff.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.world.World;
public class ContainerCrafter extends Container{
public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
public IInventory craftResult = new InventoryCraftResult();
public final int x;
public final int y;
public final int z;
public final World world;
public ContainerCrafter(EntityPlayer player){
InventoryPlayer inventory = player.inventory;
this.world = player.worldObj;
this.x = (int)player.posX;
this.y = (int)player.posY;
this.z = (int)player.posZ;
this.addSlotToContainer(new SlotCrafting(inventory.player, this.craftMatrix, this.craftResult, 0, 124, 35));
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++){
this.addSlotToContainer(new Slot(this.craftMatrix, j + i*3, 30 + j*18, 17 + 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, 8 + j*18, 84 + i*18));
}
}
for (int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 8 + i*18, 142));
}
this.onCraftMatrixChanged(this.craftMatrix);
}
@Override
public void onCraftMatrixChanged(IInventory p_75130_1_){
this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.world));
}
@Override
public void onContainerClosed(EntityPlayer player){
super.onContainerClosed(player);
if (!this.world.isRemote){
for (int i = 0; i < 9; ++i){
ItemStack stack = this.craftMatrix.getStackInSlotOnClosing(i);
if(stack != null) player.dropPlayerItemWithRandomChoice(stack, false);
}
}
}
@Override
public boolean canInteractWith(EntityPlayer player){
return true;
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
ItemStack stack = null;
Slot theSlot = (Slot)this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){
ItemStack savedStack = theSlot.getStack();
stack = savedStack.copy();
if(slot == 0){
if(!this.mergeItemStack(savedStack, 10, 46, true)) return null;
theSlot.onSlotChange(savedStack, stack);
}
else if(slot >= 10 && slot < 37 && !this.mergeItemStack(savedStack, 37, 46, false)) return null;
else if(slot >= 37 && slot < 46 && !this.mergeItemStack(savedStack, 10, 37, false)) return null;
else if(!this.mergeItemStack(savedStack, 10, 46, false)) return null;
if(savedStack.stackSize == 0) theSlot.putStack(null);
else theSlot.onSlotChanged();
if(savedStack.stackSize == stack.stackSize) return null;
theSlot.onPickupFromSlot(player, savedStack);
}
return stack;
}
}

View file

@ -0,0 +1,89 @@
package ellpeck.someprettyrandomstuff.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.inventory.slot.SlotOutput;
import ellpeck.someprettyrandomstuff.tile.TileEntityBase;
import ellpeck.someprettyrandomstuff.tile.TileEntityFurnaceDouble;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerFurnaceDouble extends Container{
private TileEntityFurnaceDouble tileFurnace;
private int lastCoalTime;
private int lastCoalTimeLeft;
private int lastFirstCrushTime;
private int lastSecondCrushTime;
public ContainerFurnaceDouble(InventoryPlayer inventory, TileEntityBase tile){
this.tileFurnace = (TileEntityFurnaceDouble)tile;
this.addSlotToContainer(new Slot(this.tileFurnace, TileEntityFurnaceDouble.SLOT_COAL, 80, 21));
this.addSlotToContainer(new Slot(this.tileFurnace, TileEntityFurnaceDouble.SLOT_INPUT_1, 51, 21));
this.addSlotToContainer(new Slot(this.tileFurnace, TileEntityFurnaceDouble.SLOT_INPUT_2, 109, 21));
this.addSlotToContainer(new SlotOutput(this.tileFurnace, TileEntityFurnaceDouble.SLOT_OUTPUT_1, 51, 69));
this.addSlotToContainer(new SlotOutput(this.tileFurnace, TileEntityFurnaceDouble.SLOT_OUTPUT_2, 108, 69));
for (int i = 0; i < 3; i++){
for (int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
}
}
for (int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155));
}
}
@Override
public void addCraftingToCrafters(ICrafting iCraft){
super.addCraftingToCrafters(iCraft);
iCraft.sendProgressBarUpdate(this, 0, this.tileFurnace.coalTime);
iCraft.sendProgressBarUpdate(this, 1, this.tileFurnace.coalTimeLeft);
iCraft.sendProgressBarUpdate(this, 2, this.tileFurnace.firstSmeltTime);
iCraft.sendProgressBarUpdate(this, 3, this.tileFurnace.secondSmeltTime);
}
@Override
public void detectAndSendChanges(){
super.detectAndSendChanges();
for(Object crafter : this.crafters){
ICrafting iCraft = (ICrafting)crafter;
if(this.lastCoalTime != this.tileFurnace.coalTime) iCraft.sendProgressBarUpdate(this, 0, this.tileFurnace.coalTime);
if(this.lastCoalTimeLeft != this.tileFurnace.coalTimeLeft) iCraft.sendProgressBarUpdate(this, 1, this.tileFurnace.coalTimeLeft);
if(this.lastFirstCrushTime != this.tileFurnace.firstSmeltTime) iCraft.sendProgressBarUpdate(this, 2, this.tileFurnace.firstSmeltTime);
if(this.lastSecondCrushTime != this.tileFurnace.secondSmeltTime) iCraft.sendProgressBarUpdate(this, 3, this.tileFurnace.secondSmeltTime);
}
this.lastCoalTime = this.tileFurnace.coalTime;
this.lastCoalTimeLeft = this.tileFurnace.coalTimeLeft;
this.lastFirstCrushTime = this.tileFurnace.firstSmeltTime;
this.lastSecondCrushTime = this.tileFurnace.secondSmeltTime;
}
@Override
@SideOnly(Side.CLIENT)
public void updateProgressBar(int par1, int par2){
if(par1 == 0) this.tileFurnace.coalTime = par2;
if(par1 == 1) this.tileFurnace.coalTimeLeft = par2;
if(par1 == 2) this.tileFurnace.firstSmeltTime = par2;
if(par1 == 3) this.tileFurnace.secondSmeltTime = par2;
}
@Override
public boolean canInteractWith(EntityPlayer player){
return this.tileFurnace.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
return null;
}
}

View file

@ -0,0 +1,95 @@
package ellpeck.someprettyrandomstuff.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.inventory.slot.SlotOutput;
import ellpeck.someprettyrandomstuff.tile.TileEntityBase;
import ellpeck.someprettyrandomstuff.tile.TileEntityGrinder;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerGrinder extends Container{
private TileEntityGrinder tileGrinder;
private boolean isDouble;
private int lastCoalTime;
private int lastCoalTimeLeft;
private int lastFirstCrushTime;
private int lastSecondCrushTime;
public ContainerGrinder(InventoryPlayer inventory, TileEntityBase tile, boolean isDouble){
this.tileGrinder = (TileEntityGrinder)tile;
this.isDouble = isDouble;
this.addSlotToContainer(new Slot(this.tileGrinder, TileEntityGrinder.SLOT_COAL, this.isDouble ? 80 : 51, 21));
this.addSlotToContainer(new Slot(this.tileGrinder, TileEntityGrinder.SLOT_INPUT_1, this.isDouble ? 51 : 80, 21));
this.addSlotToContainer(new SlotOutput(this.tileGrinder, TileEntityGrinder.SLOT_OUTPUT_1_1, this.isDouble ? 37 : 66, 69));
this.addSlotToContainer(new SlotOutput(this.tileGrinder, TileEntityGrinder.SLOT_OUTPUT_1_2, this.isDouble ? 64 : 92, 69));
if(this.isDouble){
this.addSlotToContainer(new Slot(this.tileGrinder, TileEntityGrinder.SLOT_INPUT_2, 109, 21));
this.addSlotToContainer(new SlotOutput(this.tileGrinder, TileEntityGrinder.SLOT_OUTPUT_2_1, 96, 69));
this.addSlotToContainer(new SlotOutput(this.tileGrinder, TileEntityGrinder.SLOT_OUTPUT_2_2, 121, 69));
}
for (int i = 0; i < 3; i++){
for (int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
}
}
for (int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155));
}
}
@Override
public void addCraftingToCrafters(ICrafting iCraft){
super.addCraftingToCrafters(iCraft);
iCraft.sendProgressBarUpdate(this, 0, this.tileGrinder.coalTime);
iCraft.sendProgressBarUpdate(this, 1, this.tileGrinder.coalTimeLeft);
iCraft.sendProgressBarUpdate(this, 2, this.tileGrinder.firstCrushTime);
if(this.isDouble) iCraft.sendProgressBarUpdate(this, 3, this.tileGrinder.secondCrushTime);
}
@Override
public void detectAndSendChanges(){
super.detectAndSendChanges();
for(Object crafter : this.crafters){
ICrafting iCraft = (ICrafting)crafter;
if(this.lastCoalTime != this.tileGrinder.coalTime) iCraft.sendProgressBarUpdate(this, 0, this.tileGrinder.coalTime);
if(this.lastCoalTimeLeft != this.tileGrinder.coalTimeLeft) iCraft.sendProgressBarUpdate(this, 1, this.tileGrinder.coalTimeLeft);
if(this.lastFirstCrushTime != this.tileGrinder.firstCrushTime) iCraft.sendProgressBarUpdate(this, 2, this.tileGrinder.firstCrushTime);
if(this.isDouble) if(this.lastSecondCrushTime != this.tileGrinder.secondCrushTime) iCraft.sendProgressBarUpdate(this, 3, this.tileGrinder.secondCrushTime);
}
this.lastCoalTime = this.tileGrinder.coalTime;
this.lastCoalTimeLeft = this.tileGrinder.coalTimeLeft;
this.lastFirstCrushTime = this.tileGrinder.firstCrushTime;
if(this.isDouble) this.lastSecondCrushTime = this.tileGrinder.secondCrushTime;
}
@Override
@SideOnly(Side.CLIENT)
public void updateProgressBar(int par1, int par2){
if(par1 == 0) this.tileGrinder.coalTime = par2;
if(par1 == 1) this.tileGrinder.coalTimeLeft = par2;
if(par1 == 2) this.tileGrinder.firstCrushTime = par2;
if(this.isDouble && par1 == 3) this.tileGrinder.secondCrushTime = par2;
}
@Override
public boolean canInteractWith(EntityPlayer player){
return this.tileGrinder.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
return null;
}
}

View file

@ -0,0 +1,28 @@
package ellpeck.someprettyrandomstuff.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class GuiCrafter extends GuiContainer{
private static final ResourceLocation resLoc = new ResourceLocation("textures/gui/container/crafting_table.png");
public GuiCrafter(EntityPlayer player){
super(new ContainerCrafter(player));
this.xSize = 176;
this.ySize = 166;
}
@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, this.xSize, this.ySize);
}
}

View file

@ -58,7 +58,7 @@ public class GuiFeeder extends GuiContainer{
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
if(x >= guiLeft+69 && y >= guiTop+30 && x <= guiLeft+69+10 && y <= guiTop+30+10){
String[] array = new String[]{(this.tileFeeder.currentAnimalAmount + " " + 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")))};
String[] array = new String[]{(this.tileFeeder.currentAnimalAmount + " " + StatCollector.translateToLocal("info." + Util.MOD_ID_LOWER + ".feeder.animals.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);
}
}

View file

@ -0,0 +1,54 @@
package ellpeck.someprettyrandomstuff.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.tile.TileEntityBase;
import ellpeck.someprettyrandomstuff.tile.TileEntityFurnaceDouble;
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 GuiFurnaceDouble extends GuiContainer{
private static final ResourceLocation resLoc = Util.getGuiLocation("guiFurnaceDouble");
private TileEntityFurnaceDouble tileFurnace;
public GuiFurnaceDouble(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerFurnaceDouble(inventory, tile));
this.tileFurnace = (TileEntityFurnaceDouble)tile;
this.xSize = 176;
this.ySize = 93+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(Util.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.tileFurnace.coalTime > 0){
int i = this.tileFurnace.getCoalTimeToScale(15);
this.drawTexturedModalRect(this.guiLeft+80, this.guiTop+5+14-i, 176, 44+14-i, 14, i);
}
if(this.tileFurnace.firstSmeltTime > 0){
int i = this.tileFurnace.getFirstTimeToScale(23);
this.drawTexturedModalRect(this.guiLeft+51, this.guiTop+40, 176, 0, 24, i);
}
if(this.tileFurnace.secondSmeltTime > 0){
int i = this.tileFurnace.getSecondTimeToScale(23);
this.drawTexturedModalRect(this.guiLeft + 101, this.guiTop + 40, 176, 22, 24, i);
}
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
}
}

View file

@ -0,0 +1,59 @@
package ellpeck.someprettyrandomstuff.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.tile.TileEntityBase;
import ellpeck.someprettyrandomstuff.tile.TileEntityGrinder;
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 GuiGrinder extends GuiContainer{
private static final ResourceLocation resLoc = Util.getGuiLocation("guiGrinder");
private static final ResourceLocation resLocDouble = Util.getGuiLocation("guiGrinderDouble");
private TileEntityGrinder tileGrinder;
private boolean isDouble;
public GuiGrinder(InventoryPlayer inventory, TileEntityBase tile, boolean isDouble){
super(new ContainerGrinder(inventory, tile, isDouble));
this.tileGrinder = (TileEntityGrinder)tile;
this.isDouble = isDouble;
this.xSize = 176;
this.ySize = 93+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(Util.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(this.isDouble ? resLocDouble : resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.tileGrinder.coalTime > 0){
int i = this.tileGrinder.getCoalTimeToScale(15);
this.drawTexturedModalRect(this.guiLeft+(isDouble ? 80 : 51), this.guiTop+5+14-i, 176, 44+14-i, 14, i);
}
if(this.tileGrinder.firstCrushTime > 0){
int i = this.tileGrinder.getFirstTimeToScale(23);
this.drawTexturedModalRect(this.guiLeft+(isDouble ? 51 : 80), this.guiTop+40, 176, 0, 24, i);
}
if(this.isDouble){
if(this.tileGrinder.secondCrushTime > 0){
int i = this.tileGrinder.getSecondTimeToScale(23);
this.drawTexturedModalRect(this.guiLeft + 101, this.guiTop + 40, 176, 22, 24, i);
}
}
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
}
}

View file

@ -4,6 +4,7 @@ import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import ellpeck.someprettyrandomstuff.SomePrettyRandomStuff;
import ellpeck.someprettyrandomstuff.tile.TileEntityBase;
import ellpeck.someprettyrandomstuff.tile.TileEntityGrinder;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
@ -12,12 +13,24 @@ public class GuiHandler implements IGuiHandler{
@Override
public Object getServerGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
TileEntityBase tile = (TileEntityBase)world.getTileEntity(x, y, z);
switch (id){
case FEEDER_ID:
return new ContainerFeeder(entityPlayer.inventory, tile);
TileEntityBase tileFeeder = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerFeeder(entityPlayer.inventory, tileFeeder);
case GIANT_CHEST_ID:
return new ContainerGiantChest(entityPlayer.inventory, tile);
TileEntityBase tileChest = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerGiantChest(entityPlayer.inventory, tileChest);
case CRAFTER_ID:
return new ContainerCrafter(entityPlayer);
case GRINDER_ID:
TileEntityBase tileGrinder = (TileEntityGrinder)world.getTileEntity(x, y, z);
return new ContainerGrinder(entityPlayer.inventory, tileGrinder, false);
case GRINDER_DOUBLE_ID:
TileEntityBase tileGrinderDouble = (TileEntityGrinder)world.getTileEntity(x, y, z);
return new ContainerGrinder(entityPlayer.inventory, tileGrinderDouble, true);
case FURNACE_DOUBLE_ID:
TileEntityBase tileFurnace = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerFurnaceDouble(entityPlayer.inventory, tileFurnace);
default:
return null;
}
@ -25,12 +38,24 @@ public class GuiHandler implements IGuiHandler{
@Override
public Object getClientGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
TileEntityBase tile = (TileEntityBase)world.getTileEntity(x, y, z);
switch (id){
case FEEDER_ID:
return new GuiFeeder(entityPlayer.inventory, tile);
TileEntityBase tileFeeder = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiFeeder(entityPlayer.inventory, tileFeeder);
case GIANT_CHEST_ID:
return new GuiGiantChest(entityPlayer.inventory, tile);
TileEntityBase tileChest = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiGiantChest(entityPlayer.inventory, tileChest);
case CRAFTER_ID:
return new GuiCrafter(entityPlayer);
case GRINDER_ID:
TileEntityBase tileGrinder = (TileEntityGrinder)world.getTileEntity(x, y, z);
return new GuiGrinder(entityPlayer.inventory, tileGrinder, false);
case GRINDER_DOUBLE_ID:
TileEntityBase tileGrinderDouble = (TileEntityGrinder)world.getTileEntity(x, y, z);
return new GuiGrinder(entityPlayer.inventory, tileGrinderDouble, true);
case FURNACE_DOUBLE_ID:
TileEntityBase tileFurnace = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiFurnaceDouble(entityPlayer.inventory, tileFurnace);
default:
return null;
}
@ -38,6 +63,10 @@ public class GuiHandler implements IGuiHandler{
public static final int FEEDER_ID = 0;
public static final int GIANT_CHEST_ID = 1;
public static final int CRAFTER_ID = 2;
public static final int GRINDER_ID = 3;
public static final int GRINDER_DOUBLE_ID = 4;
public static final int FURNACE_DOUBLE_ID = 5;
public static void init(){
Util.logInfo("Initializing GuiHandler...");

View file

@ -0,0 +1,17 @@
package ellpeck.someprettyrandomstuff.inventory.slot;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class SlotOutput extends Slot{
public SlotOutput(IInventory inventory, int id, int x, int y){
super(inventory, id, x, y);
}
@Override
public boolean isItemValid(ItemStack stack){
return false;
}
}

View file

@ -1,10 +1,9 @@
package ellpeck.someprettyrandomstuff.items;
import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.someprettyrandomstuff.items.tools.*;
import ellpeck.someprettyrandomstuff.material.InitItemMaterials;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
public class InitItems{
@ -13,6 +12,9 @@ public class InitItems{
public static Item itemMisc;
public static Item itemFoods;
public static Item itemKnife;
public static Item itemCrafterOnAStick;
public static Item itemDust;
public static Item itemSpecialDrop;
public static Item itemPickaxeEmerald;
public static Item itemAxeEmerald;
@ -30,29 +32,38 @@ public class InitItems{
Util.logInfo("Initializing Items...");
itemFertilizer = new ItemFertilizer();
GameRegistry.registerItem(itemFertilizer, ((IName)itemFertilizer).getName());
Util.register(itemFertilizer);
itemMisc = new ItemMisc();
GameRegistry.registerItem(itemMisc, ((IName)itemMisc).getName());
Util.register(itemMisc);
itemFoods = new ItemFoods();
GameRegistry.registerItem(itemFoods, ((IName)itemFoods).getName());
Util.register(itemFoods);
itemKnife = new ItemKnife();
GameRegistry.registerItem(itemKnife, ((IName)itemKnife).getName());
Util.register(itemKnife);
itemPickaxeEmerald = new ItemPickaxeSPRS(InitItemMaterials.toolMaterialEmerald, "itemPickaxeEmerald");
itemAxeEmerald = new ItemAxeSPRS(InitItemMaterials.toolMaterialEmerald, "itemAxeEmerald");
itemShovelEmerald = new ItemShovelSPRS(InitItemMaterials.toolMaterialEmerald, "itemShovelEmerald");
itemSwordEmerald = new ItemSwordSPRS(InitItemMaterials.toolMaterialEmerald, "itemSwordEmerald");
itemHoeEmerald = new ItemHoeSPRS(InitItemMaterials.toolMaterialEmerald, "itemHoeEmerald");
itemCrafterOnAStick = new ItemCrafterOnAStick();
Util.register(itemCrafterOnAStick);
itemDust = new ItemDust();
Util.register(itemDust);
itemSpecialDrop = new ItemSpecialDrop();
Util.register(itemSpecialDrop);
itemPickaxeEmerald = new ItemPickaxeSPRS(InitItemMaterials.toolMaterialEmerald, "itemPickaxeEmerald", EnumRarity.rare);
itemAxeEmerald = new ItemAxeSPRS(InitItemMaterials.toolMaterialEmerald, "itemAxeEmerald", EnumRarity.rare);
itemShovelEmerald = new ItemShovelSPRS(InitItemMaterials.toolMaterialEmerald, "itemShovelEmerald", EnumRarity.rare);
itemSwordEmerald = new ItemSwordSPRS(InitItemMaterials.toolMaterialEmerald, "itemSwordEmerald", EnumRarity.rare);
itemHoeEmerald = new ItemHoeSPRS(InitItemMaterials.toolMaterialEmerald, "itemHoeEmerald", EnumRarity.rare);
Util.registerItems(new Item[]{itemPickaxeEmerald, itemAxeEmerald, itemShovelEmerald, itemSwordEmerald, itemHoeEmerald});
itemPickaxeObsidian = new ItemPickaxeSPRS(InitItemMaterials.toolMaterialObsidian, "itemPickaxeObsidian");
itemAxeObsidian = new ItemAxeSPRS(InitItemMaterials.toolMaterialObsidian, "itemAxeObsidian");
itemShovelObsidian = new ItemShovelSPRS(InitItemMaterials.toolMaterialObsidian, "itemShovelObsidian");
itemSwordObsidian = new ItemSwordSPRS(InitItemMaterials.toolMaterialObsidian, "itemSwordObsidian");
itemHoeObsidian = new ItemHoeSPRS(InitItemMaterials.toolMaterialObsidian, "itemHoeObsidian");
itemPickaxeObsidian = new ItemPickaxeSPRS(InitItemMaterials.toolMaterialObsidian, "itemPickaxeObsidian", EnumRarity.uncommon);
itemAxeObsidian = new ItemAxeSPRS(InitItemMaterials.toolMaterialObsidian, "itemAxeObsidian", EnumRarity.uncommon);
itemShovelObsidian = new ItemShovelSPRS(InitItemMaterials.toolMaterialObsidian, "itemShovelObsidian", EnumRarity.uncommon);
itemSwordObsidian = new ItemSwordSPRS(InitItemMaterials.toolMaterialObsidian, "itemSwordObsidian", EnumRarity.uncommon);
itemHoeObsidian = new ItemHoeSPRS(InitItemMaterials.toolMaterialObsidian, "itemHoeObsidian", EnumRarity.uncommon);
Util.registerItems(new Item[]{itemPickaxeObsidian, itemAxeObsidian, itemShovelObsidian, itemSwordObsidian, itemHoeObsidian});
}

View file

@ -0,0 +1,61 @@
package ellpeck.someprettyrandomstuff.items;
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.util.IName;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import java.util.List;
public class ItemCrafterOnAStick extends Item implements IName{
public ItemCrafterOnAStick(){
this.setUnlocalizedName(Util.setUnlocalizedName(this));
this.setCreativeTab(CreativeTab.instance);
this.setMaxStackSize(1);
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
list.add(Util.addStandardInformation(this));
}
@Override
public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){
this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName());
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
if(!world.isRemote) player.openGui(SomePrettyRandomStuff.instance, GuiHandler.CRAFTER_ID, world, (int)player.posX, (int)player.posY, (int)player.posZ);
return stack;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
public String getName(){
return "itemCrafterOnAStick";
}
}

View file

@ -0,0 +1,82 @@
package ellpeck.someprettyrandomstuff.items;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.items.metalists.TheDusts;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import java.util.List;
public class ItemDust extends Item implements IName{
public static final TheDusts[] allDusts = TheDusts.values();
public ItemDust(){
this.setUnlocalizedName(Util.setUnlocalizedName(this));
this.setHasSubtypes(true);
this.setCreativeTab(CreativeTab.instance);
}
@Override
public String getName(){
return "itemDust";
}
@Override
public int getMetadata(int damage){
return damage;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return allDusts[stack.getItemDamage()].rarity;
}
@SuppressWarnings("all")
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list){
for(int j = 0; j < allDusts.length; j++){
list.add(new ItemStack(this, 1, j));
}
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName() + allDusts[stack.getItemDamage()].name;
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + this.getName() + allDusts[stack.getItemDamage()].getName() + ".desc"));
else list.add(Util.shiftForInfo());
}
@Override
public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon;
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass){
return allDusts[stack.getItemDamage()].color;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){
this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName());
}
}

View file

@ -7,6 +7,7 @@ import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
@ -18,7 +19,7 @@ import java.util.List;
public class ItemFertilizer extends Item implements IName{
public ItemFertilizer(){
this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.setUnlocalizedName(Util.setUnlocalizedName(this));
this.setCreativeTab(CreativeTab.instance);
}
@ -31,6 +32,11 @@ public class ItemFertilizer extends Item implements IName{
return super.onItemUse(stack, player, world, x, y, z, par7, par8, par9, par10);
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)

View file

@ -10,10 +10,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
@ -27,7 +24,7 @@ public class ItemFoods extends ItemFood implements IName{
public ItemFoods(){
super(0, 0.0F, false);
this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.setUnlocalizedName(Util.setUnlocalizedName(this));
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setCreativeTab(CreativeTab.instance);
@ -35,6 +32,11 @@ public class ItemFoods extends ItemFood implements IName{
TheFoods.setReturnItems();
}
@Override
public EnumRarity getRarity(ItemStack stack){
return allFoods[stack.getItemDamage()].rarity;
}
@Override
public int func_150905_g(ItemStack stack){
return allFoods[stack.getItemDamage()].healAmount;

View file

@ -4,20 +4,22 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.config.ConfigValues;
import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.util.IInformation;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import java.util.List;
public class ItemKnife extends Item implements IName{
public class ItemKnife extends Item implements IName, IInformation{
public ItemKnife(){
this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.setUnlocalizedName(Util.setUnlocalizedName(this));
this.setMaxDamage(ConfigValues.itemKnifeMaxDamage);
this.setCreativeTab(CreativeTab.instance);
this.setMaxStackSize(1);
@ -32,6 +34,11 @@ public class ItemKnife extends Item implements IName{
return theStack;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
@ -59,4 +66,9 @@ public class ItemKnife extends Item implements IName{
public String getName(){
return "itemKnife";
}
@Override
public String[] getInformationString(){
return new String[]{"This is a test too but it's more cool senn se assa"};
}
}

View file

@ -9,6 +9,7 @@ import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
@ -22,7 +23,7 @@ public class ItemMisc extends Item implements IName{
public IIcon[] textures = new IIcon[allMiscItems.length];
public ItemMisc(){
this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.setUnlocalizedName(Util.setUnlocalizedName(this));
this.setHasSubtypes(true);
this.setCreativeTab(CreativeTab.instance);
}
@ -32,6 +33,11 @@ public class ItemMisc extends Item implements IName{
return "itemMisc";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return allMiscItems[stack.getItemDamage()].rarity;
}
@Override
public int getMetadata(int damage){
return damage;

View file

@ -0,0 +1,79 @@
package ellpeck.someprettyrandomstuff.items;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.creative.CreativeTab;
import ellpeck.someprettyrandomstuff.items.metalists.TheSpecialDrops;
import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import java.util.List;
public class ItemSpecialDrop extends Item implements IName{
public static final TheSpecialDrops[] allDrops = TheSpecialDrops.values();
public IIcon[] textures = new IIcon[allDrops.length];
public ItemSpecialDrop(){
this.setUnlocalizedName(Util.setUnlocalizedName(this));
this.setHasSubtypes(true);
this.setCreativeTab(CreativeTab.instance);
}
@Override
public String getName(){
return "itemSpecial";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return allDrops[stack.getItemDamage()].rarity;
}
@Override
public int getMetadata(int damage){
return damage;
}
@SuppressWarnings("all")
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list){
for(int j = 0; j < allDrops.length; j++){
list.add(new ItemStack(this, 1, j));
}
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName() + allDrops[stack.getItemDamage()].name;
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + this.getName() + allDrops[stack.getItemDamage()].getName() + ".desc"));
else list.add(Util.shiftForInfo());
}
@Override
public IIcon getIconFromDamage(int par1){
return textures[par1];
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){
for(int i = 0; i < textures.length; i++){
textures[i] = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName() + allDrops[i].getName());
}
}
}

View file

@ -0,0 +1,28 @@
package ellpeck.someprettyrandomstuff.items.metalists;
import ellpeck.someprettyrandomstuff.util.IName;
import net.minecraft.item.EnumRarity;
public enum TheDusts implements IName{
IRON("Iron", 7826534, EnumRarity.common),
GOLD("Gold", 14335744, EnumRarity.uncommon),
DIAMOND("Diamond", 292003, EnumRarity.rare),
EMERALD("Emerald", 4319527, EnumRarity.epic),
LAPIS("Lapis", 1849791, EnumRarity.uncommon);
public final String name;
public final int color;
public final EnumRarity rarity;
private TheDusts(String name, int color, EnumRarity rarity){
this.name = name;
this.color = color;
this.rarity = rarity;
}
@Override
public String getName(){
return this.name;
}
}

View file

@ -3,26 +3,27 @@ package ellpeck.someprettyrandomstuff.items.metalists;
import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.util.IName;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
public enum TheFoods implements IName{
CHEESE("Cheese", 1, 0.1F, false, 3),
PUMPKIN_STEW("PumpkinStew", 10, 0.4F, true, 30),
CARROT_JUICE("CarrotJuice", 6, 0.2F, true, 20),
FISH_N_CHIPS("FishNChips", 20, 1F, false, 40),
FRENCH_FRIES("FrenchFries", 16, 0.7F, false, 32),
FRENCH_FRY("FrenchFry", 1, 0.01F, false, 3),
SPAGHETTI("Spaghetti", 18, 0.8F, false, 38),
NOODLE("Noodle", 1, 0.01F, false, 3),
CHOCOLATE_CAKE("ChocolateCake", 16, 0.45F, false, 45),
CHOCOLATE("Chocolate", 5, 0.05F, false, 15),
TOAST("Toast", 7, 0.4F, false, 25),
SUBMARINE_SANDWICH("SubmarineSandwich", 10, 0.7F, false, 40),
BIG_COOKIE("BigCookie", 6, 0.1F, false, 20),
HAMBURGER("Hamburger", 14, 0.9F, false, 40),
PIZZA("Pizza", 20, 1F, false, 45),
BAGUETTE("Baguette", 7, 0.2F, false, 25);
CHEESE("Cheese", 1, 0.1F, false, 3, EnumRarity.common),
PUMPKIN_STEW("PumpkinStew", 10, 0.4F, true, 30, EnumRarity.common),
CARROT_JUICE("CarrotJuice", 6, 0.2F, true, 20, EnumRarity.common),
FISH_N_CHIPS("FishNChips", 20, 1F, false, 40, EnumRarity.uncommon),
FRENCH_FRIES("FrenchFries", 16, 0.7F, false, 32, EnumRarity.common),
FRENCH_FRY("FrenchFry", 1, 0.01F, false, 3, EnumRarity.common),
SPAGHETTI("Spaghetti", 18, 0.8F, false, 38, EnumRarity.common),
NOODLE("Noodle", 1, 0.01F, false, 3, EnumRarity.common),
CHOCOLATE_CAKE("ChocolateCake", 16, 0.45F, false, 45, EnumRarity.uncommon),
CHOCOLATE("Chocolate", 5, 0.05F, false, 15, EnumRarity.common),
TOAST("Toast", 7, 0.4F, false, 25, EnumRarity.common),
SUBMARINE_SANDWICH("SubmarineSandwich", 10, 0.7F, false, 40, EnumRarity.uncommon),
BIG_COOKIE("BigCookie", 6, 0.1F, false, 20, EnumRarity.uncommon),
HAMBURGER("Hamburger", 14, 0.9F, false, 40, EnumRarity.common),
PIZZA("Pizza", 20, 1F, false, 45, EnumRarity.uncommon),
BAGUETTE("Baguette", 7, 0.2F, false, 25, EnumRarity.common);
public static void setReturnItems(){
SPAGHETTI.returnItem = new ItemStack(Items.bowl);
@ -38,13 +39,15 @@ public enum TheFoods implements IName{
public final boolean getsDrunken;
public final int useDuration;
public ItemStack returnItem;
public final EnumRarity rarity;
private TheFoods(String name, int healAmount, float saturation, boolean getsDrunken, int useDuration){
private TheFoods(String name, int healAmount, float saturation, boolean getsDrunken, int useDuration, EnumRarity rarity){
this.name = name;
this.getsDrunken = getsDrunken;
this.healAmount = healAmount;
this.saturation = saturation;
this.useDuration = useDuration;
this.rarity = rarity;
}
@Override

View file

@ -1,24 +1,23 @@
package ellpeck.someprettyrandomstuff.items.metalists;
import ellpeck.someprettyrandomstuff.util.IName;
import net.minecraft.item.EnumRarity;
public enum TheMiscItems implements IName{
PAPER_CONE("PaperCone"),
MASHED_FOOD("MashedFood"),
REFINED_IRON("RefinedIron"),
REFINED_REDSTONE("RefinedRedstone"),
COMPRESSED_IRON("CompressedIron"),
STEEL("Steel"),
KNIFE_BLADE("KnifeBlade"),
KNIFE_HANDLE("KnifeHandle"),
DOUGH("Dough"),
QUARTZ("BlackQuartz");
PAPER_CONE("PaperCone", EnumRarity.common),
MASHED_FOOD("MashedFood", EnumRarity.uncommon),
KNIFE_BLADE("KnifeBlade", EnumRarity.common),
KNIFE_HANDLE("KnifeHandle", EnumRarity.common),
DOUGH("Dough", EnumRarity.common),
QUARTZ("BlackQuartz", EnumRarity.epic);
public final String name;
public final EnumRarity rarity;
private TheMiscItems(String name){
private TheMiscItems(String name, EnumRarity rarity){
this.name = name;
this.rarity = rarity;
}
@Override

View file

@ -0,0 +1,41 @@
package ellpeck.someprettyrandomstuff.items.metalists;
import ellpeck.someprettyrandomstuff.config.ConfigValues;
import ellpeck.someprettyrandomstuff.util.IName;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.item.EnumRarity;
public enum TheSpecialDrops implements IName{
SOLIDIFIED_EXPERIENCE("SolidifiedExperience", 70, 3, EntityCreature.class, EnumRarity.uncommon, ConfigValues.enableExperienceDrop),
BLOOD_FRAGMENT("BloodFragment", 30, 1, EntityCreature.class, EnumRarity.uncommon, ConfigValues.enableBloodDrop),
//Change this into a Heart Fragment that is later crafted into a heart used to revive Villagers
HEART_PART("HeartPart", 10, 1, EntityCreature.class, EnumRarity.rare, ConfigValues.enableHeartDrop),
UNKNOWN_SUBSTANCE("UnknownSubstance", 5, 1, EntitySkeleton.class, EnumRarity.epic, ConfigValues.enableSubstanceDrop),
PEARL_SHARD("PearlShard", 20, 3, EntityEnderman.class, EnumRarity.epic, ConfigValues.enablePearlShardDrop),
EMERALD_SHARD("EmeraldShard", 15, 1, EntityCreeper.class, EnumRarity.rare, ConfigValues.enableEmeraldShardDrop);
public final String name;
public final int chance;
public final int maxAmount;
public final Class<? extends EntityCreature> dropFrom;
public final boolean canDrop;
public final EnumRarity rarity;
private TheSpecialDrops(String name, int chance, int maxAmount, Class<? extends EntityCreature> dropFrom, EnumRarity rarity, boolean canDrop){
this.name = name;
this.chance = chance;
this.rarity = rarity;
this.maxAmount = maxAmount;
this.dropFrom = dropFrom;
this.canDrop = canDrop;
}
@Override
public String getName(){
return this.name;
}
}

View file

@ -7,6 +7,7 @@ import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
@ -17,11 +18,13 @@ import java.util.List;
public class ItemAxeSPRS extends ItemAxe implements IName{
private String name;
private EnumRarity rarity;
public ItemAxeSPRS(ToolMaterial toolMat, String unlocalizedName){
public ItemAxeSPRS(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity){
super(toolMat);
this.name = unlocalizedName;
this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.rarity = rarity;
this.setUnlocalizedName(Util.setUnlocalizedName(this));
this.setCreativeTab(CreativeTab.instance);
}
@ -46,6 +49,11 @@ public class ItemAxeSPRS extends ItemAxe implements IName{
this.itemIcon = iconReg.registerIcon(Util.MOD_ID_LOWER + ":" + this.getName());
}
@Override
public EnumRarity getRarity(ItemStack stack){
return this.rarity;
}
@Override
public String getName(){
return name;

View file

@ -7,6 +7,7 @@ import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
@ -17,11 +18,13 @@ import java.util.List;
public class ItemHoeSPRS extends ItemHoe implements IName{
private String name;
private EnumRarity rarity;
public ItemHoeSPRS(ToolMaterial toolMat, String unlocalizedName){
public ItemHoeSPRS(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity){
super(toolMat);
this.name = unlocalizedName;
this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.rarity = rarity;
this.setUnlocalizedName(Util.setUnlocalizedName(this));
this.setCreativeTab(CreativeTab.instance);
}
@ -35,6 +38,11 @@ public class ItemHoeSPRS extends ItemHoe implements IName{
}
}
@Override
public EnumRarity getRarity(ItemStack stack){
return this.rarity;
}
@Override
public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon;

View file

@ -7,6 +7,7 @@ import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
@ -17,11 +18,13 @@ import java.util.List;
public class ItemPickaxeSPRS extends ItemPickaxe implements IName{
private String name;
private EnumRarity rarity;
public ItemPickaxeSPRS(ToolMaterial toolMat, String unlocalizedName){
public ItemPickaxeSPRS(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity){
super(toolMat);
this.name = unlocalizedName;
this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.rarity = rarity;
this.setUnlocalizedName(Util.setUnlocalizedName(this));
this.setCreativeTab(CreativeTab.instance);
}
@ -40,6 +43,11 @@ public class ItemPickaxeSPRS extends ItemPickaxe implements IName{
return this.itemIcon;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return this.rarity;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){

View file

@ -7,6 +7,7 @@ import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
@ -17,11 +18,13 @@ import java.util.List;
public class ItemShovelSPRS extends ItemSpade implements IName{
private String name;
private EnumRarity rarity;
public ItemShovelSPRS(ToolMaterial toolMat, String unlocalizedName){
public ItemShovelSPRS(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity){
super(toolMat);
this.name = unlocalizedName;
this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.rarity = rarity;
this.setUnlocalizedName(Util.setUnlocalizedName(this));
this.setCreativeTab(CreativeTab.instance);
}
@ -35,6 +38,11 @@ public class ItemShovelSPRS extends ItemSpade implements IName{
}
}
@Override
public EnumRarity getRarity(ItemStack stack){
return this.rarity;
}
@Override
public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon;

View file

@ -7,6 +7,7 @@ import ellpeck.someprettyrandomstuff.util.IName;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.util.IIcon;
@ -17,11 +18,13 @@ import java.util.List;
public class ItemSwordSPRS extends ItemSword implements IName{
private String name;
private EnumRarity rarity;
public ItemSwordSPRS(ToolMaterial toolMat, String unlocalizedName){
public ItemSwordSPRS(ToolMaterial toolMat, String unlocalizedName, EnumRarity rarity){
super(toolMat);
this.name = unlocalizedName;
this.setUnlocalizedName(Util.getNamePrefix() + this.getName());
this.rarity = rarity;
this.setUnlocalizedName(Util.setUnlocalizedName(this));
this.setCreativeTab(CreativeTab.instance);
}
@ -35,6 +38,11 @@ public class ItemSwordSPRS extends ItemSword implements IName{
}
}
@Override
public EnumRarity getRarity(ItemStack stack){
return this.rarity;
}
@Override
public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon;

View file

@ -2,7 +2,10 @@ package ellpeck.someprettyrandomstuff.material;
import ellpeck.someprettyrandomstuff.config.ConfigValues;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.EnumHelper;
public class InitItemMaterials{
@ -13,8 +16,8 @@ public class InitItemMaterials{
public static void init(){
Util.logInfo("Initializing Materials...");
toolMaterialEmerald = EnumHelper.addToolMaterial("toolMaterialEmerald", ConfigValues.toolEmeraldHarvestLevel, ConfigValues.toolEmeraldMaxUses, ConfigValues.toolEmeraldEfficiency, ConfigValues.toolEmeraldDamage, ConfigValues.toolEmeraldEnchantability);
toolMaterialObsidian = EnumHelper.addToolMaterial("toolMaterialObsidian", ConfigValues.toolObsidianHarvestLevel, ConfigValues.toolObsidianMaxUses, ConfigValues.toolObsidianEfficiency, ConfigValues.toolObsidianDamage, ConfigValues.toolObsidianEnchantability);
toolMaterialEmerald = EnumHelper.addToolMaterial("toolMaterialEmerald", ConfigValues.toolEmeraldHarvestLevel, ConfigValues.toolEmeraldMaxUses, ConfigValues.toolEmeraldEfficiency, ConfigValues.toolEmeraldDamage, ConfigValues.toolEmeraldEnchantability).setRepairItem(new ItemStack(Items.emerald));
toolMaterialObsidian = EnumHelper.addToolMaterial("toolMaterialObsidian", ConfigValues.toolObsidianHarvestLevel, ConfigValues.toolObsidianMaxUses, ConfigValues.toolObsidianEfficiency, ConfigValues.toolObsidianDamage, ConfigValues.toolObsidianEnchantability).setRepairItem(new ItemStack(Blocks.obsidian));
}

View file

@ -0,0 +1,17 @@
package ellpeck.someprettyrandomstuff.oredict;
import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.items.metalists.TheDusts;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class OreDictRegistry{
public static void init(){
OreDictionary.registerOre("dustDiamond", new ItemStack(InitItems.itemDust, 1, TheDusts.DIAMOND.ordinal()));
OreDictionary.registerOre("dustIron", new ItemStack(InitItems.itemDust, 1, TheDusts.IRON.ordinal()));
OreDictionary.registerOre("dustGold", new ItemStack(InitItems.itemDust, 1, TheDusts.GOLD.ordinal()));
OreDictionary.registerOre("dustEmerald", new ItemStack(InitItems.itemDust, 1, TheDusts.EMERALD.ordinal()));
OreDictionary.registerOre("dustLapis", new ItemStack(InitItems.itemDust, 1, TheDusts.LAPIS.ordinal()));
}
}

View file

@ -1,6 +1,15 @@
package ellpeck.someprettyrandomstuff.proxy;
import cpw.mods.fml.client.registry.ClientRegistry;
import ellpeck.someprettyrandomstuff.blocks.InitBlocks;
import ellpeck.someprettyrandomstuff.blocks.render.ModelCompost;
import ellpeck.someprettyrandomstuff.blocks.render.RenderItems;
import ellpeck.someprettyrandomstuff.blocks.render.RenderTileEntity;
import ellpeck.someprettyrandomstuff.tile.TileEntityCompost;
import net.minecraft.item.Item;
import net.minecraftforge.client.MinecraftForgeClient;
@SuppressWarnings("unused")
public class ClientProxy implements IProxy{
@ -11,7 +20,8 @@ public class ClientProxy implements IProxy{
@Override
public void init(){
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCompost.class, new RenderTileEntity(new ModelCompost()));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockCompost), new RenderItems(new ModelCompost()));
}
@Override

View file

@ -0,0 +1,54 @@
package ellpeck.someprettyrandomstuff.recipe;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
public class GrinderRecipes{
private static final GrinderRecipes instance = new GrinderRecipes();
public ArrayList<GrinderRecipe> recipes = new ArrayList<GrinderRecipe>();
public static GrinderRecipes instance(){
return instance;
}
public void registerRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int secondChance){
this.recipes.add(new GrinderRecipe(input, outputOne, outputTwo, secondChance));
}
public ItemStack getOutput(ItemStack input, boolean wantSecond){
for(GrinderRecipe recipe : recipes){
if(recipe.input.isItemEqual(input)){
return wantSecond ? recipe.secondOutput : recipe.firstOutput;
}
}
return null;
}
public int getSecondChance(ItemStack input){
for(GrinderRecipe recipe : recipes){
if(recipe.input.isItemEqual(input)){
return recipe.secondChance;
}
}
return 0;
}
public class GrinderRecipe{
public final ItemStack input;
public final ItemStack firstOutput;
public final ItemStack secondOutput;
public final int secondChance;
public GrinderRecipe(ItemStack input, ItemStack firstOutput, ItemStack secondOutput, int secondChance){
this.input = input;
this.firstOutput = firstOutput;
this.secondOutput = secondOutput;
this.secondChance = secondChance;
}
}
}

View file

@ -2,13 +2,16 @@ package ellpeck.someprettyrandomstuff.tile;
import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.someprettyrandomstuff.util.Util;
import net.minecraft.block.Block;
import net.minecraft.block.BlockAir;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public abstract class TileEntityBase extends TileEntity{
public class TileEntityBase extends TileEntity{
@Override
public Packet getDescriptionPacket(){
@ -28,5 +31,12 @@ public abstract class TileEntityBase extends TileEntity{
GameRegistry.registerTileEntity(TileEntityCompost.class, Util.MOD_ID_LOWER + ":tileEntityCompost");
GameRegistry.registerTileEntity(TileEntityFeeder.class, Util.MOD_ID_LOWER + ":tileEntityFeeder");
GameRegistry.registerTileEntity(TileEntityGiantChest.class, Util.MOD_ID_LOWER + ":tileEntityGiantChest");
GameRegistry.registerTileEntity(TileEntityGrinder.class, Util.MOD_ID_LOWER + ":tileEntityGrinder");
GameRegistry.registerTileEntity(TileEntityFurnaceDouble.class, Util.MOD_ID_LOWER + ":tileEntityFurnaceDouble");
}
@Override
public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z){
return newBlock == null || newBlock instanceof BlockAir;
}
}

View file

@ -3,6 +3,8 @@ package ellpeck.someprettyrandomstuff.tile;
import ellpeck.someprettyrandomstuff.config.ConfigValues;
import ellpeck.someprettyrandomstuff.items.InitItems;
import ellpeck.someprettyrandomstuff.items.ItemFertilizer;
import ellpeck.someprettyrandomstuff.items.ItemMisc;
import ellpeck.someprettyrandomstuff.items.metalists.TheMiscItems;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -30,6 +32,11 @@ public class TileEntityCompost extends TileEntityInventoryBase{
}
}
@Override
public int getInventoryStackLimit(){
return this.amountNeededToConvert;
}
@Override
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
@ -41,4 +48,19 @@ public class TileEntityCompost extends TileEntityInventoryBase{
super.readFromNBT(compound);
this.conversionTime = compound.getInteger("ConversionTime");
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return stack.getItem() instanceof ItemMisc && stack.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal();
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return stack.getItem() instanceof ItemFertilizer;
}
}

View file

@ -7,6 +7,7 @@ import ellpeck.someprettyrandomstuff.config.ConfigValues;
import ellpeck.someprettyrandomstuff.network.PacketHandler;
import ellpeck.someprettyrandomstuff.network.PacketTileEntityFeeder;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
@ -83,4 +84,19 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
super.readFromNBT(compound);
this.currentTimer = compound.getInteger("Timer");
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return false;
}
}

View file

@ -0,0 +1,155 @@
package ellpeck.someprettyrandomstuff.tile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.config.ConfigValues;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityFurnace;
public class TileEntityFurnaceDouble extends TileEntityInventoryBase{
public static final int SLOT_COAL = 0;
public static final int SLOT_INPUT_1 = 1;
public static final int SLOT_OUTPUT_1 = 2;
public static final int SLOT_INPUT_2 = 3;
public static final int SLOT_OUTPUT_2 = 4;
public int coalTime;
public int coalTimeLeft;
public final int maxBurnTime;
public int firstSmeltTime;
public int secondSmeltTime;
public TileEntityFurnaceDouble(){
super(5, "tileEntityFurnaceDouble");
this.maxBurnTime = ConfigValues.furnaceDoubleSmeltTime;
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
if(!worldObj.isRemote){
boolean theFlag = this.coalTimeLeft > 0;
if(this.coalTimeLeft > 0) this.coalTimeLeft--;
boolean canSmeltOnFirst = this.canSmeltOn(SLOT_INPUT_1, SLOT_OUTPUT_1);
boolean canSmeltOnSecond = this.canSmeltOn(SLOT_INPUT_2, SLOT_OUTPUT_2);
if((canSmeltOnFirst || canSmeltOnSecond) && this.coalTimeLeft <= 0 && this.slots[SLOT_COAL] != null){
this.coalTime = TileEntityFurnace.getItemBurnTime(this.slots[SLOT_COAL]);
this.coalTimeLeft = this.coalTime;
if(this.coalTime > 0){
this.slots[SLOT_COAL].stackSize--;
if(this.slots[SLOT_COAL].stackSize <= 0) this.slots[SLOT_COAL] = this.slots[SLOT_COAL].getItem().getContainerItem(this.slots[SLOT_COAL]);
}
}
if(this.coalTimeLeft > 0){
if(canSmeltOnFirst){
this.firstSmeltTime++;
if(this.firstSmeltTime >= maxBurnTime){
this.finishBurning(SLOT_INPUT_1, SLOT_OUTPUT_1);
this.firstSmeltTime = 0;
}
}
else this.firstSmeltTime = 0;
if(canSmeltOnSecond){
this.secondSmeltTime++;
if(this.secondSmeltTime >= maxBurnTime){
this.finishBurning(SLOT_INPUT_2, SLOT_OUTPUT_2);
this.secondSmeltTime = 0;
}
}
else this.secondSmeltTime = 0;
}
else{
this.firstSmeltTime = 0;
this.secondSmeltTime = 0;
this.coalTime = 0;
}
if(theFlag != this.coalTimeLeft > 0){
int metaBefore = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, (this.coalTimeLeft > 0 ? metaBefore+4 : metaBefore-4), 2);
}
}
}
public boolean canSmeltOn(int theInput, int theOutput){
if(this.slots[theInput] != null){
ItemStack output = FurnaceRecipes.smelting().getSmeltingResult(this.slots[theInput]);
if(this.slots[theInput] != null){
if(output != null){
if(this.slots[theOutput] == null || (this.slots[theOutput].isItemEqual(output) && this.slots[theOutput].stackSize <= this.slots[theOutput].getMaxStackSize()-output.stackSize)){
return true;
}
}
}
}
return false;
}
public void finishBurning(int theInput, int theOutput){
ItemStack output = FurnaceRecipes.smelting().getSmeltingResult(this.slots[theInput]);
if (this.slots[theOutput] == null) this.slots[theOutput] = output.copy();
else if(this.slots[theOutput].getItem() == output.getItem()) this.slots[theOutput].stackSize += output.stackSize;
this.slots[theInput].stackSize--;
if (this.slots[theInput].stackSize <= 0) this.slots[theInput] = null;
}
@Override
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
compound.setInteger("CoalTime", this.coalTime);
compound.setInteger("CoalTimeLeft", this.coalTimeLeft);
compound.setInteger("FirstSmeltTime", this.firstSmeltTime);
compound.setInteger("SecondSmeltTime", this.secondSmeltTime);
}
@Override
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
this.coalTime = compound.getInteger("CoalTime");
this.coalTimeLeft = compound.getInteger("CoalTimeLeft");
this.firstSmeltTime = compound.getInteger("FirstSmeltTime");
this.secondSmeltTime = compound.getInteger("SecondSmeltTime");
}
@SideOnly(Side.CLIENT)
public int getCoalTimeToScale(int i){
return this.coalTimeLeft * i / this.coalTime;
}
@SideOnly(Side.CLIENT)
public int getFirstTimeToScale(int i){
return this.firstSmeltTime * i / this.maxBurnTime;
}
@SideOnly(Side.CLIENT)
public int getSecondTimeToScale(int i){
return this.secondSmeltTime * i / this.maxBurnTime;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == SLOT_COAL && TileEntityFurnace.getItemBurnTime(stack) > 0 || (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.smelting().getSmeltingResult(stack) != null;
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2;
}
}

View file

@ -40,4 +40,24 @@ public class TileEntityGiantChest extends TileEntityInventoryBase{
}
}
}
@Override
public boolean canUpdate(){
return false;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return true;
}
}

View file

@ -0,0 +1,186 @@
package ellpeck.someprettyrandomstuff.tile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.someprettyrandomstuff.config.ConfigValues;
import ellpeck.someprettyrandomstuff.recipe.GrinderRecipes;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityFurnace;
import java.util.Random;
public class TileEntityGrinder extends TileEntityInventoryBase{
public static final int SLOT_COAL = 0;
public static final int SLOT_INPUT_1 = 1;
public static final int SLOT_OUTPUT_1_1 = 2;
public static final int SLOT_OUTPUT_1_2 = 3;
public static final int SLOT_INPUT_2 = 4;
public static final int SLOT_OUTPUT_2_1 = 5;
public static final int SLOT_OUTPUT_2_2 = 6;
public int coalTime;
public int coalTimeLeft;
public int maxCrushTime;
public int firstCrushTime;
public int secondCrushTime;
public boolean isDouble;
public TileEntityGrinder(){
super(0, "");
}
public TileEntityGrinder(boolean isDouble){
super(isDouble ? 7 : 4, isDouble ? "tileEntityGrinderDouble" : "tileEntityGrinder");
this.maxCrushTime = isDouble ? ConfigValues.grinderDoubleCrushTime : ConfigValues.grinderCrushTime;
this.isDouble = isDouble;
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
if(!worldObj.isRemote){
boolean theFlag = this.coalTimeLeft > 0;
if(this.coalTimeLeft > 0) this.coalTimeLeft--;
boolean canCrushOnFirst = this.canCrushOn(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2);
boolean canCrushOnSecond = false;
if(this.isDouble) canCrushOnSecond = this.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2);
if((canCrushOnFirst || canCrushOnSecond) && this.coalTimeLeft <= 0 && this.slots[SLOT_COAL] != null){
this.coalTime = TileEntityFurnace.getItemBurnTime(this.slots[SLOT_COAL]);
this.coalTimeLeft = this.coalTime;
if(this.coalTime > 0){
this.slots[SLOT_COAL].stackSize--;
if(this.slots[SLOT_COAL].stackSize <= 0) this.slots[SLOT_COAL] = this.slots[SLOT_COAL].getItem().getContainerItem(this.slots[SLOT_COAL]);
}
}
if(this.coalTimeLeft > 0){
if(canCrushOnFirst){
this.firstCrushTime++;
if(this.firstCrushTime >= maxCrushTime){
this.finishCrushing(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2);
this.firstCrushTime = 0;
}
}
else this.firstCrushTime = 0;
if(this.isDouble){
if(canCrushOnSecond){
this.secondCrushTime++;
if(this.secondCrushTime >= maxCrushTime){
this.finishCrushing(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2);
this.secondCrushTime = 0;
}
}
else this.secondCrushTime = 0;
}
}
else{
this.firstCrushTime = 0;
this.secondCrushTime = 0;
this.coalTime = 0;
}
if(theFlag != this.coalTimeLeft > 0){
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, (this.coalTimeLeft > 0 ? 1 : 0), 2);
}
}
}
public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput){
if(this.slots[theInput] != null){
ItemStack outputOne = GrinderRecipes.instance().getOutput(this.slots[theInput], false);
ItemStack outputTwo = GrinderRecipes.instance().getOutput(this.slots[theInput], true);
if(this.slots[theInput] != null){
if(outputOne != null){
if((this.slots[theFirstOutput] == null || (this.slots[theFirstOutput].isItemEqual(outputOne) && this.slots[theFirstOutput].stackSize <= this.slots[theFirstOutput].getMaxStackSize()-outputOne.stackSize)) && (outputTwo == null || (this.slots[theSecondOutput] == null || (this.slots[theSecondOutput].isItemEqual(outputTwo) && this.slots[theSecondOutput].stackSize <= this.slots[theSecondOutput].getMaxStackSize()-outputTwo.stackSize)))){
return true;
}
}
}
}
return false;
}
public void finishCrushing(int theInput, int theFirstOutput, int theSecondOutput){
ItemStack outputOnFirst = GrinderRecipes.instance().getOutput(this.slots[theInput], false);
if (this.slots[theFirstOutput] == null) this.slots[theFirstOutput] = outputOnFirst.copy();
else if(this.slots[theFirstOutput].getItem() == outputOnFirst.getItem()) this.slots[theFirstOutput].stackSize += outputOnFirst.stackSize;
int chance = GrinderRecipes.instance().getSecondChance(this.slots[theInput]);
ItemStack outputOnSecond = GrinderRecipes.instance().getOutput(this.slots[theInput], true);
if(outputOnSecond != null){
int rand = new Random().nextInt(100) + 1;
if(rand <= chance){
if(this.slots[theSecondOutput] == null) this.slots[theSecondOutput] = outputOnSecond.copy();
else if(this.slots[theSecondOutput].getItem() == outputOnSecond.getItem()) this.slots[theSecondOutput].stackSize += outputOnSecond.stackSize;
}
}
this.slots[theInput].stackSize--;
if (this.slots[theInput].stackSize <= 0) this.slots[theInput] = null;
}
@Override
public void writeToNBT(NBTTagCompound compound){
compound.setInteger("CoalTime", this.coalTime);
compound.setInteger("CoalTimeLeft", this.coalTimeLeft);
compound.setInteger("FirstCrushTime", this.firstCrushTime);
compound.setInteger("SecondCrushTime", this.secondCrushTime);
compound.setInteger("MaxCrushTime", this.maxCrushTime);
compound.setBoolean("IsDouble", this.isDouble);
compound.setString("Name", this.name);
compound.setInteger("Slots", this.slots.length);
super.writeToNBT(compound);
}
@Override
public void readFromNBT(NBTTagCompound compound){
this.coalTime = compound.getInteger("CoalTime");
this.coalTimeLeft = compound.getInteger("CoalTimeLeft");
this.firstCrushTime = compound.getInteger("FirstCrushTime");
this.secondCrushTime = compound.getInteger("SecondCrushTime");
this.maxCrushTime = compound.getInteger("MaxCrushTime");
this.isDouble = compound.getBoolean("IsDouble");
this.name = compound.getString("Name");
this.initializeSlots(compound.getInteger("Slots"));
super.readFromNBT(compound);
}
@SideOnly(Side.CLIENT)
public int getCoalTimeToScale(int i){
return this.coalTimeLeft * i / this.coalTime;
}
@SideOnly(Side.CLIENT)
public int getFirstTimeToScale(int i){
return this.firstCrushTime * i / this.maxCrushTime;
}
@SideOnly(Side.CLIENT)
public int getSecondTimeToScale(int i){
return this.secondCrushTime * i / this.maxCrushTime;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return i == SLOT_COAL && TileEntityFurnace.getItemBurnTime(stack) > 0 || (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && GrinderRecipes.instance().getOutput(stack, false) != null;
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2;
}
}

View file

@ -1,12 +1,12 @@
package ellpeck.someprettyrandomstuff.tile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
public abstract class TileEntityInventoryBase extends TileEntityBase implements IInventory{
public abstract class TileEntityInventoryBase extends TileEntityBase implements ISidedInventory{
public ItemStack slots[];
public String name;
@ -20,7 +20,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
NBTTagList tagList = new NBTTagList();
for(int currentIndex = 0; currentIndex < slots.length; ++currentIndex){
for(int currentIndex = 0; currentIndex < slots.length; currentIndex++){
if (slots[currentIndex] != null){
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setByte("Slot", (byte)currentIndex);
@ -35,7 +35,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
NBTTagList tagList = compound.getTagList("Items", 10);
for (int i = 0; i < tagList.tagCount(); ++i){
for (int i = 0; i < tagList.tagCount(); i++){
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
byte slotIndex = tagCompound.getByte("Slot");
if (slotIndex >= 0 && slotIndex < slots.length){
@ -120,4 +120,13 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
public void closeInventory(){
}
@Override
public int[] getAccessibleSlotsFromSide(int side){
int[] theInt = new int[slots.length];
for(int i = 0; i < theInt.length; i++){
theInt[i] = i;
}
return theInt;
}
}

View file

@ -0,0 +1,7 @@
package ellpeck.someprettyrandomstuff.util;
public interface IInformation{
public abstract String[] getInformationString();
}

View file

@ -1,9 +1,13 @@
package ellpeck.someprettyrandomstuff.util;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
@ -44,11 +48,14 @@ public class Util{
public static final String UNDERLINE = (char)167 + "n";
public static final String ITALIC = (char)167 + "o";
public static final String[] ROMAN_NUMERALS = new String[]{"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"};
public static final int DECIMAL_COLOR_WHITE = 16777215;
public static boolean isShiftPressed(){
return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
}
@SuppressWarnings("unused")
public static boolean isControlPressed(){
return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
}
@ -58,12 +65,9 @@ public class Util{
}
public static String addStandardInformation(Item item){
if(item instanceof IName){
if(isShiftPressed()) return StatCollector.translateToLocal("tooltip." + Util.MOD_ID_LOWER + "." + ((IName)item).getName() + ".desc");
else return shiftForInfo();
}
return null;
}
public static void logInfo(String text){
SPRS_LOGGER.log(Level.INFO, text);
@ -71,9 +75,7 @@ public class Util{
public static void registerItems(Item[] items){
for(Item item : items){
if(item instanceof IName){
GameRegistry.registerItem(item, ((IName)item).getName());
}
register(item);
}
}
@ -81,7 +83,24 @@ public class Util{
return new ResourceLocation(MOD_ID_LOWER, "textures/gui/" + file + ".png");
}
public static String getNamePrefix(){
return MOD_ID_LOWER + ".";
public static String setUnlocalizedName(Item item){
return MOD_ID_LOWER + "." + ((IName)item).getName();
}
public static String setUnlocalizedName(Block block){
return MOD_ID_LOWER + "." + ((IName)block).getName();
}
public static void register(Item item){
GameRegistry.registerItem(item, ((IName)item).getName());
}
public static void register(Block block, Class<? extends ItemBlock> itemBlock){
GameRegistry.registerBlock(block, itemBlock, ((IName)block).getName());
}
public static void registerEvent(Object o){
FMLCommonHandler.instance().bus().register(o);
MinecraftForge.EVENT_BUS.register(o);
}
}

View file

@ -8,12 +8,11 @@ tile.someprettyrandomstuff.blockMiscBlackQuartzChiseled.name=Chiseled Block of B
tile.someprettyrandomstuff.blockMiscBlackQuartzPillar.name=Pillar of Black Quartz
tile.someprettyrandomstuff.blockFeeder.name=Automatic Feeder
tile.someprettyrandomstuff.blockGiantChest.name=Giant Chest
tile.someprettyrandomstuff.blockGrinder.name=Crusher
tile.someprettyrandomstuff.blockGrinderDouble.name=Double Crusher
tile.someprettyrandomstuff.blockFurnaceDouble.name=Double Furnace
item.someprettyrandomstuff.itemMiscMashedFood.name=Mashed Food
item.someprettyrandomstuff.itemMiscRefinedIron.name=Refined Iron
item.someprettyrandomstuff.itemMiscRefinedRedstone.name=Refined Redstone
item.someprettyrandomstuff.itemMiscCompressedIron.name=Compressed Iron
item.someprettyrandomstuff.itemMiscSteel.name=Steel
item.someprettyrandomstuff.itemFertilizer.name=Fertilizer
item.someprettyrandomstuff.itemMiscDough.name=Dough
item.someprettyrandomstuff.itemMiscPaperCone.name=Paper Cone
@ -32,6 +31,7 @@ item.someprettyrandomstuff.itemAxeObsidian.name=Obsidian Axe
item.someprettyrandomstuff.itemShovelObsidian.name=Obsidian Shovel
item.someprettyrandomstuff.itemHoeObsidian.name=Obsidian Hoe
item.someprettyrandomstuff.itemSwordObsidian.name=Obsidian Sword
item.someprettyrandomstuff.itemCrafterOnAStick.name=Crafting Table On A Stick
item.someprettyrandomstuff.itemFoodBaguette.name=Baguette
item.someprettyrandomstuff.itemFoodPizza.name=Pizza
@ -50,24 +50,42 @@ item.someprettyrandomstuff.itemFoodCarrotJuice.name=Carrot Juice
item.someprettyrandomstuff.itemFoodPumpkinStew.name=Pumpkin Stew
item.someprettyrandomstuff.itemFoodCheese.name=Cheese
item.someprettyrandomstuff.itemSpecialUnknownSubstance.name=Unknown Substance
item.someprettyrandomstuff.itemSpecialSolidifiedExperience.name=Solidified Experience
item.someprettyrandomstuff.itemSpecialBloodFragment.name=Blood Fragment
item.someprettyrandomstuff.itemSpecialHeartPart.name=Part of a Heart
item.someprettyrandomstuff.itemSpecialPearlShard.name=Ender Pearl Shard
item.someprettyrandomstuff.itemSpecialEmeraldShard.name=Emerald Shard
item.someprettyrandomstuff.itemDustIron.name=Crushed Iron
item.someprettyrandomstuff.itemDustGold.name=Crushed Gold
item.someprettyrandomstuff.itemDustDiamond.name=Crushed Diamond
item.someprettyrandomstuff.itemDustLapis.name=Crushed Lapis
item.someprettyrandomstuff.itemDustEmerald.name=Crushed Emerald
tooltip.someprettyrandomstuff.shiftForInfo.desc=Press Shift for Info
tooltip.someprettyrandomstuff.hunger.desc=Fills
tooltip.someprettyrandomstuff.saturation.desc=Saturation
tooltip.someprettyrandomstuff.durability.desc=Durability
tooltip.someprettyrandomstuff.blockCompost.desc=Used to make Fertilizer with Mashed Food
tooltip.someprettyrandomstuff.blockCompost.desc.1=Used to make Fertilizer with Mashed Food
tooltip.someprettyrandomstuff.blockCompost.desc.2=BETA INFO: Will visually contain Compost in the Future!
tooltip.someprettyrandomstuff.blockMiscOreBlackQuartz.desc=The darkest form of Quartz. Also: You had Silk Touch!
tooltip.someprettyrandomstuff.blockMiscBlackQuartz.desc=Black, eerie Quartz! Nice for decorating.
tooltip.someprettyrandomstuff.blockMiscBlackQuartzChiseled.desc=Black, eerie chiseled Quartz! Nice for decorating.
tooltip.someprettyrandomstuff.blockMiscBlackQuartzPillar.desc=Kind of a pillar. Not really, though. It's fake! Fake I say!
tooltip.someprettyrandomstuff.blockFeeder.desc=Feeds Animals on its own!
tooltip.someprettyrandomstuff.blockGiantChest.desc=GUI Scale on 'Auto'? That's a problem!
tooltip.someprettyrandomstuff.blockGrinder.desc.1=Crushes Ores into Dusts!
tooltip.someprettyrandomstuff.blockGrinder.desc.2=You get two Dusts per Ore and Extras!
tooltip.someprettyrandomstuff.blockGrinder.desc.3=To crush two ores simultaneously,
tooltip.someprettyrandomstuff.blockGrinder.desc.4=build the Double Crusher!
tooltip.someprettyrandomstuff.blockGrinderDouble.desc.1=Crushes Ores into Dusts!
tooltip.someprettyrandomstuff.blockGrinderDouble.desc.2=You get two Dusts per Ore and Extras!
tooltip.someprettyrandomstuff.blockGrinderDouble.desc.3=Can crush two Ores simultaneously!
tooltip.someprettyrandomstuff.blockFurnaceDouble.desc=Smelts two Things simultaneously!
tooltip.someprettyrandomstuff.itemMiscMashedFood.desc=Used to make Fertilizer
tooltip.someprettyrandomstuff.itemMiscRefinedIron.desc=Iron, but better
tooltip.someprettyrandomstuff.itemMiscRefinedRedstone.desc=Redstone, but better
tooltip.someprettyrandomstuff.itemMiscCompressedIron.desc=Iron, but compressed
tooltip.someprettyrandomstuff.itemMiscSteel.desc=Like Iron, but stronger. Much stronger.
tooltip.someprettyrandomstuff.itemFertilizer.desc=Om nom nom. Don't eat it.
tooltip.someprettyrandomstuff.itemMiscDough.desc=Used to make things that involve dough.
tooltip.someprettyrandomstuff.itemMiscPaperCone.desc=Used to store foodstuffs!
@ -86,12 +104,13 @@ tooltip.someprettyrandomstuff.itemAxeObsidian.desc=Mines Wood. Slooooowly.
tooltip.someprettyrandomstuff.itemShovelObsidian.desc=Mines Dirt. Slooooowly.
tooltip.someprettyrandomstuff.itemHoeObsidian.desc=Mines... uhm... yea.
tooltip.someprettyrandomstuff.itemSwordObsidian.desc=Mines... mobs?
tooltip.someprettyrandomstuff.itemCrafterOnAStick.desc=A Crafting Table you can carry around!
tooltip.someprettyrandomstuff.itemFoodBaguette.desc=It's french. It's noms.
tooltip.someprettyrandomstuff.itemFoodPizza.desc=Who doesn't like it?
tooltip.someprettyrandomstuff.itemFoodHamburger.desc=It's from a german city!
tooltip.someprettyrandomstuff.itemFoodBigCookie.desc=Do you know? The Subway Thing?
tooltip.someprettyrandomstuff.itemFoodSubmarineSandwich.desc=Do you know? The Subway and everything else Thing?
tooltip.someprettyrandomstuff.itemFoodSubmarineSandwich.desc=Just like Subway used to make! ...still does, right?
tooltip.someprettyrandomstuff.itemFoodToast.desc="GHOSTS! GHOSTS! TOASTS!"
tooltip.someprettyrandomstuff.itemFoodChocolate.desc=Lari likes.
tooltip.someprettyrandomstuff.itemFoodChocolateCake.desc=Looks delicious. With redberries. Or something.
@ -104,6 +123,19 @@ tooltip.someprettyrandomstuff.itemFoodCarrotJuice.desc=Carrots, but pressed!
tooltip.someprettyrandomstuff.itemFoodPumpkinStew.desc=Like Mushroom Stew or Rabbit Stew, but pumpykinny.
tooltip.someprettyrandomstuff.itemFoodCheese.desc=Cheese.
tooltip.someprettyrandomstuff.itemSpecialUnknownSubstance.desc=Dropped by Skeletons. BETA INFO: Useless as of yet.
tooltip.someprettyrandomstuff.itemSpecialSolidifiedExperience.desc=Dropped by everyone. BETA INFO: Useless as of yet.
tooltip.someprettyrandomstuff.itemSpecialBloodFragment.desc=Dropped by everyone. BETA INFO: Useless as of yet.
tooltip.someprettyrandomstuff.itemSpecialHeartPart.desc=Dropped by everyone. BETA INFO: Useless as of yet.
tooltip.someprettyrandomstuff.itemSpecialPearlShard.desc=Dropped by Endermen. BETA INFO: Useless as of yet.
tooltip.someprettyrandomstuff.itemSpecialEmeraldShard.desc=Dropped by Creepers. BETA INFO: Useless as of yet.
tooltip.someprettyrandomstuff.itemDustIron.desc=Iron! Crushed in the Crusher!
tooltip.someprettyrandomstuff.itemDustGold.desc=Gold! Crushed in the Crusher!
tooltip.someprettyrandomstuff.itemDustDiamond.desc=Diamond! Crushed in the Crusher!
tooltip.someprettyrandomstuff.itemDustLapis.desc=Lapis! Crushed in the Crusher!
tooltip.someprettyrandomstuff.itemDustEmerald.desc=Emerald! Crushed in the Crusher!
achievement.someprettyrandomstuff.smeltBaguette=Better than Bread!
achievement.someprettyrandomstuff.smeltBaguette.desc=Bake a Baguette
achievement.someprettyrandomstuff.craftDough=Knead, knead!
@ -129,8 +161,7 @@ achievement.someprettyrandomstuff.craftKnifeBlade.desc=Craft a Knife Blade
achievement.someprettyrandomstuff.craftKnife=Sharper! Even sharper!
achievement.someprettyrandomstuff.craftKnife.desc=Craft a Knife
info.someprettyrandomstuff.feeder.animal.desc=Animal
info.someprettyrandomstuff.feeder.animalsSuffix.desc=s
info.someprettyrandomstuff.feeder.animals.desc=Animals
info.someprettyrandomstuff.feeder.enoughToBreed.desc=Enough to breed!
info.someprettyrandomstuff.feeder.tooMany.desc=Too many to breed!
info.someprettyrandomstuff.feeder.notEnough.desc=Not enough to breed!

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -0,0 +1,21 @@
[
{
"modid": "SomePrettyRandomStuff",
"name": "Some Pretty Random Stuff",
"description": "A bunch of random stuff added to your Game to make it even more fun, exciting and add some more variety!",
"version": "0.0.1",
"mcversion": "1.7.10",
"url": "https://github.com/Ellpeck/SomePrettyRandomStuff",
"updateUrl": "",
"authorList": [
"Ellpeck"
],
"credits": "GlenthorLP for all of the awesome Graphics",
"logoFile": "assets/someprettyrandomstuff/textures/logo.png",
"screenshots": [
],
"parent":"",
"dependencies": [
]
}
]