Jump to content

HappyHippo77

Members
  • Posts

    23
  • Joined

  • Last visited

Everything posted by HappyHippo77

  1. Thanks for the help, sorry I keep asking so many questions. Where would I use this hashmap? In a class which extends WorldSavedData?
  2. I'm relatively new to Forge, so all of this is very complicated and out of my league, but I'm good at learning, so I'll try. Do you know of any resources for this kind of thing? Well, once the blocks "die", they'd probably be replaced with separate blocks from the mod which would have a more "dead" appearance, and no ability to receive energy (and may have lesser value drops), so I don't think I'd need that kind of thing too much (the energy will restore naturally over time, and not an overly long time, so it shouldn't ever get too full of data).
  3. Thanks for the response! So to do this, would I basically need to add a value for every modified block containing the location and energy values (and potentially the block type as well) of each block?
  4. So I've got a really cool idea for a system for a mod of mine. Basically, it's a magic mod, and there will be two kinda of energy (mana), natural and personal. Natural energy exists in every natural block in the game, to different extents depending on the block itself. Personal energy is from the player themselves. By depleting personal energy too far you'll begin to experience negative effects, but if you don't give an area enough time to "recharge" after performing more magic there and trying again, the energy might be completely depleted from the blocks and they might die, rendering the area useless. Thus, you'd have to balance between using personal and natural energy in order to keep your casting areas alive. I really want to implement this system, but I've run into a massive barrier. I don't know how I would be able to store information, not only in normal vanilla blocks, but in EVERY natural block which has been depleted from its default energy in some way.. I've seen other mods do things somewhat similar to this, so I get the feeling it's possible, I just have no idea how to do it myself. Would I use Capabilities? Or is there a better system?
  5. I might be able to figure it out in 1.15. I used 1.14 because the documentation sucks for 1.15, and there's no tutorials for it either. I'll see if I can update.
  6. Hey! Thanks for the reply. Took me a while to figure out, and I'm not sure I did it right, but I think I finally managed to make a repository for it: https://github.com/HappyHippo77/Witchery2 Please tell me if I did something wrong! I'm pretty new to github. I also may have changed some stuff in the files since I last replied. (Also: I am recreating the Witchery mod, yes. Mostly for practice and personal use, though I may publicize it if it ever gets accurate enough to the original. The idea is not to claim the work as my own, but to bring back the work of another person.)
  7. So I feel bad asking here, but I can't find anything anywhere else so I'll just ask... So I've pretty much done what's in here. The game loads with no related errors or warnings. But when I place the block down, it's completely invisible. It has a hitbox, but there's nothing there. I saw one other person with this problem but they were using 1.9 and never got a good answer. Any idea what causes this?
  8. I would do this, but IIRC they closed their suggestions and such. I also don't very much like it, because it doesn't have the same feel as the original Witchery mod.
  9. Thanks for the help! Also, regarding this ^, I figured that would be it, but I do wonder how that ties in to the fact that that mod is dead (and seemingly, so too is the creator). Who would be the one to call me out if I did reproduce it? I am copying the textures from the mod to use in the recreation, but I'm actively acknowledging that they are Emoniph's creation, not mine. Is there somewhere where I can look at the specifics behind the license and everything for Witchery?
  10. Thanks for the help everyone! I got it working!
  11. Thanks! This is pretty helpful! One thing though, how would one find which block is being clicked with the onItemUse?
  12. Hey again! I'm gonna be around here a lot for a while... So this time I'm trying to make it so when I right click a cauldron with an item, it changes to a different block. Relatively simple concept, with one small problem. I want this to happen to a VANILLA cauldron. Now I've tried to do this by extending CauldronBlock in a class and overriding the onBlockActivated event, but this doesn't seem to be working. I'm assuming there's a problem with the way I'm overriding the thing, but I'm not sure what the issue is. So... how do I do this?? Here's the code: package com.happyhippo77.witchery2.block.blocks; import com.happyhippo77.witchery2.item.ModItems; import net.minecraft.block.*; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.*; import net.minecraft.potion.PotionUtils; import net.minecraft.potion.Potions; import net.minecraft.stats.Stats; import net.minecraft.tileentity.BannerTileEntity; import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.world.World; public class MinecraftCauldron extends CauldronBlock { public MinecraftCauldron(Block.Properties properties) { super(properties); this.setDefaultState(this.stateContainer.getBaseState().with(LEVEL, Integer.valueOf(0))); } @Override public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { ItemStack itemstack = player.getHeldItem(handIn); if (itemstack.getItem() == ModItems.ANOINTING_PASTE) { // DO STUFF HERE } else { return true; } if (itemstack.isEmpty()) { return true; } else { int i = state.get(LEVEL); Item item = itemstack.getItem(); if (item == Items.WATER_BUCKET) { if (i < 3 && !worldIn.isRemote) { if (!player.abilities.isCreativeMode) { player.setHeldItem(handIn, new ItemStack(Items.BUCKET)); } player.addStat(Stats.FILL_CAULDRON); this.setWaterLevel(worldIn, pos, state, 3); worldIn.playSound((PlayerEntity)null, pos, SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); } return true; } else if (item == Items.BUCKET) { if (i == 3 && !worldIn.isRemote) { if (!player.abilities.isCreativeMode) { itemstack.shrink(1); if (itemstack.isEmpty()) { player.setHeldItem(handIn, new ItemStack(Items.WATER_BUCKET)); } else if (!player.inventory.addItemStackToInventory(new ItemStack(Items.WATER_BUCKET))) { player.dropItem(new ItemStack(Items.WATER_BUCKET), false); } } player.addStat(Stats.USE_CAULDRON); this.setWaterLevel(worldIn, pos, state, 0); worldIn.playSound((PlayerEntity)null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); } return true; } else if (item == Items.GLASS_BOTTLE) { if (i > 0 && !worldIn.isRemote) { if (!player.abilities.isCreativeMode) { ItemStack itemstack4 = PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.WATER); player.addStat(Stats.USE_CAULDRON); itemstack.shrink(1); if (itemstack.isEmpty()) { player.setHeldItem(handIn, itemstack4); } else if (!player.inventory.addItemStackToInventory(itemstack4)) { player.dropItem(itemstack4, false); } else if (player instanceof ServerPlayerEntity) { ((ServerPlayerEntity)player).sendContainerToPlayer(player.container); } } worldIn.playSound((PlayerEntity)null, pos, SoundEvents.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); this.setWaterLevel(worldIn, pos, state, i - 1); } return true; } else if (item == Items.POTION && PotionUtils.getPotionFromItem(itemstack) == Potions.WATER) { if (i < 3 && !worldIn.isRemote) { if (!player.abilities.isCreativeMode) { ItemStack itemstack3 = new ItemStack(Items.GLASS_BOTTLE); player.addStat(Stats.USE_CAULDRON); player.setHeldItem(handIn, itemstack3); if (player instanceof ServerPlayerEntity) { ((ServerPlayerEntity)player).sendContainerToPlayer(player.container); } } worldIn.playSound((PlayerEntity)null, pos, SoundEvents.ITEM_BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); this.setWaterLevel(worldIn, pos, state, i + 1); } return true; } else { if (i > 0 && item instanceof IDyeableArmorItem) { IDyeableArmorItem idyeablearmoritem = (IDyeableArmorItem)item; if (idyeablearmoritem.hasColor(itemstack) && !worldIn.isRemote) { idyeablearmoritem.removeColor(itemstack); this.setWaterLevel(worldIn, pos, state, i - 1); player.addStat(Stats.CLEAN_ARMOR); return true; } } if (i > 0 && item instanceof BannerItem) { if (BannerTileEntity.getPatterns(itemstack) > 0 && !worldIn.isRemote) { ItemStack itemstack2 = itemstack.copy(); itemstack2.setCount(1); BannerTileEntity.removeBannerData(itemstack2); player.addStat(Stats.CLEAN_BANNER); if (!player.abilities.isCreativeMode) { itemstack.shrink(1); this.setWaterLevel(worldIn, pos, state, i - 1); } if (itemstack.isEmpty()) { player.setHeldItem(handIn, itemstack2); } else if (!player.inventory.addItemStackToInventory(itemstack2)) { player.dropItem(itemstack2, false); } else if (player instanceof ServerPlayerEntity) { ((ServerPlayerEntity)player).sendContainerToPlayer(player.container); } } return true; } else if (i > 0 && item instanceof BlockItem) { Block block = ((BlockItem)item).getBlock(); if (block instanceof ShulkerBoxBlock && !worldIn.isRemote()) { ItemStack itemstack1 = new ItemStack(Blocks.SHULKER_BOX, 1); if (itemstack.hasTag()) { itemstack1.setTag(itemstack.getTag().copy()); } player.setHeldItem(handIn, itemstack1); this.setWaterLevel(worldIn, pos, state, i - 1); player.addStat(Stats.CLEAN_SHULKER_BOX); } return true; } else { return false; } } } } }
  13. Thanks! One problem though, I can get it down to "client" but there's no "extra". EDIT: well I didn't find "extra", but I did find "block" above "client" and I think it was in there.
  14. So I'm not really sure if this is legal or not, but I'm trying to recreate the Witchery mod for practice. I'm not modifying or using the source code, and I'm not claiming it as original work, plus it's been dead for years (and so has the creator apparently), so I don't think it will be a problem. Now, I've run into a massive difficulty. I'm trying to recreate the Witch's Cauldron, and I've noticed something about the model. The little feet have are rotated on multiple axis. I'm using BlockBench for the models, and in normal Java Minecraft, you can only rotate parts on one axis. Now, I figured I might open the Witchery Jar and just check how they do it in that. They don't. There's no models at all. So yeah, how do you make a model with parts with multiple rotations?
  15. I'm using IntelliJ, and I can't seem to find anything like this. Would it be in "External Libraries"? And if so what would the name in there be? I see nothing similar to "client-extra"...
  16. How would I do this?
  17. What do you mean "look at"?
  18. I've been doing some searching for help with this but can't seem to find anything. I don't want to add new particles into the game, I want to use the vanilla particles. Basically I'm trying to get flame particles to appear over specific parts of a block in my mod (where there are candles) and cannot find anything telling me how to even begin to use particles. So yeah, just some information on how to do that (or pointing to a good tutorial for it) would be nice. I'm using 1.14.4.
  19. I already have a basic understanding of how Java functions. I can get around alright in a Java environment. I guess I just never heard "constructor" before. One problem that I may have is that I can't learn Java well with anything except Forge. I only learn well when I'm doing something I find interesting, and the boring, drawling, here's-this-now-go-use-it tutorials you usually find never teach me anything I'll remember. I'll end up learning Forge faster if I just learn to use Forge than if I spend forever scurrying around trying to find the smallest shred of a good resource for Java.
  20. I'm not entirely sure what this means, nor how I should fix it. What is a constructor, and what is a receive event, and what should I be doing instead?
  21. How might I go about fixing that? I'm still very new to this and have no idea what I'm doing.
  22. So I'm following some tutorials, and I'm trying to use them is ways other than exactly what they're doing (which helps me learn faster), but I may have caused problems by doing that... So the first problem started when I had a block and an item for that block. I could /setblock the block just fine, no errors. But when I /give-d myself the item, it says "an internal error occurred when running this command" and immediately crashed. I didn't understand what was wrong, but after some messing around I managed to make it stop doing that... With the slight side effect that the game wont even load. It just throws a bunch of errors, and comes up with a screen saying "1 error occurred". I have no clue how to fix this (the error seems blatantly unconnected), so I decided to ask about it here. I am using 1.14.4. This is my main file (Noodles) package com.happyhippo77.noodles; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // The value here should match an entry in the META-INF/mods.toml file @Mod("noodles") public class Noodles { public static final String MODID = "noodles"; // Directly reference a log4j logger. public static final Logger LOGGER = LogManager.getLogger(); public Noodles() { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); } private void setup(final FMLCommonSetupEvent event) { } } This is the file for the block (NoodleOre) don't ask why the obsession with noodles, I don't know package com.happyhippo77.noodles.blocks.properties; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; public class NoodleOre extends Block { public NoodleOre() { super(Properties.create(Material.ROCK) .sound(SoundType.STONE) .hardnessAndResistance(2.0f) ); setRegistryName("noodle_ore"); } } Here's the file for the blocks (ModBlocks) package com.happyhippo77.noodles.blocks; import com.happyhippo77.noodles.Noodles; import com.happyhippo77.noodles.blocks.properties.NoodleOre; import net.minecraft.block.Block; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.registries.ObjectHolder; @Mod.EventBusSubscriber(modid = Noodles.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) @ObjectHolder(Noodles.MODID) public class ModBlocks { @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register<Block> event) { // register a new block here event.getRegistry().register(new NoodleOre()); Noodles.LOGGER.info("Registered Blocks"); } public static NoodleOre NOODLE_ORE = null; } And here's the file for the items (ModItems) package com.happyhippo77.noodles.items; import com.happyhippo77.noodles.Noodles; import com.happyhippo77.noodles.blocks.ModBlocks; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(modid = Noodles.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ModItems { @SubscribeEvent public static void onItemsRegistry(final RegistryEvent.Register<Item> event) { // register a new block here event.getRegistry().register(new BlockItem(ModBlocks.NOODLE_ORE, new Item.Properties()).setRegistryName(ModBlocks.NOODLE_ORE.getRegistryName())); Noodles.LOGGER.info("Registered Items"); } } Overall the code is just kind of erratic, so there's probably some really idiotic mistake in there that I can't see. Nonetheless, I really can't figure it out, so any help is appreciated! Oh yeah, and here's the console from around the time the errors start to where they end.
  23. So I've been learning Forge for a little bit, but I can't find any good resources. So far I've been using Cadiboo's tutorials (1.15.1) at https://cadiboo.github.io/tutorials/1.15.1/forge/, but those are still very early in creation and after looking through the source code of other mods around this version it appears that it is not teaching typical organization methods. I'm intending to learn Forge 1.15.2, but if there's an easier/more accessible version that's still relatively recent then I'll take that instead, and move into 1.15.2 as I improve. So yeah, what are some good resources, and what version should I learn first?
×
×
  • Create New...

Important Information

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