Created
February 18, 2017 15:02
-
-
Save anonymous/5bf4cc6042dd370368af6370afa35415 to your computer and use it in GitHub Desktop.
cap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package loordgek.extragenarators.api.cap; | |
import net.minecraft.entity.Entity; | |
import net.minecraft.entity.player.EntityPlayer; | |
import net.minecraft.util.ResourceLocation; | |
import net.minecraftforge.event.AttachCapabilitiesEvent; | |
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | |
public class event { | |
@SubscribeEvent | |
public void onAttachCapabilities(AttachCapabilitiesEvent<Entity> event) { | |
if (event.getObject() instanceof EntityPlayer){ | |
event.addCapability( new ResourceLocation(yourmodid and a name), new yourcap((EntityPlayer)event.getObject())); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package loordgek.extragenarators.api.cap; | |
import net.minecraft.entity.player.EntityPlayer; | |
import net.minecraft.util.EnumFacing; | |
import net.minecraftforge.common.capabilities.Capability; | |
import net.minecraftforge.common.capabilities.ICapabilityProvider; | |
import javax.annotation.Nullable; | |
public class yourcap implements ICapabilityProvider { | |
private final EntityPlayer player; | |
public yourcap(EntityPlayer player) { | |
this.player = player; | |
} | |
@Override | |
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) { | |
return false; | |
} | |
@Override | |
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) { | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment