Jump to content

Sciman101

Members
  • Posts

    15
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed

Sciman101's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I'm trying to make a simple mod that works server or clientside - if you have it on your client it works fine, but if you join a modded server without it it also works. The mod doesn't have any assets or clientside features, to my knowledge. I also made sure to add the line ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.DISPLAYTEST,() -> Pair.of(()-> FMLNetworkConstants.IGNORESERVERONLY,(a,b)->true)); from the docs, to ensure it worked. However, even when the player joins with the mod, the server reports 'failed to synchronize registry data minecraft'. It might have something to do with the config files? But even then the config is set up as the SERVER type, so I would assume it doesn't need to match. All the mod does is register a block break event handler, a server config file, and a single command. Does anyone know what the issue could be? I'm stupid, I accidentally deleted a mod on my client while developing the mod. Sorry about that
  2. I asked this exact same question a year back, but between updates and not touching Forge for a while, my old solution doesn't seem to work. I'm trying to create a throwable item in the same vein as the snowball or enderpearl, and everything works except the rendering. Currently, I have a client event subscriber class with the following code @Mod.EventBusSubscriber(value= Dist.CLIENT, modid = AlchemicalBricksMod.MODID, bus=Mod.EventBusSubscriber.Bus.MOD) public class ClientEventSubscriber { @SubscribeEvent public static void registerModels(ModelRegistryEvent event) { RenderingRegistry.registerEntityRenderingHandler(ThrownBrickEntity.class, renderManager -> new SpriteRenderer<>(renderManager, Minecraft.getInstance().getItemRenderer())); } } Botania is open source, and checking that, the method is nearly identical. I don't know if I need to be referencing this class in my main mod class, or what I could be missing. Any help would be appreciated!
  3. Ah, thanks - I looked there before, but I didn't see what it was doing. Thanks for clarifying!
  4. Is it possible to make a block that performs some action when it gets a redstone pulse, like how a dispenser or dropper work, without using a tile entity? I've been able to find code for a block being powered/unpowered, but nothing so far in terms of detecting when the signal initially turns on. EDIT: I can use a tile entity if I have to, in the end, I'm just curious if it's possible without one for simplicity's sake.
  5. I'm trying to make a projectile with several varieties, and instead of making 3 separate entites with largely the same code, I'm using an enum to distinguish between them. The only issue is, I want the different entity types to create different particle effects, but I can only access the 'type' enum on the server side. How would I go about making sure the client also has access to the enum? Here's my projectile class so far
  6. Unfortunately, that didn't seem to work. Here's the code I have for my ModelRegistry package info.sciman.scistuff.client; //imports removed for brevity @Mod.EventBusSubscriber(value=Side.CLIENT,modid= SciStuffMod.MODID) public class ModelRegistrationHandler { @SubscribeEvent public static void onRegisterModelsEvent(ModelRegistryEvent event) { registerEntityRenderers(); } /*private static void registerModel(Item item, int meta) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), "inventory")); }*/ private static void registerEntityRenderers() { RenderingRegistry.registerEntityRenderingHandler(EntityBrickThrowable.class, new RenderSnowball(Minecraft.getMinecraft().getRenderManager(),ModItems.BrickThrowable,Minecraft.getMinecraft().getRenderItem())); } } And my main mod class package info.sciman.scistuff; //imports removed for brevity @Mod(modid=SciStuffMod.MODID, name=SciStuffMod.NAME, version=SciStuffMod.VERSION,acceptedMinecraftVersions = SciStuffMod.MC_VERSION) public class SciStuffMod { //Define mod properties public static final String MODID = "scistuff"; public static final String NAME = "SciStuff"; public static final String VERSION = "0.0.0"; public static final String MC_VERSION = "[1.12.2]"; public static final Logger LOGGER = LogManager.getLogger(SciStuffMod.MODID); @Mod.Instance public static SciStuffMod instance; //Eventhandlers @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { } @Mod.EventHandler public void init(FMLInitializationEvent event) { EntityRegister.registerEntities(); } @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { } } Do I have to call a method in the main class to get the ModelRegistry to work, or something?
  7. I'm trying to create something similar to a snowball, egg, ender pearl, etc. So far, everything works - I can throw the item, a custom entity is spawned, it deals damage on contact w/ enemies - but I can't for the life of me figure out how to make the thrown item render. I've tried looking through the source code, and while I'm pretty sure I need to use RenderSnowball somehow, I can't figure out how to actually register the renderer. Any help would be appreciated!
  8. How would I add that? (Sorry, I don't have a ton of experience with forge)
  9. How would I go about rendering a detail onto the player? Specifically, a large cube that encapsulates the player entierly (It's supposed to be a force field). I know I'd need to create a new class extending RenderPlayer, but the specifics are a little unknown to me.
  10. Nevermind, i figured it out. I put this code into the armor if (stack.stackTagCompound == null) { stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setInteger("mode", 2); stack.stackTagCompound.setFloat("power", 0F); System.out.println("Made NBT data"); }
  11. in what method would I put the getter, since it would go into an armor item? Edit: Actually, maybe I should just change this thread to 'How do I add NBT data to an item on creation and retrieve that data from a GUI?'
  12. Ok, so I tried that with this code public int[] grabArmorModes(EntityPlayer player) { int[] ret_mod = new int[] {0,0,0,0}; if (player.inventory.armorInventory[3] != null) { if (player.inventory.armorInventory[3].getItem() == CyborgMod.cyborgHelmet) { System.out.println(player.inventory.armorInventory[3].getItem().getUnlocalizedName()); NBTTagCompound temp = player.inventory.armorInventory[3].getTagCompound(); if (temp != null) { ret_mod[0] = temp.getInteger("mode"); System.out.println("Sucess! got int" + String.valueOf(temp.getInteger("mode"))); } } } return ret_mod; } (grabArmorModes is the function used by the helmet object to pass the armor values to the GUI to display) It prints the item's name to the console, but never gets to the next print value, so the NBT tag must be return null. This is where I declare the NBT data //Declare NBT data NBTTagCompound tag = new NBTTagCompound(); tag.setInteger("mode", 2); tag.setFloat("power",0F); What am I doing wrong? EDIT: I'm going to try changing it so that the GUI itself gets the armor values, not the helmet. EDIT AGAIN: It looks like the NBT data always returns null. I'm goign to try and see if I can fix that.
  13. Could you try and word it again, with a bit more detail? Do you mean you want the player to walk, place blocks, and later have those blocks deleted or something else?
  14. I'm trying to make a mod which adds custom armor and a GUI that can display certain properties of the armor, namely it's operation mode. These properties are stored as NBT tags, which I can set and acces, however I'm trying to write a function that checks the player's armor slots and detects if he's/she's wearing the custom armor and, if he/she is, get the NBT data from it. Every attempt I've made at this so far only resulted in my game crashing or simply nothing happening. My code looked something like this //Helmet if (player.inventory.armorInventory[3] != null) { if (player.inventory.armorInventory[3].getItem() == MODNAME.Helmet) { return player.inventory.armorInventory[3].getCompoundTag().getInterger("mode"); } } However, like I said this just crashes. Any help would be appreciated. (Also, this code is being run in the onArmorTick method of the helmet, as it's supposed to serve as a sort of heads-up-display.) EDIT: After doing some testing, it seems as though the crash is coming from trying to get the NBT data itself. The data is formatted as an interger with a value of 2.
×
×
  • Create New...

Important Information

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