• Recently Browsing

    No registered users viewing this page.

  • Posts

    • 1.7 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • My forge minecraft server keeps timing out if someone joins or you enter a certain chunk It has around 180 mods running on Ubuntu 18.04  The server doesn't output an error or anything when this happens because it just comepletely stops responding The log was too big to put into a pastebin [mediafire link deleted] modlist The server has 12GB allocated to it
    • My constructor now looks like this: public StellaEntity(EntityType<? extends StellaEntity> type, World worldIn) { super(type, worldIn); } I saw it like this in vanilla-AnlmalEntities.
    • Hi! I'm building a simple sword where it should count to 5 once every hit and once it hits five starts a cooldown! that logic is still not implemented because I'm having problems saving data inside the ItemStack of the sword in the form of a capability! here's my code, All it does is give me this error Execution failed for task ':runClient', but if I remove the initCapability function inside DickSword.java it doesn't give any error!   DickMod.java @Mod(MOD_ID) public class DickMod { public static final String MOD_ID = "dick_mod"; public static final Logger LOGGER = LogManager.getLogger(MOD_ID); public DickMod() { final IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); modEventBus.addListener(this::onCommonSetup); } private void onCommonSetup(FMLCommonSetupEvent event) { CoolDownProvider.register(); } } DickSword.java package com.example.DickMod.objects.items; import com.example.DickMod.capabilities.CoolDownProvider; import com.example.DickMod.util.helpers.KeyboardHelper; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.LivingEntity; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.BucketItem; import net.minecraft.item.IItemTier; import net.minecraft.item.ItemStack; import net.minecraft.item.SwordItem; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.SoundEvent; import net.minecraft.util.SoundEvents; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.ICapabilityProvider; import javax.annotation.Nullable; import java.util.List; public class DickSword extends SwordItem { public DickSword(IItemTier tier, int attackDamageIn, float attackSpeedIn, Properties builder) { super(tier, attackDamageIn, attackSpeedIn, builder); } @Override public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) { if (CoolDownProvider.CAPABILITY_COOLDOWN != null) { stack.getCapability(CoolDownProvider.CAPABILITY_COOLDOWN).ifPresent(cap -> { if (cap.getCoolDown() > 0) { if (cap.getCount() <= 5) { cap.setCount(cap.getCount() + 1); } else { cap.setCoolDown(5); } } else { getAttributeModifiers(EquipmentSlotType.MAINHAND).forEach((s, attributeModifier) -> { System.out.println(s); }); } System.out.println(cap.getCount()); }); } return super.hitEntity(stack, target, attacker); } @Override public boolean hasEffect(ItemStack stack) { return true; } @Override public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) { if (KeyboardHelper.isHoldingShift()) { tooltip.add(new StringTextComponent("CoolDown: " + 5)); tooltip.add(new StringTextComponent("Hold SHIFT to read More")); } super.addInformation(stack, worldIn, tooltip, flagIn); } @Override public SoundEvent func_225519_S__() { return SoundEvents.BLOCK_ANVIL_BREAK; } @Override public SoundEvent func_225520_U__() { return SoundEvents.BLOCK_ANVIL_BREAK; } @Nullable @Override public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { return new CoolDownProvider(); } } ICoolDown.java public interface ICoolDown { public void setCoolDown(int cooldown); public void setCount(int count); public int getCoolDown(); public int getCount(); } CoolDownProvider.java public class CoolDownProvider implements ICapabilitySerializable<CompoundNBT> { @CapabilityInject(ICoolDown.class) public static final Capability<ICoolDown> CAPABILITY_COOLDOWN = null; LazyOptional<ICoolDown> instance = LazyOptional.of(CAPABILITY_COOLDOWN::getDefaultInstance); public static void register() { CapabilityManager.INSTANCE.register(ICoolDown.class, new CoolDown.Storage(), CoolDown::new); } @Override public CompoundNBT serializeNBT() { return (CompoundNBT) CAPABILITY_COOLDOWN.getStorage().writeNBT(CAPABILITY_COOLDOWN, instance.orElseThrow(() -> new IllegalArgumentException("LazyOptional cannot be empty!")), null); } @Override public void deserializeNBT(CompoundNBT nbt) { CAPABILITY_COOLDOWN.getStorage().readNBT(CAPABILITY_COOLDOWN, instance.orElseThrow(() -> new IllegalArgumentException("LazyOptional cannot be empty!")), null, nbt); } @Nonnull @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { return CAPABILITY_COOLDOWN.orEmpty(cap, instance); } } CoolDown.java public class CoolDown implements ICoolDown { private int cooldown; private int count; public CoolDown() { this.cooldown = 0; } @Override public void setCoolDown(int cooldown) { this.cooldown = cooldown; } @Override public void setCount(int count) { this.count = count; } @Override public int getCoolDown() { return cooldown; } @Override public int getCount() { return count; } public static class Storage implements Capability.IStorage<ICoolDown> { @Nullable @Override public INBT writeNBT(Capability<ICoolDown> capability, ICoolDown instance, Direction side) { CompoundNBT tag = new CompoundNBT(); tag.put("cooldown", IntNBT.func_229692_a_(instance.getCoolDown())); tag.put("count", IntNBT.func_229692_a_(instance.getCount())); return tag; } @Override public void readNBT(Capability<ICoolDown> capability, ICoolDown instance, Direction side, INBT nbt) { CompoundNBT tag = (CompoundNBT) nbt; instance.setCoolDown(tag.getInt("cooldown")); instance.setCount(tag.getInt("count")); } } }  
    • It is not comfortable. I need to log some actions into a separate file. And Forge is stopping me from doing this.
  • Topics

  • Who's Online (See full list)