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
/** | |
* Creates the given item with randomized attributes and such. | |
* @param stack | |
* @param player | |
*/ | |
public static void createWeapon(ItemStack stack, EntityPlayer player) | |
{ | |
NBTTagCompound nbt = NBTHelper.loadStackNBT(stack); | |
IPlayerInformation playerInfo = player.getCapability(CapabilityPlayerInformation.PLAYER_INFORMATION, null); |
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
@SubscribeEvent | |
public void onPlayerTick(PlayerTickEvent event) | |
{ | |
if (!event.player.getEntityWorld().isRemote) | |
{ | |
if (event.phase == Phase.START) | |
{ | |
for (ItemStack stack : event.player.inventory.mainInventory) | |
{ | |
if (stack != null && stack.getItem() instanceof ItemSword) |
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
// retrieves the default attributes, like damage and attack speed. | |
Multimap<String, AttributeModifier> map = stack.getAttributeModifiers(EntityEquipmentSlot.MAINHAND); | |
Collection<AttributeModifier> damageCollection = map.get(SharedMonsterAttributes.ATTACK_DAMAGE.getName()); | |
Collection<AttributeModifier> speedCollection = map.get(SharedMonsterAttributes.ATTACK_SPEED.getName()); | |
AttributeModifier damageModifier = (AttributeModifier) damageCollection.toArray()[0]; | |
AttributeModifier speedModifier = (AttributeModifier) speedCollection.toArray()[0]; | |
double baseDamage = damageModifier.getAmount() + 1; // add one to base damage for player strength | |
double baseSpeed = speedModifier.getAmount(); | |
double damage = getWeightedDamage(Rarity.getRarity(nbt), baseDamage); |
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
RenderingRegistry.registerEntityRenderingHandler(YourEntityClass.class, new IRenderFactory() | |
{ | |
@Override | |
public Render<? super YourEntityClass> createRenderFor(RenderManager manager) | |
{ | |
return new YourEntityRender(manager); | |
} | |
}); |
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
@Override | |
public IMessage onMessage(final PacketEnemyLevel message, MessageContext ctx) | |
{ | |
IThreadListener mainThread = Minecraft.getMinecraft(); | |
mainThread.addScheduledTask(new Runnable() | |
{ | |
@Override | |
public void run() | |
{ | |
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(message.entityID); |
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
player.worldObj.playSound(player, player.getPosition(), SoundEvents.ENTITY_ENDERDRAGON_DEATH, player.getSoundCategory(), 0.8F, 1.0F); |
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
// you had "me.DommiHD.Testmod" instead of TestMod | |
@SidedProxy(clientSide="me.DommiHD.TestMod.Proxies.TestModClientProxy", serverSide="me.DommiHD.TestMod.Proxies.TestModProxy") | |
public static TestModProxy proxy; |
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
public class EventItemCrafted | |
{ | |
@SubscribeEvent | |
public void onItemCrafted(ItemCraftedEvent event) | |
{ | |
ItemStack stack = event.crafting; | |
NBTTagCompound nbt = stack.getTagCompound(); | |
if (stack.getItem() instanceof ItemSword) | |
{ |
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
//used to cool down the mummy spawning | |
public int coolDown = 100; | |
public int count = 0; | |
/** | |
* Updates every tick the Pharoah is alive. Once the cool | |
* down has finished, the Pharoah will spawn a mummy at | |
* its coordinates. The cool down then resets, and will | |
* tick down again and repeat. | |
*/ |
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
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) | |
{ | |
super.render(entity, f, f1, f2, f3, f4, f5); | |
float scaleFactor = 0.4F; // determines the scale of the entity. Mess with this to find the right size. | |
GL11.glPushMatrix(); | |
GL11.glTranslatef(0.0F, 1.5F - 1.5F * scaleFactor, 0.0F); | |
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); | |
// render code |
NewerOlder