Jump to content

LaDestitute

Members
  • Posts

    10
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • URL
    https://gitlab.com/LaDestitute/Spelunkcraft
  • Personal Text
    The following is true; the former is false

LaDestitute's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Canceling fog density is currently broken (it doesn't work.) and in pr-hell in 1.17/1.18: https://github.com/MinecraftForge/MinecraftForge/pull/8338
  2. A mod that introduces items and mechanics from Spelunky, a vertical roguelike platformer by Derek Yu. Links Curseforge/Download | Gitlab | Trello Issue Tracker | Discord Server | Optifine (recommended, especially if using the mod's dynamic lights) Features *Gold Ore and Emerald Ore is now somewhat more aplenty underground and new ores (Sapphire and Ruby) are also introduced *However, caves are more dangerous now, loaded with carved stone blocks that are instant-kill crushing hazards, spikes that instantly kill you if you fall on them and highly reactive powderboxes *Lots of new blocks and items from decorative use, tools/utilities and new types of weapons with interesting mechanics (including a couple of Spelunky Classic exclusive items) *Three new structures: mini-mineshafts, vaults and golden idol traps *Dynamic environment music (music plays randomly if you're underground) *A new death mechanic that punishes you if you are careless, you now respawn with a no-healing debuff and decreased health/hunger temporarily (config-togglable) *Fall damage now stuns entities briefly, including you so be more careful about high drops now! (config-togglable) *Dynamic light, this is also not just client-side so it actually updates lighting-levels (config-togglable) Planned +0.2: boomerang, altar tile-entity, arrow traps (unimplemented/partially working, saving for 0.2 or later), corpses, lantern, kapala, journal, new mobs (snake, bat, cobra, spinner spider, caveman, giant spider, damsel, shopkeeper) FAQ Q: What is Spelunky? A: Spelunky is a vertical roguelike by Derek Yu, with inspiration from treasure-hunting cliches and Indiana Jones. It features permadeath, random level generation, high difficulty and an emphasis on mastering mechanics, emergent gameplay and making decisions on the spot based on level-gen and unpredictable but predictable enemy AI. Spelunky currently has a sequel in development, slated for release next year. Q: Can I include this in a modpack or look at the source for code-referencing? A: Sure! Just give credit where due, especially for modpacks Q: Is this server-compatible? A: It is, from my basic LAN testing. I may need to do throughout server-testing with an actual jar, later, though. Q: I ran into a bug/crash/etc! A: Go to this link and submit an issue! Thanks! (issue tracker) Q: Requests/suggestions A: Do not use the issue tracker, please contact me via twitter/etc or join the Discord Server and use the relevant #ideas channel Blocks Items
  3. I've been working on having a custom dispenser-block in my mod and have came to the conclusion that I can't have dispensing-behavior without the block using a Dispenser as it's tile entity and having the dispensing-related code use the Dispenser TE in the block as a result, i.e in the dispense() method if I want it to be able to dispense items. This is maybe the only way it's doable in 1.12 for having custom Dispenser/Dropper blocks, since I've checked out the source code for a few mods that use custom dispenser-blocks and they do it the same way. Unless I'm missing something, is this the only way if I want a custom Dispenser-like block? This complicates another issue as a direct result, I can't do EntitiesWithinAABB checks (specifically to auto-fire if an entity walks near the southface, preferably with ITickable) without attaching a custom tile entity and doing so/replacing all the Dispenser behavior with my own Dispenser-based TE breaks the dispensing itself. My Block (don't mind the vanilla code, I'm just fiddling with stuff) https://pastebin.com/gTvsVu8n
  4. Okay, yeah that fixed it. Thanks for the pointer man. One thing learned every day.
  5. okay yeah, I'm dumb, thanks, I'll see if that fixes it. I spent hours refactoring and editing so it's silly I missed a mistake like that.
  6. I...half agree. I've begun to dislike such people for just teaching people to abuse inheritage and using static registry (which is fine if you're a beginner and doing a small-scale mod that just adds like a dozen items or something) but in general, static registry is...NO BAD! It took me a while up to now to shake those habits. However, I am of the opinion if you ignore the inheritage with custom-classes and static registers, such tutorials are okay...to maybe get your foot in. Even just for simple stuff like ore or structure gen. But you should also learn from written/text tutorials, Minecraf'ts src code (even if ...ahem, Mojang is "lets use deprecated methods, trolololol!" and "if it ain't broke, don't fix or improve it") or any available src code or open source code. Open source code is wonderfuuul to learn from.
  7. So, I just spent hours refactoring my own source code to use Cadiboo's example mod method of registering blocks and items. However, I'm getting an annoying crash, noticed my registry is...setting incorrect names (such as "arrowtrap" instead of "arrow_trap") yet all my code looks okay and I had no errors. I did a search and could only find one thing but I'm still a bit stumped, as I'm not sure that I have that specific thread's issue. My source code: https://gitlab.com/LaDestitute/Spelunkcraft/tree/unstable/src/main/java/ladestitute/spelunkcraft (the main dev branch is the unstable branch) My crash: https://pastebin.com/TYb787JY My EventHandler class: package ladestitute.spelunkcraft; import java.util.Arrays; import javax.annotation.Nonnull; import com.google.common.base.Preconditions; import ladestitute.spelunkcraft.blocks.TileEntityArrowTrap; import ladestitute.spelunkcraft.blocks.decor.RubyBlock; import ladestitute.spelunkcraft.blocks.decor.SapphireBlock; import ladestitute.spelunkcraft.blocks.decor.VaultCeilingBlock; import ladestitute.spelunkcraft.blocks.decor.VaultCornerBlock; import ladestitute.spelunkcraft.blocks.decor.VaultMiddleBlock; import ladestitute.spelunkcraft.blocks.ore.RubyOre; import ladestitute.spelunkcraft.blocks.ore.SapphireOre; import ladestitute.spelunkcraft.blocks.traps.ArrowTrap; import ladestitute.spelunkcraft.blocks.traps.PowderBox; import ladestitute.spelunkcraft.blocks.traps.PushBlock; import ladestitute.spelunkcraft.blocks.traps.Spikes; import ladestitute.spelunkcraft.init.ModBlocks; import ladestitute.spelunkcraft.items.materials.ConcentratedGunpowder; import ladestitute.spelunkcraft.items.treasure.GoldenIdol; import ladestitute.spelunkcraft.items.treasure.LargeRuby; import ladestitute.spelunkcraft.items.treasure.LargeSapphire; import ladestitute.spelunkcraft.items.treasure.SmallRuby; import ladestitute.spelunkcraft.items.treasure.SmallSapphire; import ladestitute.spelunkcraft.items.treasure.TreasureBag; import ladestitute.spelunkcraft.util.ModReference; import ladestitute.spelunkcraft.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.crash.CrashReport; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ReportedException; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.EntityEntry; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.registries.IForgeRegistry; @Mod.EventBusSubscriber(modid = ModReference.MOD_ID) public final class EventSubscriber { private static int entityId = 0; /* register blocks */ @SubscribeEvent public static void onRegisterBlocksEvent(@Nonnull final RegistryEvent.Register<Block> event) { final IForgeRegistry<Block> registry = event.getRegistry(); registry.register(new SapphireOre("oreSapphire")); registry.register(new RubyOre("oreRuby")); registry.register(new SapphireBlock("blockSapphire")); registry.register(new RubyBlock("blockRuby")); registry.register(new VaultCeilingBlock("vault_ceiling_block")); registry.register(new VaultMiddleBlock("vault_middle_block")); registry.register(new VaultCornerBlock("vault_corner_block")); registry.register(new Spikes("spikes")); registry.register(new PushBlock("push_block")); registry.register(new ArrowTrap("arrow_trap")); registry.register(new PowderBox("powder_box")); Main.SPELUNKCRAFT_MOD_LOG.debug("Registered blocks"); registerTileEntities(); Main.SPELUNKCRAFT_MOD_LOG.debug("Registered tile entities"); } private static void registerTileEntities() { GameRegistry.registerTileEntity(TileEntityArrowTrap.class, ModReference.MOD_ID + ":arrow_trap"); } private static void registerTileEntity(@Nonnull final Class<? extends TileEntity> clazz, String name) { try { GameRegistry.registerTileEntity(clazz, new ResourceLocation(ModReference.MOD_ID, name)); } catch (final Exception exception) { CrashReport crashReport = new CrashReport("Error registering Tile Entity " + clazz.getSimpleName(), exception); crashReport.makeCategory("Registering Tile Entity"); throw new ReportedException(crashReport); } } /* register items */ @SubscribeEvent public static void onRegisterItemsEvent(@Nonnull final RegistryEvent.Register<Item> event) { final IForgeRegistry<Item> registry = event.getRegistry(); // item blocks // make an array of all the blocks we want to have items Arrays.stream(new Block[]{ ModBlocks.SAPPHIREORE, ModBlocks.RUBYORE, ModBlocks.SAPPHIREBLOCK, ModBlocks.RUBYBLOCK, ModBlocks.VAULTCEILINGBLOCK, ModBlocks.VAULTMIDDLEBLOCK, ModBlocks.VAULTCORNERBLOCK, ModBlocks.SPIKES, ModBlocks.PUSHBLOCK, ModBlocks.ARROWTRAP, ModBlocks.POWDERBOX }).forEach(block -> { Preconditions.checkNotNull(block.getRegistryName(), "Registry name cannot be null!"); registry.register( ModUtil.setCreativeTab( // set it's creative tab to our creativetab (Optional) ModUtil.setRegistryNames( //set its name new ItemBlock(block), //make the itemblock block.getRegistryName()) ) ); }); // items // you can also instantiate items like this, however its not often used for a number of reasons registry.register(ModUtil.setCreativeTab(ModUtil.setRegistryNames(new Item(), "small_sapphire"))); registry.register(new SmallSapphire("small_sapphire")); registry.register(ModUtil.setCreativeTab(ModUtil.setRegistryNames(new Item(), "gemSapphire"))); registry.register(new LargeSapphire("gemSapphire")); registry.register(ModUtil.setCreativeTab(ModUtil.setRegistryNames(new Item(), "small_ruby"))); registry.register(new SmallRuby("small_ruby")); registry.register(ModUtil.setCreativeTab(ModUtil.setRegistryNames(new Item(), "gemRuby"))); registry.register(new LargeRuby("gemRuby")); registry.register(ModUtil.setCreativeTab(ModUtil.setRegistryNames(new Item(), "golden_idol"))); registry.register(new GoldenIdol("golden_idol")); registry.register(ModUtil.setCreativeTab(ModUtil.setRegistryNames(new Item(), "treasure_bag"))); registry.register(new TreasureBag("treasure_bag")); registry.register(ModUtil.setCreativeTab(ModUtil.setRegistryNames(new Item(), "concentrated_gunpowder"))); registry.register(new ConcentratedGunpowder("concentrated_gunpowder")); Main.SPELUNKCRAFT_MOD_LOG.debug("Registered items"); } /* register entities */ @SubscribeEvent public static void onRegisterEntitiesEvent(@Nonnull final RegistryEvent.Register<EntityEntry> event) { final IForgeRegistry<EntityEntry> registry = event.getRegistry(); { // final Class clazz = Entity____.class; // final ResourceLocation registryName = new ResourceLocation(MOD_ID, ModUtil.getRegistryNameForClass(clazz, "Entity")); // registry.register( // EntityEntryBuilder.create() // .entity(clazz) // .id(registryName, entityId++) // .name(registryName.getPath()) // .tracker(range, updateFrequency, sendVelocityUpdates) // .egg(primaryColor, secondaryColor) // .build() // ); } Main.SPELUNKCRAFT_MOD_LOG.debug("Registered entities"); } } The snippet of the central error:
  8. Thanks for the advice. Also yeah, I was screwing around with AxisAlignedBB earlier. I was actually pondering if I should get rid of static initializers and IHas Model, just to make my code a bit cleaner. Also just so I'm correct, with the format of Thing#thing, the latter thing (such as TileEntity#getPos) refers to a method classed under that class, right?
  9. Okay, so main question first: I have a custom block named an Arrow Trap that extends a custom ContainerBase (which implements BlockContainer) and the class itself uses dispenser code. I do have a tile entity to go with the trap (which extends dispenser for the TE) but due to an issue below, I'm just currently having the block partially use Dispenser instead as the TE for now until I can fix the issue. How do I get it to auto-trigger if any entity walks up to seven blocks away from it's south-face (if that's possible or if it's a limit of one block?), while accounting for blocks blocking line of sight (a block blocking in any portion of the range of line = no activation)? I have a hunch I'd have to use raytracing, probably, right? Not gonna post my TE code cause it's 95% vanilla code. Now, regarding GUI: I do know how to override onBlockPlacedBy and createNewTileEntity and while that gives me the custom GUI name I needed, I can't figure out how to make it so the dispensing function works...even with overriding, the dispensing breaks. Either method is fine, whether overriding and using vanilla-derived guis or creating a new one altogether, assuming I can fix the dispensing issue, though a custom GUI would be nice. How would I go about implementing a custom GUI/container, the GUI handler, etc without breaking how my arrow trap block is setup, code wise? I tried once (from Shadowfact's tutorial) and it did work once, at least to the point of being able to open the inventory and close it with no issues but due to how my mod registers blocks/items (with a static list and "ModBlocks.BLOCKS.add(this);" and "ModItems.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName()));" ), it kind of breaks the blockstates for my trap and the constructor/constructor values like Hardness. GUI class works out fine but it's the GuiHandler that gives me errors with my code, other the aforementioned way of how I'm registering things. I know setting up a custom GUI/handler for things like furnaces and chests is easy as pie but I haven't seen many "dispenser"-like examples in the GUI tutorials I've found. Maybe an unique case, given there aren't really tutorials on custom dispenser-like blocks, short of odd old threads and online questions. Arrow Trap code: https://pastebin.com/A4MYmdbe
×
×
  • Create New...

Important Information

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