fixes #522
This commit is contained in:
parent
e01a8ed4c1
commit
b06d89cf93
3 changed files with 22 additions and 72 deletions
|
@ -6,10 +6,13 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.tiles.transformers.TileHVTransformer;
|
import techreborn.tiles.transformers.TileHVTransformer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,30 +31,11 @@ public class BlockHVTransformer extends BlockTransformer
|
||||||
{
|
{
|
||||||
return new TileHVTransformer();
|
return new TileHVTransformer();
|
||||||
}
|
}
|
||||||
@Override
|
@Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
|
||||||
{
|
{
|
||||||
ItemStack itemStack = new ItemStack(ModBlocks.machineframe, 1 ,7);
|
ArrayList<ItemStack> list = new ArrayList<>();
|
||||||
Random rand = new Random();
|
list.add(new ItemStack(ModBlocks.machineframe, 1 , 7));
|
||||||
|
return list;
|
||||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
|
||||||
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
|
||||||
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
|
||||||
|
|
||||||
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ,
|
|
||||||
itemStack.copy());
|
|
||||||
|
|
||||||
if (itemStack.hasTagCompound())
|
|
||||||
{
|
|
||||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
|
||||||
}
|
|
||||||
|
|
||||||
float factor = 0.05F;
|
|
||||||
entityItem.motionX = rand.nextGaussian() * factor;
|
|
||||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
|
||||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
|
||||||
world.spawnEntityInWorld(entityItem);
|
|
||||||
itemStack.stackSize = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,12 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import techreborn.tiles.transformers.TileLVTransformer;
|
import techreborn.tiles.transformers.TileLVTransformer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,30 +31,10 @@ public class BlockLVTransformer extends BlockTransformer
|
||||||
return new TileLVTransformer();
|
return new TileLVTransformer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
|
||||||
{
|
{
|
||||||
ItemStack itemStack = new ItemStack(this);
|
ArrayList<ItemStack> list = new ArrayList<>();
|
||||||
|
list.add(new ItemStack(this, 1 , 0));
|
||||||
Random rand = new Random();
|
return list;
|
||||||
|
|
||||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
|
||||||
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
|
||||||
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
|
||||||
|
|
||||||
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ,
|
|
||||||
itemStack.copy());
|
|
||||||
|
|
||||||
if (itemStack.hasTagCompound())
|
|
||||||
{
|
|
||||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
|
||||||
}
|
|
||||||
|
|
||||||
float factor = 0.05F;
|
|
||||||
entityItem.motionX = rand.nextGaussian() * factor;
|
|
||||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
|
||||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
|
||||||
world.spawnEntityInWorld(entityItem);
|
|
||||||
itemStack.stackSize = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,13 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.tiles.transformers.TileMVTransformer;
|
import techreborn.tiles.transformers.TileMVTransformer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,31 +31,11 @@ public class BlockMVTransformer extends BlockTransformer
|
||||||
{
|
{
|
||||||
return new TileMVTransformer();
|
return new TileMVTransformer();
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
@Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||||
{
|
{
|
||||||
ItemStack itemStack = new ItemStack(ModBlocks.machineframe);
|
ArrayList<ItemStack> list = new ArrayList<>();
|
||||||
itemStack.setItemDamage(6);
|
list.add(new ItemStack(ModBlocks.machineframe, 1 , 6));
|
||||||
Random rand = new Random();
|
return list;
|
||||||
|
|
||||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
|
||||||
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
|
||||||
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
|
||||||
|
|
||||||
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ,
|
|
||||||
itemStack.copy());
|
|
||||||
|
|
||||||
if (itemStack.hasTagCompound())
|
|
||||||
{
|
|
||||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
|
||||||
}
|
|
||||||
|
|
||||||
float factor = 0.05F;
|
|
||||||
entityItem.motionX = rand.nextGaussian() * factor;
|
|
||||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
|
||||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
|
||||||
world.spawnEntityInWorld(entityItem);
|
|
||||||
itemStack.stackSize = 0;
|
|
||||||
super.breakBlock(world, pos, state);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue