MinecraftWero
-
Posts
43 -
Joined
-
Last visited
Posts posted by MinecraftWero
-
-
3 hours ago, diesieben07 said:
Probably. We can't help you though, because you have not posted your code.
what code do you need? I thought I posted everything that was needed
-
6 minutes ago, DimensionsInTime said:
0.4F / (itemRand.nextFloat() * 0.4F + 0.8F
Why is your pitch that complicated formula and not 1.0F for normal speed?
wow I feel so dumb now.. that fixed it! thank you.
Edit: is there anyway to make it sound as soon as I press the right click? it's working now but it has a tiny delay.
-
Hello, I wanted to add a custom sound to my mod and it registers but it sounds different than the sound I want to use, here's my code:
SoundHandler
package com.minecraftwero.baconmod.handlers; import com.minecraftwero.baconmod.Reference; import com.minecraftwero.baconmod.util.Utils; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; public class BaconSoundHandler { private static int size = 0; public static SoundEvent BACON_SHOOT; public static void init(){ size = SoundEvent.REGISTRY.getKeys().size(); BACON_SHOOT = register("item.bacon_shoot.shoot"); } public static SoundEvent register(String name){ ResourceLocation location = new ResourceLocation(Reference.MODID, name); SoundEvent e = new SoundEvent(location); SoundEvent.REGISTRY.register(size, location, e); size++; Utils.getLogger().info("Registered sound: " + name); return e; } }
Sound .json
{ "item.bacon_shoot.shoot": { "category": "item", "subtitle": "item.bacon_shoot.shoot", "sounds": [ { "name": "bmod:item/bacon_shoot/shoot", "stream": true } ] } }
and here's my Item class that I want the sound for (basically ItemSnowball class:
package com.minecraftwero.baconmod.items; import com.minecraftwero.baconmod.Reference; import com.minecraftwero.baconmod.entities.EntityBacon; import com.minecraftwero.baconmod.handlers.BaconSoundHandler; import com.minecraftwero.baconmod.init.ModItems; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemArrow; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraftforge.items.ItemStackHandler; public class BaconLauncher extends Item { public BaconLauncher(String unlocalizedName, String registryName) { this.setUnlocalizedName(unlocalizedName); this.setRegistryName(new ResourceLocation(Reference.MODID, registryName)); this.setMaxStackSize(1); } /** * Called when the equipped item is right clicked. */ public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { ItemStack itemStack = playerIn.getHeldItem(handIn); for (int i = 0; i < playerIn.inventory.getSizeInventory(); ++i){ ItemStack itemstack = playerIn.inventory.getStackInSlot(i); if (itemstack.getItem()==ModItems.rawbacon){ itemstack.shrink(1); if (!worldIn.isRemote) { EntityBacon entitybacon = new EntityBacon(worldIn, playerIn); entitybacon.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F); worldIn.spawnEntity(entitybacon); worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, BaconSoundHandler.BACON_SHOOT, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); } break; } } playerIn.addStat(StatList.getObjectUseStats(this)); return new ActionResult(EnumActionResult.SUCCESS, itemStack); } }
I would appreciate it if someone could point out what I am doing wrong, oh I and I also registered the SoundHandlers inside my Init on main class.
-
Thanks got it working.
-
5 hours ago, Jay Avery said:
What arguments does it ask for? Are they objects which you have access to?
heres the error
EDIT: Here's my code:
package com.minecraftwero.baconmod.renders; import org.lwjgl.opengl.GL11; import com.minecraftwero.baconmod.Bacon; import com.minecraftwero.baconmod.Reference; import com.minecraftwero.baconmod.entities.EntityBacon; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderEntity; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; public class RenderBacon extends RenderEntity { public RenderBacon(RenderManager renderManagerIn) { super(renderManagerIn); } @Override protected ResourceLocation getEntityTexture(Entity entity) { return new ResourceLocation(":textures/entity/rawbacon"); } }
package com.minecraftwero.baconmod.init; import com.minecraftwero.baconmod.Bacon; import com.minecraftwero.baconmod.Reference; import com.minecraftwero.baconmod.entities.EntityBacon; import com.minecraftwero.baconmod.handlers.EntityHandler; import com.minecraftwero.baconmod.items.BaconLauncher; import com.minecraftwero.baconmod.items.CookedBacon; import com.minecraftwero.baconmod.items.RawBacon; import com.minecraftwero.baconmod.renders.RenderBacon; import com.minecraftwero.baconmod.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.main.Main; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.common.registry.GameData; import net.minecraftforge.fml.common.registry.GameRegistry; public class ModItems { private static final String Harvester = null; public static Item rawbacon; public static Item cookedbacon; public static Item baconlauncher; public static void init(){ rawbacon = new RawBacon("rawbacon", "rawbacon"); cookedbacon = new CookedBacon("cookedbacon", "cookedbacon"); baconlauncher = new BaconLauncher("baconlauncher", "baconlauncher"); //Entity Registration ResourceLocation baconbullet = new ResourceLocation(Reference.MODID + ":" + "baconbullet" , "inventory"); // EntityHandler.registerModEntity(entitybaconres, EntityBacon.class, "entitybaconres", Bacon.instance, 16, 20, true); EntityRegistry.registerModEntity(baconbullet, EntityBacon.class, "baconbullet", 1, Reference.MODID, 128, 1, true); RenderingRegistry.registerEntityRenderingHandler(EntityBacon.class, new RenderSnowball(ModItems.rawbacon )); } public static void register(){ registerItem(rawbacon); registerItem(cookedbacon); registerItem(baconlauncher); } public static void registerRenders(){ registerRender(rawbacon); registerRender(cookedbacon); registerRender(baconlauncher); } public static void registerItem(Item item){ item.setCreativeTab(Bacon.items); GameRegistry.register(item); Utils.getLogger().info("Registered Item: " + item.getUnlocalizedName().substring(5)); } public static void registerRender(Item item){ ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(new ResourceLocation(Reference.MODID, item.getUnlocalizedName().substring(5)), "inventory")); Utils.getLogger().info("Registered render for " + item.getUnlocalizedName().substring(5)); } }
-
On 5/29/2017 at 0:31 AM, Choonster said:
If you want something to behave similar to vanilla, look at the vanilla implementation and either re-use or extend it as appropriate.
In this case, use or extend RenderSnowball to render an entity as an item model.
I tried using this
RenderingRegistry.registerEntityRenderingHandler(EntityBacon.class, new RenderSnowball(ModItems.rawbacon ));
But it asks me to add arguments and i tried everything but can't figure it out.
-
So i made an item that launches another custom item, and it is working, but i want the render to look like the snowball looks when you throw it I don't want a custom model.
How would i go about this?
-
3 minutes ago, Jay Avery said:
Do you have a file at this location?
You know what i am just dumb, i thought it was named correctly i was missing an "s".
Feeling really stupid now thanks!
-
I am having this error in the console:
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release [12:35:57] [main/INFO] [GradleStart]: Extra: [] [12:35:57] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, /Users/isaactobalina/.gradle/caches/minecraft/assets, --assetIndex, 1.11, --accessToken{REDACTED}, --version, 1.11.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [12:35:57] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [12:35:58] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [12:35:58] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [12:35:58] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker [12:35:58] [main/INFO] [FML]: Forge Mod Loader version 13.20.0.2304 for Minecraft 1.11.2 loading [12:35:58] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_131, running on Mac OS X:x86_64:10.12.3, installed at /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre [12:35:58] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [12:35:58] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [12:35:58] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin [12:35:58] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [12:35:58] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [12:35:58] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [12:35:58] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [12:35:58] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [12:35:58] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [12:35:58] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [12:35:58] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [12:36:01] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [12:36:01] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [12:36:01] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [12:36:02] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [12:36:02] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker [12:36:02] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker [12:36:02] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [12:36:14] [Client thread/INFO]: Setting user: Player720 [12:36:23] [Client thread/WARN]: Skipping bad option: lastServer: [12:36:23] [Client thread/INFO]: LWJGL Version: 2.9.2 [12:36:25] [Client thread/INFO] [FML]: MinecraftForge v13.20.0.2304 Initialized [12:36:25] [Client thread/INFO] [FML]: Replaced 232 ore recipes [12:36:25] [Client thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer [12:36:25] [Client thread/INFO] [FML]: Searching /Users/isaactobalina/Documents/Bacon1.11.2/run/mods for mods [12:36:29] [Client thread/INFO] [FML]: Forge Mod Loader has identified 5 mods to load [12:36:29] [Client thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, bmod] at CLIENT [12:36:29] [Client thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, bmod] at SERVER [12:36:30] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Bacon Mod [12:36:31] [Client thread/INFO] [FML]: Processing ObjectHolder annotations [12:36:31] [Client thread/INFO] [FML]: Found 445 ObjectHolder annotations [12:36:31] [Client thread/INFO] [FML]: Identifying ItemStackHolder annotations [12:36:31] [Client thread/INFO] [FML]: Found 0 ItemStackHolder annotations [12:36:31] [Client thread/INFO] [FML]: Applying holder lookups [12:36:31] [Client thread/INFO] [FML]: Holder lookups applied [12:36:31] [Client thread/INFO] [FML]: Applying holder lookups [12:36:31] [Client thread/INFO] [FML]: Holder lookups applied [12:36:31] [Client thread/INFO] [FML]: Applying holder lookups [12:36:31] [Client thread/INFO] [FML]: Holder lookups applied [12:36:31] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [12:36:31] [Forge Version Check/INFO] [ForgeVersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json [12:36:31] [Client thread/INFO] [bmod]: Registered Item: raw_bacon [12:36:31] [Client thread/INFO] [bmod]: Registered render for raw_bacon [12:36:31] [Client thread/INFO] [FML]: Applying holder lookups [12:36:31] [Client thread/INFO] [FML]: Holder lookups applied [12:36:31] [Client thread/INFO] [FML]: Injecting itemstacks [12:36:31] [Client thread/INFO] [FML]: Itemstack injection complete [12:36:32] [Forge Version Check/INFO] [ForgeVersionCheck]: [forge] Found status: AHEAD Target: null [12:36:38] [Sound Library Loader/INFO]: Starting up SoundSystem... [12:36:39] [Thread-6/INFO]: Initializing LWJGL OpenAL [12:36:39] [Thread-6/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [12:36:40] [Thread-6/INFO]: OpenAL initialized. [12:36:40] [Sound Library Loader/INFO]: Sound engine started [12:36:44] [Client thread/INFO] [FML]: Max texture size: 8192 [12:36:44] [Client thread/INFO]: Created: 16x16 textures-atlas [12:36:44] [Client thread/ERROR] [FML]: Exception loading model for variant bmod:raw_bacon#inventory for item "bmod:raw_bacon", normal location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model bmod:item/raw_bacon with loader VanillaLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:340) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:160) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:541) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:387) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.io.FileNotFoundException: bmod:models/item/raw_bacon.json at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:334) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.access$1600(ModelLoader.java:127) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:941) ~[ModelLoader$VanillaLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 20 more [12:36:44] [Client thread/ERROR] [FML]: Exception loading model for variant bmod:raw_bacon#inventory for item "bmod:raw_bacon", blockstate location exception: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model bmod:raw_bacon#inventory with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:348) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:160) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:541) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:387) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1257) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 20 more [12:36:45] [Client thread/INFO] [FML]: Injecting itemstacks [12:36:45] [Client thread/INFO] [FML]: Itemstack injection complete [12:36:46] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 5 mods [12:36:46] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Bacon Mod [12:36:48] [Client thread/INFO]: SoundSystem shutting down... [12:36:48] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com [12:36:48] [Sound Library Loader/INFO]: Starting up SoundSystem... [12:36:48] [Thread-8/INFO]: Initializing LWJGL OpenAL [12:36:48] [Thread-8/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [12:36:48] [Thread-8/INFO]: OpenAL initialized. [12:36:48] [Sound Library Loader/INFO]: Sound engine started [12:36:51] [Client thread/INFO] [FML]: Max texture size: 8192 [12:36:51] [Client thread/INFO]: Created: 512x512 textures-atlas [12:36:54] [Client thread/WARN]: Skipping bad option: lastServer: [12:36:54] [Client thread/ERROR]: ########## GL ERROR ########## [12:36:54] [Client thread/ERROR]: @ Post startup [12:36:54] [Client thread/ERROR]: 1281: Invalid value [12:36:56] [Realms Notification Availability checker #1/INFO]: Could not authorize you against Realms server: Invalid session id
The game loads, but of course the textures are not applying.
-
what i did was create a new class for the rendering of my items:
public static void registerItemRender(){ } public static void register(Item item){ Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Strings.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
-
Yeah about that.. the /. is just to show the locactions on mac.
But i found this code on the forums:
export _JAVA_OPTIONS='-Xmx2G'
Basically when you select the folder to install the mdk you type this on terminal and start the gradlew setupDecompWorkspace the process will start and it will say "picked up JAVA_OPTIONS"
So now i fixed the problem and i am ready to start coding 1.9.4!
EDIT: uhm for some reason the eclipse folder was not created i was following the forge documentation but i will see what i can do.
-
Uhm i don't see what i am missing, the wikipedia page said /Users/<username> so that's where i put the gradle folder .
Sorry i really sound like am new here, i used to have a mod "the bacon mod" but i left it a while ago and now i want to comeback to the modding scene but lots of things have changed since last time i modded.
-
Sure.
Okay so i tried installing it again with no luck, it still gives me the same message, maybe i have to do some more research or the properties file is wrong?
-
Did you even read it?
It even has a link to Wikipedia to explain where the user home is...
alright so i did this:
the gradle.properties has only this line: org.gradle.jvmargs=-Xmx2G is that correct?
-
Read the documentation.
I tried the documentation but i cannot find ~/.gradle/gradle.properties anywhere on my mac!
-
Hello everyone, i'm trying to install the 1.9.4 mdk, but everytime i try to it gives me the message:
I was browsing through the forum and found another topic like this, but they couldn't solve the issue, i know i have to add more memory to gradle but i just can't seem to find the way to do this.
I'm using a Mac with OSX El capitan.
Hopefully someone can help me with this!
-
Who could teach me how to make guns and renderings, i will be very happy if someone offers i would literally pay them (no more than 15 dollars)
so if someone could help me here is my skype:
weeroo96
-
-
Hey guys its me again, so im having some problems running minecraft with eclipse basically when i hit the start button it opens the minecraft test but now it doesnt and in the lines of eclipse i get this error:
2012-10-20 10:06:33 [iNFO] [ForgeModLoader] Forge Mod Loader version 3.1.50.400 for Minecraft client:1.3.2, server:1.3.2 loading
2012-10-20 10:06:34 [iNFO] [sTDERR] java.lang.reflect.InvocationTargetException
2012-10-20 10:06:34 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2012-10-20 10:06:34 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
2012-10-20 10:06:34 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
2012-10-20 10:06:34 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Method.java:597)
2012-10-20 10:06:34 [iNFO] [sTDERR] at cpw.mods.fml.relauncher.FMLRelauncher.relaunchClient(FMLRelauncher.java:111)
2012-10-20 10:06:34 [iNFO] [sTDERR] at cpw.mods.fml.relauncher.FMLRelauncher.handleClientRelaunch(FMLRelauncher.java:26)
2012-10-20 10:06:34 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.main(Minecraft.java:2112)
2012-10-20 10:06:34 [iNFO] [sTDERR] at Start.main(Start.java:29)
2012-10-20 10:06:34 [iNFO] [sTDERR] Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
2012-10-20 10:06:34 [iNFO] [sTDERR] at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1758)
2012-10-20 10:06:34 [iNFO] [sTDERR] at java.lang.Runtime.loadLibrary0(Runtime.java:823)
2012-10-20 10:06:34 [iNFO] [sTDERR] at java.lang.System.loadLibrary(System.java:1045)
2012-10-20 10:06:34 [iNFO] [sTDERR] at org.lwjgl.Sys$1.run(Sys.java:73)
2012-10-20 10:06:34 [iNFO] [sTDERR] at java.security.AccessController.doPrivileged(Native Method)
2012-10-20 10:06:34 [iNFO] [sTDERR] at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
2012-10-20 10:06:34 [iNFO] [sTDERR] at org.lwjgl.Sys.loadLibrary(Sys.java:95)
2012-10-20 10:06:34 [iNFO] [sTDERR] at org.lwjgl.Sys.<clinit>(Sys.java:112)
2012-10-20 10:06:34 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.getSystemTime(Minecraft.java:2423)
2012-10-20 10:06:34 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.fmlReentry(Minecraft.java:2122)
2012-10-20 10:06:34 [iNFO] [sTDERR] ... 8 more
-
what do i have to do in there?
-
Okay so i posted my codes can you guys help me now?
-
We need your main class (BaconMod.java or similar), your Common Proxy and Client Proxy class in order to help you.
here:
BaconMod.java
package minecraftwero.common; import java.io.File; import net.minecraft.client.Minecraft; import net.minecraft.src.BiomeCache; import net.minecraft.src.BiomeGenBase; import net.minecraft.src.BiomeGenForest; import net.minecraft.src.Block; import net.minecraft.src.BlockCake; import net.minecraft.src.BlockFlower; import net.minecraft.src.CreativeTabs; import net.minecraft.src.Entity; import net.minecraft.src.EnumArmorMaterial; import net.minecraft.src.EnumCreatureType; import net.minecraft.src.EnumToolMaterial; import net.minecraft.src.Item; import net.minecraft.src.ItemBucket; import net.minecraft.src.ItemFood; import net.minecraft.src.ItemStack; import net.minecraft.src.ModLoader; import net.minecraft.src.Potion; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.EnumHelper; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid = "MinecraftWero", name = "Bacon Mod", version = "1.0.0") public class BaconMod { public static Item baconGun; public static Item baconClip; public static BlockFlower baconFlower; public static Block cornCrop; public static Item baconHelmet; public static Item baconPlate; public static Item baconLegs; public static Item baconBoots; public static Block baconOre; public static Item baconStick; public static Item baconSword; public static Item baconHoe; public static Item baconPickaxe; public static Item baconAxe; public static Item baconSpade; public static ItemFood cereal; public static ItemFood rawBacon; public static ItemFood cookedBacon; public static ItemFood cookedEgg; public static ItemFood baconSandwich; public static ItemFood cheeseWheel; public static ItemFood cheeseSlice; public static ItemFood baconEC; public static ItemFood gayBacon; public static ItemFood tacoShell; public static ItemFood taco; public static ItemFood beer; public static ItemFood nutella; public static ItemFood nutellaBread; public static ItemFood tortilla; public static ItemFood quesadilla; public static ItemFood rawMeat; public static ItemFood meat; public static ItemFood meatSoup; public static Item cornSeeds; public static ItemFood corn; public static ItemFood cornKernel; public static BiomeGenBase baconForest; @SidedProxy(clientSide = "BaconMod.client.ClientProxyTutorial", serverSide = "minecraftwero.common.CommonProxyTutorial") public static CommonProxyTutorial proxy; //ToolMaterial// static EnumToolMaterial EnumToolMaterialBacon = EnumHelper.addToolMaterial("Bacon", 3, 20000, 8.0F, 2, 15); static EnumArmorMaterial EnumArmorMaterialBacon = EnumHelper.addArmorMaterial("Bacon",33, new int[]{3, 8, 6, 3}, 10); @Init public void load(FMLInitializationEvent event){}{ //Entity// //Sounds// Minecraft mc = ModLoader.getMinecraftInstance(); //Events// MinecraftForge.EVENT_BUS.register(new BoneMealEvent()); //Biome// final BiomeGenBase baconForest = (new BiomeGenBacon(26)).setBiomeName("baconForest"); ModLoader.addBiome(baconForest); //Mobs// //Armor// baconHelmet = new ItemBaconHelmet(896, EnumArmorMaterialBacon, ModLoader.addArmor("Bacon"), 0).setItemName("baconHelmet").setIconIndex(13); baconPlate = new ItemBaconPlate(897, EnumArmorMaterialBacon, ModLoader.addArmor("Bacon"), 1).setItemName("baconPlate").setIconIndex(14); baconLegs = new ItemBaconLegs(898, EnumArmorMaterialBacon, ModLoader.addArmor("Bacon"), 2).setItemName("baconLegs").setIconIndex(15); baconBoots = new ItemBaconBoots(899, EnumArmorMaterialBacon, ModLoader.addArmor("Bacon"), 3).setItemName("baconBoots").setIconIndex(16); LanguageRegistry.addName(baconHelmet, "Bacon Helmet"); LanguageRegistry.addName(baconPlate, "Bacon Plate"); LanguageRegistry.addName(baconLegs, "Bacon Leggings"); LanguageRegistry.addName(baconBoots, "Bacon Boots"); //Food// rawBacon = (ItemFood) new ItemRawBaconFood(900, 3, true).setIconIndex(0).setItemName("rawBacon"); cookedBacon = (ItemFood) new ItemCookedBaconFood(901, 5, true).setIconIndex(1).setItemName("cookedBacon"); cookedEgg = (ItemFood) new ItemCookedEgg(902, 4, false).setIconIndex(2).setItemName("cookedEgg"); baconSandwich = (ItemFood) new ItemBaconSandwich(903, 7, false).setIconIndex(3).setItemName("baconSandwich"); cheeseWheel = (ItemFood) new ItemCheeseWheel(904, 12, false).setIconIndex(4).setItemName("cheeseWheel"); cheeseSlice = (ItemFood) new ItemCheeseSlice(905, 2, false).setIconIndex(5).setItemName("cheeseSlice"); baconEC = (ItemFood) new ItemBaconEC(906, 10, false).setIconIndex(6).setItemName("baconEC"); gayBacon = (ItemFood) new ItemGayBacon(907, 6, false).setAlwaysEdible().setIconIndex(.setItemName("gayBacon"); tacoShell = (ItemFood) new ItemTacoShell(908, 2, false).setIconIndex(17).setItemName("tacoShell"); taco = (ItemFood) new ItemTaco(909, 8, false).setIconIndex(18).setItemName("taco"); cereal = (ItemFood) new ItemCereal(910, 5, false).setIconIndex(19).setItemName("cereal"); beer = (ItemFood) new ItemBeer(911, 4, false).setAlwaysEdible().setIconIndex(20).setItemName("beer"); nutella = (ItemFood) new ItemNutella(912, 8, false).setIconIndex(21).setItemName("nutella"); nutellaBread = (ItemFood) new ItemNutellaBread(913, 4, false).setIconIndex(22).setItemName("nutellaBread"); tortilla = (ItemFood) new ItemTortilla(914, 2, false).setIconIndex(23).setItemName("tortilla"); quesadilla = (ItemFood) new ItemQuesadilla(915, 6, false).setIconIndex(24).setItemName("quesadilla"); rawMeat = (ItemFood) new ItemRawMeat(916, 2, false).setIconIndex(25).setItemName("Raw Meat"); meat = (ItemFood) new ItemMeat(917, 4, false).setIconIndex(26).setItemName("Meat"); meatSoup = (ItemFood) new ItemMeatSoup(918, 6, false).setIconIndex(27).setItemName("meatSoup"); corn = (ItemFood) new ItemCorn(919, 4, false).setIconIndex(29).setItemName("corn"); LanguageRegistry.addName(nutella, "Nutella"); LanguageRegistry.addName(nutellaBread, "Nutella on Bread"); LanguageRegistry.addName(tortilla, "Tortilla"); LanguageRegistry.addName(quesadilla, "Quesadilla"); LanguageRegistry.addName(gayBacon, "Gay Bacon"); LanguageRegistry.addName(rawBacon, "Raw Bacon"); LanguageRegistry.addName(cookedBacon, "Cooked Bacon"); LanguageRegistry.addName(cookedEgg, "Cooked Egg"); LanguageRegistry.addName(baconSandwich, "Bacon Sandwich"); LanguageRegistry.addName(cheeseWheel, "Cheese Wheel"); LanguageRegistry.addName(cheeseSlice, "Cheese Slice"); LanguageRegistry.addName(baconEC, "Deluxe Sandwich"); LanguageRegistry.addName(tacoShell, "Taco Shell"); LanguageRegistry.addName(taco, "Taco"); LanguageRegistry.addName(cereal, "Cereal"); LanguageRegistry.addName(beer, "Beer"); LanguageRegistry.addName(rawMeat, "Raw Meat"); LanguageRegistry.addName(meat, "Meat"); LanguageRegistry.addName(meatSoup, "Meat Soup"); LanguageRegistry.addName(corn, "Corn Cob"); //Blocks// baconOre = new BlockBaconOre(2000, 0).setStepSound(Block.soundStoneFootstep).setHardness(3F).setResistance(1.0F).setBlockName("baconOre"); GameRegistry.registerBlock(baconOre); LanguageRegistry.addName(baconOre, "Bacon Block"); GameRegistry.registerWorldGenerator(new WorldGeneratorBacon()); baconFlower = (BlockFlower) new BlockFlowerBacon(2001,1).setBlockName("baconFlower"); GameRegistry.registerBlock(baconFlower); LanguageRegistry.addName(baconFlower, "Bacon Flower"); cornCrop = new BlockCornCrop(2002, 2).setStepSound(Block.soundGrassFootstep).setHardness(0.0F).setBlockName("cornCrop"); GameRegistry.registerBlock(cornCrop); LanguageRegistry.addName(cornCrop, "Corn Crop"); //Items// baconSword = new ItemBaconSword(950, EnumToolMaterialBacon).setIconIndex(7).setItemName("baconSword"); baconHoe = new ItemBaconHoe(951, EnumToolMaterialBacon).setIconIndex(9).setItemName("baconHoe"); baconPickaxe = new ItemBaconPickaxe(952, EnumToolMaterialBacon).setIconIndex(10).setItemName("baconPickaxe"); baconAxe = new ItemBaconAxe(953, EnumToolMaterialBacon).setIconIndex(11).setItemName("baconAxe"); baconSpade = new ItemBaconSpade(954, EnumToolMaterialBacon).setIconIndex(12).setItemName("baconSpade"); cornSeeds = new ItemCornSeeds(955, cornCrop.blockID, Block.tilledField.blockID).setIconIndex(28).setItemName("cornSeeds"); baconClip = new ItemBaconClip(956).setMaxStackSize(64).setItemName("baconClip").setIconIndex(31); baconGun = new ItemBaconGun(957, 5, 12, BaconMod.baconClip.shiftedIndex, 1, "gun.shoot", "gun.reload").setItemName("baconGun").setIconIndex(32); LanguageRegistry.addName(baconSpade, "Bacon Shovel"); LanguageRegistry.addName(baconHoe, "Bacon Hoe"); LanguageRegistry.addName(baconPickaxe, "Bacon Pickaxe"); LanguageRegistry.addName(baconAxe, "Bacon Axe"); LanguageRegistry.addName(baconSword, "Bacon Sword"); LanguageRegistry.addName(cornSeeds, "Corn Kernels"); LanguageRegistry.addName(baconClip, "Bacon Clip"); LanguageRegistry.addName(baconGun, "Bacon Gun"); //Crafting// GameRegistry.addRecipe(new ItemStack(BaconMod.baconOre, 1), new Object[] {"BBB", "RRR", "BBB", 'B', BaconMod.cookedBacon, 'R', BaconMod.rawBacon}); GameRegistry.addRecipe(new ItemStack(BaconMod.rawBacon, 4), new Object [] {"X", 'X', Item.porkRaw}); GameRegistry.addRecipe(new ItemStack(BaconMod.baconSandwich, 1), new Object [] {" X ", " B ", " X ", 'X', Item.bread, 'B', BaconMod.cookedBacon}); GameRegistry.addRecipe(new ItemStack(BaconMod.cheeseSlice, 6), new Object[] {"X", 'X', BaconMod.cheeseWheel}); GameRegistry.addRecipe(new ItemStack(BaconMod.baconEC, 1), new Object[] {" B ", "xce", " B ", 'B', Item.bread, 'x', BaconMod.cookedBacon, 'c', BaconMod.cheeseSlice, 'e', BaconMod.cookedEgg}); GameRegistry.addRecipe(new ItemStack(BaconMod.baconSword, 1), new Object[] { " B ", " B ", " S ", 'B', BaconMod.cookedBacon, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(BaconMod.gayBacon, 1), new Object[] {" S ", "SBS", " S ", 'S', Item.sugar, 'B', BaconMod.rawBacon}); GameRegistry.addRecipe(new ItemStack(BaconMod.baconHoe, 1), new Object[] {"BB ", " S ", " S ", 'B', BaconMod.cookedBacon, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(BaconMod.baconPickaxe, 1), new Object[] {"BBB", " S ", " S ", 'B', BaconMod.cookedBacon, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(BaconMod.baconAxe, 1), new Object[] {"BB ", "BS ", " S ", 'B', BaconMod.cookedBacon, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(BaconMod.baconSpade, 1), new Object[] {" B ", " S ", " S ", 'B', BaconMod.cookedBacon, 'S', Item.stick}); GameRegistry.addRecipe(new ItemStack(BaconMod.baconHelmet, 1), new Object[] {"BBB", "B B", " ", 'B', BaconMod.cookedBacon}); GameRegistry.addRecipe(new ItemStack(BaconMod.baconPlate, 1), new Object[] {"B B", "BBB", "BBB", 'B', BaconMod.cookedBacon}); GameRegistry.addRecipe(new ItemStack(BaconMod.baconLegs, 1), new Object[] {"BBB", "B B", "B B", 'B', BaconMod.cookedBacon}); GameRegistry.addRecipe(new ItemStack(BaconMod.baconBoots, 1), new Object[] {" ", "B B", "B B", 'B', BaconMod.cookedBacon}); GameRegistry.addRecipe(new ItemStack(BaconMod.taco, 1), new Object[] {" C ", " B ", " T ", 'C', BaconMod.cheeseSlice, 'B', BaconMod.meat, 'T', BaconMod.tacoShell}); GameRegistry.addRecipe(new ItemStack(BaconMod.cereal, 1), new Object[] {" W ", " B ", " C ", 'W', Item.wheat, 'B', Item.bucketMilk, 'C', Item.bowlEmpty}); GameRegistry.addRecipe(new ItemStack(BaconMod.beer, 1), new Object[] {" W ", " S ", " B ", 'W', Item.wheat, 'S', Item.seeds, 'B', Item.bucketWater}); GameRegistry.addRecipe(new ItemStack(BaconMod.nutella, 1), new Object[] {"CCC", "MMM", "CCC", 'C', new ItemStack(Item.dyePowder, 1, 3), 'M', Item.bucketMilk}); GameRegistry.addRecipe(new ItemStack(BaconMod.nutellaBread, 1), new Object[] {" N ", " B ", " ", 'N', BaconMod.nutella, 'B', Item.bread}); GameRegistry.addRecipe(new ItemStack(BaconMod.tortilla, 1), new Object[] {" W ", "W W", " W ", 'W', BaconMod.cornSeeds}); GameRegistry.addRecipe(new ItemStack(BaconMod.quesadilla, 1), new Object[] {" T ", " C ", " T ", 'T', BaconMod.tortilla, 'C', BaconMod.cheeseSlice}); GameRegistry.addRecipe(new ItemStack(BaconMod.rawMeat, 3), new Object[] {"X", 'X', Item.beefRaw}); GameRegistry.addRecipe(new ItemStack(BaconMod.meatSoup, 1), new Object[] {" B ", " W ", " V ", 'B', BaconMod.meat, 'W', Item.bucketWater, 'V', Item.bowlEmpty}); GameRegistry.addRecipe(new ItemStack(BaconMod.cornSeeds, 4), new Object[] {"C", 'C', BaconMod.corn}); //Smelting// GameRegistry.addSmelting(BaconMod.rawBacon.shiftedIndex, new ItemStack(BaconMod.cookedBacon), 0.1F); GameRegistry.addSmelting(Item.egg.shiftedIndex, new ItemStack(BaconMod.cookedEgg), 0.1F); GameRegistry.addSmelting(Item.bucketMilk.shiftedIndex, new ItemStack(BaconMod.cheeseWheel), 01.F); GameRegistry.addSmelting(BaconMod.tortilla.shiftedIndex, new ItemStack(BaconMod.tacoShell), 0.1F); GameRegistry.addSmelting(BaconMod.rawMeat.shiftedIndex, new ItemStack(BaconMod.meat), 0.1F); //Set Sounds// mc.installResource("newsound/gun/shoot.ogg", new File(mc.mcDataDir, "resources/newsound/gun/shoot.ogg")); mc.installResource("newsound/gun/reload.ogg", new File(mc.mcDataDir, "resources/newsound/gun/reload.ogg")); } }
ClientProxy.java:
package BaconMod.client; import cpw.mods.fml.client.registry.RenderingRegistry; import minecraftwero.common.CommonProxyTutorial; import minecraftwero.common.EntityBullet; import minecraftwero.common.RenderBullet; import net.minecraft.src.RenderEntity; import net.minecraftforge.client.MinecraftForgeClient; public class ClientProxyTutorial extends CommonProxyTutorial { @Override public void registerRenderThings() { MinecraftForgeClient.preloadTexture("/BaconTextures/baconTex.png"); RenderingRegistry.instance().registerEntityRenderingHandler(EntityBullet.class, new RenderBullet()); } }
-
hey guys i know im really annoying but i just want to finish the gun. So i made this mod called The bacon mod
link: http://www.minecraftforum.net/topic/1499035-132-bacon-mod-v10-forge/
and i want to add a "Bacon Gun" so i decided to give it a try and it works pretty well, it has sounds, and it hurts the mobs but the problem is the bullet i dont know how to render it i have try with alot of stuff, i tried using render arrow.class and it didnt work it was still invisible, 3 modders helped me but no one could tell me what the problem was so i hope you guys tell me how to do it, if you can here is my skype name: weeroo96
and here are the codes:
ItemBaconGun.class
package minecraftwero.common; //CHANGE THIS import cpw.mods.fml.common.Side; import cpw.mods.fml.common.asm.SideOnly; import net.minecraft.src.CreativeTabs; import net.minecraft.src.EntityPlayer; import net.minecraft.src.Item; import net.minecraft.src.ItemStack; import net.minecraft.src.World; public class ItemBaconGun extends Item{ //These are all of our base variables for our gun private int damage; //Damage in half-hearts private int reloadtick; //The current value of our reloading timer private int reloadmax; //The value that the reloadtick variable needs to be in order for the gun to reload private int clipid; //The item id of our clip private int ammo; //The amount of ammo avaliable per clip (used in setting durability) private int firetick; //The current value of our shooting timer private int firemax; //The value that the firetick variable needs to be in order for the gun to fire //Fire delay is completely ignored when firemax is set to 0 private String firesound; //The String that notch uses in his code to figure out what sound to play when we shoot our gun private String reloadsound; //Firesound but with reloading //The parameters for our constructor are: //int i (the id), int damage (damage in half-hearts), int ammo (how much ammo per clip) //int clipid (the item id of the clip this gun uses), int firedelay (the value of firemax) //String firesound (the value of firesound), String reloadsound (the value of reloadsound) public ItemBaconGun(int i, int damage, int ammo, int clipid, int firedelay, String firesound, String reloadsound){ super(i); //calls the Item.java constructor and passes in the item id for a parameter this.damage = damage; //sets the damage value firemax = firedelay; //sets the firemax value firetick = firemax; //sets the firetick value equal to firemax (so you don't need to wait for the delay on the first shot) reloadmax = 2; //sets the reload max reloadtick = 0; //sets the reloadtick to 0 this.ammo = ammo; //sets the ammo this.clipid = clipid; //sets the clipid this.firesound = firesound; //sets the firesound this.reloadsound = reloadsound; //sets the reloadsound setMaxStackSize(1); //sets the max stack size to one setMaxDamage(ammo + 1); //sets the durability of our gun to the ammo count + 1 this.setTabToDisplayOn(CreativeTabs.tabCombat); } public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){ //Checks if the player has enough ammo if(!par2World.isRemote && par1ItemStack.getItemDamage() < ammo){ //if the firemax isn't 0, and the fireing counter is done, then this is true if(firetick == firemax && firemax != 0){ //spawns the bullet par2World.spawnEntityInWorld(new EntityBullet(par2World, par3EntityPlayer, damage, 1)); //plays the sound effect par2World.playSoundAtEntity(par3EntityPlayer, firesound, 1F, 1F); //damages the gun par1ItemStack.damageItem(1, par3EntityPlayer); //resets the fire delay counter firetick = 0; }else{ //if the fire delay counter isn't done, then this is called, which increases the fire delay counter ++firetick; } //if firemax is 0 none of the above was called, so call this instead if(firemax == 0){ par2World.spawnEntityInWorld(new EntityBullet(par2World, par3EntityPlayer, damage, 1)); par2World.playSoundAtEntity(par3EntityPlayer, firesound, 1F, 1F); par1ItemStack.damageItem(1, par3EntityPlayer); //already explained... } //If the player is out of ammo in the current clip, and the player has the correct clip, run this code }else if(!par2World.isRemote && par3EntityPlayer.inventory.hasItem(clipid) && par1ItemStack.getItemDamage() == ammo){ //checks for the reload timer to complete if(reloadtick == reloadmax){ //resets the reload timer reloadtick = 0; //plays the reload sound par2World.playSoundAtEntity(par3EntityPlayer, reloadsound, 1F, 1F); //consumes the item of the clipid par3EntityPlayer.inventory.consumeInventoryItem(clipid); //resets the ammo of the gun par1ItemStack.setItemDamage(0); }else{ //just like with firetick and firemax... ++reloadtick; } } //just some housekeeping stuff return par1ItemStack; } public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int i){ //this resets the firetick. I originally planned on using this method for non-automatic weapons //but the method didn't seem to end up being called at all... if someone could clarify why this is //happening I would appreciate it... firetick = firemax; } //CHANGE THIS TO YOUR BLOCK/IMAGE SPRITE @SideOnly(Side.CLIENT) public String getTextureFile(){ return "/BaconTextures/baconTex.png"; } }
EntityBullet.class
package minecraftwero.common; //CHANGE THIS import java.util.List; import java.util.Random; import net.minecraft.client.Minecraft; import net.minecraft.src.AxisAlignedBB; import net.minecraft.src.Block; import net.minecraft.src.Entity; import net.minecraft.src.EntityDamageSource; import net.minecraft.src.EntityLiving; import net.minecraft.src.EntityPlayer; import net.minecraft.src.Item; import net.minecraft.src.ItemStack; import net.minecraft.src.MathHelper; import net.minecraft.src.MovingObjectPosition; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.Vec3; import net.minecraft.src.Vec3Pool; import net.minecraft.src.World; public class EntityBullet extends Entity { private int xTile; private int yTile; private int zTile; private int inTile; private boolean inGround; public int arrowShake; public EntityLiving shootingEntity; private int timeTillDeath; private int flyTime; private EntityPlayer owner; private int damage; private final float size = 1F; public EntityBullet(World world) { super(world); xTile = -1; yTile = -1; zTile = -1; inTile = 0; inGround = false; arrowShake = 0; flyTime = 0; setSize(size, size); } public EntityBullet(World world, double d, double d1, double d2, double d3, double d4, double d5, EntityPlayer entityplayer) { super(world); xTile = -1; yTile = -1; zTile = -1; inTile = 0; inGround = false; arrowShake = 0; flyTime = 0; setSize(size, size); setPosition(d, d1, d2); yOffset = 0.0F; setVelocity(d3, d4, d5); owner = entityplayer; } public EntityBullet(World world, double d, double d1, double d2) { super(world); xTile = -1; yTile = -1; zTile = -1; inTile = 0; inGround = false; arrowShake = 0; flyTime = 0; setSize(size, size); setPosition(d, d1, d2); yOffset = 0.0F; } public EntityBullet(World world, EntityLiving entityliving, int damage, int accuracy) { super(world); this.damage = damage; xTile = -1; yTile = -1; zTile = -1; inTile = 0; inGround = false; arrowShake = 0; flyTime = 0; shootingEntity = entityliving; setSize(size, size); setLocationAndAngles(entityliving.posX, entityliving.posY + (double)entityliving.getEyeHeight(), entityliving.posZ, entityliving.rotationYaw, entityliving.rotationPitch); posX -= MathHelper.cos((rotationYaw / 180F) * 3.141593F) * 0.16F; posY -= 0.10000000149011612D; posZ -= MathHelper.sin((rotationYaw / 180F) * 3.141593F) * 0.16F; setPosition(posX, posY, posZ); yOffset = 0.0F; motionX = 1000F * -MathHelper.sin((rotationYaw / 180F) * 3.141593F) * MathHelper.cos((rotationPitch / 180F) * 3.141593F); motionZ = 1000F * MathHelper.cos((rotationYaw / 180F) * 3.141593F) * MathHelper.cos((rotationPitch / 180F) * 3.141593F); motionY = 1000F * -MathHelper.sin((rotationPitch / 180F) * 3.141593F); setArrowHeading(motionX, motionY, motionZ, 200.0F, 1.5F, accuracy); } protected void entityInit() { } public void setArrowHeading(double d, double d1, double d2, float f, float f1, int i) { float f2 = MathHelper.sqrt_double(d * d + d1 * d1 + d2 * d2); d /= f2; d1 /= f2; d2 /= f2; d += rand.nextGaussian() * 0.0034999998323619365D * (double)f1 * (double)i / 5; d1 += rand.nextGaussian() * 0.0034999998323619365D * (double)f1 * (double)i / 5; d2 += rand.nextGaussian() * 0.0034999998323619365D * (double)f1 * (double)i / 5; d *= f; d1 *= f; d2 *= f; motionX = d; motionY = d1; motionZ = d2; float f3 = MathHelper.sqrt_double(d * d + d2 * d2); prevRotationYaw = rotationYaw = (float)((Math.atan2(d, d2) * 180D) / 3.1415927410125732D); prevRotationPitch = rotationPitch = (float)((Math.atan2(d1, f3) * 180D) / 3.1415927410125732D); timeTillDeath = 0; } public void setVelocity(double d, double d1, double d2) { motionX = d; motionY = d1; motionZ = d2; if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(d * d + d2 * d2); prevRotationYaw = rotationYaw = (float)((Math.atan2(d, d2) * 180D) / 3.1415927410125732D); prevRotationPitch = rotationPitch = (float)((Math.atan2(d1, f) * 180D) / 3.1415927410125732D); } } public void onUpdate() { super.onUpdate(); if (flyTime > 1000) { setDead(); } if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ); prevRotationYaw = rotationYaw = (float)((Math.atan2(motionX, motionZ) * 180D) / 3.1415927410125732D); prevRotationPitch = rotationPitch = (float)((Math.atan2(motionY, f) * 180D) / 3.1415927410125732D); } if (arrowShake > 0) { arrowShake--; } if (inGround) { int i = worldObj.getBlockId(xTile, yTile, zTile); if (i != inTile) { inGround = false; motionX *= rand.nextFloat() * 0.2F; motionY *= rand.nextFloat() * 0.2F; motionZ *= rand.nextFloat() * 0.2F; timeTillDeath = 0; flyTime = 0; } else { timeTillDeath++; if (timeTillDeath == 1200) { setDead(); } return; } } else { flyTime++; } Vec3 vec3d = Vec3.getVec3Pool().getVecFromPool(posX, posY, posZ); Vec3 vec3d1 = Vec3.getVec3Pool().getVecFromPool(posX + motionX, posY + motionY, posZ + motionZ); MovingObjectPosition movingobjectposition = worldObj.rayTraceBlocks(vec3d, vec3d1); vec3d = Vec3.getVec3Pool().getVecFromPool(posX, posY, posZ); vec3d1 = Vec3.getVec3Pool().getVecFromPool(posX + motionX, posY + motionY, posZ + motionZ); if (movingobjectposition != null) { vec3d1 = Vec3.getVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); } Entity entity = null; List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D)); double d = 0.0D; for (int j = 0; j < list.size(); j++) { Entity entity1 = (Entity)list.get(j); if (!entity1.canBeCollidedWith() || entity1 == shootingEntity && flyTime < 5) { continue; } float f4 = 0.3F; AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f4, f4, f4); MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3d, vec3d1); if (movingobjectposition1 == null) { continue; } double d1 = vec3d.distanceTo(movingobjectposition1.hitVec); if (d1 < d || d == 0.0D) { entity = entity1; d = d1; } } if (entity != null) { movingobjectposition = new MovingObjectPosition(entity); } if (movingobjectposition != null) { if (movingobjectposition.entityHit != null) { if (movingobjectposition.entityHit.attackEntityFrom(new EntityDamageSource("player", owner), damage)) { worldObj.playSoundAtEntity(this, "BulletHit", 1.0F, 1.2F / (rand.nextFloat() * 0.2F + 0.9F)); setDead(); } else { motionX *= 0.10000000149011612D; motionY *= 0.10000000149011612D; motionZ *= 0.10000000149011612D; flyTime = 0; setDead(); } } else { xTile = movingobjectposition.blockX; yTile = movingobjectposition.blockY; zTile = movingobjectposition.blockZ; inTile = worldObj.getBlockId(xTile, yTile, zTile); if (inTile == Block.glass.blockID || inTile == Block.glowStone.blockID || inTile == Block.leaves.blockID) { Block block = Block.blocksList[inTile]; //ModLoader.getMinecraftInstance().sndManager.playSound(block.stepSound.stepSoundDir(), (float)xTile + 0.5F, (float)yTile + 0.5F, (float)zTile + 0.5F, (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); worldObj.setBlockWithNotify(xTile, yTile, zTile, 0); } else { motionX = (float)(movingobjectposition.hitVec.xCoord - posX); motionY = (float)(movingobjectposition.hitVec.yCoord - posY); motionZ = (float)(movingobjectposition.hitVec.zCoord - posZ); float f1 = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ); posX -= (motionX / (double)f1) * 0.05000000074505806D; posY -= (motionY / (double)f1) * 0.05000000074505806D; posZ -= (motionZ / (double)f1) * 0.05000000074505806D; worldObj.playSoundAtEntity(this, "Bullet2Hit", 1.0F, 1.2F / (rand.nextFloat() * 0.2F + 0.9F)); setDead(); } } } posX += motionX * 3D; posY += motionY * 3D; posZ += motionZ * 3D; float f2 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ); rotationYaw = (float)((Math.atan2(motionX, motionZ) * 180D) / 3.1415927410125732D); for (rotationPitch = (float)((Math.atan2(motionY, f2) * 180D) / 3.1415927410125732D); rotationPitch - prevRotationPitch < -180F; prevRotationPitch -= 360F) { } for (; rotationPitch - prevRotationPitch >= 180F; prevRotationPitch += 360F) { } for (; rotationYaw - prevRotationYaw < -180F; prevRotationYaw -= 360F) { } for (; rotationYaw - prevRotationYaw >= 180F; prevRotationYaw += 360F) { } rotationPitch = prevRotationPitch + (rotationPitch - prevRotationPitch) * 0.2F; rotationYaw = prevRotationYaw + (rotationYaw - prevRotationYaw) * 0.2F; float f3 = 0.99F; float f5 = 0.03F; if (handleWaterMovement()) { for (int k = 0; k < 4; k++) { float f6 = 0.25F; worldObj.spawnParticle("bubble", posX - motionX * (double)f6, posY - motionY * (double)f6, posZ - motionZ * (double)f6, motionX, motionY, motionZ); } f3 = 0.8F; } motionX *= f3; motionY *= f3; motionZ *= f3; setPosition(posX, posY, posZ); } public void writeEntityToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setShort("xTile", (short)xTile); nbttagcompound.setShort("yTile", (short)yTile); nbttagcompound.setShort("zTile", (short)zTile); nbttagcompound.setByte("inTile", (byte)inTile); nbttagcompound.setByte("shake", (byte)arrowShake); nbttagcompound.setByte("inGround", (byte)(inGround ? 1 : 0)); } public void readEntityFromNBT(NBTTagCompound nbttagcompound) { xTile = nbttagcompound.getShort("xTile"); yTile = nbttagcompound.getShort("yTile"); zTile = nbttagcompound.getShort("zTile"); inTile = nbttagcompound.getByte("inTile") & 0xff; arrowShake = nbttagcompound.getByte("shake") & 0xff; inGround = nbttagcompound.getByte("inGround") == 1; } public void onCollideWithPlayer(EntityPlayer entityplayer) { if (worldObj.isRemote) { return; } if (inGround && shootingEntity == entityplayer && arrowShake <= 0 && entityplayer.inventory.addItemStackToInventory(new ItemStack(Item.arrow, 1))) { worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); entityplayer.onItemPickup(this, 1); setDead(); } } public float getShadowSize() { return 0.0F; } }
-
now i need help with the rendering of the bullet can someone teach me how?
[1.11.2] Custom Sound Issues
in Modder Support
Posted · Edited by MinecraftWero
I guess there was an issue with formatting in the main post..
anyways I managed to fix it, here is my item class: