slimeBoots and slimeSling (#93)

* slimeBoots and slimeSling

* changed items directories and some code
* slime sling now with durability (100)
* boots now reduce bounce instead of increasing it
* added vanilla recipes

* fix slimeSling and Slime Boots
* removed debug logs
* Reduced bounce distance to 20 blocks (up or away)
* small fixes
* structural recovery as was
* add 100 durability to slime sling and slime boots
* bs
This commit is contained in:
Quetz4l authored and GitHub committed 2023-09-09 19:42:05 +02:00
1 parent 9120091823
commit f7c6a9ecaf
6 files changed
+95 -114

No files matched your search

@@ -11,7 +11,6 @@ import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import tconstruct.gadgets.TinkerGadgets;
import tconstruct.gadgets.item.ItemSlimeBoots;
/** Logic for entities bouncing */
@@ -36,16 +35,6 @@ public class SlimeBounceHandler {
}
}
private SlimeBounceHandler() {
TinkerGadgets.log.info("Created instance of Bounce Handler.");
}
/** Registers event handlers */
public static void init() {
TinkerGadgets.log.info("Registering Bounce Handler.");
registerEvent(new SlimeBounceHandler());
}
/**
* Preserves entity air momentum
*
@@ -71,9 +60,7 @@ public class SlimeBounceHandler {
if (hasSlimeBoots(entity)) {
if (info == null) {
BOUNCING_ENTITIES.put(entity, new BounceInfo(entity, bounce));
TinkerGadgets.log.info("Created new BounceInfo for " + entity.getCommandSenderName());
} else if (bounce != 0) {
TinkerGadgets.log.info("Updating Bounce data?");
// updated bounce if needed
info.bounce = bounce;
// add one to the tick as there is a 1 tick delay between falling and ticking
@@ -98,33 +85,27 @@ public class SlimeBounceHandler {
if (entity != null) {
BounceInfo info = BOUNCING_ENTITIES.get(entity);
// TinkerGadgets.log.info("Bounce Data valid? "+(info != null));
// if we have info for this entity, time to work
if (info != null) {
// TinkerGadgets.log.info("Found Bounce Data in tick handler.");
// if flying, nothing to do
if (entity.isDead || entity.noClip) {
// TinkerGadgets.log.info("Removing Bounce Data.");
BOUNCING_ENTITIES.remove(entity);
return;
}
if (!hasSlimeBoots(entity)) {
// TinkerGadgets.log.info("Removing Bounce Data. No Boots.");
BOUNCING_ENTITIES.remove(entity);
return;
}
// if its the bounce tick, time to bounce. This is to circumvent the logic that
// if it's the bounce tick, time to bounce. This is to circumvent the logic that
// resets y motion after landing
if (entity.ticksExisted == info.bounceTick) {
TinkerGadgets.log.info("Bounce Tick?");
entity.motionY = info.bounce;
info.bounceTick = 0;
}
boolean isInAir = !entity.onGround && !entity.isInWater() && !entity.isOnLadder();
// TinkerGadgets.log.info("In Air? "+isInAir);
// preserve motion
if (isInAir && info.lastMagSq > 0) {
// figure out how much motion has reduced
@@ -157,23 +138,18 @@ public class SlimeBounceHandler {
}
}
}
// TinkerGadgets.log.info("Did things? 1");
// timing the effect out
if (info.wasInAir && !isInAir) {
if (info.endHandler == 0) {
info.endHandler = entity.ticksExisted + 5;
} else if (entity.ticksExisted > info.endHandler) {
// TinkerGadgets.log.info("Removing Bounce Data for "+entity.getCommandSenderName());
BOUNCING_ENTITIES.remove(entity);
}
} else {
info.endHandler = 0;
info.wasInAir = true;
}
// TinkerGadgets.log.info("Did things? 2");
} else {
// TinkerGadgets.log.info("Bad Bounce Data.");
}
}
}
@@ -187,7 +163,6 @@ public class SlimeBounceHandler {
for (int i = 1; i < 5; i++) {
ItemStack aBoots = entity.getEquipmentInSlot(i);
if (aBoots != null && aBoots.getItem() instanceof ItemSlimeBoots) {
// TinkerGadgets.log.info("Found boots in slot "+i);
return true;
}
}