-
Posts
21 -
Joined
-
Last visited
Everything posted by Xeraster
-
I have updated the mod to version 1.0.1. Here is what is improved: Added 6 new TNTs: Arrow TNT, Airborne TNT, Teleportation TNT, Warp TNT, Fact TNT and Jail TNT. Modified the Mine TNT so that when it encounters ores, it will mine them and then drop the ore on the ground rather than delete it entirely causing any resources caught in the blast to be lost. Now, you can use the Mine TNT and be able to pick up ores that it Mined. Added a splash logo for the mcmodinfo screen. Added Spanish localization leftover from the 1.7.2 version
-
The Super TNT Mod for Minecraft 1.12.2 Adds 56 new TNTs to Minecraft Updated 7/9/18 (latest release is version 1.0.1) Download link below Here is a remake of my Super TNT mod for 1.7.2. It currently has 56 TNTs. Below is a list of all 56 of them and a description of what they all do. For a more detailed description including recipes and screenshots, go here. Here are some videos I made about it. Quick trailer made before the mod was ready for download: 18 minute video demonstrating many of the different TNTs and what they do: Requirements: To play this mod, you need to be using Minecraft 1.12.2. Forge also has to be installed. In order to prevent your game from crashing and for maximum smoothness, you should probably use -Xmx3G for your launch arguments but I recommend -Xmx8G if you have the ram for it. This mod does take less ram than the 1.7.2 version and lags less but it still helps to have a good computer and have java properly set up. Download: HERE is the link to the download page! The latest version is for 1.12.2 and the mod version is 1.0.1. Have fun!
-
How can I spawn a Jukebox with music playing?
Xeraster replied to Xeraster's topic in Modder Support
The one called "RECORDSONG". It's a custom added record, not a base game one. It gets inserted when I execute jukebox1.setrecord.(recordWhatever.copy()). I can observe that the record does in fact insert because after the jukebox spawns, I can right-click on it or destroy it and the record pops out. -
I have what appears to be a simple question but it turns out to be way not simple if actually attempted. I am trying to spawn a jukebox, with a record in it and get the jukebox to play that record. So far I can spawn the actual jukebox. That's simple. I can assign it to a TileEntityJukebox variable and get it to put a record in it but I can't get it to actually play the stupid record for anything. I've lost track of all the different things I've tried but here's what I have right now: this.world.setBlockState(new BlockPos(this.posX - 1, this.posY, this.posZ), Blocks.JUKEBOX.getDefaultState()); //spawn the jukebox block TileEntityJukebox jukebox1 = (TileEntityJukebox)this.world.getTileEntity(new BlockPos(this.posX - 1, this.posY, this.posZ));//assign it to a TileEntityJukebox ItemStack recordWhatever = new ItemStack(com.xeraster.supertnt.init.Items.RECORDSONG, 1);//create the item stack with the record to go into the jukebox jukebox1.setRecord(recordWhatever.copy());//Put the record in the jukebox. Doesn't matter if I do it with or without that ".copy()" part at the end. It won't play the record either way. this.world.setBlockState(new BlockPos(this.posX - 1, this.posY, this.posZ), Blocks.JUKEBOX.getDefaultState().withProperty(PropertyBool.create("has_record"), Boolean.valueOf(true)));//I saw this in the BlockJukebox class so I tried slapping it in but lo and behold it still doesn't work. Shocker. /s this.world.playRecord(new BlockPos(this.posX - 1, this.posY, this.posZ), SoundHandler.RECORDSONG);//tried this too because I saw it on line 86 of BlockJukebox. Doesn't work either. Yeah yeah yeah ik it was in the "dropRecord" function but I'm out of things to try at this point It must be noted that my custom record DOES work when I insert it manually. If I right-click on the spawned jukebox, it spits out the record that it's not playing and if I manually put it back in, it will play. So what am I missing? How to I spawn a Jukebox with a record in it and make it play it?
-
[1.12.2] I can't figure out how to register rendering
Xeraster replied to Xeraster's topic in Modder Support
Well I made this mod a long time ago in 1.7.2 back when the structure of Minecraft made more sense and wasn't nearly as cryptic and convoluted, and the stuff that was that bad had much better documentation. Even software development for the friggin Super Nintendo is more straightforward and less cryptic than this, which I know from experience. I've written lots of other software in lots of languages including Java, so say whatever you want. The difficulty I have been having comes from how they've just reinvented the wheel on a number of things having to do with Minecraft's code and adequate documentation for a lot of it just isn't there. Yes I did look it up. Multiple times. And with slightly different search terms each time. And even went back several pages on Google search, still not finding what I needed.. I couldn't find anything giving me actually helpful or complete enough information so I had to resort to figuring it out myself through trial and error until I came up with a temporary way to get it working myself which just happened to not be the official way that works the best. This is the first time I have even seen anything close to what you've pasted here and I look forward using this and seeing if I can get it to work like that. Thank you for posting that. -
[1.12.2] I can't figure out how to register rendering
Xeraster replied to Xeraster's topic in Modder Support
Sorry to double post but I finally did get it working!! Here is what I did: 1. Go to my RenderLargeTNTPrimed class file. On line 86, comment out the line: doRender(entity, x, y, z, entityYaw, partialTicks); 2. In my main classes init() function, put: RenderingRegistry.registerEntityRenderingHandler(LARGE_TNT_ENTITY.getEntityClass(), new RenderTNTLargePrimed(Minecraft.getMinecraft().getRenderManager())); 3. In my client proxy function which has "RegistryEvent.Register<EntityEntry> event", make sure it contains the following code in this particular and very specific order: LARGE_TNT_ENTITY.setRegistryName(SuperTNTMod.MODID, "large_tnt_1"); event.getRegistry().register(LARGE_TNT_ENTITY); EntityRegistry.registerModEntity(LARGE_TNT_ENTITY.getRegistryName(), LARGE_TNT_ENTITY.getEntityClass(), LARGE_TNT_ENTITY.getName(), 0, SuperTNTMod.MODID, 128, 1, false); 4. Make sure this is at the top of whatever class I have the above code in: public static final EntityEntry LARGE_TNT_ENTITY = new EntityEntry(EntityTNTLargePrimed.class, SuperTNTMod.MODID + ":large_tnt_primed"); So there. Now as soon as I figure out how to use this EntityEntryBuilder system that diesieben07 is talking about, it will probably be more efficient but I'm just happy it's working now finally. -
[1.12.2] I can't figure out how to register rendering
Xeraster replied to Xeraster's topic in Modder Support
I'm really struggling to grasp an understanding of this EntityEntryBuilder idea here. The best documentation I can find is here: http://maven.thiakil.com/forge-1.12-javadoc/net/minecraftforge/fml/common/registry/EntityEntryBuilder.html but it's still pretty vague and not very helpful at least to me. Is EntityEntryBuilder a type of variable? Is it a function? You said EntityRegistry as I'm currently using it doesn't fully do the job. So I've been trying stuff like: EntityRegistration fff = new EntityRegistry.EntityRegistration(SuperTNTMod.ModContainer, LARGE_TNT_ENTITY.getRegistryName(), LARGE_TNT_ENTITY.getEntityClass(), LARGE_TNT_ENTITY.getName(), 0, 128, 1, false); EntityEntryBuilder.create(fff); which might work if mod container was a variable I knew how to reproduce. Is this how that is supposed to work? If so, how do I satisfy the mod container variable? Where do I get ModContainer from? -
[1.12.2] I can't figure out how to register rendering
Xeraster replied to Xeraster's topic in Modder Support
With all due respect, I don't agree with the statement that you told me how to do this above. I guess I'm just still missing something somewhere. After Googleing, I think I'm supposed to establish a variable entity at the top so it looks like: public static final EntityEntry LARGE_TNT_ENTITY = new EntityEntry(EntityTNTLargePrimed.class, SuperTNTMod.MODID + ":large_tnt_primed") at the top where all my blocks get their variables set? So I know I'm supposed to have a RegistryEvent function. I didn't have this before. I made that just now. It looks like this: @SubscribeEvent public static void registerStuff(RegistryEvent.Register<EntityEntry> event) { //event.getRegistry().register([EntityEntry]); System.out.println("registerStuff got executed"); LARGE_TNT_ENTITY.setRegistryName(SuperTNTMod.MODID, "large_tnt_1"); event.getRegistry().register(LARGE_TNT_ENTITY); EntityRegistry.registerModEntity(new ResourceLocation(SuperTNTMod.MODID, "largetnt_1"), EntityTNTLargePrimed.class, "largetnt_1", 0, SuperTNTMod.MODID, 128, 1, false); } I was previously putting the EntityRegistry line in my init. Doing this makes it execute and I get the white cube too though. What I can't find really find from Google is where and what I'm supposed to do with a EntityEntryBuilder statement and how to make one. I do observe that at no point in my current code are EntityLargeTNTPrimed and RenderLargeTNTPrimed linked to each-other in any way and according to common sense, this has to be done. The fact that none of my console comments in the RenderTNTLargePrimed never get executed supports this theory. Perhaps if I knew the correct syntax and intended use of EntityEntryBuilder, I could do this? You told me to register my renderer and put it in my preinit. Is this what EntityEntryBuilder does? Hey but thank you so much for helping so far. I hope I get this working soon. -
[1.12.2] I can't figure out how to register rendering
Xeraster replied to Xeraster's topic in Modder Support
OK I'm getting warmer but still no cigar. In my RenderTNTLargePrimed class file, I replaced: protected ResourceLocation getEntityTexture(EntityTNTLargePrimed entity) { return TextureMap.LOCATION_BLOCKS_TEXTURE; } with: @Override protected ResourceLocation getEntityTexture(Entity entity) { return TextureMap.LOCATION_BLOCKS_TEXTURE; } which Draco18s expertly pointed out was causing a problem. Now, I can put the line: EntityRegistry.registerModEntity(new ResourceLocation(SuperTNTMod.MODID, "largetnt"), EntityTNTLargePrimed.class, "EntityTNTLargePrimed", 0, SuperTNTMod.MODID, 128, 1, false); in my init function. Putting it anywhere else makes it crash on startup. Doing this makes it damn-near almost work. When I ignite the tnt, it shows up as a white, textureless cube along with the fuse burning particles. Interestingly enough, the console doesn't actually output any errors like it does if I use anything other than "largetnt" for the ResourceLocation part after my ModId. Here is my console log: Here is a screenshot of what it looks like when I do this: https://imgur.com/a/0tDKg Adding in the deprecated ""RenderingRegistry.registerEntityRenderingHandler(blah blah blah)" as previously pointed out to not use, causes the white textureless box to not show at all, but will show the fuse burning particles and shadow. I makes no difference if I put it before or after the EntityRegistry line. The console log is completely the same whether I put that line in there, whether its before EntityRegistry or after EntityRegistry. I think maybe it has to do with the resource location part in my render class. Changing it to return something like "new ResourceLocation(SuperTNTMod.MODID, "largetnt")" or "new ResourceLocation(SuperTNTMod.MODID, "textures/blocks/largetnt_side")" doesn't actually seem to do anything. Am I correct to guess that this is where the last problem is or am I barking up the wrong tree? Also, I have changed my RenderTNTLargePrimed file. Here is what it looks like right now. package com.xeraster.supertnt.renders; import com.xeraster.supertnt.SuperTNTMod; import com.xeraster.supertnt.primedtnt.EntityTNTLargePrimed; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityTNTPrimed; import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderTNTLargePrimed extends Render<EntityTNTLargePrimed> { public RenderTNTLargePrimed(RenderManager renderManagerIn) { super(renderManagerIn); this.shadowSize = 0.5F; } /** * Renders the desired {@code T} type Entity. */ public void doRender(EntityTNTLargePrimed entity, double x, double y, double z, float entityYaw, float partialTicks) { BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y + 0.5F, (float)z); if ((float)entity.getFuse() - partialTicks + 1.0F < 10.0F) { float f = 1.0F - ((float)entity.getFuse() - partialTicks + 1.0F) / 10.0F; f = MathHelper.clamp(f, 0.0F, 1.0F); f = f * f; f = f * f; float f1 = 1.0F + f * 0.3F; GlStateManager.scale(f1, f1, f1); } float f2 = (1.0F - ((float)entity.getFuse() - partialTicks + 1.0F) / 100.0F) * 0.8F; //bindEntityTexture(entity); bindEntityTexture(entity); GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.translate(-0.5F, -0.5F, 0.5F); blockrendererdispatcher.renderBlockBrightness(SuperTNTMod.LARGE_TNT.getDefaultState(), entity.getBrightness()); GlStateManager.translate(0.0F, 0.0F, 1.0F); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); blockrendererdispatcher.renderBlockBrightness(SuperTNTMod.LARGE_TNT.getDefaultState(), 1.0F); GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } else if (entity.getFuse() / 5 % 2 == 0) { GlStateManager.disableTexture2D(); GlStateManager.disableLighting(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.DST_ALPHA); GlStateManager.color(1.0F, 1.0F, 1.0F, f2); GlStateManager.doPolygonOffset(-3.0F, -3.0F); GlStateManager.enablePolygonOffset(); blockrendererdispatcher.renderBlockBrightness(SuperTNTMod.LARGE_TNT.getDefaultState(), 1.0F); GlStateManager.doPolygonOffset(0.0F, 0.0F); GlStateManager.disablePolygonOffset(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.enableTexture2D(); } GlStateManager.popMatrix(); doRender(entity, x, y, z, entityYaw, partialTicks); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ @Override protected ResourceLocation getEntityTexture(EntityTNTLargePrimed entity) { return TextureMap.LOCATION_BLOCKS_TEXTURE; } } Edit: Well if I put any console output commands into my render's doRender function, it doesn't get executed. This means that there's still a problem with my registering. This is really frustrating though because if I change ANYTHING having to do with registering renders, it either functions even worse or crashes. I'm amazed at the convoluted complexity of this. Another edit: @diesieben07 I would love to try your suggestion of using EntityEntryBuilder except that I can't find documentation on how to use it, a working example of how to use it or how to do it myself through trial and error. Could you point me to a source of documentation or shed more light on this? Typing "EntityEntryBuilder.BuiltEntityEntry()" won't give me that one tooltip with what arguments the function accepts. -
[1.12.2] I can't figure out how to register rendering
Xeraster replied to Xeraster's topic in Modder Support
What do I put for the first argument of the EntityRegistry.registerModEntity function? RenderTNTLargePrimed is what would make sense but that gives me an error. What ResouceLocation variable can I put in there that will not only keep the game from crashing, but cause my render to actually work? Putting null crashes it. Entering a new ResourceLocation(SuperTNTMod.MODID, "RenderTNTLargePrimed") crashes it. I have only been able to crash it or get errors by using that line. What do I do for the ResourceLocation variable? Update: I changed that one line to EntityRegistry.registerModEntity(new ResourceLocation(SuperTNTMod.MODID + ":textures/blocks/largetnt_side.png"), EntityTNTLargePrimed.class, "EntityTNTLargePrimed", 0, SuperTNTMod.MODID, 128, 1, false); Now, it waits until I ignite the TNT to crash. So.. close... Also, here is my crash log: -
[1.12.2] I can't figure out how to register rendering
Xeraster replied to Xeraster's topic in Modder Support
Ok well omitting the EntityRegistry.registerGlobalEntityID(blah blah blah) and EntityRegistry.registerModEntity(blah blah blah) lines causes the render animation to not show (not that it was showing before). Perhaps I need the EntityRegistry.registerModEntity line since it doesn't have "global id" in it as pointed out. I am taking a stab in the dark here, but as far as converting the 1.7.2 code into something that will actually compile, I came up with: @SideOnly(Side.CLIENT) @SubscribeEvent public static void onRegisterModels(ModelRegistryEvent event) { EntityRegistry.registerModEntity(new ResourceLocation("EntityTNTLargePrimed"), EntityTNTLargePrimed.class, "entitytntlargeprimed", 64, SuperTNTMod.SUPER_TNT, 256, 1, false); RenderingRegistry.registerEntityRenderingHandler(EntityTNTLargePrimed.class, new RenderTNTLargePrimed(Minecraft.getMinecraft().getRenderManager())); } Now it just crashes on start up. What can I do now? -
[1.12.2] I can't figure out how to register rendering
Xeraster replied to Xeraster's topic in Modder Support
OK but what do I replace it with in order to make that function actually execute? Do you mean to just not use registerGlobalEntityID at all? If that is what you mean, that solves half my problem but I still can't find a way to make it accept the "EntityRegistry.registerModEntity(EntityTNTLargePrimed.class, "entitytntlarge", 64, this, 256, 1, false);" line Note that simply putting the line "RenderingRegistry.registerEntityRenderingHandler(EntityTNTLargePrimed.class, new RenderTNTLargePrimed(Minecraft.getMinecraft().getRenderManager()));" in client proxy doesn't fix it and renders still don't work like that. -
I'm having a lot of trouble getting renders to work, specifically with custom TNT. In it's current state, when I ignite a custom TNT block, creating an "EntityTNTLargePrimed", it becomes invisible. Here is how I am registering my render in my preInit(): RenderingRegistry.registerEntityRenderingHandler(EntityTNTLargePrimed.class, new RenderTNTLargePrimed(Minecraft.getMinecraft().getRenderManager())); System.out.println("Registered RenderTNTLargePrimed from preint function"); I don't get any render related errors in the console and that system print statement correctly outputs to the console. In my "RenderTNTLargePrimed" class, it's basically a copy and paste of "RenderTNTPrimed" from the base game. package com.xeraster.supertnt.renders; import com.xeraster.supertnt.SuperTNTMod; import com.xeraster.supertnt.primedtnt.EntityTNTLargePrimed; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.item.EntityTNTPrimed; import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderTNTLargePrimed extends Render<EntityTNTLargePrimed> { public RenderTNTLargePrimed(RenderManager renderManagerIn) { super(renderManagerIn); this.shadowSize = 0.5F; } /** * Renders the desired {@code T} type Entity. */ public void doRender(EntityTNTLargePrimed entity, double x, double y, double z, float entityYaw, float partialTicks) { BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y + 0.5F, (float)z); if ((float)entity.getFuse() - partialTicks + 1.0F < 10.0F) { float f = 1.0F - ((float)entity.getFuse() - partialTicks + 1.0F) / 10.0F; f = MathHelper.clamp(f, 0.0F, 1.0F); f = f * f; f = f * f; float f1 = 1.0F + f * 0.3F; GlStateManager.scale(f1, f1, f1); } float f2 = (1.0F - ((float)entity.getFuse() - partialTicks + 1.0F) / 100.0F) * 0.8F; bindEntityTexture(entity); GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.translate(-0.5F, -0.5F, 0.5F); blockrendererdispatcher.renderBlockBrightness(SuperTNTMod.LARGE_TNT.getDefaultState(), entity.getBrightness()); GlStateManager.translate(0.0F, 0.0F, 1.0F); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); blockrendererdispatcher.renderBlockBrightness(SuperTNTMod.LARGE_TNT.getDefaultState(), 1.0F); GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } else if (entity.getFuse() / 5 % 2 == 0) { GlStateManager.disableTexture2D(); GlStateManager.disableLighting(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.DST_ALPHA); GlStateManager.color(1.0F, 1.0F, 1.0F, f2); GlStateManager.doPolygonOffset(-3.0F, -3.0F); GlStateManager.enablePolygonOffset(); blockrendererdispatcher.renderBlockBrightness(SuperTNTMod.LARGE_TNT.getDefaultState(), 1.0F); GlStateManager.doPolygonOffset(0.0F, 0.0F); GlStateManager.disablePolygonOffset(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.enableTexture2D(); } GlStateManager.popMatrix(); doRender(entity, x, y, z, entityYaw, partialTicks); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntityTNTLargePrimed entity) { return TextureMap.LOCATION_BLOCKS_TEXTURE; } } I can't find any information on the internet about stuff that's relevant for fixing this. I did look in a really really old 1.7.2 mod that I made were entity renders for TNT work. The code appears to be: EntityRegistry.registerGlobalEntityID(EntityTNTLargePrimed.class, "entitytntlarge", EntityRegistry.findGlobalUniqueEntityId()); EntityRegistry.registerModEntity(EntityTNTLargePrimed.class, "entitytntlarge", 64, this, 256, 1, false); RenderingRegistry.registerEntityRenderingHandler(EntityTNTLargePrimed.class, new RenderTNTLargePrimed(Minecraft.getMinecraft().getRenderManager())); where my rendering registry is but the problem is that in 1.12.2 that doesn't work. I get errors in the registerGlobalEntityID and registerModEntity lines. On the registerGlobalEntityID, it doesn't like the ".findGlobalUniqueEntityId" part. The error just says "The method findGlobalUniqueEntityId() is undefined for the type EntityRegistry". If I backspace and then make a period, I don't see any functions even remotely close to findGlobalUniqueEntityId and when I just backspace it, it doesn't work either. On the next line, the problem is with the registerModEntity function and the fact that I have (class extends Entity, String, int, Object, int, int, boolean) where it's expecting (ResourceLocation, class extends Entity, String, Object, int, int, boolean). Does anybody know of either a workaround, another way to do this, or something I'm doing wrong that would otherwise allow this to work without those two lines of 1.7.2 code I can't hack into working? I'm thoroughly stumped with this.
-
You are right. It was a typo and I needed to change my item registration to: ModelLoader.setCustomModelResourceLocation(STARWARSRECORD, 0, new ModelResourceLocation("supertnt:record.starrecord", "inventory")); rather than ModelLoader.setCustomModelResourceLocation(STARWARSRECORD, 0, new ModelResourceLocation("record.starrecord", "inventory")); And thanks for pointing out the stuff about @SideOnly and @SidedProxy. I'll look into changing that when I get a chance to.
-
I am wanting to make a custom fluid in forge 1.12.2. I did it in a 1.7.2 mod and I think I remember it being substantially difficult but I did figure it out. I think my biggest problem was with textures. That is not the case now. After looking at the minecraft files for 1.12.2, they seem to have made it so much more complicated that I don't even know where or how to start making a custom one. I've made a few attempts extending base classes but in the end haven't been able to get anywhere because of the way they register their liquids in net.minecraft.init.Blocks and how that applies to or works with net.minecraftforge.fluids. The biggest barrier that makes it not possible to extend existing classes and mess with it until it works is in net.minecraft.init.Blocks where they have: public static final BlockDynamicLiquid FLOWING_WATER; public static final BlockStaticLiquid WATER; followed by: @Nullable private static Block getRegisteredBlock(String blockName) { Block block = Block.REGISTRY.getObject(new ResourceLocation(blockName)); if (!CACHE.add(block)) { throw new IllegalStateException("Invalid Block requested: " + blockName); } else { return block; } } static { if (!Bootstrap.isRegistered()) { throw new RuntimeException("Accessed Blocks before Bootstrap!"); } else { FLOWING_WATER = (BlockDynamicLiquid)getRegisteredBlock("flowing_water"); WATER = (BlockStaticLiquid)getRegisteredBlock("water"); } } I expected there to be something along the lines of: public static final BlockDynamicLiquid FLOWING_WATER = new BlockDynamicLiquid().getRegisteredBlock("flowing_water") public static final BlockStaticLiquid WATER = new BlockStaticLiquid().getRegisteredBlock("water") Now after doing what I believe is a good job of duplicating or extending base class files or making new ones, the above won't work, nor will: public static final BlockDynamicLiquid FLOWING_WATER = new BlockDynamicLiquid("flowing_water"); public static final BlockStaticLiquid WATER = new BlockStaticLiquid("water"); or any other variation after much messing around with it. The idea was to get that to work and then in my block registry, just register it like any regular block like: @Mod.EventBusSubscriber(modid = SuperTNTMod.MODID) public static class RegistrationHandler { public static final Set<ItemBlock> ITEM_BLOCKS = new HashSet<>(); @SubscribeEvent public static void registerBlocks(final RegistryEvent.Register<Block> event) { final IForgeRegistry<Block> registry = event.getRegistry(); System.out.println("register blocks event executed"); final Block[] blocks = {FLOWING_WATER, WATER}; registry.registerAll(blocks); System.out.println("register all function executed"); } @SubscribeEvent public static void registerItemBlocks(final RegistryEvent.Register<Item> event) { final ItemBlock[] items = {new ItemBlock(WATER), new ItemBlock(FLOWING_WATER) }; I just can't even do a good enough job of this to even get it to compile. I have also tried blatantly copy and pasting class files from TestMod3 to get a liquid working using that code. Seems like a reasonable idea if you're desperate enough but it just kept going down a never-ending rabbit hole and I had to keep creating more and more and more TestMod3 dependent classes. I gave up halfway through the multiplayer server crap which doesn't have anything to do with liquid but in TestMod3 I guess it does. So is 1.12.2 liquid really this elusively difficult? What am I missing? I'm an experienced programmer but I'm dumbfounded from the unnecessary complexity of this liquid system. I don't even have any code to post because I can't really get anything close to what might work or something I think should work that could compile. Is there an "idiots guide" for 1.12.2 liquid?
-
I'm having a lot of trouble getting item textures to work. I'm on McForge for 1.12.2. It's for a record, the kind that goes in a jukebox, to be exact. I am able to use console logging to see that my unlocalized name is "item.record.starrecord" and registry name is "supertnt:record.starrecord". The problem is that it shows the purple and black "untextured" texture instead of what I'm trying to display. I thought it was a json problem at first but after trying a lot of stuff, it might be a code problem. It would be easier to narrow it down if I knew the correct json file arrangement for 1.12.2 for items but here is what I have right now: record.starrecord.json located in supertnt/models/item { "parent": "item/generated", "textures": { "layer0": "supertnt:items/record.starrecord" } } Here is the file located in supertnt/blockstates/record.starrecord.json. Note that I have tried it both with and without this file present and niether of them work. { "forge_marker": 1, "defaults": { "model": "supertnt:item/record.starrecord" }, "variants": { "normal": [ { } ], "inventory": [ { "transform": "supertnt:item/record.starrecord" } ] } } Here is my item initialization code: Here is where I initialize the model resource location for my item @SideOnly(Side.CLIENT) @SubscribeEvent public static void onRegisterModels(ModelRegistryEvent event) { ModelLoader.setCustomModelResourceLocation(Items.STARRECORD, 0, new ModelResourceLocation("starrecord", "inventory")); System.out.println("record registry name is = " + Items.STARRECORD.getRegistryName()); System.out.println("record unlocalized name is = " + Items.STARRECORD.getUnlocalizedName()); } Here is where I set up the item: @ObjectHolder(SuperTNTMod.MODID) public class Items { public static final StarRecord STARRECORD = new StarRecord("starrecord", SoundHandler.ACROSSTHESTARS2); @Mod.EventBusSubscriber(modid = SuperTNTMod.MODID) public static class RegistrationHandler { public static final StarRecord STARRECORD = new StarRecord("starrecord", SoundHandler.ACROSSTHESTARS2); public static final Set<Item> ITEMS = new HashSet<>(); /** * Register this mod's {@link Item}s. * * @param event The event */ @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { final IForgeRegistry<Item> registry = event.getRegistry(); final Item[] items = {STARRECORD}; registry.registerAll(items); } } @SideOnly(Side.CLIENT) @SubscribeEvent public static void onRegisterModels(ModelRegistryEvent event) { ModelLoader.setCustomModelResourceLocation(STARRECORD, 0, new ModelResourceLocation("starrecord", "inventory")); System.out.println("record registry name is = " + STARRECORD.getRegistryName()); System.out.println("record unlocalized name is = " + STARRECORD.getUnlocalizedName()); } } And then here is the class file for my item just in case: ublic class StarRecord extends ItemRecord { private static final Map<SoundEvent, ItemRecord> RECORDS = Maps.<SoundEvent, ItemRecord>newHashMap(); private final SoundEvent sound; private final String displayName; public StarRecord(String p_i46742_1_, SoundEvent soundIn) { super(p_i46742_1_, soundIn); this.displayName = "record." + p_i46742_1_; this.setRegistryName(displayName); this.setUnlocalizedName(displayName); this.sound = soundIn; this.maxStackSize = 1; this.setCreativeTab(CreativeTabs.MISC); RECORDS.put(this.sound, this); } /** * Called when a Block is right-clicked with this Item */ public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { IBlockState iblockstate = worldIn.getBlockState(pos); if (iblockstate.getBlock() == Blocks.JUKEBOX && !((Boolean)iblockstate.getValue(BlockJukebox.HAS_RECORD)).booleanValue()) { if (!worldIn.isRemote) { ItemStack itemstack = player.getHeldItem(hand); ((BlockJukebox)Blocks.JUKEBOX).insertRecord(worldIn, pos, iblockstate, itemstack); worldIn.playEvent((EntityPlayer)null, 1010, pos, Item.getIdFromItem(this)); itemstack.shrink(1); player.addStat(StatList.RECORD_PLAYED); } return EnumActionResult.SUCCESS; } else { return EnumActionResult.PASS; } } /** * allows items to add custom lines of information to the mouseover description */ @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { tooltip.add(this.getRecordNameLocal()); } @SideOnly(Side.CLIENT) public String getRecordNameLocal() { return I18n.translateToLocal(this.displayName); } /** * Return an item rarity from EnumRarity */ public EnumRarity getRarity(ItemStack stack) { return EnumRarity.RARE; } @Nullable @SideOnly(Side.CLIENT) public static ItemRecord getBySound(SoundEvent soundIn) { return RECORDS.get(soundIn); } @SideOnly(Side.CLIENT) public SoundEvent getSound() { return this.sound; } } If someone can find the problem and point it out and how to fix it, I would greatly appreciate the help. Thanks in advance.
-
Now I am having trouble with getting block textures to work. The best I have been able to do is get it to where a block doesn't have textures when in the inventory screen or when dropped but it does have a texture when I place the block. Here is a screen shot of what it looks like. I've tried a whole lot of things, but what I have right now is the only thing that will at least allow textures to show up when the block is placed instead of make it so that no textures show up period. Here is all my relevant code: Block and item registration in my main class file: @Mod.EventBusSubscriber(modid = SuperTNTMod.MODID) public static class RegistrationHandler { public static final Set<ItemBlock> ITEM_BLOCKS = new HashSet<>(); /** * Register this mod's {@link Block}s. * * @param event The event */ @SubscribeEvent public static void registerBlocks(final RegistryEvent.Register<Block> event) { final IForgeRegistry<Block> registry = event.getRegistry(); System.out.println("register blocks event executed"); final Block[] blocks = {WHATEVER_TEST, WHATEVER_TEST_SECOND}; registry.registerAll(blocks); System.out.println("register all function executed"); } @SubscribeEvent public static void registerItemBlocks(final RegistryEvent.Register<Item> event) { final ItemBlock[] items = { new ItemBlock(WHATEVER_TEST), new ItemBlock(WHATEVER_TEST_SECOND), }; final IForgeRegistry<Item> registry = event.getRegistry(); for (final ItemBlock item : items) { final Block block = item.getBlock(); final ResourceLocation registryName = Preconditions.checkNotNull(block.getRegistryName(), "Block %s has null registry name", block); registry.register(item.setRegistryName(registryName)); ITEM_BLOCKS.add(item); } //registerTileEntities(); } } Here is the block class file of the block in the picture if it matters package com.xeraster.supertnt.blocks; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; public class BlockTestBlock extends BlockBase{ public BlockTestBlock(String name, Material mat, CreativeTabs tab, float hardness, float resistance, String tool, int harvest) { super(name, mat, tab, hardness, resistance, tool, harvest); } } Here is a picture of the file tree Here are the contents of "testblock.json" located in blockstates: { "variants": { "normal": {"model": "supertnt:testblock"} } } Here are the contents of "testblock.json" located in models/block { "parent": "block/cube_all", "textures": { "all": "supertnt:blocks/testblock" } } And lastly, here are the contents of "testblock.json" located in models/item { "parent": "supertnt:block/testblock" } I can't seem to figure out why any of this doesn't work as expected. If anyone could point out where I'm wrong and how to fix it that would be great. Thanks in advance.
-
Sorry to reply to my own topic but I randomly got lucky and found in TestMod3 Choonster's TestMod3 that I have to add this to my RegistrationHandler class under the registerBlocks subscribe event function: @SubscribeEvent public static void registerItemBlocks(final RegistryEvent.Register<Item> event) { final ItemBlock[] items = { new ItemBlock(WHATEVER_TEST), new ItemBlock(WHATEVER_TEST_SECOND), }; final IForgeRegistry<Item> registry = event.getRegistry(); for (final ItemBlock item : items) { final Block block = item.getBlock(); final ResourceLocation registryName = Preconditions.checkNotNull(block.getRegistryName(), "Block %s has null registry name", block); registry.register(item.setRegistryName(registryName)); ITEM_BLOCKS.add(item); } //registerTileEntities(); } I guess I was confused because I thought that Blocks and Items were different things and that it wasn't possible for a block to also be an item. But in 1.12, I presume anything that could be in a player's inventory is considered an "item" which is why it has to be initialized as an item to be holdable by the player.
-
Hello. I am an old modder from the days of 1.6 and 1.7. A lot of stuff has changed since then so I guess I have to re-learn a lot of mcforge stuff. I am having a lot of trouble getting a custom block added. Earlier today, I believed that I had the block class files set up correctly but couldn't get them to initialize. From what I understand, the blocks have to be registered differently than they used to. At first I thought I couldn't get the blocks to register but if I put System.out.println lines in my register function, it will display in the console and if I change my block's registry name, Minecraft gives an error about it indicating that there was something there. So now I think that there is a problem with the way I am making the blocks. I tried 2 methods of getting a block to work. I made a bunch of custom classes as seen in various tutorials and I also made a block which is basically a direct extension of BlockStone which in theory should mean it has no excuse not to work and should at least show a copy of the stone block. That isn't the case though because of my 2 blocks, none of them show up in the creative menu. I also tried using the give command (/give *player* supertnt:testblock to attempt to force the game to show them but it still doesn't work. It just gives me an error saying "There is no such item with name supertnt:testblock". Here is what I came up with in my main class file to register the blocks: public static final BlockTestBlock WHATEVER_TEST = new BlockTestBlock("testblock", Material.ROCK, CreativeTabs.BUILDING_BLOCKS, 5F, 15F, "pickaxe", 1); public static final BlockStoneCopy WHATEVER_TEST_SECOND = new BlockStoneCopy("testblock2", Material.ROCK, CreativeTabs.BUILDING_BLOCKS, 5F, 15F, "pickaxe", 1); @Mod.EventBusSubscriber(modid = SuperTNTMod.MODID) public static class RegistrationHandler { public static final Set<ItemBlock> ITEM_BLOCKS = new HashSet<>(); /** * Register this mod's {@link Block}s. * * @param event The event */ @SubscribeEvent public static void registerBlocks(final RegistryEvent.Register<Block> event) { final IForgeRegistry<Block> registry = event.getRegistry(); System.out.println("register blocks event executed"); final Block[] blocks = {WHATEVER_TEST, WHATEVER_TEST_SECOND}; registry.registerAll(blocks); System.out.println("register all function executed"); } } Here are the contents of my "BlockTestBlock" file: package com.xeraster.supertnt.blocks; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; public class BlockTestBlock extends BlockBase{ public BlockTestBlock(String name, Material mat, CreativeTabs tab, float hardness, float resistance, String tool, int harvest) { super(name, mat, tab, hardness, resistance, tool, harvest); } //public BlockTestBlock() { // super("testblock", Material.ICE, CreativeTabs.BUILDING_BLOCKS, 10.0F, 10.0F, "pickaxe", 1); //} } and then, here are the contents of the "BlockBase" file: package com.xeraster.supertnt.blocks; import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; public class BlockBase extends Block{ public BlockBase(String name, Material mat, CreativeTabs tab, float hardness, float resistance, String tool, int harvest) { this(name, mat, tab, hardness, resistance); setHarvestLevel(tool, harvest); } public BlockBase(String name, Material mat, CreativeTabs tab, float hardness, float resistance, float light) { this(name, mat, tab, hardness, resistance); setLightLevel(light); } public BlockBase(String name, Material mat, CreativeTabs tab, float hardness, float resistance) { super(mat); setUnlocalizedName(name); setRegistryName(name); setHardness(hardness); setResistance(resistance); setCreativeTab(tab); } } If someone could point out why the above posted code doesn't produce the desired effect of putting a block in my game, that would be greatly appreciated. Another thing I would like to post though is the contents of my "BlockStoneCopy" file. This is just a fundamentally uncomplicated thing and it just baffles me why it doesn't work. I expected to be able to just do the following and get a clone of the stone block to show up but it doesn't actually do anything. package com.xeraster.supertnt.blocks; import net.minecraft.block.BlockStone; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; public class BlockStoneCopy extends BlockStone{ public BlockStoneCopy(String name, Material mat, CreativeTabs tab, float hardness, float resistance, String tool, int harvest) { //this.(name, mat, tab, hardness, resistance, tool, harvest); this.setRegistryName(name); this.setUnlocalizedName(name); this.setCreativeTab(tab); this.setHardness(hardness); this.setResistance(resistance); this.setHarvestLevel(tool, harvest); } } If anyone could point out where my code is wrong and how to change it to get the desired effects, I would be really grateful.