• Recently Browsing

    No registered users viewing this page.

  • Posts

    • You need to register a custom entity type. Its a registry entry, just like blocks or items.
    • Hi, i have attached a IItemHandler capability to my entity but i have to pass an IInventory to my Container and i don't kwon how convert it in order to be able to pass to the Container constructor.   Here is the code:   Entity: @CapabilityInject(IItemHandler.class) private static Capability<IItemHandler> ITEM_HANDLER_CAPABILITY = null; protected IItemHandler inventory = new ItemStackHandler();     Container: public class RidableDolphinContainer extends Container { private PlayerInventory playerInventory; private IInventory inventory; public RidableDolphinContainer(int windowID, PlayerInventory playerInventory) { this(windowID, playerInventory, new Inventory(1)); } public RidableDolphinContainer(int windowID, PlayerInventory playerInventory, IInventory inventory) { super(ModContainers.RIDABLE_DOLPHIN.get(), windowID); assertInventorySize(inventory, 1); this.playerInventory = playerInventory; this.inventory = inventory; inventory.openInventory(playerInventory.player); this.addSlot(new SlotSonarRidableDolphin(inventory, 0, 80, 20));  
    • Show your code and the logs from server and client.
    • As far as the server is concerned, the player is always looking at their inventory (unless they are looking at a different container, like a chest).You have to use GuiOpenEvent to replace the GUI. If you want to change the container as well, you will need to do it when the player is created (probably PlayerLoggedInEvent).  
    • So I'm still sorta lost on how to spawn an entity. I'm pretty sure i can use world.addentity to spawn it, but first I guess I need to make it using something like this: Missile m1 = new Missile(???, world); My question is what do I put instead of the three question marks? I tried putting null, and it just crashed my game when it should have started. Here is my missile class. package com.sonniccub.racismmod.entities; import java.util.Random; import com.sonniccub.racismmod.racismmod; import com.sonniccub.racismmod.init.ModEntityTypes; import net.minecraft.entity.EntityType; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.MonsterEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.Explosion; import net.minecraft.world.World; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; import net.minecraftforge.event.entity.living.LivingHurtEvent; @Mod.EventBusSubscriber(modid = racismmod.MOD_ID, bus = Bus.FORGE) public class Missile extends MonsterEntity { public Missile(EntityType<? extends MonsterEntity> type, World worldIn) { super(type, worldIn); } protected void registerAttributes() { super.registerAttributes(); this.getAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(1D); this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.26F); } }  
  • Topics

  • Who's Online (See full list)