Lots of stuff, Breakers and Placers!

This commit is contained in:
Ellpeck 2015-04-19 00:50:02 +01:00
parent 54418715da
commit 4f93fa3d29
63 changed files with 842 additions and 191 deletions

View file

@ -49,5 +49,10 @@
-Decorative Lead
-Can be placed between two Fences for Decoration
-Greenhouse Glass
-Gives Plants below more Growth Ticks
-Crafting Table Minecart
-Anvil Minecart
-Dropper Minecart
-Super Speed Track
-File Jukebox
-Plays Sound Files put into your Minecraft Folder

View file

@ -1,15 +0,0 @@
package ellpeck.actuallyadditions.achievement;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
public class AchievementAA extends Achievement{
public AchievementAA(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore){
super("achievement." + ModUtil.MOD_ID_LOWER + "." + name, ModUtil.MOD_ID_LOWER + "." + name, x, y, displayStack, hasToHaveBefore);
/*InitAchievements.achievementList.add(this);
if(hasToHaveBefore == null) this.initIndependentStat();
this.registerStat();*/
}
}

View file

@ -1,48 +1,31 @@
package ellpeck.actuallyadditions.achievement;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.stats.Achievement;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.AchievementPage;
import java.util.ArrayList;
public class InitAchievements{
/*public static AchievementPage theAchievementPage;
public static final int CRAFTING_ACH = 0;
public static final int SMELTING_ACH = 1;
public static final int PICKUP_ACH = 2;
public static AchievementPage theAchievementPage;
public static ArrayList<Achievement> achievementList = new ArrayList<Achievement>();
public static Achievement achievementCraftKnifeBlade;
public static Achievement achievementCraftKnife;
public static Achievement achievementCraftDough;
public static Achievement achievementSmeltBaguette;
public static Achievement achievementCraftSubSandwich;
public static Achievement achievementCraftMashedFood;
public static Achievement achievementCraftCompost;
public static Achievement achievementCraftFertilizer;
public static Achievement achievementCraftPaperCone;
public static Achievement achievementCraftFrenchFry;
public static Achievement achievementCraftFrenchFries;
public static Achievement achievementCraftFishNChips;*/
public static void init(){
/*Util.logInfo("Initializing Achievements...");
achievementCraftKnifeBlade = new AchievementAA("craftKnifeBlade", -2, 0, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()), null);
achievementCraftKnife = new AchievementAA("craftKnife", 0, 0, new ItemStack(InitItems.itemKnife), achievementCraftKnifeBlade);
achievementCraftDough = new AchievementAA("craftDough", 0, -3, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()), achievementCraftKnife);
achievementSmeltBaguette = new AchievementAA("smeltBaguette", 2, -3, new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()), achievementCraftDough);
achievementCraftSubSandwich = new AchievementAA("craftSubSandwich", 4, -3, new ItemStack(InitItems.itemFoods, 1, TheFoods.SUBMARINE_SANDWICH.ordinal()), achievementSmeltBaguette);
achievementCraftMashedFood = new AchievementAA("craftMashedFood", 3, 0, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.MASHED_FOOD.ordinal()), achievementCraftKnife);
achievementCraftCompost = new AchievementAA("craftCompost", 5, 0, new ItemStack(InitBlocks.blockCompost), achievementCraftMashedFood);
achievementCraftFertilizer = new AchievementAA("craftFertilizer", 7, 0, new ItemStack(InitItems.itemFertilizer), achievementCraftCompost);
achievementCraftPaperCone = new AchievementAA("craftPaperCone", 0, 3, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()), achievementCraftKnife);
achievementCraftFrenchFry = new AchievementAA("craftFrenchFry", 2, 3, new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal()), achievementCraftPaperCone);
achievementCraftFrenchFries = new AchievementAA("craftFrenchFries", 4, 4, new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRIES.ordinal()), achievementCraftFrenchFry);
achievementCraftFishNChips = new AchievementAA("craftFishNChips", 4, 2, new ItemStack(InitItems.itemFoods, 1, TheFoods.FISH_N_CHIPS.ordinal()), achievementCraftFrenchFry);
Util.logInfo("Initializing Achievements...");
for(int i = 0; i < TheAchievements.values().length; i++){
achievementList.add(TheAchievements.values()[i].ach);
}
theAchievementPage = new AchievementPage(StatCollector.translateToLocal("achievement.page." + ModUtil.MOD_ID_LOWER), achievementList.toArray(new Achievement[achievementList.size()]));
AchievementPage.registerAchievementPage(theAchievementPage);*/
AchievementPage.registerAchievementPage(theAchievementPage);
}
}

View file

@ -0,0 +1,41 @@
package ellpeck.actuallyadditions.achievement;
import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
public enum TheAchievements{
//Special Stuff Path
PICK_UP_XP("pickUpSolidXP", 0, 0, new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()), null, InitAchievements.PICKUP_ACH),
//Food & Fertilizer Path
CRAFT_KNIFE_BLADE("craftKnifeBlade", 0, 2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()), null),
CRAFT_KNIFE("craftKnife", 2, 2, new ItemStack(InitItems.itemKnife), CRAFT_KNIFE_BLADE.ach),
CRAFT_MASHED_FOOD("craftMashedFood", 4, 2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.MASHED_FOOD.ordinal()), CRAFT_KNIFE.ach),
//Machine Path
CRAFT_WOODEN_CASE("craftWoodenCasing", 0, -3, new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()), null),
CRAFT_STONE_CASE("craftStoneCasing", 2, -4, new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()), CRAFT_WOODEN_CASE.ach),
CRAFT_COIL("craftBasicCoil", 2, -2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), CRAFT_WOODEN_CASE.ach),
CRAFT_ADVANCED_COIL("craftAdvancedCoil", 4, -2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), CRAFT_COIL.ach);
public final Achievement ach;
public final int type;
TheAchievements(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore, int type){
this.ach = new Achievement("achievement." + ModUtil.MOD_ID_LOWER + "." + name, ModUtil.MOD_ID_LOWER + "." + name, x, y, displayStack, hasToHaveBefore);
if(hasToHaveBefore == null) this.ach.initIndependentStat();
this.ach.registerStat();
this.type = type;
}
TheAchievements(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore){
this(name, x, y, displayStack, hasToHaveBefore, InitAchievements.CRAFTING_ACH);
}
}

View file

@ -0,0 +1,126 @@
package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.tile.TileEntityBreaker;
import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.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.world.World;
import java.util.List;
public class BlockBreaker extends BlockContainerBase implements INameableItem{
private IIcon frontIcon;
private IIcon topIcon;
private boolean isPlacer;
public BlockBreaker(boolean isPlacer){
super(Material.rock);
this.isPlacer = isPlacer;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeStone);
}
@Override
public String getOredictName(){
return this.getName();
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityBreaker(this.isPlacer);
}
@Override
public IIcon getIcon(int side, int meta){
if(side != meta && (side == 0 || side == 1)) return this.topIcon;
if(side == meta) return this.frontIcon;
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Front");
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top");
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityBreaker breaker = (TileEntityBreaker)world.getTileEntity(x, y, z);
if (breaker != null) player.openGui(ActuallyAdditions.instance, GuiHandler.BREAKER_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 this.isPlacer ? "blockPlacer" : "blockBreaker";
}
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) {
BlockUtil.addInformation(theBlock, list, 1, "");
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -44,26 +44,6 @@ public class BlockFurnaceDouble extends BlockContainerBase implements INameableI
return this.getName();
}
@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;

View file

@ -0,0 +1,115 @@
package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityGreenhouseGlass;
import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ModUtil;
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.Facing;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.List;
public class BlockGreenhouseGlass extends BlockContainerBase implements INameableItem{
public BlockGreenhouseGlass(){
super(Material.rock);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeStone);
}
@Override
public String getOredictName(){
return this.getName();
}
@Override
public boolean isOpaqueCube(){
return false;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass(){
return 0;
}
@Override
public boolean renderAsNormalBlock(){
return false;
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityGreenhouseGlass();
}
@Override
public IIcon getIcon(int side, int metadata){
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
}
@Override
public String getName(){
return "blockGreenhouseGlass";
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int meta){
return world.getBlockMetadata(x, y, z) != world.getBlockMetadata(x-Facing.offsetsXForSide[meta], y-Facing.offsetsYForSide[meta], z-Facing.offsetsZForSide[meta]) || (world.getBlock(x, y, z) != this && super.shouldSideBeRendered(world, x, y, z, meta));
}
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.epic;
}
@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) {
BlockUtil.addInformation(theBlock, list, 1, "");
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -20,6 +20,9 @@ public class InitBlocks{
public static Block blockFurnaceSolar;
public static Block blockHeatCollector;
public static Block blockItemRepairer;
public static Block blockGreenhouseGlass;
public static Block blockBreaker;
public static Block blockPlacer;
public static void init(){
Util.logInfo("Initializing Blocks...");
@ -62,5 +65,14 @@ public class InitBlocks{
blockItemRepairer = new BlockItemRepairer();
BlockUtil.register(blockItemRepairer, BlockItemRepairer.TheItemBlock.class);
blockGreenhouseGlass = new BlockGreenhouseGlass();
BlockUtil.register(blockGreenhouseGlass, BlockGreenhouseGlass.TheItemBlock.class);
blockBreaker = new BlockBreaker(false);
BlockUtil.register(blockBreaker, BlockBreaker.TheItemBlock.class);
blockPlacer = new BlockBreaker(true);
BlockUtil.register(blockPlacer, BlockBreaker.TheItemBlock.class);
}
}

View file

@ -75,6 +75,8 @@ public class ConfigValues{
public static int jamVillagerID;
public static boolean jamVillagerExists;
public static int greenhouseGlassTimeNeeded;
public static void defineConfigValues(Configuration config){
for(int i = 0; i < enabledFoodRecipes.length; i++){
@ -159,5 +161,7 @@ public class ConfigValues{
repairerSpeedSlowdown = config.getInt("Item Repairer: Speed Slowdown", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 2, 1, 100, "How much slower the Item Repairer repairs");
heatCollectorBlocksNeeded = config.getInt("Heat Collector: Blocks Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 4, 1, 5, "How many Blocks are needed for the Heat Collector to power Machines above it");
heatCollectorRandomChance = config.getInt("Heat Collector: Random Chance", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 10000, 10, 100000, "The Chance of the Heat Collector destroying a Lava Block around (Default Value 2000 meaning a 1/2000 Chance!)");
greenhouseGlassTimeNeeded = config.getInt("Greenhouse Glass: Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 1000, 10, 1000000, "The Time Needed for the Greenhouse Glass to grow a Plant below it");
}
}

View file

@ -28,13 +28,16 @@ public class CreativeTab extends CreativeTabs{
this.addBlock(InitBlocks.blockInputter);
this.addBlock(InitBlocks.blockInputterAdvanced);
this.addBlock(InitBlocks.blockGreenhouseGlass);
this.addBlock(InitBlocks.blockGrinder);
this.addBlock(InitBlocks.blockGrinderDouble);
this.addBlock(InitBlocks.blockFurnaceDouble);
this.addBlock(InitBlocks.blockFurnaceSolar);
this.addBlock(InitBlocks.blockFishingNet);
this.addBlock(InitBlocks.blockHeatCollector);
this.addBlock(InitBlocks.blockItemRepairer);
this.addBlock(InitBlocks.blockFishingNet);
this.addBlock(InitBlocks.blockBreaker);
this.addBlock(InitBlocks.blockPlacer);
this.addBlock(InitBlocks.blockMisc);
this.addBlock(InitBlocks.blockFeeder);

View file

@ -2,40 +2,27 @@ package ellpeck.actuallyadditions.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import ellpeck.actuallyadditions.achievement.InitAchievements;
import ellpeck.actuallyadditions.achievement.TheAchievements;
import net.minecraft.item.ItemStack;
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);
checkAchievements(event.crafting, event, InitAchievements.CRAFTING_ACH);
}
public static void checkAchievements(ItemStack gotten, PlayerEvent event, int type){
for(int i = 0; i < TheAchievements.values().length; i++){
TheAchievements ach = TheAchievements.values()[i];
if(ach.type == type){
if(gotten.getItem() == ach.ach.theItemStack.getItem()){
if(gotten.getItemDamage() == ach.ach.theItemStack.getItemDamage()){
event.player.addStat(ach.ach, 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

@ -10,6 +10,7 @@ public class InitEvents{
Util.registerEvent(new SmeltEvent());
Util.registerEvent(new CraftEvent());
Util.registerEvent(new KilledEvent());
Util.registerEvent(new PickupEvent());
}
}

View file

@ -0,0 +1,14 @@
package ellpeck.actuallyadditions.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import ellpeck.actuallyadditions.achievement.InitAchievements;
public class PickupEvent{
@SubscribeEvent
public void onCraftedEvent(PlayerEvent.ItemPickupEvent event){
CraftEvent.checkAchievements(event.pickedUp.getEntityItem(), event, InitAchievements.PICKUP_ACH);
}
}

View file

@ -2,13 +2,12 @@ package ellpeck.actuallyadditions.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import ellpeck.actuallyadditions.achievement.InitAchievements;
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);
}*/
CraftEvent.checkAchievements(event.smelting, event, InitAchievements.SMELTING_ACH);
}
}

View file

@ -37,7 +37,7 @@ public class JamVillagerTradeHandler implements VillagerRegistry.IVillageTradeHa
ItemStack wantsOne = villagerWants.get(i);
wantsOne.stackSize = rand.nextInt(10)+10;
if(wantsOne.stackSize > wantsOne.getMaxStackSize()) wantsOne.stackSize = wantsOne.getMaxStackSize();
if(rand.nextInt(10) == 0){
if(rand.nextInt(5) == 0){
wantsTwo = villagerWants.get(rand.nextInt(villagerWants.size()));
wantsTwo.stackSize = rand.nextInt(10)+1;
if(wantsTwo.stackSize > wantsTwo.getMaxStackSize()) wantsTwo.stackSize = wantsTwo.getMaxStackSize();

View file

@ -0,0 +1,76 @@
package ellpeck.actuallyadditions.inventory;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityBreaker;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerBreaker extends Container{
private TileEntityBreaker breaker;
public ContainerBreaker(InventoryPlayer inventory, TileEntityBase tile){
this.breaker = (TileEntityBreaker)tile;
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++){
this.addSlotToContainer(new Slot(this.breaker, j+i*3, 62+j*18, 21+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, 97 + i * 18));
}
}
for (int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155));
}
}
@Override
public boolean canInteractWith(EntityPlayer player){
return this.breaker.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
final int inventoryStart = 9;
final int inventoryEnd = inventoryStart+26;
final int hotbarStart = inventoryEnd+1;
final int hotbarEnd = hotbarStart+8;
Slot theSlot = (Slot)this.inventorySlots.get(slot);
if(theSlot.getHasStack()){
ItemStack currentStack = theSlot.getStack();
ItemStack newStack = currentStack.copy();
if(slot <= hotbarEnd && slot >= inventoryStart){
this.mergeItemStack(newStack, 0, 9+1, false);
}
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
}
else if(slot <= inventoryEnd && slot >= inventoryStart){
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
}
else if(slot < inventoryStart){
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
}
if(newStack.stackSize == 0) theSlot.putStack(null);
else theSlot.onSlotChanged();
if(newStack.stackSize == currentStack.stackSize) return null;
theSlot.onPickupFromSlot(player, newStack);
return currentStack;
}
return null;
}
}

View file

@ -35,7 +35,7 @@ public class ContainerInputter extends Container{
for(int i = 0; i < 2; i++){
this.addSlotToContainer(new SlotFilter(this.tileInputter, 1+i*6, 20+i*84, 6));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 2+i*6, 38+i*84, 6));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 3+i*6, 56+i*85, 6));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 3+i*6, 56+i*84, 6));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 4+i*6, 20+i*84, 24));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 5+i*6, 38+i*84, 24));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 6+i*6, 56+i*84, 24));

View file

@ -0,0 +1,47 @@
package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityBreaker;
import ellpeck.actuallyadditions.util.AssetUtil;
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 GuiBreaker extends GuiContainer{
private TileEntityBreaker breaker;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker");
public GuiBreaker(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerBreaker(inventory, tile));
this.breaker = (TileEntityBreaker)tile;
this.xSize = 176;
this.ySize = 93+86;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.breaker.getInventoryName());
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.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);
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
}
}

View file

@ -2,6 +2,8 @@ package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.AssetUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
@ -19,6 +21,11 @@ public class GuiCrafter extends GuiContainer{
this.ySize = 166;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 74, -10, "container." + ModUtil.MOD_ID_LOWER + ".crafting");
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -29,6 +29,11 @@ public class GuiFeeder extends GuiContainer{
this.ySize = 70+86;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 70-5, -10, this.tileFeeder.getInventoryName());
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -23,6 +23,11 @@ public class GuiFurnaceDouble extends GuiContainer{
this.ySize = 93+86;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.tileFurnace.getInventoryName());
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -3,6 +3,7 @@ package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityGiantChest;
import ellpeck.actuallyadditions.util.AssetUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
@ -14,13 +15,21 @@ public class GuiGiantChest extends GuiContainer{
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiGiantChest");
TileEntityGiantChest chest;
public GuiGiantChest(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerGiantChest(inventory, tile));
this.chest = (TileEntityGiantChest)tile;
this.xSize = 242;
this.ySize = 172+86;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 172-5, -10, this.chest.getInventoryName());
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -26,6 +26,11 @@ public class GuiGrinder extends GuiContainer{
this.ySize = 93+86;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.tileGrinder.getInventoryName());
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -40,6 +40,9 @@ public class GuiHandler implements IGuiHandler{
case REPAIRER_ID:
TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerRepairer(entityPlayer.inventory, tileRepairer);
case BREAKER_ID:
TileEntityBase tileBreaker = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerBreaker(entityPlayer.inventory, tileBreaker);
default:
return null;
}
@ -74,6 +77,9 @@ public class GuiHandler implements IGuiHandler{
case REPAIRER_ID:
TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiRepairer(entityPlayer.inventory, tileRepairer);
case BREAKER_ID:
TileEntityBase tileBreaker = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiBreaker(entityPlayer.inventory, tileBreaker);
default:
return null;
}
@ -88,6 +94,7 @@ public class GuiHandler implements IGuiHandler{
public static final int INPUTTER_ID = 6;
public static final int REPAIRER_ID = 7;
public static final int INPUTTER_ADVANCED_ID = 8;
public static final int BREAKER_ID = 9;
public static void init(){
Util.logInfo("Initializing GuiHandler...");

View file

@ -60,6 +60,11 @@ public class GuiInputter extends GuiContainer{
this.isAdvanced = isAdvanced;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, this.isAdvanced ? 105-5 : 93-5, -10, this.tileInputter.getInventoryName());
}
@SuppressWarnings("unchecked")
@Override
public void initGui(){

View file

@ -23,6 +23,11 @@ public class GuiRepairer extends GuiContainer{
this.ySize = 93+86;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.tileRepairer.getInventoryName());
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -83,14 +83,11 @@ public class ItemJams extends ItemFood implements INameableItem{
ItemStack stackToReturn = super.onEaten(stack, world, player);
if(!world.isRemote){
if(allJams[stack.getItemDamage()].firstEffectToGet != 0){
PotionEffect firstEffectToGet = new PotionEffect(allJams[stack.getItemDamage()].firstEffectToGet, 200);
player.addPotionEffect(firstEffectToGet);
}
if(allJams[stack.getItemDamage()].secondEffectToGet != 0){
PotionEffect secondEffectToGet = new PotionEffect(allJams[stack.getItemDamage()].secondEffectToGet, 600);
player.addPotionEffect(secondEffectToGet);
}
PotionEffect firstEffectToGet = new PotionEffect(allJams[stack.getItemDamage()].firstEffectToGet, 200);
player.addPotionEffect(firstEffectToGet);
PotionEffect secondEffectToGet = new PotionEffect(allJams[stack.getItemDamage()].secondEffectToGet, 600);
player.addPotionEffect(secondEffectToGet);
ItemStack returnItem = new ItemStack(Items.glass_bottle);
if(!player.inventory.addItemStackToInventory(returnItem.copy())){

View file

@ -5,11 +5,12 @@ import net.minecraft.item.EnumRarity;
public enum TheJams implements INameableItem{
CU_BA_RA("CuBaRa", 5, 2F, EnumRarity.common, "jamCuBaRa", 5, 12, 12595273),
GRA_KI_BA("GraKiBa", 5, 2F, EnumRarity.common, "jamGraKiBa", 16, 13, 5492820),
PL_AP_LE("PlApLe", 5, 2F, EnumRarity.common, "jamPlApLe", 15, 3, 13226009),
CH_AP_CI("ChApCi", 5, 2F, EnumRarity.common, "jamChApCi", 10, 1, 13189222),
HO_ME_KI("HoMeKi", 5, 2F, EnumRarity.common, "jamHoMeKi", 10, 14, 2031360);
CU_BA_RA("CuBaRa", 20, 5F, EnumRarity.rare, "jamCuBaRa", 5, 12, 12595273),
GRA_KI_BA("GraKiBa", 20, 5F, EnumRarity.rare, "jamGraKiBa", 16, 13, 5492820),
PL_AP_LE("PlApLe", 20, 5F, EnumRarity.rare, "jamPlApLe", 15, 3, 13226009),
CH_AP_CI("ChApCi", 20, 5F, EnumRarity.rare, "jamChApCi", 10, 1, 13189222),
HO_ME_KI("HoMeKi", 20, 5F, EnumRarity.rare, "jamHoMeKi", 10, 14, 2031360),
PI_CO("PiCo", 20, 5F, EnumRarity.rare, "jamPiCo", 9, 1, 16056203);
public final String name;
public final String oredictName;

View file

@ -39,6 +39,8 @@ public class TileEntityBase extends TileEntity{
GameRegistry.registerTileEntity(TileEntityFurnaceSolar.class, ModUtil.MOD_ID_LOWER + ":tileEntityFurnaceSolar");
GameRegistry.registerTileEntity(TileEntityHeatCollector.class, ModUtil.MOD_ID_LOWER + ":tileEntityHeatCollector");
GameRegistry.registerTileEntity(TileEntityItemRepairer.class, ModUtil.MOD_ID_LOWER + ":tileEntityRepairer");
GameRegistry.registerTileEntity(TileEntityGreenhouseGlass.class, ModUtil.MOD_ID_LOWER + ":tileEntityGreenhouseGlass");
GameRegistry.registerTileEntity(TileEntityBreaker.class, ModUtil.MOD_ID_LOWER + ":tileEntityBreaker");
}
@Override

View file

@ -0,0 +1,129 @@
package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockAir;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChunkCoordinates;
import java.util.ArrayList;
public class TileEntityBreaker extends TileEntityInventoryBase{
private boolean isPlacer;
@SuppressWarnings("unused")
public TileEntityBreaker(){
super(9, "");
}
public TileEntityBreaker(boolean isPlacer){
super(9, isPlacer ? "placer" : "breaker");
this.isPlacer = isPlacer;
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
if(!worldObj.isRemote){
if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){
int sideToBreak = -1;
int metaOfCurrentBlock = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
if(metaOfCurrentBlock == 0) sideToBreak = 1;
else if(metaOfCurrentBlock == 1) sideToBreak = 0;
else if(metaOfCurrentBlock == 2) sideToBreak = 2;
else if(metaOfCurrentBlock == 3) sideToBreak = 4;
else if(metaOfCurrentBlock == 4) sideToBreak = 5;
else if(metaOfCurrentBlock == 5) sideToBreak = 3;
ChunkCoordinates coordsOfBlockToBreak = WorldUtil.getCoordsFromSide(sideToBreak, xCoord, yCoord, zCoord);
if(coordsOfBlockToBreak != null){
Block blockToBreak = worldObj.getBlock(coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ);
if(!this.isPlacer && blockToBreak != null && blockToBreak.getBlockHardness(worldObj, coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ) > -1.0F){
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
int meta = worldObj.getBlockMetadata(coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ);
drops.addAll(blockToBreak.getDrops(worldObj, coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ, meta, 0));
if(this.addToInventory(drops, false)){
worldObj.playAuxSFX(2001, coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ, Block.getIdFromBlock(blockToBreak) + (meta << 12));
WorldUtil.breakBlockAtSide(sideToBreak, worldObj, xCoord, yCoord, zCoord);
this.addToInventory(drops, true);
this.markDirty();
}
}
else if(this.isPlacer && (worldObj.getBlock(coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ).isReplaceable(worldObj, coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ))){
ItemStack removeFalse = this.removeFromInventory(false);
if(removeFalse != null && Block.getBlockFromItem(removeFalse.getItem()) != blockToBreak && Block.getBlockFromItem(removeFalse.getItem()).canPlaceBlockAt(worldObj, coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ)){
ItemStack stack = this.removeFromInventory(true);
//TODO insert sound effect
WorldUtil.placeBlockAtSide(sideToBreak, worldObj, xCoord, yCoord, zCoord, stack);
}
}
}
}
}
}
@Override
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
compound.setBoolean("IsPlacer", this.isPlacer);
compound.setString("Name", this.name);
}
@Override
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
this.isPlacer = compound.getBoolean("IsPlacer");
this.name = compound.getString("Name");
}
public boolean addToInventory(ArrayList<ItemStack> stacks, boolean actuallyDo){
int working = 0;
for(ItemStack stack : stacks){
for(int i = 0; i < this.slots.length; i++){
if(this.slots[i] == null || (this.slots[i].isItemEqual(stack) && this.slots[i].stackSize <= stack.getMaxStackSize()-stack.stackSize)){
working++;
if(actuallyDo){
if(this.slots[i] == null) this.slots[i] = stack.copy();
else this.slots[i].stackSize += stack.stackSize;
}
break;
}
}
}
return working >= stacks.size();
}
public ItemStack removeFromInventory(boolean actuallyDo){
for(int i = 0; i < this.slots.length; i++){
if(this.slots[i] != null && !(Block.getBlockFromItem(this.slots[i].getItem()) instanceof BlockAir)){
ItemStack slot = this.slots[i].copy();
if(actuallyDo){
this.slots[i].stackSize--;
if(this.slots[i].stackSize <= 0) this.slots[i] = null;
}
return slot;
}
}
return null;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isPlacer;
}
@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

@ -16,7 +16,7 @@ public class TileEntityCompost extends TileEntityInventoryBase{
public int conversionTime;
public TileEntityCompost(){
super(1, "tileEntityCompost");
super(1, "compost");
}
@Override

View file

@ -24,7 +24,7 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
public int currentAnimalAmount;
public TileEntityFeeder(){
super(1, "tileEntityFeeder");
super(1, "feeder");
}
@Override

View file

@ -26,7 +26,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
public int secondSmeltTime;
public TileEntityFurnaceDouble(){
super(5, "tileEntityFurnaceDouble");
super(5, "furnaceDouble");
}
@Override

View file

@ -1,5 +1,6 @@
package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.block.BlockFurnace;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
@ -10,7 +11,7 @@ public class TileEntityFurnaceSolar extends TileEntityBase{
public void updateEntity(){
if(!worldObj.isRemote){
if(worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) && worldObj.isDaytime()){
TileEntity tileBelow = TileEntityInputter.getTileEntityFromSide(1, worldObj, xCoord, yCoord, zCoord);
TileEntity tileBelow = WorldUtil.getTileEntityFromSide(1, worldObj, xCoord, yCoord, zCoord);
givePowerTo(tileBelow);
}

View file

@ -8,7 +8,7 @@ import net.minecraft.nbt.NBTTagList;
public class TileEntityGiantChest extends TileEntityInventoryBase{
public TileEntityGiantChest(){
super(9*13, "tileEntityGiantChest");
super(9*13, "giantChest");
}
@Override

View file

@ -0,0 +1,58 @@
package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.config.ConfigValues;
import net.minecraft.block.Block;
import net.minecraft.block.BlockAir;
import net.minecraft.block.BlockGrass;
import net.minecraft.block.IGrowable;
import net.minecraft.init.Items;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.FakePlayerFactory;
import java.util.Random;
public class TileEntityGreenhouseGlass extends TileEntityBase{
private int timeUntilNextFertToSet = ConfigValues.greenhouseGlassTimeNeeded;
private int timeUntilNextFert;
@Override
public void updateEntity(){
if(!worldObj.isRemote){
if(worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) && worldObj.isDaytime()){
ChunkCoordinates blockToFert = this.blockToFertilize();
if(blockToFert != null){
Random rand = new Random();
if(this.timeUntilNextFert > 0){
this.timeUntilNextFert--;
if(timeUntilNextFert <= 0){
this.applyBonemealEffect(blockToFert);
}
}
else this.timeUntilNextFert = this.timeUntilNextFertToSet + rand.nextInt(this.timeUntilNextFertToSet/2);
}
}
}
}
public ChunkCoordinates blockToFertilize(){
for(int i = yCoord-1; i > 0; i--){
Block block = worldObj.getBlock(xCoord, i, zCoord);
if(block != null && !(block instanceof BlockAir)){
if(block instanceof IGrowable && !(block instanceof BlockGrass)){
return new ChunkCoordinates(xCoord, i, zCoord);
}
else return null;
}
}
return null;
}
public boolean applyBonemealEffect(ChunkCoordinates coords){
return ItemDye.applyBonemeal(new ItemStack(Items.dye, 1, 15), worldObj, coords.posX, coords.posY, coords.posZ, FakePlayerFactory.getMinecraft((WorldServer)worldObj));
}
}

View file

@ -36,7 +36,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IPower
}
public TileEntityGrinder(boolean isDouble){
super(isDouble ? 7 : 4, isDouble ? "tileEntityGrinderDouble" : "tileEntityGrinder");
super(isDouble ? 7 : 4, isDouble ? "grinderDouble" : "grinder");
this.maxCrushTime = isDouble ? ConfigValues.grinderDoubleCrushTime : ConfigValues.grinderCrushTime;
this.isDouble = isDouble;
}

View file

@ -1,11 +1,11 @@
package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.config.ConfigValues;
import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.Random;
@ -21,7 +21,7 @@ public class TileEntityHeatCollector extends TileEntityBase{
ArrayList<Integer> blocksAround = new ArrayList<Integer>();
for(int i = 1; i <= 5; i++){
ChunkCoordinates coords = getBlockFromSide(i, xCoord, yCoord, zCoord);
ChunkCoordinates coords = WorldUtil.getCoordsFromSide(i, xCoord, yCoord, zCoord);
if(coords != null){
Block block = worldObj.getBlock(coords.posX, coords.posY, coords.posZ);
if(block != null && block.getMaterial() == Material.lava && worldObj.getBlockMetadata(coords.posX, coords.posY, coords.posZ) == 0){
@ -31,35 +31,16 @@ public class TileEntityHeatCollector extends TileEntityBase{
}
if(blocksAround.size() >= blocksNeeded){
TileEntity tileAbove = TileEntityInputter.getTileEntityFromSide(0, worldObj, xCoord, yCoord, zCoord);
TileEntity tileAbove = WorldUtil.getTileEntityFromSide(0, worldObj, xCoord, yCoord, zCoord);
TileEntityFurnaceSolar.givePowerTo(tileAbove);
Random rand = new Random();
if(rand.nextInt(randomChance) == 0){
int randomSide = blocksAround.get(rand.nextInt(blocksAround.size()));
breakBlockAtSide(randomSide, worldObj, xCoord, yCoord, zCoord);
WorldUtil.breakBlockAtSide(randomSide, worldObj, xCoord, yCoord, zCoord);
}
}
}
}
public static ChunkCoordinates getBlockFromSide(int side, int x, int y, int z){
if(side == 0) return new ChunkCoordinates(x, y + 1, z);
if(side == 1) return new ChunkCoordinates(x, y - 1, z);
if(side == 2) return new ChunkCoordinates(x, y, z - 1);
if(side == 3) return new ChunkCoordinates(x - 1, y, z);
if(side == 4) return new ChunkCoordinates(x, y, z + 1);
if(side == 5) return new ChunkCoordinates(x + 1, y, z);
else return null;
}
public static void breakBlockAtSide(int side, World world, int x, int y, int z){
if(side == 0) world.setBlockToAir(x, y + 1, z);
if(side == 1) world.setBlockToAir(x, y - 1, z);
if(side == 2) world.setBlockToAir(x, y, z - 1);
if(side == 3) world.setBlockToAir(x - 1, y, z);
if(side == 4) world.setBlockToAir(x, y, z + 1);
if(side == 5) world.setBlockToAir(x + 1, y, z);
}
}

View file

@ -1,11 +1,11 @@
package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class TileEntityInputter extends TileEntityInventoryBase{
@ -29,7 +29,7 @@ public class TileEntityInputter extends TileEntityInventoryBase{
}
public TileEntityInputter(boolean isAdvanced){
super(isAdvanced ? 13 : 1, isAdvanced ? "tilEntityInputterAdvanced" : "tileEntityInputter");
super(isAdvanced ? 13 : 1, isAdvanced ? "inputterAdvanced" : "inputter");
this.isAdvanced = isAdvanced;
}
@ -177,8 +177,8 @@ public class TileEntityInputter extends TileEntityInventoryBase{
}
public void initVars(){
this.placeToPull = getTileEntityFromSide(this.sideToPull, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
this.placeToPut = getTileEntityFromSide(this.sideToPut, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
this.placeToPull = WorldUtil.getTileEntityFromSide(this.sideToPull, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
this.placeToPut = WorldUtil.getTileEntityFromSide(this.sideToPut, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
if(this.placeToPull != null && this.placeToPull instanceof IInventory){
this.placeToPullSlotAmount = ((IInventory)this.placeToPull).getSizeInventory();
@ -197,16 +197,6 @@ public class TileEntityInputter extends TileEntityInventoryBase{
}
}
public static TileEntity getTileEntityFromSide(int side, World world, int x, int y, int z){
if(side == 0) return world.getTileEntity(x, y+1, z);
if(side == 1) return world.getTileEntity(x, y-1, z);
if(side == 2) return world.getTileEntity(x, y, z-1);
if(side == 3) return world.getTileEntity(x-1, y, z);
if(side == 4) return world.getTileEntity(x, y, z+1);
if(side == 5) return world.getTileEntity(x+1, y, z);
else return null;
}
public void onButtonPressed(int buttonID){
if(buttonID == 0) this.sideToPut++;
if(buttonID == 1) this.sideToPut--;

View file

@ -1,5 +1,6 @@
package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
@ -13,7 +14,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
public TileEntityInventoryBase(int slots, String name){
this.initializeSlots(slots);
this.name = name;
this.name = "container." + ModUtil.MOD_ID_LOWER + "." + name;
}
@Override

View file

@ -22,7 +22,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
public int nextRepairTick;
public TileEntityItemRepairer(){
super(3, "tileEntityItemRepairer");
super(3, "repairer");
}
@Override

View file

@ -1,6 +1,8 @@
package ellpeck.actuallyadditions.util;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
public class AssetUtil{
@ -10,4 +12,10 @@ public class AssetUtil{
return new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/gui/" + file + ".png");
}
public static void displayNameAndInventoryString(FontRenderer font, int xSize, int yPositionOfInventoryText, int yPositionOfMachineText, String machineName){
String localMachineName = StatCollector.translateToLocal(machineName + ".name");
String inventoryName = StatCollector.translateToLocal("container.inventory");
font.drawString(localMachineName, xSize/2 - font.getStringWidth(localMachineName)/2, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE);
font.drawString(inventoryName, xSize/2 - font.getStringWidth(inventoryName)/2, yPositionOfInventoryText-1, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
}
}

View file

@ -27,5 +27,6 @@ public class StringUtil{
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 final int DECIMAL_COLOR_GRAY_TEXT = 4210752;
}

View file

@ -0,0 +1,45 @@
package ellpeck.actuallyadditions.util;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
public class WorldUtil{
public static ChunkCoordinates getCoordsFromSide(int side, int x, int y, int z){
if(side == 0) return new ChunkCoordinates(x, y + 1, z);
if(side == 1) return new ChunkCoordinates(x, y - 1, z);
if(side == 2) return new ChunkCoordinates(x, y, z - 1);
if(side == 3) return new ChunkCoordinates(x + 1, y, z);
if(side == 4) return new ChunkCoordinates(x, y, z + 1);
if(side == 5) return new ChunkCoordinates(x - 1, y, z);
else return null;
}
public static void breakBlockAtSide(int side, World world, int x, int y, int z){
ChunkCoordinates c = getCoordsFromSide(side, x, y, z);
if(c != null){
world.setBlockToAir(c.posX, c.posY, c.posZ);
}
}
public static void placeBlockAtSide(int side, World world, int x, int y, int z, ItemStack stack){
Block block = Block.getBlockFromItem(stack.getItem());
int meta = stack.getItem().getDamage(stack);
ChunkCoordinates c = getCoordsFromSide(side, x, y, z);
if(c != null){
world.setBlock(c.posX, c.posY, c.posZ, block, meta, 2);
}
}
public static TileEntity getTileEntityFromSide(int side, World world, int x, int y, int z){
ChunkCoordinates c = getCoordsFromSide(side, x, y, z);
if(c != null){
return world.getTileEntity(c.posX, c.posY, c.posZ);
}
else return null;
}
}

View file

@ -18,6 +18,9 @@ tile.actuallyadditions.blockItemRepairer.name=Item Repairer
tile.actuallyadditions.blockMiscWoodCasing.name=Wood Casing
tile.actuallyadditions.blockMiscStoneCasing.name=Stone Casing
tile.actuallyadditions.blockGreenhouseGlass.name=Greenhouse Glass
tile.actuallyadditions.blockBreaker.name=Breaker
tile.actuallyadditions.blockPlacer.name=Placer
tile.actuallyadditions.blockInputter.name=ESD
tile.actuallyadditions.blockInputterAdvanced.name=Advanced ESD
@ -150,6 +153,8 @@ tooltip.actuallyadditions.blockHeatCollector.desc.1=Powers Actually Additions Ma
tooltip.actuallyadditions.blockHeatCollector.desc.2=Needs a bunch of Lava around it
tooltip.actuallyadditions.blockHeatCollector.desc.3=Occasionally steals the Lava. Watch out!
tooltip.actuallyadditions.blockItemRepairer.desc=Repairs Tools and Armor automatically
tooltip.actuallyadditions.blockBreaker.desc=Breaks Blocks and stores them in its internal Inventory
tooltip.actuallyadditions.blockPlacer.desc=Places Blocks stored in its internal Inventory
tooltip.actuallyadditions.itemMiscMashedFood.desc=Used to make Fertilizer
tooltip.actuallyadditions.itemFertilizer.desc=Om nom nom. Don't eat it. Made in a Compost.
@ -162,6 +167,8 @@ tooltip.actuallyadditions.itemMiscRing.desc=Used for crafting Effect Rings
tooltip.actuallyadditions.blockMiscWoodCasing.desc=Not so sturdy Casing, used for Crafting
tooltip.actuallyadditions.blockMiscStoneCasing.desc=Pretty sturdy Casing, used for Crafting
tooltip.actuallyadditions.blockGreenhouseGlass.desc=Lets Crops below it grow faster when it is Daytime
tooltip.actuallyadditions.blockCrafter.desc=Automatically crafts Items without needing any form of Power
tooltip.actuallyadditions.itemPotionRing.desc.1=Gives Potion Effect of Level 1
tooltip.actuallyadditions.itemPotionRing.desc.2=Needs to be held in Hand
@ -224,31 +231,6 @@ tooltip.actuallyadditions.itemDustQuartz.desc=Quartz! Crushed in the Crusher!
tooltip.actuallyadditions.itemDustCoal.desc=Coal! Crushed in the Crusher!
tooltip.actuallyadditions.itemDustQuartzBlack.desc=Black Quartz! Crushed in the Crusher!
achievement.actuallyadditions.smeltBaguette=Better than Bread!
achievement.actuallyadditions.smeltBaguette.desc=Bake a Baguette
achievement.actuallyadditions.craftDough=Knead, knead!
achievement.actuallyadditions.craftDough.desc=Craft some Dough
achievement.actuallyadditions.craftCompost=Throw it all in!
achievement.actuallyadditions.craftCompost.desc=Craft a Compost
achievement.actuallyadditions.craftFertilizer=Better than Bone Meal!
achievement.actuallyadditions.craftFertilizer.desc=Make Fertilizer
achievement.actuallyadditions.craftSubSandwich=Metro, Underground, Tube, Nom!
achievement.actuallyadditions.craftSubSandwich.desc=Craft a Submarine Sandwich
achievement.actuallyadditions.craftPaperCone=Witch's hat!
achievement.actuallyadditions.craftPaperCone.desc=Craft a Paper Cone
achievement.actuallyadditions.craftFrenchFry=Just the single one...
achievement.actuallyadditions.craftFrenchFry.desc=Craft a French Fry
achievement.actuallyadditions.craftFrenchFries=French Fires?
achievement.actuallyadditions.craftFrenchFries.desc=Craft French Fries
achievement.actuallyadditions.craftFishNChips=It's Fish! It's Chips!
achievement.actuallyadditions.craftFishNChips.desc=Craft Fish 'N' Chips
achievement.actuallyadditions.craftMashedFood=Munch munch munch!
achievement.actuallyadditions.craftMashedFood.desc=Craft Mashed Food
achievement.actuallyadditions.craftKnifeBlade=Sharp! So sharp!
achievement.actuallyadditions.craftKnifeBlade.desc=Craft a Knife Blade
achievement.actuallyadditions.craftKnife=Sharper! Even sharper!
achievement.actuallyadditions.craftKnife.desc=Craft a Knife
info.actuallyadditions.gui.animals=Animals
info.actuallyadditions.gui.enoughToBreed=Enough to breed!
info.actuallyadditions.gui.tooMany=Too many to breed!
@ -275,4 +257,33 @@ effect.actuallyadditions.fireResistance.name=Fire Resistance
effect.actuallyadditions.waterBreathing.name=Water Breathing
effect.actuallyadditions.invisibility.name=Invisibility
effect.actuallyadditions.nightVision.name=Night Vision
effect.actuallyadditions.saturation.name=Saturation
effect.actuallyadditions.saturation.name=Saturation
container.actuallyadditions.inputter.name=ESD
container.actuallyadditions.inputterAdvanced.name=Advanced ESD
container.actuallyadditions.grinder.name=Crusher
container.actuallyadditions.grinderDouble.name=Double Crusher
container.actuallyadditions.furnaceDouble.name=Double Furnace
container.actuallyadditions.feeder.name=Feeder
container.actuallyadditions.giantChest.name=Storage Crate
container.actuallyadditions.repairer.name=Repairer
container.actuallyadditions.placer.name=Placer
container.actuallyadditions.breaker.name=Breaker
container.actuallyadditions.crafting.name=Crafting Table On A Stick
achievement.actuallyadditions.pickUpSolidXP=Hard and Rich and Stuff
achievement.actuallyadditions.pickUpSolidXP.desc=Pick up some Solidified Experience
achievement.actuallyadditions.craftKnifeBlade=Sharp! So Sharp!
achievement.actuallyadditions.craftKnifeBlade.desc=Craft a Knife Blade
achievement.actuallyadditions.craftKnife=Cutcutcutcutcutcutcutcutcutcutcut!
achievement.actuallyadditions.craftKnife.desc=Craft a Knife
achievement.actuallyadditions.craftMashedFood=Munch munch munch!
achievement.actuallyadditions.craftMashedFood.desc=Craft some Mashed Food
achievement.actuallyadditions.craftWoodenCasing=Hard and sturdy!
achievement.actuallyadditions.craftWoodenCasing.desc=Craft a Wooden Casing
achievement.actuallyadditions.craftStoneCasing=Harder and sturdier!
achievement.actuallyadditions.craftStoneCasing.desc=Craft a Stone Casing
achievement.actuallyadditions.craftBasicCoil=Transmits.. power.. or something?
achievement.actuallyadditions.craftBasicCoil.desc=Craft a Basic Coil
achievement.actuallyadditions.craftAdvancedCoil=Transmits... more power I guess.
achievement.actuallyadditions.craftAdvancedCoil.desc=Craft an Advanced Coil

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 793 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 B