feature/d01-branch-a-bridge #6
@@ -320,10 +320,12 @@ public class PlayerEquipment {
|
||||
player,
|
||||
BodyRegionV2.ARMS
|
||||
);
|
||||
if (
|
||||
stack.isEmpty() || !(stack.getItem() instanceof ItemBind bind)
|
||||
) return 0;
|
||||
return bind.getCurrentResistance(stack, player);
|
||||
if (stack.isEmpty()) return 0;
|
||||
// V1 and V2 both implement IHasResistance
|
||||
if (stack.getItem() instanceof com.tiedup.remake.items.base.IHasResistance resistance) {
|
||||
return resistance.getCurrentResistance(stack, player);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,10 +336,11 @@ public class PlayerEquipment {
|
||||
player,
|
||||
BodyRegionV2.ARMS
|
||||
);
|
||||
if (
|
||||
stack.isEmpty() || !(stack.getItem() instanceof ItemBind bind)
|
||||
) return;
|
||||
bind.setCurrentResistance(stack, resistance);
|
||||
if (stack.isEmpty()) return;
|
||||
// V1 and V2 both implement IHasResistance
|
||||
if (stack.getItem() instanceof com.tiedup.remake.items.base.IHasResistance resistanceItem) {
|
||||
resistanceItem.setCurrentResistance(stack, resistance);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -348,10 +351,12 @@ public class PlayerEquipment {
|
||||
player,
|
||||
BodyRegionV2.NECK
|
||||
);
|
||||
if (
|
||||
stack.isEmpty() || !(stack.getItem() instanceof ItemCollar collar)
|
||||
) return 0;
|
||||
return collar.getCurrentResistance(stack, player);
|
||||
if (stack.isEmpty()) return 0;
|
||||
// V1 and V2 both implement IHasResistance
|
||||
if (stack.getItem() instanceof com.tiedup.remake.items.base.IHasResistance resistance) {
|
||||
return resistance.getCurrentResistance(stack, player);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -362,10 +367,11 @@ public class PlayerEquipment {
|
||||
player,
|
||||
BodyRegionV2.NECK
|
||||
);
|
||||
if (
|
||||
stack.isEmpty() || !(stack.getItem() instanceof ItemCollar collar)
|
||||
) return;
|
||||
collar.setCurrentResistance(stack, resistance);
|
||||
if (stack.isEmpty()) return;
|
||||
// V1 and V2 both implement IHasResistance
|
||||
if (stack.getItem() instanceof com.tiedup.remake.items.base.IHasResistance resistanceItem) {
|
||||
resistanceItem.setCurrentResistance(stack, resistance);
|
||||
}
|
||||
}
|
||||
|
||||
// ========== Helper Methods ==========
|
||||
|
||||
@@ -9,6 +9,9 @@ import com.tiedup.remake.state.PlayerBindState;
|
||||
import com.tiedup.remake.v2.BodyRegionV2;
|
||||
import com.tiedup.remake.v2.bondage.CollarHelper;
|
||||
import com.tiedup.remake.v2.bondage.capability.V2EquipmentHelper;
|
||||
import com.tiedup.remake.v2.bondage.component.ComponentType;
|
||||
import com.tiedup.remake.v2.bondage.component.ResistanceComponent;
|
||||
import com.tiedup.remake.v2.bondage.datadriven.DataDrivenBondageItem;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
@@ -227,9 +230,18 @@ public class StruggleCollar extends StruggleState {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get resistance (V1 and V2 via IHasResistance)
|
||||
// Get resistance — V2: read ResistanceComponent directly (avoids MAX-scan bug),
|
||||
// V1: use IHasResistance.getBaseResistance()
|
||||
if (!(collar.getItem() instanceof IHasResistance resistanceItem)) return;
|
||||
int baseResistance = resistanceItem.getBaseResistance(target);
|
||||
int baseResistance;
|
||||
ResistanceComponent comp = DataDrivenBondageItem.getComponent(
|
||||
collar, ComponentType.RESISTANCE, ResistanceComponent.class
|
||||
);
|
||||
if (comp != null) {
|
||||
baseResistance = comp.getBaseResistance();
|
||||
} else {
|
||||
baseResistance = resistanceItem.getBaseResistance(target);
|
||||
}
|
||||
int currentResistance = resistanceItem.getCurrentResistance(collar, target);
|
||||
|
||||
// Only tighten if current resistance is lower than base
|
||||
|
||||
Reference in New Issue
Block a user