Attempt to fix 1.16.3 branch's issues on the repository
Added the original 'wayoftime' folder back, so see if that fixed the multiple folder issue.
This commit is contained in:
parent
6b4145a67c
commit
9fa68e86ae
224 changed files with 24047 additions and 0 deletions
|
@ -0,0 +1,73 @@
|
|||
package wayoftime.bloodmagic.util.handler.event;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.core.data.Binding;
|
||||
import wayoftime.bloodmagic.core.data.SoulNetwork;
|
||||
import wayoftime.bloodmagic.event.ItemBindEvent;
|
||||
import wayoftime.bloodmagic.iface.IBindable;
|
||||
import wayoftime.bloodmagic.orb.BloodOrb;
|
||||
import wayoftime.bloodmagic.orb.IBloodOrb;
|
||||
import wayoftime.bloodmagic.util.helper.BindableHelper;
|
||||
import wayoftime.bloodmagic.util.helper.NetworkHelper;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = BloodMagic.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class GenericHandler
|
||||
{
|
||||
// Handles binding of IBindable's as well as setting a player's highest orb tier
|
||||
@SubscribeEvent
|
||||
public void onInteract(PlayerInteractEvent.RightClickItem event)
|
||||
{
|
||||
if (event.getWorld().isRemote)
|
||||
return;
|
||||
|
||||
PlayerEntity player = event.getPlayer();
|
||||
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return;
|
||||
|
||||
ItemStack held = event.getItemStack();
|
||||
if (!held.isEmpty() && held.getItem() instanceof IBindable)
|
||||
{ // Make sure it's bindable
|
||||
IBindable bindable = (IBindable) held.getItem();
|
||||
Binding binding = bindable.getBinding(held);
|
||||
if (binding == null)
|
||||
{ // If the binding is null, let's create one
|
||||
if (bindable.onBind(player, held))
|
||||
{
|
||||
ItemBindEvent toPost = new ItemBindEvent(player, held);
|
||||
if (MinecraftForge.EVENT_BUS.post(toPost)) // Allow cancellation of binding
|
||||
return;
|
||||
|
||||
BindableHelper.applyBinding(held, player); // Bind item to the player
|
||||
}
|
||||
// If the binding exists, we'll check if the player's name has changed since
|
||||
// they last used it and update that if so.
|
||||
} else if (binding.getOwnerId().equals(player.getGameProfile().getId())
|
||||
&& !binding.getOwnerName().equals(player.getGameProfile().getName()))
|
||||
{
|
||||
binding.setOwnerName(player.getGameProfile().getName());
|
||||
BindableHelper.applyBinding(held, binding);
|
||||
}
|
||||
}
|
||||
|
||||
if (!held.isEmpty() && held.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
IBloodOrb bloodOrb = (IBloodOrb) held.getItem();
|
||||
SoulNetwork network = NetworkHelper.getSoulNetwork(player);
|
||||
|
||||
BloodOrb orb = bloodOrb.getOrb(held);
|
||||
if (orb == null)
|
||||
return;
|
||||
|
||||
if (orb.getTier() > network.getOrbTier())
|
||||
network.setOrbTier(orb.getTier());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue