mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Fixed the mess blur created
This commit is contained in:
parent
0cc6428e45
commit
07c24cf8dc
1 changed files with 25 additions and 18 deletions
|
@ -10,9 +10,6 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
import de.ellpeck.actuallyadditions.mod.creative.CreativeTab;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
|
@ -31,6 +28,9 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.EnumPlantType;
|
import net.minecraftforge.common.EnumPlantType;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockPlant extends BlockCrops{
|
public class BlockPlant extends BlockCrops{
|
||||||
|
|
||||||
public Item seedItem;
|
public Item seedItem;
|
||||||
|
@ -46,22 +46,28 @@ public class BlockPlant extends BlockCrops{
|
||||||
this.addDropAmount = addDropAmount;
|
this.addDropAmount = addDropAmount;
|
||||||
this.register();
|
this.register();
|
||||||
}
|
}
|
||||||
public boolean onBlockActivated(World w, BlockPos p, IBlockState s, EntityPlayer ep, EnumFacing f, float hitX, float hitY, float hitZ){
|
|
||||||
if(getMetaFromState(s)>=7){
|
@Override
|
||||||
if(w.isRemote)return true;
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing facing, float hitX, float hitY, float hitZ){
|
||||||
List<ItemStack> isa = getDrops(w, p, s, 0);
|
if(getMetaFromState(state) >= 7){
|
||||||
for(ItemStack i:isa){
|
if(!world.isRemote){
|
||||||
if(i!=null&&i.getItem()==this.getSeed()){
|
|
||||||
i.stackSize--;
|
List<ItemStack> drops = getDrops(world, pos, state, 0);
|
||||||
}
|
for(ItemStack stack : drops){
|
||||||
EntityItem ei = new EntityItem(w, p.getX()+.5,p.getY()+.5,p.getZ()+.5,i);
|
if(stack != null && stack.getItem() == this.getSeed()){
|
||||||
w.spawnEntityInWorld(ei);
|
stack.stackSize--;
|
||||||
}
|
}
|
||||||
w.setBlockState(p, getStateFromMeta(0));
|
EntityItem entity = new EntityItem(world, pos.getX()+.5, pos.getY()+.5, pos.getZ()+.5, stack);
|
||||||
return true;
|
world.spawnEntityInWorld(entity);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
world.setBlockState(pos, getStateFromMeta(0));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void register(){
|
private void register(){
|
||||||
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
this.setUnlocalizedName(ModUtil.MOD_ID_LOWER+"."+this.getBaseName());
|
||||||
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
|
GameRegistry.registerBlock(this, this.getItemBlock(), this.getBaseName());
|
||||||
|
@ -109,6 +115,7 @@ public class BlockPlant extends BlockCrops{
|
||||||
public Item getCrop(){
|
public Item getCrop(){
|
||||||
return this.returnItem;
|
return this.returnItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(IBlockState state, Random rand, int par3){
|
public Item getItemDropped(IBlockState state, Random rand, int par3){
|
||||||
return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();
|
return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();
|
||||||
|
|
Loading…
Reference in a new issue