Jump to content

Sataniq

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by Sataniq

  1. I shouldn't need to provide code. Anybody with half a brain can see what information I'm in need of by simply reading the post. I mentioned that I am unable to figure out how to programatically place a block facing a direction - self-explanatory. I need to place a block facing a specified direction, and I don't know how to do this. The model displays big black blotches, if you know about Minecraft's lighting system you would be able to provide some helpful insight into what causes that and how to get around it. And finally the model displays too large in the inventory. Again, fairly self explanatory. Just telling me my post isn't informative enough for you is not helpful, so therefore what was the purpose of your reply? My point being, I don't need to provide code. This isn't a "help me program my mod" thread, this is a simple "please help with this generic issue".
  2. So, I'm back with yet more problems To cut a long story short, I have a block which uses an OBJ model. I've got OBJ models figured out now for the most part. The issues are as follows: 1. I cannot for the life of me figure out this stupid BlockState nonsense, so I'm unable to programatically place a block facing a direction. 2. The model is larger than 1 block space, it's several block spaces large. This causes lighting issues (big dark blotches in seemingly random places). 3. The model is HUGE in the inventory. I would rather it was either invisible or used a different texture. This is a block that should not be obtainable by players anyway, and it doesn't need to show in mods like NEI. Does anyone have any advise to offer on how I can solve any/all of these problems? If so, you're a legend.
  3. Thanks, so I changed the code around a little, and now it works! I don't know why Forge's own events weren't loading the model properly, but it looks like I will be using your way of registering things from now on! You sir, are a legend, take 100 cookies Here's how I'm now registering the blocks: public static void RegisterAll() { RegisterBlock(CEILING_VENT, new ItemBlock(CEILING_VENT)); } @SideOnly(Side.CLIENT) public static void RegisterRenderers() { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(CEILING_VENT), 0, new ModelResourceLocation(new ResourceLocation(DLIM.MODID, "block_ceiling_vent"), "inventory")); } private static void RegisterBlock(Block block, ItemBlock item) { ForgeRegistries.BLOCKS.register(block); ForgeRegistries.ITEMS.register(item.setRegistryName(block.getRegistryName())); }
  4. It seems to be accepting the file with/without the brackets now, and with/without the "default" section. I just don't see why it won't load the inventory item. I wish I knew how to override the inventory display item for it and just render a texture.
  5. I have tried that, same result this is really frustrating, the lack of errors in the log makes it a whole lot worse. If it could tell me what it's failing to find/load, that would be great.
  6. Without the brackets in the blockstate JSON file, that's what it was telling me. I changed the file to look like this: No errors, but still the same result - block renders fine, inventory item is a huge purple and black square. EDIT: It seems I can now remove the square brackets after adding the model definition for the "normal" variant, but the overall issue still remains
  7. Sure, be warned: I do it in a (slightly) strange way, however it's the way I prefer to do things and simplifies my job quite a lot. In my blocks class, I have the block defined: @GameRegistry.ObjectHolder(DLIM.MODID + ":block_ceiling_vent") public static final BlockCeilingVent CEILING_VENT = new BlockCeilingVent("block_ceiling_vent"); The block is then put into an array (all blocks will go here): public static final DBlock[] BLOCKS = { CEILING_VENT }; The blocks are then registered: public static void RegisterBlocks(final RegistryEvent.Register<Block> event) { final IForgeRegistry<Block> REGISTRY = event.getRegistry(); REGISTRY.registerAll(BLOCKS); } public static void RegisterItemBlocks(final RegistryEvent.Register<Item> event) { for (DBlock block : BLOCKS) block.RegisterItemBlock(event); } public static void InitializeModels(ModelRegistryEvent event) { for (DBlock block : BLOCKS) block.InitializeModel(); } DBlock is a custom class extending Block in which all my blocks will extend, and it looks like this (simplified, other stuff goes here but it's not relevant): public DBlock(String name, CreativeTabs tab, float hardness, float resistance, Material material, SoundType placeSound, MapColor mapColour) { super(material, mapColour); this.setUnlocalizedName(DLIM.MODID + ":" + name); this.setRegistryName(new ResourceLocation(DLIM.MODID, name)); this.setHardness(hardness); this.setResistance(resistance); this.setSoundType(placeSound); this.setCreativeTab(tab); } @SuppressWarnings("ConstantConditions") @Override public void RegisterItemBlock(final RegistryEvent.Register<Item> event) { System.out.println("Registering ItemBlock for " + getUnlocalizedName()); event.getRegistry().register(new ItemBlock(this).setRegistryName(this.getRegistryName())); } @SuppressWarnings("ConstantConditions") @Override @SideOnly(Side.CLIENT) public void InitializeModel() { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory")); } The register events are called: @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { DBlocks.RegisterItemBlocks(event); } @SubscribeEvent public static void registerBlocks(final RegistryEvent.Register<Block> event) { DBlocks.RegisterBlocks(event); } And from the Client proxy: @Override public void PreInitialization(FMLPreInitializationEvent event) { OBJLoader.INSTANCE.addDomain(DLIM.MODID); super.PreInitialization(event); } @SubscribeEvent public static void RegisterModels(ModelRegistryEvent event) { DBlocks.InitializeModels(event); }
  8. After putting the brackets back in, I have noticed this: This is odd. Also after making the changes suggested, I am still met with the same results.
  9. I think it should have been mentioned that yes, I have an ItemBlock being registered for the block. Yes, it seems the mtlib had been replaced by usemtl, probably in my confusion while trying to fix the problem. As I said, I am following Forge's example, so as for why I am using brackets, and did the "inventory" part the way I did, see this. After removing the brackets, ALL of the errors have appeared. I'm specifically concerned by the fact that it's now looking in the ITEMS directory It also doesn't seem to want to find the material definition within the .mtl file (and yes, it's spelt correctly). Any ideas? Or could you possibly provide some of your code for how you get .OBJ files to work? (I think that'd be easier than me pestering you all night)
  10. Hello. So, I've started to dabble in the wonderful world of .OBJ. As someone who uses 3D modelling software, and has experience with .OBJ, this is how I'd rather create my models. I have created a block, that uses a .OBJ model. The block renders in the world just fine, but it does not render in the inventory. I've looked at Forge's example and made sure everything's done the same way, to no avail. (Image SHOULD be attached) I am getting only 2 errors in the log: and that's all. And this shouldn't be happening, because the .mtl file is right next to the .obj file, just as it is in the Forge example here. So I am made of questions. Here is the blockstate JSON: { "forge_marker": 1, "defaults": { "textures": {}, "model": "dlim:ceilingvent.obj" }, "variants": { "normal": [{}], "inventory": [{ "transform": "forge:default-block" }] } } The .OBJ file: The .MTL file: newmtl main map_Kd dlim:block_ceiling_vent Does anybody know how to either: Fix the item in the inventory OR for the inventory item, render a texture from the assets, preferrably without creating an item for it?
  11. Hello. So it seems to me, a TileEntity that implements ITickable and overrides the update() function is having some side-related issues. When I open a GUI on the client side my custom Gui class renders the background and overlays as expected. The problem arises if I make the TileEntity update check if the world.isRemote(). If I put the whole update code inside a if (!world.isRemote()) { ... } the TileEntity seems to update just fine, but the GUI; which is pulling values from a reference to the TileEntity; seems to not be getting those values. I would very much like to only have my machine updating on the server side, and have the GUI be able to display it's power level, status etc like it does just fine with no side checking. How would you reccommend I go about fixing this issue? And an explanation as to what causes it would be appreciated, because it makes no sense to me as the values are being set and read from in a normal manner, so I would assume all the values in the TileEntity are being created as copies on both the client and server sides? Please enlighten me, it's been a long week!
  12. Ooookayyy then... so putting a System.out.println() at the top of the read and write to NBT functions has fixed the issue. I will not question it, I will just go with it and assume major-league B.S. Did I facedesk? You bet I did!
  13. Well, the title says it all, really. I have a TileEntity which is saving its NBT data (supposedly), but it won't load anything. Here's the code (only the parts you need to see): private static final String NBTTAG_INVENTORY = "inventory"; private ItemStackHandler inventory = new ItemStackHandler(4) { @Override protected void onContentsChanged (int slot) { TileEntityCrusher.this.markDirty(); } }; @Override public NBTTagCompound writeToNBT (NBTTagCompound compound) { super.writeToNBT(compound); compound.setTag(NBTTAG_INVENTORY, this.inventory.serializeNBT()); System.out.println("Saved crusher inventory"); return compound; } @Override public void readFromNBT (NBTTagCompound compound) { if (compound.hasKey(NBTTAG_INVENTORY)) { this.inventory.deserializeNBT(compound.getCompoundTag(NBTTAG_INVENTORY)); System.out.println("Loaded crusher inventory"); } else { System.err.println("ERROR: Could not load crusher inventory"); } super.readFromNBT(compound); } As you can see, I'm using the output stream to log when the inventory is saved/loaded. All I see in the console is that it has saved, so the writeToNBT() is working. But then if I leave and re-join the world, I see NOTHING about loading, not a message saying it's loaded the inventory OR an error message saying it couldn't... nothing. The TileEntity loses its inventory every time. This is very frustrating, and I'm using the same code as my test project, where this worked just fine. What could be causing this mysterious and stupid behaviour? And yes, the TileEntity is registered... and no, I see no errors in the console.
  14. Sooo, yeah. I have a machine, which has taken an entire day to get to work properly, and I would like to display the machine's "status" as text on the container GUI. Problem is, the text isn't updating. It's being updated in the TileEntity, but when using drawGuiContainerForegroundLayer(), the text does not change. How can I remedy this? Also, how does one properly go about decreasing the text size?
  15. I resolved this, like so: @Override public void getSubItems (CreativeTabs tab, NonNullList<ItemStack> items) { if (getCreativeTab() != tab) return; super.getSubItems(tab, items); items.add(new ItemStack(this, 1, 1)); }
  16. Hello wonderful modders! So I have a query: I have a block, which has a default texture (like all blocks). I'm wondering what would be the best way to go about having its texture change to a 2nd texture when the block is being looked at (within a certain distance and when holding a specific item with a specific metadata), and have it change back to the original texture otherwise. I'd like this to apply to blocks within an imaginary circle on the screen (so, the block being directly looked at and a few around it, based on what would essentially be a 2d-screen-to-3d-world raycast). I don't know if this should be done with a TileEntity and/or TESR, or blockstates (idrk how blockstates work). Help would be greatly appreciated.
  17. Ah, I see. I have a reference to an item but the function still doesn't show in the IDE's suggestions list. I've found it in the Item class, but it's protected. My item does extend a class that extends net.minecraft.item.Item, so surely this should be visible to me? I'm not sure if IDEA is being strange, or I'm just being stupid. Also, how do we actually get the single ItemStack in the getSubItems() function? It's passing a NonNullList<ItemStack> EDIT: I figured I had to cast the item to the class type to get access to the function. This is why you don't program at 8am
  18. Okay, so I would really like to know why people use # in front of function calls when describing them, instead of the period you ACTUALLY use. But regardless, Item.isInCreativeTab does not appear to exist in forge-1.12-14.21.1.2443. How does one go about resolving this problem? - As I'm having it too.
  19. Everything is fixed now, I changed my Item registration to work the same way as you had it set out in your test mod, and that seems to have fixed the language file naming. I also made the coin crafting recipe use 9 copper coins in a 3x3 grid to create a silver coin. I would've preferred to have the value equal to 10 instead of 9, but it's not super important. Perhaps I'll make a machine, but since this is a medieval themed mod, I don't really feel that machines would fit in. Thank you for all your help Choonster
  20. I'm not a fan of GitHub, I find it confusing to use (all this push, pull, fork, requests, bash etc). I tried using it a while back with a tutorial and I just couldn't get along with it Also you're right, and the encoding is indeed UTF-8 for the .lang file. This is how the file looks:
  21. Yes, when I created the package in IntelliJ IDEA, it created it with dots so I deleted them and created them in Windows Explorer to ensure they're nested. No errors appear in the log. I'm not sure of the encoding of the .lang file, but usually IDEA makes the files properly and they work, so I'd assume they are encoded in the correct format.
  22. -Yes, the unlocalized names match. -The lang file is: assets.twt.lang.en_US.lang (I've also tried en_us.lang) -Yes, I have a pack.mcmeta with the version set to 3
  23. So can I not make it so 10 copper coins can be crafted into 1 silver coin and vice-versa, etc? And looking at your mod (from the link posted in one of the comments above), I've set my lang file out the same way, changing the mod ID of course, and no matter what it won't name the items. The modid is correct, the assets folder is correct, etc. I've made plenty of mods before and I do know how these things should be set out, but 1.12 changes are a real pain.
  24. Okay, I finally got somewhere. It required the mod ID to be appended at the start of the name, followed by a colon (it seems). New problem: in the recipe I defined that for the input, it requires a stack of 10, but it provides output when a single item is put in the crafting bench. Also the .lang file isn't naming the items now. I'm aware you're supposed to append the mod ID in front of the item name, but this isn't working as per the examples. AddRecipe(new ItemStack(ModItems.coinDwarfSilver, 1), new Object[]{"#", '#', new ItemStack(ModItems.coinDwarfCopper, 10)}); private static void AddRecipe(ItemStack output, Object... input) { ResourceLocation name = new ResourceLocation(Main.MODID + ":coins"); ResourceLocation group = null; GameRegistry.addShapedRecipe(name, group, output, input); }
×
×
  • Create New...

Important Information

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