Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/03/17 in all areas

  1. A ticking TileEntity or a TileEntity with a TESR are probably your best options here.
    1 point
  2. Only if you want to either: a) test in the development environment b) using an exposed API You need to add dependencies = "required-after:..." or dependencies = "after:..." depending on hard or soft dependencies ("after" just loads your mod later, "required-after" means that the other mod MUST be present or your mod can't load). Technically, nothing, but you should add a "dependencies": ["..."] for any hard dependencies If your not using an exposed API, nothing. Otherwise find and follow the directions in the dependencies block. The former uses if(Loader.isModLoaded(...)) to control logic (e.g. recipes) of itself. The latter uses API calls. For example: this. See above The @Optional annotation can allow you to move a hard-dependency to a soft-dependency. The only example I have is from 1.7.10 and I think the package changed.
    1 point
  3. RegistryEvent.Register<SoundEvent> is fired on both physical sides, not just the physical client. If the registry is empty on the server, something is wrong. Post your registration code.
    1 point
  4. I think you'll need to store the powered state in the block state or the TileEntity and use that on the client instead of using World#isBlockPowered directly. Look at BlockRedstoneLight for an example of this (though it unnecessarily uses two Blocks instead of a property).
    1 point
  5. Lightmaps are not 3d. The first argument is a texture unit target to apply the coordinates to.
    1 point
  6. You can use Store the previous coordinates in locals(the current coordinates are stored in OpenGlHelper.lastBrightnessX and OpenGlHelper.lastBrightnessY), set the coordinates to whatever you want, render your thing and reset them back. The target parameter for OpenGlHelper.setLightmapTextureCoords would be OpenGlHelper.lightmapTexUnit
    1 point
  7. Your format is POSITION_COLOR. It doesn't specify a lightmap.
    1 point
  8. Have you heard of gradients? How do you think they work? The color is a property of a vertex, aka a point. If you define a point with a red color and a point with a green color the color of the line drawn between those two points will be linearly interpolated. You put it after you define a vertex. When you call pos you define a position element of a vertex. When you call color you define another element of a vertex. wr.pos(0, 0, 0).color(100, 100, 100, 255).endVertex(); is a fully defined position + color vertex. You would either select a vertex format that uses lightmap as one of it's vertex elements or manualy set it with OpenGlHelper.setLightmapTextureCoords. If you use the later do not forget to reset it back. Additionally if your vertex format does not include UVs(texture) disable it before rendering(GlStateManager.disableTexture2D) and enable it after you are done.
    1 point
  9. package com.awex; import com.awex.tabs.MaterialTab; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import com.awex.proxy.CommonProxy; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraftforge.common.util.EnumHelper; @Mod(modid = Main.MODID, version = Main.VERSION) public class Main { public static final String MODID = "awex"; public static final String VERSION = "1.0.1"; public static final MaterialTab creativeTabMaterial = new MaterialTab(); /** * ============== * Tools Sections * ============== */ public static final Item.ToolMaterial AluminiumToolMaterial = EnumHelper.addToolMaterial("aluminiumToolMaterial", 2, 512, 5.0F, 1.0F, 14); public static final Item.ToolMaterial TinToolMaterial = EnumHelper.addToolMaterial("tinToolMaterial", 2, 768, 5.0F, 1.4F, 19); public static final Item.ToolMaterial CopperToolMaterial = EnumHelper.addToolMaterial("copperToolMaterial", 2, 1024, 6.0F, 1.8F, 19); public static final Item.ToolMaterial LimoniteToolMaterial = EnumHelper.addToolMaterial("limoniteToolMaterial", 2, 1280, 6.0F, 2.2F, 19); public static final Item.ToolMaterial BronzeToolMaterial = EnumHelper.addToolMaterial("bronzeToolMaterial", 3, 1536, 7.0F, 2.6F, 17); public static final Item.ToolMaterial TungstenToolMaterial = EnumHelper.addToolMaterial("tungstenToolMaterial", 3, 1792, 8.0F, 3.0F, 22); public static final Item.ToolMaterial MagnesiumToolMaterial = EnumHelper.addToolMaterial("magnesiumToolMaterial", 3, 2048, 9.0F, 3.4F, 22); public static final Item.ToolMaterial SteelToolMaterial = EnumHelper.addToolMaterial("steelToolMaterial", 3, 2304, 10.0F, 3.8F, 15); public static final Item.ToolMaterial TitaniumToolMaterial = EnumHelper.addToolMaterial("titaniumToolMaterial", 4, 2560, 11.0F, 4.2F, 20); public static final Item.ToolMaterial PlatinumToolMaterial = EnumHelper.addToolMaterial("platinumToolMaterial", 4, 3072, 12.0F, 4.6F, 22); public static final Item.ToolMaterial NthmetalToolMaterial = EnumHelper.addToolMaterial("nthmetalToolMaterial", 5, 4096, 14.0F, 5.0F, 40); public static ItemArmor.ArmorMaterial HJArmor = EnumHelper.addArmorMaterial("HJArmor", 42, new int[] {5, 10, 8, 4}, 5); /** * ============== * Proxy * ============== */ @SidedProxy(clientSide="com.awex.proxy.ClientProxy", serverSide="com.awex.proxy.ServerProxy") public static CommonProxy proxy; /** * ============== * Initialization * ============== */ @EventHandler public void preInit(FMLPreInitializationEvent e) { proxy.preInit(e); } @EventHandler public void init(FMLInitializationEvent e) { proxy.init(e); } @EventHandler public void postInit(FMLPostInitializationEvent e) { proxy.postInit(e); } /** * ============== * End :) * ============== */ } Main Class ^ package com.awex.proxy; import com.awex.heros.HalJordanModel; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import net.minecraft.client.model.ModelBiped; public class ClientProxy extends CommonProxy { private static final ModelBiped bipedBase = new ModelBiped(0.2F); private static final HalJordanModel haljordan = new HalJordanModel(0.2F); @Override public void preInit(FMLPreInitializationEvent e) { super.preInit(e); } @Override public void init(FMLInitializationEvent e) { super.init(e); } @Override public void postInit(FMLPostInitializationEvent e) { super.postInit(e); } public static ModelBiped getArmorModel(int id) { switch (id) { case 0: return bipedBase; case 1: return haljordan; default: break; } return bipedBase; //default, if whenever you should have passed on a wrong id } } } } ClientProxy ^ package com.awex.heros; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class HalJordanModel extends ModelBiped { public ModelRenderer LeftArm; public ModelRenderer RightLeg; public ModelRenderer Head; public ModelRenderer Torso; public ModelRenderer RightArm; public ModelRenderer LeftLeg; public HalJordanModel(float scale){ super(scale, 0, 64, 64); this.textureWidth = 64; this.textureHeight = 64; this.RightLeg = new ModelRenderer(this, 0, 16); this.RightLeg.mirror = true; this.RightLeg.setRotationPoint(1.9F, 12.0F, 0.0F); this.RightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); this.RightArm = new ModelRenderer(this, 40, 16); this.RightArm.mirror = true; this.RightArm.setRotationPoint(5.0F, 2.0F, 0.0F); this.RightArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F); this.LeftArm = new ModelRenderer(this, 40, 16); this.LeftArm.setRotationPoint(-5.0F, 2.0F, 0.0F); this.LeftArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F); this.LeftLeg = new ModelRenderer(this, 0, 16); this.LeftLeg.setRotationPoint(-1.9F, 12.0F, 0.0F); this.LeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); this.Head = new ModelRenderer(this, 0, 0); this.Head.setRotationPoint(0.0F, 0.0F, 0.0F); this.Head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.0F); this.Torso = new ModelRenderer(this, 16, 16); this.Torso.setRotationPoint(0.0F, 0.0F, 0.0F); this.Torso.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.0F); bipedHeadwear.addChild(Head); bipedHead.addChild(Head); bipedBody.addChild(Torso); bipedLeftArm.addChild(LeftArm); bipedRightArm.addChild(RightArm); bipedLeftLeg.addChild(LeftLeg); bipedRightLeg.addChild(RightLeg); } @Override public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { this.RightLeg.render(f5); this.RightArm.render(f5); this.LeftArm.render(f5); this.LeftLeg.render(f5); this.Head.render(f5); this.Torso.render(f5); } /** * This is a helper function from Tabula to set the rotation of model parts */ public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } } Model File ^ package com.awex.heros; import com.awex.Main; import com.awex.handlers.ArmorHandler; import com.awex.proxy.ClientProxy; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; public class HalJordan extends ItemArmor{ public String textureName; public HalJordan(String unlocalizedName, ArmorMaterial material, String textureName, int type) { super(material, 0, type); this.textureName = textureName; this.setUnlocalizedName(unlocalizedName); this.setTextureName(Main.MODID + ":" + unlocalizedName); } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer) { if (stack.getItem().equals(ArmorHandler.hjHelmet) || stack.getItem().equals(ArmorHandler.hjPlate) || stack.getItem().equals(ArmorHandler.hjBoots)) { return Main.MODID + ":textures/items/armor/HJ.png"; } if (stack.getItem().equals(ArmorHandler.hjLeggings)) { return Main.MODID + ":textures/items/armor/HJ.png"; } else return null; } @Override @SideOnly(Side.CLIENT) public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { ModelBiped armorModel = new ModelBiped(); if (itemStack != null) { if (itemStack.getItem() instanceof HalJordan) { int type = ((ItemArmor) itemStack.getItem()).armorType; if (type == 1 || type == 3) { armorModel = ClientProxy.getArmorModel(1); } else { armorModel = ClientProxy.getArmorModel(1); } } if (armorModel != null) { armorModel.bipedHead.showModel = armorSlot == 0; armorModel.bipedHeadwear.showModel = armorSlot == 0; armorModel.bipedBody.showModel = armorSlot == 1 || armorSlot == 2; armorModel.bipedRightArm.showModel = armorSlot == 1; armorModel.bipedLeftArm.showModel = armorSlot == 1; armorModel.bipedRightLeg.showModel = armorSlot == 2 || armorSlot == 3; armorModel.bipedLeftLeg.showModel = armorSlot == 2 || armorSlot == 3; armorModel.isSneak = entityLiving.isSneaking(); armorModel.isRiding = entityLiving.isRiding(); armorModel.isChild = entityLiving.isChild(); armorModel.heldItemRight = ((EntityPlayer) entityLiving).getCurrentArmor(0) != null ? 1 : 0; // for armorModel.heldItemRight = ((EntityPlayer) entityLiving).getCurrentEquippedItem() != null ? 1 : 0; // for armorModel.aimedBow = false; if ((entityLiving instanceof EntityPlayer)) { if (((EntityPlayer) entityLiving).getItemInUseDuration() > 0) { EnumAction enumaction = ((EntityPlayer) entityLiving).getCurrentEquippedItem() .getItemUseAction(); if (enumaction == EnumAction.block) { armorModel.heldItemRight = 3; } else if (enumaction == EnumAction.bow) { armorModel.aimedBow = true; } } } return armorModel; } } return null; } @Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { if (player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(1) != null && player.getCurrentArmor(0) != null) { if (player.getCurrentArmor(3).getItem().equals(ArmorHandler.hjHelmet) && player.getCurrentArmor(2).getItem().equals(ArmorHandler.hjPlate) && player.getCurrentArmor(1).getItem().equals(ArmorHandler.hjLeggings) && player.getCurrentArmor(0).getItem().equals(ArmorHandler.hjBoots)) { player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 10, 0)); player.fallDistance = 0.0f; } } } } ItemArmor Class ^ http://imgur.com/szxFV7P Located at assets.awex.textures.items.armor Every time I launch and put this armor on it loads very oddly. If I sneak I can see a snippet of the armor, but that's about it. It also doesn't move with the player.
    1 point
  10. Stop making mods for old versions.
    1 point
  11. The root of your repository should be the root directory of your mod, i.e. where build.gradle is. The repository should include the buildscript (build.gradle and gradle.properties [if you have it]), the Gradle Wrapper (gradlew, gradlew.bat and the gradle directory) and your source code/resources (the src directory). Look at my mod and its .gitignore file for an example of the repository structure to use and which files to include.
    1 point
  12. Ambiguous in the sense that this is a strictly defined "Use your class name" Where as if you start introducing variables then it just makes it more complicated. And yes FORGE already parses the mod, tho it doesn't keep any information about the package so we'd still have to look that up from the container. But this isn't about Forge it's about other things that look up this information outside of the Minecraft runtime. Seriously no, it saves you 10 seconds, but adds a ton of complexity to the system. Stop being lazy and just write out the package. If you have IDE it's literally 4 clicks.
    1 point
  13. Take these with a rain of salt code-style wise as they are patches but: Furnaces Chests BrewingStands This is my original test code which shows my intention of how modders should so it with Caps that Forge/They don't provide {Doing it this way gives soft-dependencies} https://github.com/LexManos/MinecraftForge/blob/Capabilities/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch#L58 This shows my original test code which creates, and queries a TE for it's capability: https://github.com/LexManos/MinecraftForge/blob/Capabilities/src/test/java/net/minecraftforge/test/capabilitytest/TestCapabilityMod.java#L27-L62 It's not to difficult. Someone write better docs.
    1 point
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.