Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

GVmG

Members
  • Joined

  • Last visited

  1. I did though, and it doesn't seem to be working. It's right at the top of my code. EDIT: cleaned up my IDE's cache, that fixed it. guess it was something behind the scenes with compilation.
  2. GVmG changed their profile photo
  3. I have made a custom enchantment (of which all behavior is handled separately). I want this item to only apply to my own custom item. I have tried to use different methods, including overriding the "canEnchant" and "canApplyAtEnchantingTable" methods and such, but somehow that ends up not letting me enchant anything When I fall back to trying to use the custom EnchantmentCategory, that's when it lets me enchant the custom item... and everything else in the game. My enchantment code: public class SpaciousEnchantment extends Enchantment { public static final EnchantmentCategory ENCH_BACKPACK=EnchantmentCategory.create("backpack_enchants", (i) -> i==BackpackMod.ITEM_BACKPACK.get()); public SpaciousEnchantment() { super(Rarity.VERY_RARE, ENCH_BACKPACK, new EquipmentSlot[]{}); } public static int rowsPerLevel(int level) { if (level==1) return 2; if (level==2) return 4; if (level==3) return 6; return 1; } //we override isCurse and the getFullName methods so we can make this un-removable but have a custom color. @Override public boolean isCurse() {return true;} @Override public Component getFullname(int pLevel) { MutableComponent mutablecomponent = Component.translatable(this.getDescriptionId()); mutablecomponent.withStyle(ChatFormatting.GREEN); //mutablecomponent.withStyle(ChatFormatting.GRAY); if (pLevel != 1 || this.getMaxLevel() != 1) { mutablecomponent.append(" ").append(Component.translatable("enchantment.level." + pLevel)); } return mutablecomponent; } @Override public boolean isTreasureOnly() {return true;} @Override public boolean isTradeable() {return false;} @Override public boolean isDiscoverable() {return false;} @Override public int getMaxLevel() {return 3;} } I suspected the issue was the EquipmentSlot stuff, but I tried making it {EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND} and that changed absolutely nothing either, allowing every item in the game to be enchanted. EDIT: I even tried the "canApplyAtEnchantingTable" method in the item class itself and again, nothing changed (since that only affects the item itself, not every other item). i have no idea why it wont work.
  4. So, I am working on a mod and I can say I have some decent experience with java, but while experimenting with my custom renderer, I ran into a problem. Everything works perfectly, it renders exactly a it's supposed to do, but there's a little... thing, that I think could be a bug. I'm not sure if it's a bug in Minecraft, Forge or even Java itself. It may be any of these. Now, straight to what the problem is: I have declared the entity (registered it) and the renderer. Then I wanted to make a variation of that entity, rendered with the same renderer as they have to do basically the same thing. First, let me show you how my entities "parented". Entity>EntityThrowable>EntityBomb - this is a bomb. The renderer for this works well. Entity>EntityThrowable>EntityBomb>EntityStckyBomb - this bomb is sticky. The renderer works but uses the EntityBomb texture. Now, the sticky bomb extends the normal bomb and just stops when something is touched. It has a custom Icon (the item has one), but it is drawn wth the default icon. It also draws like a normal bomb (keeps bouncing around after it has sticked), but it explodes where it's supposed to be stuck. //note that this may be a problem on my part. The problem is that when it renders, it uses the default ItemBomb texture instead of its own. Now, this may seem like a problem with my mod, but here comes the thing that made me think it's not my fault. I tried to "clone" EntityBomb, and the bomb item launches the clone (which is just a bunch of inherited events). The result was the same. I tried setting the renderer for the new bomb clone and for the sticky bomb, ignoring the main bomb entity, but that leads to the default rendering (a white block). Then I tried implementing a method that returns a ResourceLocation with the custom texture, but it doesn't seem to be called. Looks like the renderer can't render entities that aren't direct childs of vanilla entities (like EntityThrower). Then, while I was writing this post, I thought it might have been a missing override, but it wasn't. Then I tried editing the renderer to recognize if it's rendering a bomb or a stickybomb, but I can't find a way to do it. My code is pretty messy (tons of unused varables and methods) because this is not a serious project and I'm experimenting, but I'm pretty sure it's not a problem on my side. I hope this can help, I'm going to make EntityStickyBomb an entity on it's own instead of extending the normal bomb. That will surely fix my problem, even if it means having two renders that do the same thing. Bye! -GV ps: sorry if some letters are missing, my keyboard is acting crazy today. EDIT: quick thing: I'm on the recomended forge for 1.7.10, and I'm now updating to 1.8.1. (EDIT2: actually, to 1.8 ).

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.