Make handling of curios centralized and add handling for no curios (#2913)

Minor fixes to cosmetic bauble rendering (GL stack overflows),
include the missed belt in belt curios
This commit is contained in:
Hubry authored and Vincent Lee committed 2019-06-24 18:45:59 -07:00
1 parent 2f3a1935cf
commit 05c88fd62a
45 files changed
+1334 -1461

No files matched your search

@@ -14,8 +14,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraftforge.fml.network.NetworkEvent;
import vazkii.botania.common.Botania;
import vazkii.botania.common.integration.curios.CurioIntegration;
import vazkii.botania.common.core.handler.EquipmentHandler;
import vazkii.botania.common.item.equipment.bauble.ItemCloudPendant;
import vazkii.botania.common.item.equipment.bauble.ItemTravelBelt;
@@ -32,16 +31,14 @@ public class PacketJump {
ctx.get().enqueueWork(() -> {
EntityPlayerMP player = ctx.get().getSender();
if(Botania.curiosLoaded) {
ItemStack amuletStack = CurioIntegration.findOrEmpty(s -> s.getItem() instanceof ItemCloudPendant, player);
if(!amuletStack.isEmpty()) {
player.addExhaustion(0.3F);
player.fallDistance = 0;
ItemStack amuletStack = EquipmentHandler.findOrEmpty(s -> s.getItem() instanceof ItemCloudPendant, player);
if(!amuletStack.isEmpty()) {
player.addExhaustion(0.3F);
player.fallDistance = 0;
ItemStack belt = CurioIntegration.findOrEmpty(s -> s.getItem() instanceof ItemTravelBelt, player);
if(!belt.isEmpty())
player.fallDistance = -((ItemTravelBelt) belt.getItem()).fallBuffer * ((ItemCloudPendant) amuletStack.getItem()).getMaxAllowedJumps();
}
ItemStack belt = EquipmentHandler.findOrEmpty(s -> s.getItem() instanceof ItemTravelBelt, player);
if(!belt.isEmpty())
player.fallDistance = -((ItemTravelBelt) belt.getItem()).fallBuffer * ((ItemCloudPendant) amuletStack.getItem()).getMaxAllowedJumps();
}
});
ctx.get().setPacketHandled(true);