-Added new Villager Field

-Fixed Jam House
-Added Dispenser Handlers for Buckets and Fertilizer
This commit is contained in:
Ellpeck 2015-06-29 20:55:56 +02:00
parent 4f49f7fc65
commit d7382976e5
17 changed files with 238 additions and 51 deletions

View file

@ -4,10 +4,7 @@ import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.*;
import ellpeck.actuallyadditions.achievement.InitAchievements;
import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.communication.InterModCommunications;
@ -22,6 +19,8 @@ import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.ItemCoffee;
import ellpeck.actuallyadditions.material.InitItemMaterials;
import ellpeck.actuallyadditions.misc.DispenserHandlerEmptyBucket;
import ellpeck.actuallyadditions.misc.DispenserHandlerFertilize;
import ellpeck.actuallyadditions.network.PacketHandler;
import ellpeck.actuallyadditions.proxy.IProxy;
import ellpeck.actuallyadditions.recipe.FuelHandler;
@ -29,6 +28,7 @@ import ellpeck.actuallyadditions.recipe.HairyBallHandler;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.BlockDispenser;
@Mod(modid = ModUtil.MOD_ID, name = ModUtil.NAME, version = ModUtil.VERSION)
public class ActuallyAdditions{
@ -88,4 +88,11 @@ public class ActuallyAdditions{
public void onIMCReceived(FMLInterModComms.IMCEvent event){
InterModCommunications.processIMC(event.getMessages());
}
@EventHandler
public void serverStarting(FMLServerStartingEvent event){
BlockDispenser.dispenseBehaviorRegistry.putObject(InitItems.itemBucketCanolaOil, new DispenserHandlerEmptyBucket());
BlockDispenser.dispenseBehaviorRegistry.putObject(InitItems.itemBucketOil, new DispenserHandlerEmptyBucket());
BlockDispenser.dispenseBehaviorRegistry.putObject(InitItems.itemFertilizer, new DispenserHandlerFertilize());
}
}

View file

@ -11,6 +11,7 @@ public enum ConfigBoolValues{
LEAF_BLOWER_SOUND("Leaf Blower: Sound", ConfigCategories.TOOL_VALUES, true, "If the Leaf Blower makes Sounds"),
JAM_VILLAGER_EXISTS("Jam Villager: Existence", ConfigCategories.WORLD_GEN, true, "If the Jam Villager and his House exist"),
CROP_FIELD_EXISTS("Crop Field: Existence", ConfigCategories.WORLD_GEN, true, "If the Custom Crop Fields exist"),
GENERATE_QUARTZ("Black Quartz", ConfigCategories.WORLD_GEN, true, "If the Black Quartz generates in the world"),

View file

@ -26,7 +26,7 @@ public class GrinderCrafting{
GrinderRecipeManualRegistry.registerRecipe(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone));
GrinderRecipeManualRegistry.registerRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.sugar, 2));
GrinderRecipeManualRegistry.registerRecipe("oreNickel", "dustNickel", "dustPlatinum", 30, 2);
GrinderRecipeManualRegistry.registerRecipe("oreNickel", "dustNickel", "dustPlatinum", 15, 2);
GrinderRecipeManualRegistry.registerRecipe("oreIron", "dustIron", "dustGold", 20, 2);
GrinderRecipeAutoRegistry.searchCases.add(new SearchCase("oreNether", 6));

View file

@ -5,6 +5,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.items.InitItems;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.player.FillBucketEvent;
@ -12,17 +13,16 @@ public class BucketFillEvent{
@SubscribeEvent
public void onBucketFilled(FillBucketEvent event){
this.fillBucket(event, InitItems.itemBucketOil, InitBlocks.blockOil);
this.fillBucket(event, InitItems.itemBucketCanolaOil, InitBlocks.blockCanolaOil);
}
private void fillBucket(FillBucketEvent event, Item item, Block fluid){
Block block = event.world.getBlock(event.target.blockX, event.target.blockY, event.target.blockZ);
if(block == InitBlocks.blockCanolaOil){
if(block == fluid){
event.world.setBlockToAir(event.target.blockX, event.target.blockY, event.target.blockZ);
event.result = new ItemStack(InitItems.itemBucketCanolaOil);
event.setResult(Event.Result.ALLOW);
}
if(block == InitBlocks.blockOil){
event.world.setBlockToAir(event.target.blockX, event.target.blockY, event.target.blockZ);
event.result = new ItemStack(InitItems.itemBucketOil);
event.result = new ItemStack(item);
event.setResult(Event.Result.ALLOW);
}
}
}

View file

@ -23,6 +23,9 @@ public class InitVillager{
if(ConfigBoolValues.JAM_VILLAGER_EXISTS.isEnabled()){
initJamVillagePart();
}
if(ConfigBoolValues.CROP_FIELD_EXISTS.isEnabled()){
initCustomCropFieldPart();
}
}
private static void initJamVillagePart(){
@ -32,7 +35,7 @@ public class InitVillager{
ChestGenHooks jamHouseChest = ChestGenHooks.getInfo(JAM_HOUSE_CHEST_NAME);
jamHouseChest.setMin(5);
jamHouseChest.setMax(20);
jamHouseChest.setMax(10);
for(int i = 0; i < TheJams.values().length; i++){
ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(InitItems.itemJams, 1, i), 1, 1, 10));
}
@ -43,4 +46,9 @@ public class InitVillager{
MapGenStructureIO.func_143031_a(VillageComponentJamHouse.class, ModUtil.MOD_ID_LOWER+":jamHouseStructure");
}
private static void initCustomCropFieldPart(){
VillagerRegistry.instance().registerVillageCreationHandler(new VillageCustomCropFieldHandler());
MapGenStructureIO.func_143031_a(VillageComponentCustomCropField.class, ModUtil.MOD_ID_LOWER+":customCropFieldStructure");
}
}

View file

@ -6,6 +6,7 @@ import ellpeck.actuallyadditions.items.metalists.TheJams;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList;
import net.minecraftforge.oredict.OreDictionary;
@ -18,15 +19,15 @@ public class JamVillagerTradeHandler implements VillagerRegistry.IVillageTradeHa
private ArrayList<Trade> trades = new ArrayList<Trade>();
public JamVillagerTradeHandler(){
this.addWants("ingotGold", 5, 2);
this.addWants("cropWheat", 15, 10);
this.addWants("dustRedstone", 25, 15);
this.addWants(new ItemStack(Items.bucket), 5, 4);
this.addWants(new ItemStack(Items.glass_bottle), 12, 5);
this.addWants(new ItemStack(Items.potionitem), 1, 0);
this.addWants("ingotIron", 10, 5);
this.addWants("ingotGold", 5, 7);
this.addWants("cropWheat", 15, 25);
this.addWants("dustRedstone", 25, 40);
this.addWants(new ItemStack(Items.bucket), 5, 9);
this.addWants(new ItemStack(Items.glass_bottle), 12, 17);
this.addWants(new ItemStack(Items.potionitem), 1, 1);
this.addWants("ingotIron", 10, 15);
this.addWants("gemDiamond", 1, 2);
this.addWants("dustGlowstone", 12, 10);
this.addWants("dustGlowstone", 12, 22);
}
@Override
@ -37,12 +38,12 @@ public class JamVillagerTradeHandler implements VillagerRegistry.IVillageTradeHa
ItemStack wantsTwo = null;
ItemStack wantsOne = trades.get(i).wants.get(j);
wantsOne.stackSize = rand.nextInt(trades.get(i).extraStackSize) + trades.get(i).baseStackSize;
wantsOne.stackSize = MathHelper.getRandomIntegerInRange(rand, trades.get(i).minStackSize, trades.get(i).maxStackSize);
if(rand.nextInt(3) == 0){
int toGet = rand.nextInt(trades.size());
for(int k = 0; k < trades.get(toGet).wants.size(); k++){
wantsTwo = trades.get(toGet).wants.get(k);
wantsTwo.stackSize = rand.nextInt(trades.get(k).extraStackSize) + trades.get(k).baseStackSize;
wantsTwo.stackSize = MathHelper.getRandomIntegerInRange(rand, trades.get(k).minStackSize, trades.get(k).maxStackSize);
}
}
if(wantsOne == wantsTwo) wantsTwo = null;
@ -66,19 +67,19 @@ public class JamVillagerTradeHandler implements VillagerRegistry.IVillageTradeHa
public static class Trade{
public final ArrayList<ItemStack> wants = new ArrayList<ItemStack>();
public final int baseStackSize;
public final int extraStackSize;
public final int minStackSize;
public final int maxStackSize;
public Trade(ArrayList<ItemStack> wants, int minStackSize, int maxStackSize){
this.wants.addAll(wants);
this.baseStackSize = minStackSize <= 0 ? 1 : minStackSize;
this.extraStackSize = maxStackSize <= 0 ? 1 : maxStackSize;
this.minStackSize = minStackSize <= 0 ? 1 : minStackSize;
this.maxStackSize = maxStackSize <= 0 ? 1 : maxStackSize;
}
public Trade(ItemStack want, int minStackSize, int maxStackSize){
this.wants.add(want);
this.baseStackSize = minStackSize <= 0 ? 1 : minStackSize;
this.extraStackSize = maxStackSize <= 0 ? 1 : maxStackSize;
this.minStackSize = minStackSize <= 0 ? 1 : minStackSize;
this.maxStackSize = maxStackSize <= 0 ? 1 : maxStackSize;
}
}

View file

@ -10,8 +10,8 @@ import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import org.apache.logging.log4j.Level;
@ -22,8 +22,6 @@ public class OreGen implements IWorldGenerator{
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
if(world.provider.terrainType == WorldType.FLAT) return;
switch(world.provider.dimensionId){
case -1:
generateNether(world, random, chunkX*16, chunkZ*16);
@ -43,7 +41,7 @@ public class OreGen implements IWorldGenerator{
private void generateSurface(World world, Random random, int x, int z){
if(ConfigBoolValues.GENERATE_QUARTZ.isEnabled()){
this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.stone, world, random, x, z, this.getRandom(ConfigIntValues.BLACK_QUARTZ_BASE_AMOUNT.getValue(), ConfigIntValues.BLACK_QUARTZ_ADD_CHANCE.getValue(), random), ConfigIntValues.BLACK_QUARTZ_CHANCE.getValue(), ConfigIntValues.BLACK_QUARTZ_MIN_HEIGHT.getValue(), ConfigIntValues.BLACK_QUARTZ_MAX_HEIGHT.getValue());
this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.stone, world, random, x, z, MathHelper.getRandomIntegerInRange(random, ConfigIntValues.BLACK_QUARTZ_BASE_AMOUNT.getValue(), ConfigIntValues.BLACK_QUARTZ_ADD_CHANCE.getValue()), ConfigIntValues.BLACK_QUARTZ_CHANCE.getValue(), ConfigIntValues.BLACK_QUARTZ_MIN_HEIGHT.getValue(), ConfigIntValues.BLACK_QUARTZ_MAX_HEIGHT.getValue());
}
}
@ -65,10 +63,6 @@ public class OreGen implements IWorldGenerator{
else ModUtil.LOGGER.log(Level.FATAL, "Couldn't generate '" + block.getUnlocalizedName() + "' into the world because the Min Y coordinate is bigger than the Max! This is definitely a Config Error! Check the Files!");
}
public int getRandom(int base, int extra, Random rand){
return extra > 0 ? base+rand.nextInt(extra+1) : base;
}
public static void init(){
Util.logInfo("Registering World Generator...");
GameRegistry.registerWorldGenerator(new OreGen(), 10);

View file

@ -0,0 +1,96 @@
package ellpeck.actuallyadditions.gen;
import ellpeck.actuallyadditions.blocks.InitBlocks;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import java.util.List;
import java.util.Random;
public class VillageComponentCustomCropField extends StructureVillagePieces.House1{
private static final int xSize = 13;
private static final int ySize = 4;
private static final int zSize = 9;
private int averageGroundLevel = -1;
@SuppressWarnings("unused")
public VillageComponentCustomCropField(){
}
public VillageComponentCustomCropField(StructureBoundingBox boundingBox, int par5){
this.coordBaseMode = par5;
this.boundingBox = boundingBox;
}
public static VillageComponentCustomCropField buildComponent(List pieces, int p1, int p2, int p3, int p4){
StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, xSize, ySize, zSize, p4);
return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentCustomCropField(boundingBox, p4) : null;
}
@Override
public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb){
if(this.averageGroundLevel < 0){
this.averageGroundLevel = this.getAverageGroundLevel(world, sbb);
if(this.averageGroundLevel < 0) return true;
this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize-1, 0);
}
this.fillWithBlocks(world, sbb, 0, 0, 0, xSize-1, ySize-1, zSize-1, Blocks.air);
this.spawnActualHouse(world, rand, sbb);
for (int i = 0; i < xSize; i++){
for(int j = 0; j < zSize; j++){
this.clearCurrentPositionBlocksUpwards(world, i, ySize, j, sbb);
this.func_151554_b(world, Blocks.dirt, 0, i, -1, j, sbb);
}
}
return true;
}
private Block getRandomCropType(Random rand){
switch(rand.nextInt(4)){
case 0: return InitBlocks.blockFlax;
case 1: return InitBlocks.blockCoffee;
case 2: return InitBlocks.blockRice;
default: return InitBlocks.blockCanola;
}
}
public void spawnActualHouse(World world, Random rand, StructureBoundingBox sbb){
this.fillWithBlocks(world, sbb, 1, 0, 1, 2, 0, 7, Blocks.farmland);
this.fillWithBlocks(world, sbb, 4, 0, 1, 5, 0, 7, Blocks.farmland);
this.fillWithBlocks(world, sbb, 7, 0, 1, 8, 0, 7, Blocks.farmland);
this.fillWithBlocks(world, sbb, 10, 0, 1, 11, 0, 7, Blocks.farmland);
this.fillWithBlocks(world, sbb, 0, 0, 0, 0, 0, 8, Blocks.log);
this.fillWithBlocks(world, sbb, 6, 0, 0, 6, 0, 8, Blocks.log);
this.fillWithBlocks(world, sbb, 12, 0, 0, 12, 0, 8, Blocks.log);
this.fillWithBlocks(world, sbb, 1, 0, 0, 11, 0, 0, Blocks.log);
this.fillWithBlocks(world, sbb, 1, 0, 8, 11, 0, 8, Blocks.log);
this.fillWithBlocks(world, sbb, 3, 0, 1, 3, 0, 7, Blocks.water);
this.fillWithBlocks(world, sbb, 9, 0, 1, 9, 0, 7, Blocks.water);
for(int i = 1; i <= 7; ++i){
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 1, 1, i, sbb);
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 2, 1, i, sbb);
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 4, 1, i, sbb);
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 5, 1, i, sbb);
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 7, 1, i, sbb);
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 8, 1, i, sbb);
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 10, 1, i, sbb);
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 11, 1, i, sbb);
}
}
public void fillWithBlocks(World world, StructureBoundingBox sbb, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block){
this.fillWithBlocks(world, sbb, minX, minY, minZ, maxX, maxY, maxZ, block, block, false);
}
}

View file

@ -17,9 +17,9 @@ import java.util.Random;
public class VillageComponentJamHouse extends StructureVillagePieces.House1{
private static final int xSize = 10;
private static final int xSize = 11;
private static final int ySize = 8;
private static final int zSize = 11;
private static final int zSize = 12;
private int averageGroundLevel = -1;
@ -34,7 +34,7 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{
}
public static VillageComponentJamHouse buildComponent(List pieces, int p1, int p2, int p3, int p4){
StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, xSize+1, ySize+1, zSize+1, p4);
StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, xSize, ySize, zSize, p4);
return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentJamHouse(boundingBox, p4) : null;
}
@ -43,9 +43,10 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{
if(this.averageGroundLevel < 0){
this.averageGroundLevel = this.getAverageGroundLevel(world, sbb);
if(this.averageGroundLevel < 0) return true;
this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize, 0);
this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize-1, 0);
}
this.fillWithBlocks(world, sbb, 0, 0, 0, xSize-1, ySize-1, zSize-1, Blocks.air);
this.spawnActualHouse(world, rand, sbb);
for (int i = 0; i < xSize; i++){

View file

@ -0,0 +1,25 @@
package ellpeck.actuallyadditions.gen;
import cpw.mods.fml.common.registry.VillagerRegistry;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import java.util.List;
import java.util.Random;
public class VillageCustomCropFieldHandler implements VillagerRegistry.IVillageCreationHandler{
@Override
public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int i){
return new StructureVillagePieces.PieceWeight(VillageComponentCustomCropField.class, 5, 2);
}
@Override
public Class<?> getComponentClass(){
return VillageComponentCustomCropField.class;
}
@Override
public Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5){
return VillageComponentCustomCropField.buildComponent(pieces, p1, p2, p3, p4);
}
}

View file

@ -159,19 +159,19 @@ public class InitItems{
itemCoffeeBean = new ItemCoffeeBean();
ItemUtil.register(itemCoffeeBean);
itemRiceSeed = new ItemSeed("itemRiceSeed", InitBlocks.blockRice, itemFoods, TheFoods.RICE.ordinal());
itemRiceSeed = new ItemSeed("itemRiceSeed", "seedRice", InitBlocks.blockRice, itemFoods, TheFoods.RICE.ordinal());
ItemUtil.register(itemRiceSeed);
CompatUtil.registerMFRSeed(itemRiceSeed);
itemCanolaSeed = new ItemSeed("itemCanolaSeed", InitBlocks.blockCanola, itemMisc, TheMiscItems.CANOLA.ordinal());
itemCanolaSeed = new ItemSeed("itemCanolaSeed", "seedCanola", InitBlocks.blockCanola, itemMisc, TheMiscItems.CANOLA.ordinal());
ItemUtil.register(itemCanolaSeed);
CompatUtil.registerMFRSeed(itemCanolaSeed);
itemFlaxSeed = new ItemSeed("itemFlaxSeed", InitBlocks.blockFlax, Items.string, 0);
itemFlaxSeed = new ItemSeed("itemFlaxSeed", "seedFlax", InitBlocks.blockFlax, Items.string, 0);
ItemUtil.register(itemFlaxSeed);
CompatUtil.registerMFRSeed(itemFlaxSeed);
itemCoffeeSeed = new ItemSeed("itemCoffeeSeed", InitBlocks.blockCoffee, itemCoffeeBean, 0);
itemCoffeeSeed = new ItemSeed("itemCoffeeSeed", "seedCoffeeBeans", InitBlocks.blockCoffee, itemCoffeeBean, 0);
ItemUtil.register(itemCoffeeSeed);
CompatUtil.registerMFRSeed(itemCoffeeSeed);

View file

@ -23,7 +23,7 @@ public class ItemCoffeeBean extends ItemFood implements INameableItem{
@Override
public String getOredictName(){
return this.getName();
return "cropCoffeeBeans";
}
@Override

View file

@ -23,10 +23,12 @@ public class ItemSeed extends ItemSeeds implements INameableItem{
public Block plant;
public String name;
public String oredictName;
public ItemSeed(String name, Block plant, Item returnItem, int returnMeta){
public ItemSeed(String name, String oredictName, Block plant, Item returnItem, int returnMeta){
super(plant, Blocks.farmland);
this.name = name;
this.oredictName = oredictName;
this.plant = plant;
((BlockPlant)this.plant).seedItem = this;
((BlockPlant)this.plant).returnItem = returnItem;
@ -72,6 +74,6 @@ public class ItemSeed extends ItemSeeds implements INameableItem{
@Override
public String getOredictName(){
return this.getName();
return this.oredictName;
}
}

View file

@ -24,7 +24,7 @@ public enum TheFoods implements INameableItem{
HAMBURGER("Hamburger", 14, 6F, false, 40, EnumRarity.common, "foodHamburger"),
PIZZA("Pizza", 20, 10F, false, 45, EnumRarity.uncommon, "foodPizza"),
BAGUETTE("Baguette", 7, 2F, false, 25, EnumRarity.common, "foodBaguette"),
RICE("Rice", 2, 1F, false, 10, EnumRarity.uncommon, "foodRice"),
RICE("Rice", 2, 1F, false, 10, EnumRarity.uncommon, "cropRice"),
RICE_BREAD("RiceBread", 8, 3F, false, 25, EnumRarity.uncommon, "foodRiceBread");
public static void setReturnItems(){

View file

@ -18,7 +18,7 @@ public enum TheMiscItems implements INameableItem{
TINY_COAL("TinyCoal", EnumRarity.common, "itemTinyCoal"),
TINY_CHAR("TinyCharcoal", EnumRarity.common, "itemTinyChar"),
RICE_SLIME("RiceSlime", EnumRarity.uncommon, "slimeball"),
CANOLA("Canola", EnumRarity.uncommon, "itemCanola"),
CANOLA("Canola", EnumRarity.uncommon, "cropCanola"),
CUP("Cup", EnumRarity.uncommon, "itemCup");
public final String name;

View file

@ -0,0 +1,27 @@
package ellpeck.actuallyadditions.misc;
import net.minecraft.block.BlockDispenser;
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
import net.minecraft.dispenser.IBlockSource;
import net.minecraft.init.Items;
import net.minecraft.item.ItemBucket;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
public class DispenserHandlerEmptyBucket extends BehaviorDefaultDispenseItem{
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack bucket){
EnumFacing facing = BlockDispenser.func_149937_b(source.getBlockMetadata());
int x = source.getXInt()+facing.getFrontOffsetX();
int y = source.getYInt()+facing.getFrontOffsetY();
int z = source.getZInt()+facing.getFrontOffsetZ();
if(source.getWorld().isAirBlock(x, y, z) && !source.getWorld().getBlock(x, y, z).getMaterial().isSolid() && ((ItemBucket)bucket.getItem()).tryPlaceContainedLiquid(source.getWorld(), x, y, z)){
return new ItemStack(Items.bucket);
}
return new BehaviorDefaultDispenseItem().dispense(source, bucket);
}
}

View file

@ -0,0 +1,25 @@
package ellpeck.actuallyadditions.misc;
import net.minecraft.block.BlockDispenser;
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
import net.minecraft.dispenser.IBlockSource;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
public class DispenserHandlerFertilize extends BehaviorDefaultDispenseItem{
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack stack){
EnumFacing facing = BlockDispenser.func_149937_b(source.getBlockMetadata());
int x = source.getXInt()+facing.getFrontOffsetX();
int y = source.getYInt()+facing.getFrontOffsetY();
int z = source.getZInt()+facing.getFrontOffsetZ();
if(ItemDye.applyBonemeal(stack, source.getWorld(), x, y, z, null)){
source.getWorld().playAuxSFX(2005, x, y, z, 0);
}
return stack;
}
}