Remove build artifacts, dev tool configs, unused dependencies, and third-party source dumps. Add proper README, update .gitignore, clean up Makefile.
61 lines
1.7 KiB
Java
61 lines
1.7 KiB
Java
package com.tiedup.remake.items;
|
|
|
|
import com.tiedup.remake.state.IRestrainable;
|
|
import com.tiedup.remake.util.KidnappedHelper;
|
|
import net.minecraft.world.entity.LivingEntity;
|
|
import net.minecraft.world.item.ItemStack;
|
|
|
|
/**
|
|
* Automatic Shock Collar - Shocks the wearer at regular intervals.
|
|
*
|
|
* Phase 14.1.5: Refactored to support IRestrainable (LivingEntity + NPCs)
|
|
*
|
|
* <p>Mechanics:</p>
|
|
* <ul>
|
|
* <li><b>Self-Triggering:</b> Has an internal timer stored in NBT that shocks the entity when it reaches 0.</li>
|
|
* <li><b>Unstruggable:</b> By default, cannot be escaped via struggle mechanics (requires key).</li>
|
|
* </ul>
|
|
*/
|
|
public class ItemShockCollarAuto extends ItemShockCollar {
|
|
|
|
private final int interval;
|
|
|
|
/**
|
|
* @param interval Frequency of shocks in TICKS (20 ticks = 1 second).
|
|
*/
|
|
public ItemShockCollarAuto() {
|
|
this(600); // 30 seconds default
|
|
}
|
|
|
|
public ItemShockCollarAuto(int interval) {
|
|
super();
|
|
this.interval = interval;
|
|
}
|
|
|
|
public int getInterval() {
|
|
return interval;
|
|
}
|
|
|
|
/**
|
|
* Ensures the internal shock timer is cleaned up when the item is removed.
|
|
*
|
|
* Phase 14.1.5: Refactored to support IRestrainable (LivingEntity + NPCs)
|
|
*/
|
|
@Override
|
|
public void onUnequipped(ItemStack stack, LivingEntity entity) {
|
|
IRestrainable state = KidnappedHelper.getKidnappedState(entity);
|
|
if (state != null) {
|
|
state.resetAutoShockTimer();
|
|
}
|
|
super.onUnequipped(stack, entity);
|
|
}
|
|
|
|
/**
|
|
* Prevents escaping through struggle mechanics for this specific collar type.
|
|
*/
|
|
@Override
|
|
public boolean canBeStruggledOut(ItemStack stack) {
|
|
return false;
|
|
}
|
|
}
|