Jump to content

lisilew

Members
  • Posts

    56
  • Joined

  • Last visited

Everything posted by lisilew

  1. I want CompoundBowItem to be able to shoot only CompoundArrowEntity. Everything works but CompoundArrowEntity does not have custom texture. public class CompoundArrowItem extends ArrowItem { public CompoundArrowItem(Properties builder) { super(builder); } @Override public AbstractArrowEntity createArrow(World worldIn, ItemStack stack, LivingEntity shooter) { return new CompoundArrowEntity(worldIn, shooter); } } public class CompoundBowItem extends BowItem { public CompoundBowItem(Properties builder) { super(builder); } @Override public Predicate<ItemStack> getInventoryAmmoPredicate() { return getAmmoPredicate(); } @Override public Predicate<ItemStack> getAmmoPredicate() { return itemStack -> itemStack.getItem() instanceof CompoundArrowItem; } } public class CompoundArrowEntity extends ArrowEntity { public CompoundArrowEntity(EntityType<? extends CompoundArrowEntity> p_i50172_1_, World p_i50172_2_) { super(p_i50172_1_, p_i50172_2_); } public CompoundArrowEntity(World worldIn, double x, double y, double z) { super(worldIn, x, y, z); } public CompoundArrowEntity(World worldIn, LivingEntity shooter) { super(worldIn, shooter); } @Override protected ItemStack getArrowStack() { return new ItemStack(Items.COMPOUND_ARROW.get()); } } public class CompoundArrowRenderer extends ArrowRenderer<CompoundArrowEntity> { private static final ResourceLocation COMPOUND_ARROW_TEXTURE = new ResourceLocation(ExampleMod.ID, "textures/entity/projectiles/compound_arrow.png"); public CompoundArrowRenderer(EntityRendererManager renderManagerIn) { super(renderManagerIn); } @Override public ResourceLocation getEntityTexture(CompoundArrowEntity entity) { return COMPOUND_ARROW_TEXTURE; } } textures/entity/projectiles/compound_arrow.png is just recolored version of minecraft/textures/entity/projectiles/arrow.png yet it has minecraft arrow texture.
  2. This is actually what I have implemented. I have created an enchantment Advanced Bane of Arthropods with calcDamageByCreature returning 0 and when LivingHurtEvent is fired, I modify damage according to enchantment level. And this brought me another question: how are LivingDamageEvent and LivingHurtEvent different? If using events is the only way to modify effects of enchantments, I will stick with it. Now, if I want players to be able to use Advanced Bane of Arthropods only, do I register it as minecraft:bane_of_arthropods or is it possible to remove vanilla Bane of Arthropods from normal obtaining methods?
  3. I apologize for not providing enough information. My main purpose is to change how damages are calculated. For example, I want bane of arthropods to deal extra damage to enderman alongside with spider. I will be playing with my mod only or at least with mods that do not add anything to game so other mods are not a concern to me. What I mean by removing enchantments is preventing players from obtaining those enchantments through normal ways. Obtaining those enchantments via commands or mods providing players with items that have those enchantments are fine. I am aware that those enchantments can still be obtained through commands but I am okay with that as normal players will not have access to that.
  4. Thanks. I will try that. Enchanting methods are enchantment table, anvil combination and enchanted books which can be obtained through chest loot, fishing, trading, drops, enchanting and bartering. Is removing enchantments still completely impossible even if I listen to these events and alter enchantments as I wish?
  5. If I want to change damage calculation of vanilla enchantments, is ASM the only way to achieve it or is it possible through reflection? If it is only possible with ASM, then I want to create enchantment and disable vanilla ones. In order to remove certain enchantments from game, should I just listen to events, such as world generation, fishing, enchanting and anvil, and cancel them or is there a better way to achieve it?
  6. I want to override default inventory with extra slots so I created TestContainer and TestScreen classes with the same source code as PlayerContainer and InventoryScreen. ContainerType and TestScreen are registered using RegistryEvent.Register<ContainerType<?>> and ScreenManager. I listen to GuiOpenEvent and show my screen instead of default screen like below. @SubscribeEvent public static void onGuiOpen(GuiOpenEvent event) { if (event.getGui() instanceof InventoryScreen) { event.setGui(new TestScreen(Minecraft.getInstance().player)); } } Everything works great but when the recipe book button is clicked, Minecraft crashes with ArrayIndexOutOfBoundsException at net.minecraft.client.gui.recipebook.RecipeBookGui.func_201518_a. What am I doing wrong?
×
×
  • Create New...

Important Information

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