Merge branch 'master' into 1.16
This commit is contained in:
commit
8a09fb55b2
8 files changed
+89
-543
No files matched your search
@@ -4,6 +4,7 @@ import carpet.fakes.ServerPlayerEntityInterface;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.passive.HorseBaseEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.entity.vehicle.MinecartEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -222,6 +223,31 @@ public class EntityPlayerActionPack
|
||||
return Tracer.rayTrace(player, 1, reach, false);
|
||||
}
|
||||
|
||||
private void dropItemFromSlot(int slot, boolean dropAll)
|
||||
{
|
||||
PlayerInventory inv = player.inventory;
|
||||
if (!inv.getInvStack(slot).isEmpty())
|
||||
player.dropItem(inv.takeInvStack(slot,
|
||||
dropAll ? inv.getInvStack(slot).getCount() : 1
|
||||
), false, true); // scatter, keep owner
|
||||
}
|
||||
|
||||
public void drop(int selectedSlot, boolean dropAll)
|
||||
{
|
||||
PlayerInventory inv = player.inventory;
|
||||
if (selectedSlot == -2) // all
|
||||
{
|
||||
for (int i = inv.getInvSize(); i >= 0; i--)
|
||||
dropItemFromSlot(i, dropAll);
|
||||
}
|
||||
else // one slot
|
||||
{
|
||||
if (selectedSlot == -1)
|
||||
selectedSlot = inv.selectedSlot;
|
||||
dropItemFromSlot(selectedSlot, dropAll);
|
||||
}
|
||||
}
|
||||
|
||||
public enum ActionType
|
||||
{
|
||||
USE(true)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package carpet.helpers;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.BlockItem;
|
||||
|
||||
public class PortalHelper
|
||||
{
|
||||
public static boolean player_holds_obsidian(PlayerEntity playerIn)
|
||||
{
|
||||
return (!playerIn.getMainHandStack().isEmpty()
|
||||
&& playerIn.getMainHandStack().getItem() instanceof BlockItem &&
|
||||
((BlockItem) (playerIn.getMainHandStack().getItem())).getBlock() == Blocks.OBSIDIAN);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user