Compare commits
4 commits
7489d030ad
...
d3326e6f18
Author | SHA1 | Date | |
---|---|---|---|
d3326e6f18 | |||
c74009fe4a | |||
e52928e2e7 | |||
04a8538752 |
4 changed files with 36 additions and 2 deletions
|
@ -3,7 +3,7 @@ org.gradle.jvmargs = -Xmx4G
|
||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
version = 2.0.0
|
version = 2.0.1
|
||||||
maven_group = pm.c7.scout
|
maven_group = pm.c7.scout
|
||||||
archives_base_name = Scout
|
archives_base_name = Scout
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class ScoutMixin extends AutoMixin {
|
||||||
var params = decodeAnnotationParams(an);
|
var params = decodeAnnotationParams(an);
|
||||||
Type type = (Type)params.get("value");
|
Type type = (Type)params.get("value");
|
||||||
try {
|
try {
|
||||||
transformers.put(name, (ClassNodeTransformer) Class.forName(type.getClassName()).newInstance());
|
transformers.put(name, (ClassNodeTransformer) Class.forName(type.getClassName()).getDeclaredConstructor().newInstance());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Transformer class for mixin {} not found", name, e);
|
LOGGER.error("Transformer class for mixin {} not found", name, e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,6 +220,16 @@ public class BaseBagItem extends TrinketItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick(ItemStack stack, SlotReference slot, LivingEntity entity) {
|
||||||
|
var inv = getInventory(stack);
|
||||||
|
|
||||||
|
for (int i = 0; i < inv.size(); i++) {
|
||||||
|
var invStack = inv.getStack(i);
|
||||||
|
invStack.inventoryTick(entity.getWorld(), entity, i, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public enum BagType {
|
public enum BagType {
|
||||||
SATCHEL,
|
SATCHEL,
|
||||||
POUCH
|
POUCH
|
||||||
|
|
24
src/main/java/pm/c7/scout/mixin/DefaultedListMixin.java
Normal file
24
src/main/java/pm/c7/scout/mixin/DefaultedListMixin.java
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
package pm.c7.scout.mixin;
|
||||||
|
|
||||||
|
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.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import net.minecraft.util.collection.DefaultedList;
|
||||||
|
import pm.c7.scout.ScoutUtil;
|
||||||
|
|
||||||
|
@Mixin(DefaultedList.class)
|
||||||
|
public class DefaultedListMixin {
|
||||||
|
@Inject(method = "get", at = @At("HEAD"), cancellable = true)
|
||||||
|
public void scout$fixIndexingSlots(int index, CallbackInfoReturnable<Object> cir) {
|
||||||
|
var playerScreenHandler = ScoutUtil.getPlayerScreenHandler();
|
||||||
|
if (ScoutUtil.isBagSlot(index)) {
|
||||||
|
if (playerScreenHandler != null) {
|
||||||
|
cir.setReturnValue(ScoutUtil.getBagSlot(index, playerScreenHandler));
|
||||||
|
} else {
|
||||||
|
cir.setReturnValue(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue