mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 20:52:34 +00:00
1.18.x Omnibus (#8239)
This commit is contained in:
1 parent
4011c3fb07
commit
34291c1fb2
89 files changed
+1014
-1192
No files matched your search
@@ -151,7 +151,7 @@ public class ItemHandlerHelper
|
||||
if (stack.isEmpty()) return;
|
||||
|
||||
IItemHandler inventory = new PlayerMainInvWrapper(player.getInventory());
|
||||
Level world = player.level;
|
||||
Level level = player.level;
|
||||
|
||||
// try adding it into the inventory
|
||||
ItemStack remainder = stack;
|
||||
@@ -169,18 +169,18 @@ public class ItemHandlerHelper
|
||||
// play sound if something got picked up
|
||||
if (remainder.isEmpty() || remainder.getCount() != stack.getCount())
|
||||
{
|
||||
world.playSound(null, player.getX(), player.getY() + 0.5, player.getZ(),
|
||||
SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, 0.2F, ((world.random.nextFloat() - world.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
level.playSound(null, player.getX(), player.getY() + 0.5, player.getZ(),
|
||||
SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, 0.2F, ((level.random.nextFloat() - level.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
}
|
||||
|
||||
// drop remaining itemstack into the world
|
||||
if (!remainder.isEmpty() && !world.isClientSide)
|
||||
// drop remaining itemstack into the level
|
||||
if (!remainder.isEmpty() && !level.isClientSide)
|
||||
{
|
||||
ItemEntity entityitem = new ItemEntity(world, player.getX(), player.getY() + 0.5, player.getZ(), remainder);
|
||||
ItemEntity entityitem = new ItemEntity(level, player.getX(), player.getY() + 0.5, player.getZ(), remainder);
|
||||
entityitem.setPickUpDelay(40);
|
||||
entityitem.setDeltaMovement(entityitem.getDeltaMovement().multiply(0, 1, 0));
|
||||
|
||||
world.addFreshEntity(entityitem);
|
||||
level.addFreshEntity(entityitem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,11 +70,11 @@ public class VanillaInventoryCodeHooks
|
||||
/**
|
||||
* Copied from BlockDropper#dispense and added capability support
|
||||
*/
|
||||
public static boolean dropperInsertHook(Level world, BlockPos pos, DispenserBlockEntity dropper, int slot, @Nonnull ItemStack stack)
|
||||
public static boolean dropperInsertHook(Level level, BlockPos pos, DispenserBlockEntity dropper, int slot, @Nonnull ItemStack stack)
|
||||
{
|
||||
Direction enumfacing = world.getBlockState(pos).getValue(DropperBlock.FACING);
|
||||
Direction enumfacing = level.getBlockState(pos).getValue(DropperBlock.FACING);
|
||||
BlockPos blockpos = pos.relative(enumfacing);
|
||||
return getItemHandler(world, (double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ(), enumfacing.getOpposite())
|
||||
return getItemHandler(level, (double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ(), enumfacing.getOpposite())
|
||||
.map(destinationResult -> {
|
||||
IItemHandler itemHandler = destinationResult.getKey();
|
||||
Object destination = destinationResult.getValue();
|
||||
|
||||
Reference in new issue
Block a user