Jump to content

Aarilight

Members
  • Posts

    86
  • Joined

  • Last visited

Everything posted by Aarilight

  1. I'm making Yet Another Spike Block and I think it would be unique if you collided with all sides except for the pointy side. (It looks kinda like punji sticks) Can you manipulate collision boxes to do something like this or is that not possible?
  2. I've implemented a modded bucket based on Choonster's TestMod3 buckets, and it has a maximum durability of 2. It takes damage fine for world interaction, but altho it works to insert and remove from fluid containers in the world (such as barrels from ex nihilo creatio), it does not damage the bucket as it should. Is there a way to run code when a bucket is filled or emptied by interaction with a fluid container? Here's my custom bucket implementation, if it helps.
  3. I have an item which requires a boolean isFilled and a durability. I don't want to save isFilled as NBT or something because that's silly when I can just pair it with the durability (durability * 2 + int value of isFilled): private int getStackDamage(ItemStack stack) { return stack.getItemDamage() / 2; } private boolean isStackFilled(ItemStack stack) { return (stack.getItemDamage() & 1) != 0; } private ItemStack getStackFilled(ItemStack stack) { return getItemStack(1, getStackDamage(stack) + 1); } However, the texture for the item should be based solely on whether it's isFilled. I saw there used to be something called getIconFromDamage, but I couldn't find something that seemed like what I wanted in threads about upgrading from that. Is there a way I can change the texture for any given item based on the current damage? [edit]: Solved. Use ItemMeshDefinition, ModelLoader.setCustomMeshDefinition, and ModelBakery.registerItemVariants
  4. But instead of having each of my blocks in a list of tile entities, which are updated every tick, I can instead elect to not have them be in the list unless they actually need to be. It may not be necessary optimization but it's not hard so I don't see the point of not doing it. And it's implemented, so.... Also, aren't tile entities saved to disk, whether or not you save any data in them? Doesn't this technically reduce file size as well?
  5. I'm not really worried about a few blocks, but I like the look of the block and want to keep it as a viable building block. Having a tile entity in each of them just sounds really inefficient when it doesn't have to be that way. The comparator functionality is just a fun quirk I wanted to add to the block, not the sole purpose of it.
  6. onNeighborChange only seems to be called when I destroy a comparator, not place it, and it doesn't work if the comparator is placed two blocks away. Is there another event I could use to detect this? I could switch to the comparator blockstate when hasComparatorInputOverride or getComparatorInputOverride are first called, I think that would be fine, but would detecting the comparator being destroyed only be possible via looping through all the valid comparator locations?
  7. Hmm, okay. Is it possible to only create a tile entity if there's a comparator that's connected to it? I doubt there's official methods for that, so do you think it would be worth it to attempt to do that?
  8. I saw another thread (from a long time ago, tho) which recommended I use setTickRandomly(false);, set the tickRate to 1, and use onUpdate, but I couldn't figure out what onUpdate was referring to. Is this what I should be doing to update the comparator? If so, what is onUpdate referring to? It doesn't seem to be updateTick, as that seems to only be called by random ticks, which I'm disabling.
  9. I want to make a block that updates its comparator output every tick, preferably without having to create a tile entity for it (because it can be used as a building block and for beacon bases as well... making a tile entity for all of them and updating all of them every tick sounds like an issue). Is this possible? (I've already Overridden hasComparatorInputOverride and getComparatorInputOverride)
  10. Look at the source for ItemStack, there is no constructor for it that takes no arguments. You must pass at least a block or item You should return playerIn.getHeldItem(handIn)
  11. I have a block, "SummonerEmpty" which has variants. They all render correctly in the world, and the ItemBlocks for them seem to function correctly (eg: they place the correct blocks) However, all the ItemBlocks, when in inventory slots, are the "missing texture", while held they are the "missing texture" block. This is my currrent block class: public class SummonerEmpty extends ModBlock { public static final IProperty<EndersteelType> VARIANT = PropertyEnum.create("variant", EndersteelType.class); public SummonerEmpty() { super("summoner_empty", new Material(MapColor.STONE).setTransparent()); setHasItem(); setHardness(5F); setResistance(30F); setHarvestLevel("pickaxe", 1); setSoundType(SoundType.METAL); setDefaultState(getDefaultState().withProperty(VARIANT, EndersteelType.NORMAL)); } @Override protected BlockStateContainer createBlockState() { List<IProperty<?>> props = new ArrayList<>(super.createBlockState().getProperties()); props.add(VARIANT); return new BlockStateContainer(this, props.toArray(new IProperty<?>[0])); } @Override public IBlockState getStateFromMeta(int meta) { return getDefaultState().withProperty(VARIANT, EndersteelType.byMetadata(meta)); } @Override public int getMetaFromState(IBlockState state) { return state.getValue(VARIANT).getMeta(); } @Override public int damageDropped(IBlockState state) { return getMetaFromState(state); } @Override public void getSubBlocks(CreativeTab tab, NonNullList<ItemStack> list) { for (EndersteelType enumType : EndersteelType.values()) { Logger.info("" + enumType.getMeta()); list.add(new ItemStack(this, 1, enumType.getMeta())); } } @Override public ItemBlock getItemBlock() { ItemBlock result = new ItemBlock(this) { @Override public int getMetadata(int damage) { return damage; } }; result.setRegistryName(getRegistryName()); return result; } } And then models/item/summoner_empty.json: { "parent": "soulus:block/summoner" } Which inherits models/block/summoner.json: { "parent": "minecraft:block/cube_all", "textures": { "all": "soulus:blocks/summoner_normal" } } I know this wouldn't work for the variants, because it only specifies the normal texture, but I would have expected this to show that texture for all of them, instead of texture erroring... I'm assuming I'm missing something pretty basic for the variants to work? [solved, this was like 10 billion different issues all rolled into one]
  12. The block I have is based on endersteel bars from vanilla, here's the current blockstate: { "multipart": [ { "apply": { "model": "soulus:bars_endersteel_post_ends" }}, { "when": { "north": false, "east": false, "south": false, "west": false }, "apply": { "model": "soulus:bars_endersteel_post" } }, { "when": { "north": true, "east": false, "south": false, "west": false }, "apply": { "model": "soulus:bars_endersteel_cap" } }, { "when": { "north": false, "east": true, "south": false, "west": false }, "apply": { "model": "soulus:bars_endersteel_cap", "y": 90 } }, { "when": { "north": false, "east": false, "south": true, "west": false }, "apply": { "model": "soulus:bars_endersteel_cap_alt" } }, { "when": { "north": false, "east": false, "south": false, "west": true }, "apply": { "model": "soulus:bars_endersteel_cap_alt", "y": 90 } }, { "when": { "north": true }, "apply": { "model": "soulus:bars_endersteel_side" } }, { "when": { "east": true }, "apply": { "model": "soulus:bars_endersteel_side", "y": 90 } }, { "when": { "south": true }, "apply": { "model": "soulus:bars_endersteel_side_alt" } }, { "when": { "west": true }, "apply": { "model": "soulus:bars_endersteel_side_alt", "y": 90 } } ] } I want to add variants for the block, eg, my enum: NORMAL(0, "normal"), WOOD(1, "wood"), STONE(2, "stone"), END_STONE(3, "end_stone"), BLAZE(4, "blaze"); How can I combine the multipart and block variation? I was looking at Choonster's block variant example: https://github.com/Choonster-Minecraft-Mods/TestMod3/blob/1.12.2/src/main/resources/assets/testmod3/blockstates/variants.json, this makes me think I have to copy the whole multipart thing for every variation, is this the case, or is there a simpler way to write this?
  13. I think I finally fixed all of the crashes. Thank you guys for your help. I still don't understand why a couple of them happened but nevertheless I was able to fix them. I do have one more issue (only visual, tho) but I'm going to make a separate thread about it. Thanks again, this makes it so I have a working release, hah
  14. Oh, thanks! That is something I totally didn't know and probably wouldn't have figured out. Why would removing the switch fix it? Cause just for the heck of it I tried removing the switch (and using an if/else statement that does the same thing instead) and it worked fine.
  15. Is there something that I don't understand about how classes within classes work? I found another instance of NoClassDefFoundError java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: yuudaari/soulus/common/block/summoner/Summoner$1 at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_131-1-redhat] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_131-1-redhat] at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:796) [MinecraftServer.class:?] at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:414) [DedicatedServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131-1-redhat] Caused by: java.lang.NoClassDefFoundError: yuudaari/soulus/common/block/summoner/Summoner$1 at yuudaari.soulus.common.block.summoner.Summoner.onBlockActivated(Summoner.java:263) ~[Summoner.class:?] at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:472) ~[PlayerInteractionManager.class:?] at net.minecraft.network.NetHandlerPlayServer.processTryUseItemOnBlock(NetHandlerPlayServer.java:767) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:68) ~[CPacketPlayerTryUseItemOnBlock.class:?] at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:13) ~[CPacketPlayerTryUseItemOnBlock.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_131-1-redhat] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_131-1-redhat] at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?] This is the file in question (there have been a couple local edits since then, but not affecting this method): https://github.com/Yuudaari/soulus/blob/master/src/main/java/yuudaari/soulus/common/block/Summoner/Summoner.java Summoner$1 would be the Upgrades class, right? Why would that not exist? I feel like there's some basic concept here about classes and sides that I'm still not getting, maybe.
  16. I use VSCode for Java development because I like pain. (Kidding, it's because I use VSCode for everything else and I really dislike having to configure more than one IDE, when I already know everything about this one and have tweaked it do literally everything I want... it does lack some basic features of Eclipse and IntelliJ but it gets better over time. Also, I'm not really a fan of things that Just Work ™, I'd rather know exactly how a Java/modding workspace needs to be set up to make it work)
  17. I went from new NBTHelper().nbt (which returns an NBTTagCompound) to new NBTTagCompound() and that made it work, before that it did not work. NBTHelper was completely commented out except for its constructor and the nbt field. I had previously commented out all other lines that used NBTHelper methods and since that didn't fix it, that's when I switched to commenting out the use of NBTHelper altogether. After removing all of the references to NBTHelper and extracting the methods I was using in it to each place that called them, it works. I'm not a fan of the change because it adds a lot more lines to each place that used to call it, but it working is better than a crash any day.
  18. I commented every single thing out of the NBTHelper and nothing has changed. How would I go about making the JVM more verbose? Is there an option with gradlew or something? Since I test via gradlew runServer. I don't use Eclipse for development, but if I can't figure this out altogether I'll get it to try to fix this bug. Thanks for the tips! [edit] It for sure is an issue with the NBTHelper class because after removing all references to it, the error doesn't happen anymore. I don't understand why just this one class has NoClassDefFoundErrors. Weirdest thing ever. Does anyone have any ideas?
  19. Yes, I've written 99% of this myself, on and off for the past year or so. I'm a fulltime developer, but Java is probably my least favourite language, so my main deficiencies are with not being a Java expert or knowing all of the little intricacies with the Minecraft and Forge APIs. I honestly don't even know how to debug issues like this, to be honest. The error isn't really helpful at all. I'm not sure what issues could lie in a package, and the class is for sure in the jar, so... I feel so helpless haha Also, I had never tested with runServer because I mistakenly assumed that Open to LAN would be using most of the same code, (yea, it does, obviously, but all the client code is there still because it's still being run in a client). The past day has made me feel the stupidest I've ever felt... lol
  20. I was able to resolve this initial issue thanks to your guys' help, but it's come up again for a weirder class, my NBTHelper utility https://github.com/Yuudaari/soulus/blob/master/src/main/java/yuudaari/soulus/common/util/NBTHelper.java Can you guys see anything here that's client side only? I sure can't... I've gotta be doing something stupid, right? For reference, here's the error: java.lang.NoClassDefFoundError: yuudaari/soulus/common/util/NBTHelper at yuudaari.soulus.common.block.Summoner.SummonerTileEntity.writeToNBT(SummonerTileEntity.java:385) ~[SummonerTileEntity.class:?] at net.minecraft.world.chunk.storage.AnvilChunkLoader.writeChunkToNBT(AnvilChunkLoader.java:412) ~[AnvilChunkLoader.class:?] at net.minecraft.world.chunk.storage.AnvilChunkLoader.saveChunk(AnvilChunkLoader.java:183) ~[AnvilChunkLoader.class:?] at net.minecraft.world.gen.ChunkProviderServer.saveChunkData(ChunkProviderServer.java:214) ~[ChunkProviderServer.class:?] at net.minecraft.world.gen.ChunkProviderServer.saveChunks(ChunkProviderServer.java:242) ~[ChunkProviderServer.class:?] at net.minecraft.world.WorldServer.saveAllChunks(WorldServer.java:1060) ~[WorldServer.class:?] at net.minecraft.server.MinecraftServer.saveAllWorlds(MinecraftServer.java:468) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:509) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:643) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131-1-redhat]
  21. What I got from your comment was that I need to remove all imports of SideOnly(Client) classes from classes running on the server side, correct? That would mean that I have to have two versions of each item that has a custom tooltip via overriding addInformation, because that method requires importing ITooltipFlag, which is SideOnly(Client) Did I misunderstand something or do I really have to do this? That seems like so much bloat
  22. Oh, dang, I didn't realise it worked like this, now I feel really dumb for not realising... I guess I gotta do some rewrites now hah
  23. My mod works fine in singleplayer and on a lan server hosted from a client, but as soon as I try to run a dedicated server it crashes when trying to register items. This sounds like it would be a @SideOnly bug, but the class it can't find is my class yuudaari.soulus.common.ModItems, which is a basic class, obviously, since it's all my mod's items. I have no idea why it wouldn't exist on a server... Here's the full error: java.lang.NoClassDefFoundError: Could not initialize class yuudaari.soulus.common.ModItems at yuudaari.soulus.Soulus.registerItems(Soulus.java:133) ~[Soulus.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_18_Soulus_registerItems_Register.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:143) ~[EventBus$1.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179) ~[EventBus.class:?] at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:741) ~[GameData.class:?] at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:603) ~[Loader.class:?] at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:98) ~[FMLServerHandler.class:?] at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:331) ~[FMLCommonHandler.class:?] at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:128) ~[DedicatedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:550) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131-1-redhat] Here's the repo: https://github.com/Yuudaari/soulus Am I doing something obviously wrong? I don't even know where to begin on a bug like this. Any tips for debugging things like this would be appreciated as well.
  24. I know this isn't quite an forge thing, but a question about an api. I did see a couple other posts about this on this forum, tho, and Waila has become a universal thing, kinda, so I figured this would be okay... I'm having trouble getting my Waila support to work. I've registered the support and made it set a header and a body for my "Summoner" block, but neither appears. I tried adding some logging to see if the code was even being hit, and both of my providers do log when showing the tooltip for that block, but for some reason they still don't show up in the tooltip. Here is my WailaPlugin: https://github.com/Yuudaari/souls/blob/4a6985476a44451bfed9bb407cc7124ca2cba72a/src/main/java/yuudaari/souls/common/compat/Waila.java Here are the lines that actually generate the tooltip: https://github.com/Yuudaari/souls/blob/4a6985476a44451bfed9bb407cc7124ca2cba72a/src/main/java/yuudaari/souls/common/block/Summoner/SummonerTileEntity.java#L542-L557 What am I doing wrong? [Edit: Solved] You can't create a new List<String>, you must add your lines to the provided one.
  25. [edit: solved] My mod is completed and everything works when I test via `gradlew runClient`. I'm trying to make the first build of it. After fixing multiple issues I've come across one that's left me completely stumped. When I open the creative tabs, I crash and get the following error: java.lang.AbstractMethodError: Method yuudaari/souls/common/block/BarsEndersteel.getCreativeTabToDisplayOn()Lnet/minecraft/creativetab/CreativeTabs; is abstract at yuudaari.souls.common.block.BarsEndersteel.getCreativeTabToDisplayOn(BarsEndersteel.java) at yuudaari.souls.common.CreativeTab.func_78018_a(CreativeTab.java:33) at net.minecraft.client.gui.inventory.GuiContainerCreative.func_147050_b(GuiContainerCreative.java:500) at net.minecraft.client.gui.inventory.GuiContainerCreative.func_146286_b(GuiContainerCreative.java:443) at net.minecraft.client.gui.GuiScreen.func_146274_d(GuiScreen.java:543) at net.minecraft.client.gui.inventory.GuiContainerCreative.func_146274_d(GuiContainerCreative.java:590) at net.minecraft.client.gui.GuiScreen.func_146269_k(GuiScreen.java:501) at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1757) at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1096) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:397) at net.minecraft.client.main.Main.main(SourceFile:123) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) All of my blocks extend the same base classes which provide their own getCreativeTabToDisplayOn function (because I'm lazy and didn't want to have to write that line on every block i make). I originally had it running setCreativeTab(CreativeTab.INSTANCE); and changed it to this in an effort to fix the problem. It didn't work, obviously. @Override public CreativeTabs getCreativeTabToDisplayOn() { return CreativeTab.INSTANCE; } See my creative tab class, which is instantiated statically. What am I doing wrong? [edit: solved] Seems like for some reason abstract works differently from workspace to game, I have no idea why. I use a function marked as abstract because I know that any instances will have the function implemented, but for some reason it's not in the build. No clue.
×
×
  • Create New...

Important Information

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