Skip to content

Commit

Permalink
Fixed 1.19.3 crashes and potentially #8
Browse files Browse the repository at this point in the history
  • Loading branch information
mattymatty97 committed May 21, 2023
1 parent f8dc8bc commit d52a2df
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 40 deletions.
4 changes: 2 additions & 2 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Sat Feb 25 18:23:10 CET 2023
#Sat May 20 13:16:10 CEST 2023
mod_version=1.9.7
mod_buildnumber=2
mod_buildnumber=5
1 change: 0 additions & 1 deletion src/main/java/com/carpet_shadow/CarpetShadow.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import carpet.CarpetServer;
import com.carpet_shadow.utility.RandomString;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.loader.api.FabricLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import carpet.settings.Rule;

import static carpet.settings.RuleCategory.*;
import static com.carpet_shadow.CarpetShadowSettings.*;
import static carpet.settings.RuleCategory.FEATURE;
import static carpet.settings.RuleCategory.OPTIMIZATION;
import static com.carpet_shadow.CarpetShadowSettings.SHADOW;

@SuppressWarnings({"removal"})
public class CarpetShadowServerSettings {
@Rule(desc = "Prevents desync betwen client and server when using a fast refilling shadow stack", category = {SHADOW, OPTIMIZATION, FEATURE})
public static boolean shadowItemUseFix = false;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/carpet_shadow/CarpetShadowSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import static carpet.settings.RuleCategory.*;

@SuppressWarnings({"removal"})
public class CarpetShadowSettings {
public static final String SHADOW = "shadow_items";
@Rule(desc = "Shadow Items Action over Unloading ( Unlink is default vanilla )", category = {SHADOW, BUGFIX})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.carpet_shadow.mixins.fragility;

import com.carpet_shadow.CarpetShadow;
import com.carpet_shadow.CarpetShadowSettings;
import com.carpet_shadow.interfaces.ShadowItem;
import net.minecraft.block.DropperBlock;
Expand All @@ -12,7 +11,8 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.crash.CrashException;
import net.minecraft.util.crash.CrashReport;
import net.minecraft.util.crash.CrashReportSection;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(PlayerInventory.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,15 @@
import com.carpet_shadow.CarpetShadowSettings;
import com.carpet_shadow.Globals;
import com.carpet_shadow.interfaces.ShadowItem;
import com.carpet_shadow.utility.ShadowingException;
import com.carpet_shadow.utility.SlotException;
import de.cronn.reflection.util.ClassUtils;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.MappingResolver;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.slot.Slot;
import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.util.crash.CrashException;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.Slice;

import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
import java.util.Arrays;

@Mixin(ScreenHandler.class)
public abstract class ScreenHandlerMixin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
import com.carpet_shadow.interfaces.ShadowItem;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.server.network.ServerPlayerEntity;
Expand All @@ -18,8 +15,6 @@
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import com.carpet_shadow.Globals;
import net.minecraft.inventory.Inventory;
import net.minecraft.server.MinecraftServer;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.carpet_shadow.mixins.inv_updates;

import com.carpet_shadow.interfaces.ShadowItem;
import com.carpet_shadow.interfaces.InventoryItem;
import com.carpet_shadow.interfaces.ShadowItem;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.slot.Slot;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
import com.carpet_shadow.interfaces.ShadowItem;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.command.BlockDataObject;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.util.math.BlockPos;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(BlockEntity.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.Objects;

@Mixin(PacketByteBuf.class)
public abstract class PacketByteBufMixin {

Expand Down Expand Up @@ -59,10 +57,11 @@ public void filter_shadow_lore(CallbackInfoReturnable<ItemStack> cir) {
String string;
MutableText mutableText2;
NbtCompound nbt = stack.getNbt();
if (nbt != null && nbt.contains(ItemStack.DISPLAY_KEY)) {
if (nbt != null && (nbt.contains(ItemStack.DISPLAY_KEY) || nbt.contains(ShadowItem.SHADOW_KEY))) {
String shadow_id = nbt.getString(ShadowItem.SHADOW_KEY);
if (!shadow_id.equals("")){
((ShadowItem) (Object) stack).setShadowId(shadow_id);
nbt.remove(ShadowItem.SHADOW_KEY);
}
NbtCompound display = nbt.getCompound(ItemStack.DISPLAY_KEY);
if (display.contains(ItemStack.LORE_KEY)) {
Expand All @@ -84,9 +83,9 @@ public void filter_shadow_lore(CallbackInfoReturnable<ItemStack> cir) {
display.remove(ItemStack.LORE_KEY);
if (display.isEmpty())
nbt.remove(ItemStack.DISPLAY_KEY);
if (nbt.isEmpty())
stack.setNbt(null);
}
if (nbt.isEmpty())
stack.setNbt(null);
}

}
Expand Down

0 comments on commit d52a2df

Please sign in to comment.