mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-13 17:04:24 +00:00
Merge branch 'master' into experimental
This commit is contained in:
commit
6ea64191e1
4 files changed
+23
-34
No files matched your search
@@ -98,7 +98,7 @@ public class DryingRack extends InventoryBlock
|
||||
{
|
||||
ItemStack decrStack = logic.decrStackSize(0, 1);
|
||||
if (decrStack != null)
|
||||
addItemToInventory(player, world, x, y, z, decrStack);
|
||||
AbilityHelper.spawnItemAtPlayer(player, decrStack);
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
@@ -106,15 +106,6 @@ public class DryingRack extends InventoryBlock
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addItemToInventory (EntityPlayer player, World world, int x, int y, int z, ItemStack stack)
|
||||
{
|
||||
if(!player.inventory.addItemStackToInventory(stack))
|
||||
{
|
||||
// drop the rest as an item
|
||||
AbilityHelper.spawnItemAtPlayer(player, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.entity.player.UseHoeEvent;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.*;
|
||||
import tconstruct.library.util.PiercingEntityDamage;
|
||||
|
||||
@@ -599,10 +600,20 @@ public class AbilityHelper
|
||||
{
|
||||
if (!player.worldObj.isRemote)
|
||||
{
|
||||
EntityItem entityitem = new EntityItem(player.worldObj, player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, stack);
|
||||
player.worldObj.spawnEntityInWorld(entityitem);
|
||||
if (!(player instanceof FakePlayer))
|
||||
entityitem.onCollideWithPlayer(player);
|
||||
// try to put it into the players inventory
|
||||
if(player instanceof FakePlayer || !player.inventory.addItemStackToInventory(stack)) // note that the addItemStackToInventory is not called for fake players
|
||||
{
|
||||
// drop the rest as an entity
|
||||
EntityItem entityitem = new EntityItem(player.worldObj, player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, stack);
|
||||
player.worldObj.spawnEntityInWorld(entityitem);
|
||||
if (!(player instanceof FakePlayer))
|
||||
entityitem.onCollideWithPlayer(player);
|
||||
}
|
||||
// if it got picked up, we're playing the sound
|
||||
else {
|
||||
player.worldObj.playSoundAtEntity(player, "random.pop", 0.2F, ((TConstruct.random.nextFloat() - TConstruct.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
player.inventory.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -317,14 +317,7 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
|
||||
// try to transfer thes tack to the player inventory
|
||||
ItemStack output = event.item;
|
||||
if(!player.inventory.addItemStackToInventory(output))
|
||||
{
|
||||
// drop the rest as an item
|
||||
AbilityHelper.spawnItemAtPlayer(player, output);
|
||||
}
|
||||
// added to inventory, update inventory
|
||||
else
|
||||
player.inventory.markDirty();
|
||||
AbilityHelper.spawnItemAtPlayer(player, output);
|
||||
|
||||
// remove inventory contents, since we spilled the full contents of the slot
|
||||
inventory[slot] = null;
|
||||
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.util.*;
|
||||
import net.minecraft.world.*;
|
||||
import net.minecraftforge.common.*;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
@@ -175,24 +176,18 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
|
||||
@Override
|
||||
public void onBlockClicked (World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta >= 12)
|
||||
{
|
||||
world.setBlock(x, y, z, this, meta - 4, 3);
|
||||
AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TinkerWorld.oreBerries, 1, meta % 4 + itemMeat));
|
||||
}
|
||||
}
|
||||
harvest(world, x,y,z, player);
|
||||
}
|
||||
|
||||
/* Right-click harvests berries */
|
||||
@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)
|
||||
return false;*/
|
||||
return harvest(world, x,y,z, player);
|
||||
}
|
||||
|
||||
public boolean harvest(World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta >= 12)
|
||||
{
|
||||
@@ -201,7 +196,6 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
|
||||
|
||||
world.setBlock(x, y, z, this, meta - 4, 3);
|
||||
AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TinkerWorld.oreBerries, random.nextInt(3) + 1, meta % 4 + itemMeat));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user