mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
parent
4c855914e6
commit
25c1ceffd5
1 changed files with 15 additions and 1 deletions
|
@ -12,6 +12,9 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
import net.minecraft.entity.passive.EntityAnimal;
|
import net.minecraft.entity.passive.EntityAnimal;
|
||||||
|
import net.minecraft.entity.passive.EntityHorse;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -73,7 +76,7 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
|
||||||
this.currentTimer = 0;
|
this.currentTimer = 0;
|
||||||
if(this.slots[0] != null){
|
if(this.slots[0] != null){
|
||||||
EntityAnimal randomAnimal = animals.get(Util.RANDOM.nextInt(this.currentAnimalAmount));
|
EntityAnimal randomAnimal = animals.get(Util.RANDOM.nextInt(this.currentAnimalAmount));
|
||||||
if(!randomAnimal.isInLove() && randomAnimal.getGrowingAge() == 0 && randomAnimal.isBreedingItem(this.slots[0])){
|
if(!randomAnimal.isInLove() && randomAnimal.getGrowingAge() == 0 && (randomAnimal.isBreedingItem(this.slots[0]) || this.canHorseBeFed(randomAnimal))){
|
||||||
|
|
||||||
this.feedAnimal(randomAnimal);
|
this.feedAnimal(randomAnimal);
|
||||||
|
|
||||||
|
@ -108,6 +111,17 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean canHorseBeFed(EntityAnimal animal){
|
||||||
|
if(animal instanceof EntityHorse){
|
||||||
|
EntityHorse horse = (EntityHorse)animal;
|
||||||
|
if(horse.isTame()){
|
||||||
|
Item item = this.slots[0].getItem();
|
||||||
|
return item == Items.GOLDEN_APPLE || item == Items.GOLDEN_CARROT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue