Merge branch 'master' into future

This commit is contained in:
gnembon committed 2021-08-11 15:02:51 -03:00
commit 783f3f49f0
4 files changed
+41 -1

No files matched your search

@@ -0,0 +1,33 @@
package carpet.mixins;
import carpet.CarpetSettings;
import carpet.helpers.InventoryHelper;
import net.minecraft.block.ShulkerBoxBlock;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.slot.Slot;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ScreenHandler.class)
public class ScreenHandler_stackableSBoxesMixin
{
@Redirect(method = "internalOnSlotClick", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/screen/slot/Slot;getMaxItemCount(Lnet/minecraft/item/ItemStack;)I"
))
private int getMaxCountForSboxesInScreenHander(Slot slot, ItemStack stack)
{
if (CarpetSettings.stackableShulkerBoxes &&
stack.getItem() instanceof BlockItem &&
((BlockItem)stack.getItem()).getBlock() instanceof ShulkerBoxBlock &&
!InventoryHelper.shulkerBoxHasItems(stack)
)
{
return CarpetSettings.SHULKER_STACK_SIZE;
}
return slot.getMaxItemCount(stack);
}
}
@@ -16,7 +16,7 @@ public class Slot_stackableSBoxesMixin {
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/screen/slot/Slot;getMaxItemCount(Lnet/minecraft/item/ItemStack;)I" target = "Lnet/minecraft/screen/slot/Slot;getMaxItemCount(Lnet/minecraft/item/ItemStack;)I"
)) ))
private int getMaxCountForSboxes(Slot slot, ItemStack stack) private int getMaxCountForSboxesInSlot(Slot slot, ItemStack stack)
{ {
if (CarpetSettings.stackableShulkerBoxes && if (CarpetSettings.stackableShulkerBoxes &&
stack.getItem() instanceof BlockItem && stack.getItem() instanceof BlockItem &&
@@ -1,5 +1,6 @@
package carpet.utils; package carpet.utils;
import carpet.CarpetSettings;
import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2LongMap; import it.unimi.dsi.fastutil.objects.Object2LongMap;
import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap;
@@ -85,6 +86,11 @@ public class SpawnReporter
long count = spawn_stats.get(key).getOrDefault(mob.getType(), 0L); long count = spawn_stats.get(key).getOrDefault(mob.getType(), 0L);
spawn_stats.get(key).put(mob.getType(), count + 1); spawn_stats.get(key).put(mob.getType(), count + 1);
spawned_mobs.get(key).put(Pair.of(mob.getType(), pos)); spawned_mobs.get(key).put(Pair.of(mob.getType(), pos));
if (!local_spawns.containsKey(cat))
{
CarpetSettings.LOG.error("Rogue spawn detected for category "+cat.getName()+" for mob "+mob.getType().getName().getString()+". If you see this message let carpet peeps know about it on github issues.");
local_spawns.put(cat, 0L);
}
local_spawns.put(cat, local_spawns.get(cat)+1); local_spawns.put(cat, local_spawns.get(cat)+1);
} }
+1
View File
@@ -136,6 +136,7 @@
"CauldronBlock_stackableSBoxesMixin", "CauldronBlock_stackableSBoxesMixin",
"AbstractCauldronBlock_stackableSBoxesMixin", "AbstractCauldronBlock_stackableSBoxesMixin",
"Slot_stackableSBoxesMixin", "Slot_stackableSBoxesMixin",
"ScreenHandler_stackableSBoxesMixin",
"ItemEntityMixin", "ItemEntityMixin",
"TntBlockMixin", "TntBlockMixin",
"ExplosionMixin", "ExplosionMixin",