-
Posts
1061 -
Joined
-
Last visited
Posts posted by NovaViper
-
-
Uh... how do you add the entity renderer in 1.8.9? I notice that you need a renderer class that has IRenderFactory. How do I make such a class for this? My code so far:
Render
package novaviper.tetracraft.client.render.entity; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.util.ResourceLocation; import novaviper.tetracraft.common.entity.EntityTerrakon; import novaviper.tetracraft.client.lib.TextureReference; /** * Created by NovaViper on 3/1/2016. * Class Purpose: */ public class RenderTerrakon extends RenderLiving<EntityTerrakon> { protected ResourceLocation terrakonTexture; public RenderTerrakon(RenderManager renderManager, ModelBase modelBase, float shadowSize) { super(renderManager, modelBase, shadowSize); setEntityTexture(); } @Override protected void preRenderCallback(EntityTerrakon entity, float f) { preRenderCallbackSerpent((EntityTerrakon) entity, f); } protected void preRenderCallbackSerpent(EntityTerrakon entity, float f) { // some people do some G11 transformations or blends here, like you can do // GL11.glScalef(2F, 2F, 2F); to scale up the entity // which is used for Slime entities. I suggest having the entity cast to // your custom type to make it easier to access fields from your // custom entity, eg. GL11.glScalef(entity.scaleFactor, entity.scaleFactor, // entity.scaleFactor); } protected void setEntityTexture() { terrakonTexture = TextureReference.terrakon; } @Override protected ResourceLocation getEntityTexture(EntityTerrakon entity) { return terrakonTexture; } }
ClientProxy
package novaviper.tetracraft.client.proxy; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumParticleTypes; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import novaviper.tetracraft.common.lib.Registers; import novaviper.tetracraft.common.proxy.CommonProxy; import novaviper.tetracraft.main.ModBlocks; import novaviper.tetracraft.main.ModItems; import novaviper.tetracraft.client.model.*; import novaviper.tetracraft.common.entity.*; import novaviper.tetracraft.client.render.entity.*; /** * Created by NovaViper on 2/6/2016. * Class Purpose: Loads stuff on the client side */ public class ClientProxy extends CommonProxy { // Client Objects\\ @Override public void registerRenderThings() { ModBlocks.loadRenderers(); ModItems.loadRenderers(); ModItems.loadVariants(); RenderManager renderManager = Minecraft.getMinecraft().getRenderManager(); RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); Registers.addEntityRender(EntityTerrakon(), new RenderTerrakon(renderManager, new ModelTerrakon(), 0.5F)); } @Override public void registerMoreThings() {} // Client Objects\\ @Override public EntityPlayer getPlayerEntity(MessageContext ctx) { return (ctx.side.isClient() ? Minecraft.getMinecraft().thePlayer : super.getPlayerEntity(ctx)); } @Override public EntityPlayer getPlayerEntity() { return Minecraft.getMinecraft().thePlayer; } @Override public void spawnCrit(World world, Entity entity) { FMLClientHandler.instance().getClient().effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT); } @Override public void spawnRoar(World world, Entity entity) { FMLClientHandler.instance().getClient().effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.SPELL_WITCH); FMLClientHandler.instance().getClient().effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT); } }
Register
public static void addEntityRender(Class entityClass, IRenderFactory render) { RenderingRegistry.registerEntityRenderingHandler(entityClass, render); }
-
I got Tabula to work, I placed both mods in the folder and it finally worked
-
There wasn't an error and I finally got the game to read the mods
-
I do have a clean instance of 1.8.. but the game never even loads it up.
-
I don't want to use the System.out.print, I want to use the Log Helper class I made so i can have the mod's name next to it as well as the progress percent of the loading (I want to automatic like the World Generation loading progess)
-
Read Ichun's tutorials, it takes his core mod as well to run tabula
I've looked and still haven't found a tutorial or solution to run it
-
Is it possible to make a progression bar (Like how the game makes when the world is loading)?
-
If you want to fire arrows continuously but still have the player draw back the bow, it may be better to fire them from
Item#onItemUseFinish
and
Item#onPlayerStoppedUsing
instead of from
Item#onItemRightClick
with a cooldown.
I've written an example of this here (parent class).
I tried out the methods you made and they work perfectly (I did put your name next to them so I won't steal the credit from you)
-
Alright, I got the method in but I can't seem to get the timing of the textures correct
-
Sorry for taking a while to respond, been busy and I put the method in but still having texture issues
package novaviper.tetracraft.common.item; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.init.Items; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagLong; import net.minecraft.stats.StatList; import net.minecraft.world.World; import novaviper.tetracraft.common.lib.ModelJsonReference; /** * Created by NovaViper on 2/12/2016. * Class Purpose: */ public class ItemContinousBow extends ItemModBow{ int fireRate; //int using; public ItemContinousBow(String unlocalizedName, CreativeTabs tab, String type, int damage, int fireRate) { super(unlocalizedName, tab, type, damage); this.fireRate = fireRate; } /** * Has it been at least FIRE_RATE ticks since thebowr was last used? * * @param stack The launcher ItemStack * @param world The World to check the time against * @return True if the ItemStack was last used at least FIRE_RATE ticks ago or if it has never been used */ private boolean isOffCooldown(ItemStack stack, World world) { return !stack.hasTagCompound() || (world.getTotalWorldTime() - stack.getTagCompound().getLong("lastUsage")) >=fireRate; } /** * Set thbower's last use time to the specified time. * * @param stack Thbower ItemStack * @param time The time */ private void setLastUsage(ItemStack stack, long time) { stack.setTagInfo("lastUsage", new NBTTagLong(time)); } /** * Does the player need ammunition to fire tbowsher? * * @param stack Tbowher ItemStack * @param player The player to check * @return True if the player is not in creative mode and the launcher doesn't have the Infinity enchantment */ private boolean playerNeedsAmmo(ItemStack stack, EntityPlayer player) { return !player.capabilities.isCreativeMode && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) == 0; } /** * How long it takes to use or consume an item */ @Override public int getMaxItemUseDuration(ItemStack stack){return 10;} /** * returns the action that specifies what animation to play when the items is being used */ @Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.BOW; } @Override public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) { ModelResourceLocation modelresourcelocation = new ModelResourceLocation(ModelJsonReference.getBowStandbyModel(bowType), "inventory"); //System.out.println(player.getItemInUse() +":" + useRemaining); //USE FOR DEBUGGING ONLY if (stack.getItem() == this && isOffCooldown(stack, player.getEntityWorld() )) { if (useRemaining >= 9) { modelresourcelocation = new ModelResourceLocation(ModelJsonReference.getBowPullingModel(bowType, "0"), "inventory"); } else if (useRemaining > 6) { modelresourcelocation = new ModelResourceLocation(ModelJsonReference.getBowPullingModel(bowType, "1"), "inventory"); } else if (useRemaining <= 4 || useRemaining >= 3) { modelresourcelocation = new ModelResourceLocation(ModelJsonReference.getBowPullingModel(bowType, "2"), "inventory"); } } return modelresourcelocation; } /** * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer */ @Override public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) { boolean offCooldown = isOffCooldown(itemStackIn, worldIn); boolean needsAmmo = playerNeedsAmmo(itemStackIn, playerIn); { if (offCooldown && (!needsAmmo || playerIn.inventory.consumeInventoryItem(Items.arrow))) { setLastUsage(itemStackIn, worldIn.getTotalWorldTime()); playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, itemStackIn, fireRate); if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return null; int charge = event.charge + 15; float charge2 = (float) charge / 20.0F; charge2 = (charge2 * charge2 + charge2 * 2.0F) / 3.0F; if ((double) charge2 < 0.1D) { return null; } if (charge2 > 1.0F) { charge2 = 1.0F; } EntityArrow entityarrow = new EntityArrow(worldIn, playerIn, charge2 * 2.0F); int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, itemStackIn); entityarrow.setIsCritical(true); if (j > 0) { entityarrow.setDamage(entityarrow.getDamage() + (double) j * 0.5D + 0.5D); } int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, itemStackIn); if (k > 0) { entityarrow.setKnockbackStrength(k); } if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, itemStackIn) > 0) { entityarrow.setFire(100); } itemStackIn.damageItem(1, playerIn); worldIn.playSoundAtEntity(playerIn, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + charge2 * 0.5F); playerIn.triggerAchievement(StatList.objectUseStats[item.getIdFromItem(this)]); if (!worldIn.isRemote) { worldIn.spawnEntityInWorld(entityarrow); } } } return itemStackIn; } }
-
Yeah, I tried 1.8.9 and 1.8
-
I'm using the setUsage method like the one in your rocket launcher, do I use the data from the methods I used?
-
Ah, ok. I thought I could make the textures load like normal bows but just quicker
-
Alright.. I got everything up, now I need help modding the textures
package novaviper.tetracraft.common.item; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.init.Items; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagLong; import net.minecraft.stats.StatList; import net.minecraft.world.World; import novaviper.tetracraft.common.lib.ModelJsonReference; /** * Created by NovaViper on 2/12/2016. * Class Purpose: */ public class ItemContinousBow extends ItemModBow{ int fireRate; public ItemContinousBow(String unlocalizedName, CreativeTabs tab, String type, int damage, int fireRate) { super(unlocalizedName, tab, type, damage); this.fireRate = fireRate; } /** * Has it been at least FIRE_RATE ticks since thebowr was last used? * * @param stack The launcher ItemStack * @param world The World to check the time against * @return True if the ItemStack was last used at least FIRE_RATE ticks ago or if it has never been used */ private boolean isOffCooldown(ItemStack stack, World world) { return !stack.hasTagCompound() || (world.getTotalWorldTime() - stack.getTagCompound().getLong("lastUsage")) >=fireRate; } /** * Set thbower's last use time to the specified time. * * @param stack Thbower ItemStack * @param time The time */ private void setLastUsage(ItemStack stack, long time) { stack.setTagInfo("lastUsage", new NBTTagLong(time)); } /** * Does the player need ammunition to fire tbowsher? * * @param stack Tbowher ItemStack * @param player The player to check * @return True if the player is not in creative mode and the launcher doesn't have the Infinity enchantment */ private boolean playerNeedsAmmo(ItemStack stack, EntityPlayer player) { return !player.capabilities.isCreativeMode && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) == 0; } /** * How long it takes to use or consume an item */ @Override public int getMaxItemUseDuration(ItemStack stack){return 0;} /** * returns the action that specifies what animation to play when the items is being used */ @Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.BOW; } @Override public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) { ModelResourceLocation modelresourcelocation = new ModelResourceLocation(ModelJsonReference.getBowStandbyModel(bowType), "inventory"); //System.out.println(player.getItemInUse() +":" + useRemaining); //USE FOR DEBUGGING ONLY if (stack.getItem() == this && player.getItemInUse() != null) { if (useRemaining >= 71987) { modelresourcelocation = new ModelResourceLocation(ModelJsonReference.getBowPullingModel(bowType, "0"), "inventory"); } else if (useRemaining > 71980) { modelresourcelocation = new ModelResourceLocation(ModelJsonReference.getBowPullingModel(bowType, "1"), "inventory"); } else if (useRemaining <= 71976 || useRemaining >= 71976) { modelresourcelocation = new ModelResourceLocation(ModelJsonReference.getBowPullingModel(bowType, "2"), "inventory"); } } return modelresourcelocation; } /** * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer */ @Override public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) { boolean offCooldown = isOffCooldown(itemStackIn, worldIn); boolean needsAmmo = playerNeedsAmmo(itemStackIn, playerIn); { if (offCooldown && (!needsAmmo || playerIn.inventory.consumeInventoryItem(Items.arrow))) { setLastUsage(itemStackIn, worldIn.getTotalWorldTime()); net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, itemStackIn, fireRate); if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return null; int charge = event.charge + 15; float charge2 = (float) charge / 20.0F; charge2 = (charge2 * charge2 + charge2 * 2.0F) / 3.0F; if ((double) charge2 < 0.1D) { return null; } if (charge2 > 1.0F) { charge2 = 1.0F; } EntityArrow entityarrow = new EntityArrow(worldIn, playerIn, charge2 * 2.0F); int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, itemStackIn); entityarrow.setIsCritical(true); if (j > 0) { entityarrow.setDamage(entityarrow.getDamage() + (double) j * 0.5D + 0.5D); } int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, itemStackIn); if (k > 0) { entityarrow.setKnockbackStrength(k); } if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, itemStackIn) > 0) { entityarrow.setFire(100); } itemStackIn.damageItem(1, playerIn); worldIn.playSoundAtEntity(playerIn, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + charge2 * 0.5F); playerIn.triggerAchievement(StatList.objectUseStats[item.getIdFromItem(this)]); if (!worldIn.isRemote) { worldIn.spawnEntityInWorld(entityarrow); } } } return itemStackIn; } }
-
I put in my mods folder but it never initalizes or runs
-
I was asking about the usage time for the charge, the default one takes the maxUse and subtracts it by the time. Do I use the worldTime instead of the useTime?
-
And another question, when using MagicaVoxel and Sketch, they can export files as .obj files. Are those file types supported yet? Also.. how would I texture the models?
-
Hey guys, what about this program called SketchUp? I used this before to make a a dog to be 3D printed.
-
dude,use voxel magica,is the easiest obj modeler,very user friendly,and free
i think monument valley was created using this
Also.. is this made for creating entites? MagicaVoxel looks like its made for blocks
-
You mean like techne?
Yes it is a mod called Tabula now, it works for 1.8
I tried using Tabula, it doesn't want to start up
dude,use voxel magica,is the easiest obj modeler,very user friendly,and free
i think monument valley was created using this
It looks interesting and just about what I want.. but Im having issues trying to make the frame larger
-
What do I do with the other events in the arrow? So far I have the code like this but I'm not sure wthat to do with the rest
package novaviper.tetracraft.common.item; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.init.Items; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagLong; import net.minecraft.stats.StatList; import net.minecraft.world.World; /** * Created by NovaViper on 2/12/2016. * Class Purpose: */ public class ItemContinousBow extends ItemModBow{ int fireRate; public ItemContinousBow(String unlocalizedName, CreativeTabs tab, String type, int damage, int fireRate) { super(unlocalizedName, tab, type, damage); this.fireRate = fireRate; } /** * Has it been at least FIRE_RATE ticks since the bow was last used? * * @param stack The launcher ItemStack * @param world The World to check the time against * @return True if the ItemStack was last used at least FIRE_RATE ticks ago or if it has never been used */ private boolean isOffCooldown(ItemStack stack, World world) { return !stack.hasTagCompound() || (world.getTotalWorldTime() - stack.getTagCompound().getLong("lastUsage")) >= fireRate; } /** * Set the bow's last use time to the specified time. * * @param stack The bow ItemStack * @param time The time */ private void setLastUsage(ItemStack stack, long time) { stack.setTagInfo("lastUsage", new NBTTagLong(time)); } /** * Does the player need ammunition to fire the bows? * * @param stack The bow ItemStack * @param player The player to check * @return True if the player is not in creative mode and the launcher doesn't have the Infinity enchantment */ private boolean playerNeedsAmmo(ItemStack stack, EntityPlayer player) { return !player.capabilities.isCreativeMode && EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) == 0; } /** * How long it takes to use or consume an item */ @Override public int getMaxItemUseDuration(ItemStack stack) { return 20; } /** * returns the action that specifies what animation to play when the items is being used */ @Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.BOW; } /** * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer */ @Override public ItemStack onItemRightClick(ItemStack stack, World worldIn, EntityPlayer playerIn) { boolean cooldownOfff = isOffCooldown(stack, worldIn); boolean needsAmmo = playerNeedsAmmo(stack, playerIn); { if (cooldownOfff && (!needsAmmo || playerIn.inventory.consumeInventoryItem(Items.arrow))) { setLastUsage(stack, worldIn.getTotalWorldTime()); net.minecraftforge.event.entity.player.ArrowLooseEvent event = new net.minecraftforge.event.entity.player.ArrowLooseEvent(playerIn, stack, i); if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return null; i = event.charge; float f = (float) i / 20.0F; f = (f * f + f * 2.0F) / 3.0F; if ((double) f < 0.1D) { return null; } if (f > 1.0F) { f = 1.0F; } EntityArrow entityarrow = new EntityArrow(worldIn, playerIn, f * 2.0F); if (f == 1.0F) { entityarrow.setIsCritical(true); } int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack); if (j > 0) { entityarrow.setDamage(entityarrow.getDamage() + (double) j * 0.5D + 0.5D); } int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack); if (k > 0) { entityarrow.setKnockbackStrength(k); } if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0) { entityarrow.setFire(100); } stack.damageItem(1, playerIn); worldIn.playSoundAtEntity(playerIn, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); if (flag) { entityarrow.canBePickedUp = 2; } else { playerIn.inventory.consumeInventoryItem(Items.arrow); } playerIn.triggerAchievement(StatList.objectUseStats[item.getIdFromItem(this)]); if (!worldIn.isRemote) { worldIn.spawnEntityInWorld(entityarrow); } } } return stack; } }
-
Ok.. I got the method changed and got it continously firing.. Now how do I decrease that firing rate? I want it like the Draconic Bow in Draconic Evolution?
-
And does Tabula work with 1.8.9?
-
Oh? I thought that software died off. I'll try that also.. oh.. I'm having a bit of trouble using Blender, not sure how I can move around the editor
[SOLVED][1.8.9] Need Help Adding Custom Entites
in Modder Support
Posted
I tried that, it just crashes with this error