mappings
This commit is contained in:
1 parent
419b739d5e
commit
43ff0e8c11
7 files changed
+39
-41
No files matched your search
+1
-1
@@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx1G
|
||||
# check these on https://fabricmc.net/use
|
||||
# or better: https://modmuss50.me/fabric.html
|
||||
minecraft_version=20w13b
|
||||
yarn_mappings=20w13b+build.4
|
||||
yarn_mappings=20w13b+build.7
|
||||
loader_version=0.7.8+build.189
|
||||
|
||||
# Mod Properties
|
||||
|
||||
@@ -242,9 +242,9 @@ public class EntityPlayerActionPack
|
||||
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
|
||||
if (!inv.getStack(slot).isEmpty())
|
||||
player.dropItem(inv.removeStack(slot,
|
||||
dropAll ? inv.getStack(slot).getCount() : 1
|
||||
), false, true); // scatter, keep owner
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ public class EntityPlayerActionPack
|
||||
PlayerInventory inv = player.inventory;
|
||||
if (selectedSlot == -2) // all
|
||||
{
|
||||
for (int i = inv.getInvSize(); i >= 0; i--)
|
||||
for (int i = inv.size(); i >= 0; i--)
|
||||
dropItemFromSlot(i, dropAll);
|
||||
}
|
||||
else // one slot
|
||||
|
||||
@@ -32,11 +32,9 @@ public abstract class HopperBlockEntityMixin extends LootableContainerBlockEntit
|
||||
@Shadow
|
||||
public abstract double getHopperZ();
|
||||
|
||||
@Shadow
|
||||
public abstract void setInvStack(int int_1, ItemStack itemStack_1);
|
||||
@Shadow public abstract int size();
|
||||
|
||||
@Shadow
|
||||
public abstract int getInvSize();
|
||||
@Shadow public abstract void setStack(int slot, ItemStack stack);
|
||||
|
||||
@Inject(method = "insert", at = @At("HEAD"), cancellable = true)
|
||||
private void onInsert(CallbackInfoReturnable<Boolean> cir)
|
||||
@@ -47,13 +45,13 @@ public abstract class HopperBlockEntityMixin extends LootableContainerBlockEntit
|
||||
new BlockPos(getHopperX(), getHopperY(), getHopperZ()).offset(this.getCachedState().get(HopperBlock.FACING)));
|
||||
if (wool_color != null)
|
||||
{
|
||||
for (int i = 0; i < this.getInvSize(); ++i)
|
||||
for (int i = 0; i < size(); ++i)
|
||||
{
|
||||
if (!this.getInvStack(i).isEmpty())
|
||||
if (!this.getStack(i).isEmpty())
|
||||
{
|
||||
ItemStack itemstack = this.getInvStack(i);//.copy();
|
||||
ItemStack itemstack = this.getStack(i);//.copy();
|
||||
HopperCounter.COUNTERS.get(wool_color).add(this.getWorld().getServer(), itemstack);
|
||||
this.setInvStack(i, ItemStack.EMPTY);
|
||||
this.setStack(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
cir.setReturnValue(true);
|
||||
|
||||
@@ -18,7 +18,7 @@ import net.minecraft.item.Items;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.GlobalPos;
|
||||
import net.minecraft.util.dynamic.GlobalPos;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.dynamic.Timestamp;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
@@ -1417,7 +1417,7 @@ public class CarpetExpression
|
||||
NBTSerializableValue.InventoryLocator inventoryLocator = NBTSerializableValue.locateInventory(cc, lv, 0);
|
||||
if (inventoryLocator == null)
|
||||
return (_c, _t) -> Value.NULL;
|
||||
Value res = new NumericValue(inventoryLocator.inventory.getInvSize());
|
||||
Value res = new NumericValue(inventoryLocator.inventory.size());
|
||||
return (_c, _t) -> res;
|
||||
});
|
||||
|
||||
@@ -1427,7 +1427,7 @@ public class CarpetExpression
|
||||
NBTSerializableValue.InventoryLocator inventoryLocator = NBTSerializableValue.locateInventory(cc, lv, 0);
|
||||
if (inventoryLocator == null)
|
||||
return (_c, _t) -> Value.NULL;
|
||||
Value res = new NumericValue(!inventoryLocator.inventory.isInvEmpty());
|
||||
Value res = new NumericValue(!inventoryLocator.inventory.isEmpty());
|
||||
return (_c, _t) -> res;
|
||||
});
|
||||
|
||||
@@ -1441,18 +1441,18 @@ public class CarpetExpression
|
||||
if (lv.size() == inventoryLocator.offset)
|
||||
{
|
||||
List<Value> fullInventory = new ArrayList<>();
|
||||
for (int i = 0, maxi = inventoryLocator.inventory.getInvSize(); i < maxi; i++)
|
||||
for (int i = 0, maxi = inventoryLocator.inventory.size(); i < maxi; i++)
|
||||
{
|
||||
fullInventory.add(ListValue.fromItemStack(inventoryLocator.inventory.getInvStack(i)));
|
||||
fullInventory.add(ListValue.fromItemStack(inventoryLocator.inventory.getStack(i)));
|
||||
}
|
||||
Value res = ListValue.wrap(fullInventory);
|
||||
return (_c, _t) -> res;
|
||||
}
|
||||
int slot = (int)NumericValue.asNumber(lv.get(inventoryLocator.offset).evalValue(c)).getLong();
|
||||
slot = NBTSerializableValue.validateSlot(slot, inventoryLocator.inventory);
|
||||
if (slot == inventoryLocator.inventory.getInvSize())
|
||||
if (slot == inventoryLocator.inventory.size())
|
||||
return (_c, _t) -> Value.NULL;
|
||||
Value res = ListValue.fromItemStack(inventoryLocator.inventory.getInvStack(slot));
|
||||
Value res = ListValue.fromItemStack(inventoryLocator.inventory.getStack(slot));
|
||||
return (_c, _t) -> res;
|
||||
});
|
||||
|
||||
@@ -1467,23 +1467,23 @@ public class CarpetExpression
|
||||
throw new InternalExpressionException("'inventory_set' requires at least slot number and new stack size, and optional new item");
|
||||
int slot = (int) NumericValue.asNumber(lv.get(inventoryLocator.offset+0).evalValue(c)).getLong();
|
||||
slot = NBTSerializableValue.validateSlot(slot, inventoryLocator.inventory);
|
||||
if (slot == inventoryLocator.inventory.getInvSize())
|
||||
if (slot == inventoryLocator.inventory.size())
|
||||
return (_c, _t) -> Value.NULL;
|
||||
int count = (int) NumericValue.asNumber(lv.get(inventoryLocator.offset+1).evalValue(c)).getLong();
|
||||
if (count == 0)
|
||||
{
|
||||
// clear slot
|
||||
ItemStack removedStack = inventoryLocator.inventory.removeInvStack(slot);
|
||||
ItemStack removedStack = inventoryLocator.inventory.removeStack(slot);
|
||||
syncPlayerInventory(inventoryLocator, slot);
|
||||
//Value res = ListValue.fromItemStack(removedStack); // that tuple will be read only but cheaper if noone cares
|
||||
return (_c, _t) -> ListValue.fromItemStack(removedStack);
|
||||
}
|
||||
if (lv.size() < inventoryLocator.offset+3)
|
||||
{
|
||||
ItemStack previousStack = inventoryLocator.inventory.getInvStack(slot);
|
||||
ItemStack previousStack = inventoryLocator.inventory.getStack(slot);
|
||||
ItemStack newStack = previousStack.copy();
|
||||
newStack.setCount(count);
|
||||
inventoryLocator.inventory.setInvStack(slot, newStack);
|
||||
inventoryLocator.inventory.setStack(slot, newStack);
|
||||
syncPlayerInventory(inventoryLocator, slot);
|
||||
return (_c, _t) -> ListValue.fromItemStack(previousStack);
|
||||
}
|
||||
@@ -1503,10 +1503,10 @@ public class CarpetExpression
|
||||
nbt
|
||||
);
|
||||
|
||||
ItemStack previousStack = inventoryLocator.inventory.getInvStack(slot);
|
||||
ItemStack previousStack = inventoryLocator.inventory.getStack(slot);
|
||||
try
|
||||
{
|
||||
inventoryLocator.inventory.setInvStack(slot, newitem.createStack(count, false));
|
||||
inventoryLocator.inventory.setStack(slot, newitem.createStack(count, false));
|
||||
syncPlayerInventory(inventoryLocator, slot);
|
||||
}
|
||||
catch (CommandSyntaxException e)
|
||||
@@ -1536,9 +1536,9 @@ public class CarpetExpression
|
||||
startIndex = (int) NumericValue.asNumber(lv.get(inventoryLocator.offset+1).evalValue(c)).getLong();
|
||||
}
|
||||
startIndex = NBTSerializableValue.validateSlot(startIndex, inventoryLocator.inventory);
|
||||
for (int i = startIndex, maxi = inventoryLocator.inventory.getInvSize(); i < maxi; i++)
|
||||
for (int i = startIndex, maxi = inventoryLocator.inventory.size(); i < maxi; i++)
|
||||
{
|
||||
ItemStack stack = inventoryLocator.inventory.getInvStack(i);
|
||||
ItemStack stack = inventoryLocator.inventory.getStack(i);
|
||||
if ( (itemArg == null && stack.isEmpty()) || (itemArg != null && itemArg.getItem().equals(stack.getItem())) )
|
||||
{
|
||||
Value res = new NumericValue(i);
|
||||
@@ -1566,14 +1566,14 @@ public class CarpetExpression
|
||||
amount = (int)NumericValue.asNumber(lv.get(inventoryLocator.offset+1).evalValue(c)).getLong();
|
||||
}
|
||||
// not enough
|
||||
if (((amount == 1) && (!inventoryLocator.inventory.containsAnyInInv(Sets.newHashSet(searchItem.getItem()))))
|
||||
|| (inventoryLocator.inventory.countInInv(searchItem.getItem()) < amount))
|
||||
if (((amount == 1) && (!inventoryLocator.inventory.containsAny(Sets.newHashSet(searchItem.getItem()))))
|
||||
|| (inventoryLocator.inventory.count(searchItem.getItem()) < amount))
|
||||
{
|
||||
return (_c, _t) -> Value.FALSE;
|
||||
}
|
||||
for (int i = 0, maxi = inventoryLocator.inventory.getInvSize(); i < maxi; i++)
|
||||
for (int i = 0, maxi = inventoryLocator.inventory.size(); i < maxi; i++)
|
||||
{
|
||||
ItemStack stack = inventoryLocator.inventory.getInvStack(i);
|
||||
ItemStack stack = inventoryLocator.inventory.getStack(i);
|
||||
if (stack.isEmpty())
|
||||
continue;
|
||||
if (!stack.getItem().equals(searchItem.getItem()))
|
||||
@@ -1582,13 +1582,13 @@ public class CarpetExpression
|
||||
if (left > 0)
|
||||
{
|
||||
stack.setCount(left);
|
||||
inventoryLocator.inventory.setInvStack(i, stack);
|
||||
inventoryLocator.inventory.setStack(i, stack);
|
||||
syncPlayerInventory(inventoryLocator, i);
|
||||
return (_c, _t) -> Value.TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
inventoryLocator.inventory.removeInvStack(i);
|
||||
inventoryLocator.inventory.removeStack(i);
|
||||
syncPlayerInventory(inventoryLocator, i);
|
||||
amount -= stack.getCount();
|
||||
}
|
||||
@@ -1609,19 +1609,19 @@ public class CarpetExpression
|
||||
throw new InternalExpressionException("Slot number is required for inventory_drop");
|
||||
int slot = (int)NumericValue.asNumber(lv.get(inventoryLocator.offset).evalValue(c)).getLong();
|
||||
slot = NBTSerializableValue.validateSlot(slot, inventoryLocator.inventory);
|
||||
if (slot == inventoryLocator.inventory.getInvSize())
|
||||
if (slot == inventoryLocator.inventory.size())
|
||||
return (_c, _t) -> Value.NULL;
|
||||
int amount = 0;
|
||||
if (lv.size() > inventoryLocator.offset+1)
|
||||
amount = (int)NumericValue.asNumber(lv.get(inventoryLocator.offset+1).evalValue(c)).getLong();
|
||||
if (amount < 0)
|
||||
throw new InternalExpressionException("Cannot throw negative number of items");
|
||||
ItemStack stack = inventoryLocator.inventory.getInvStack(slot);
|
||||
ItemStack stack = inventoryLocator.inventory.getStack(slot);
|
||||
if (stack == null || stack.isEmpty())
|
||||
return (_c, _t) -> Value.ZERO;
|
||||
if (amount == 0)
|
||||
amount = stack.getCount();
|
||||
ItemStack droppedStack = inventoryLocator.inventory.takeInvStack(slot, amount);
|
||||
ItemStack droppedStack = inventoryLocator.inventory.removeStack(slot, amount);
|
||||
if (droppedStack.isEmpty())
|
||||
{
|
||||
return (_c, _t) -> Value.ZERO;
|
||||
@@ -1662,7 +1662,7 @@ public class CarpetExpression
|
||||
player.networkHandler.sendPacket(new ScreenHandlerSlotUpdateS2CPacket(
|
||||
-2,
|
||||
int_1,
|
||||
inventory.inventory.getInvStack(int_1)
|
||||
inventory.inventory.getStack(int_1)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.GlobalPos;
|
||||
import net.minecraft.util.dynamic.GlobalPos;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
@@ -263,11 +263,11 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
||||
|
||||
public static int validateSlot(int slot, Inventory inv)
|
||||
{
|
||||
int invSize = inv.getInvSize();
|
||||
int invSize = inv.size();
|
||||
if (slot < 0)
|
||||
slot = invSize + slot;
|
||||
if (slot < 0 || slot >= invSize)
|
||||
return inv.getInvSize(); // outside of inventory
|
||||
return inv.size(); // outside of inventory
|
||||
return slot;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user