
HappyKiller1O1
Members-
Posts
581 -
Joined
-
Last visited
Everything posted by HappyKiller1O1
-
So, I am trying to create an entity that floats in the middle of my transparent block. Pretty simple, except that it won't spawn! It throws a NullPointerException at my super(world) in my Entity class. Here is everything, I hope I can get some help. EntityClass: package com.happykiller.weightlimit.entites; import net.minecraft.entity.EntityLiving; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class EntityUpgradeCore extends EntityLiving { public int innerRotation; public EntityUpgradeCore(World world) { super(world); //THIS IS WHERE I GET THE NULL ERROR this.preventEntitySpawning = true; this.setSize(2.0F, 2.0F); this.innerRotation = this.rand.nextInt(100000); } @SideOnly(Side.CLIENT) public EntityUpgradeCore(World worldIn, double posX, double posY, double posZ) { this(worldIn); this.setPosition(posX, posY, posZ); } protected boolean canTriggerWalking() { return false; } public boolean canBeCollidedWith() { return false; } public void onUpdate() { innerRotation++; } protected void entityInit() {} } Render: package com.happykiller.weightlimit.client.renderer; import com.happykiller.weightlimit.entites.EntityUpgradeCore; import com.happykiller.weightlimit.main.ModReference; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderEntityUCore extends RenderLiving<EntityUpgradeCore> { private ResourceLocation rl = new ResourceLocation(ModReference.MOD_RL + "/textures/entity/entity_upgrade_core.png"); public RenderEntityUCore(RenderManager renderManager, ModelBase model, float scale) { super(renderManager, model, scale); this.shadowSize = 0.0F; } protected ResourceLocation getEntityTexture(EntityUpgradeCore entity) { return rl; } } Registering (called in my init): public void registerEntityRenders() { RenderManager rm = Minecraft.getMinecraft().getRenderManager(); RenderingRegistry.registerEntityRenderingHandler(EntityUpgradeCore.class, new RenderEntityUCore(rm, new ModelUpgradeCore(), 0.0F)); } How I am trying to spawn it: public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { Entity entity = new EntityUpgradeCore(worldIn); entity.setLocationAndAngles(pos.getX(), pos.getY(), pos.getZ(), worldIn.rand.nextFloat() * 360.0F, 0.0F); if(!worldIn.isRemote) worldIn.spawnEntityInWorld(entity); super.onBlockAdded(worldIn, pos, state); } Any help is welcome!
-
[Solved] [1.8.9] Custom slabs have incorrect lighting in world
HappyKiller1O1 replied to Choonster's topic in Modder Support
Glad I could help! Sorry about the confusion earlier, happy modding! -
[Solved] [1.8.9] Custom slabs have incorrect lighting in world
HappyKiller1O1 replied to Choonster's topic in Modder Support
There is a really nice tutorial I found here. They only use the neighboring block's brightness if it is not double, so that slightly confirms it will work. Also, they seem to setup their model file WAY differently than yours. Give it a look, and see if it helps! -
[Solved] [1.8.9] Custom slabs have incorrect lighting in world
HappyKiller1O1 replied to Choonster's topic in Modder Support
I was looking at some posts with similar issues, and they all said doing "this.useNeighborBrightness(true)" fixes the rendering issues. Haven't tested it, so I'm not sure. But it's worth a shot. -
[Solved] [1.8.9] Custom slabs have incorrect lighting in world
HappyKiller1O1 replied to Choonster's topic in Modder Support
Oh my God! I thought you were attempting to make Stained Glass slabs, not Stained Clay. Sorry on my part! Hm, have you tried setting your textures in your json manually? (instead of doing all, do north, south, east, west, up, and down). A little tip: you can add a line of code like this to your json file in order to call textures with ease: "textures": { "particle": "texture path for particle", "0": "texture path 0", "1": "texture path 1", "2": "texture path 2", "3": "etc" } Then, you just call it as "#[texture number]" (in quotations, if you didn't already know). It could perhaps be a UV error, but this is unlikely. -
[Solved] [1.8.9] Custom slabs have incorrect lighting in world
HappyKiller1O1 replied to Choonster's topic in Modder Support
Well, I got my transparent block to work be returning CUTOUT, and a render type of 3. It's worth a try, even if you do not see it in vanilla classes. -
[Solved] [1.8.9] Custom slabs have incorrect lighting in world
HappyKiller1O1 replied to Choonster's topic in Modder Support
Add this to your block class: public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.TRANSLUCENT; } There are three of these Enums: SOLID, TRANSLUCENT, CUTOUT. (There is also CUTOUT_MIPPED, but I am not sure how that one works). SOLID means the block has no transparency. TRANSLUCENT means the block is semi-transparent (stained glass, ice). And, CUTOUT means fully transparent (regular glass). This is all I needed to make my block see through (my block contains regular glass, so I use CUTOUT). Just don't forget this: public boolean isOpaqueCube() { return false; } This simply means the block is transparent. Block#getRenderType is required for slabs I believe, but you need that too when using the boolean above. Hope I helped! -
[1.8.8] Can't activate block while holding something
HappyKiller1O1 replied to HappyKiller1O1's topic in Modder Support
I opened an issue, although I am still wondering if I am doing anything wrong. I never added a block with a gui in 1.8, only when I updated to 1.8.8. I might try to do the same in 1.8.9, and see if I get the same result. -
You have to run commands such as "/op [player]" in the console of the server.
-
[1.8.8][SOLVED] Tile Entity Inventory not saving
HappyKiller1O1 replied to HappyKiller1O1's topic in Modder Support
Solved it! Forgot to call the super for write/read nbt. -
Very simple error: my inventory on my container is not saving. Here is my TileEntity class, all is registered correctly, the inventory just won't save. package com.happykiller.weightlimit.blocks.tileentites; import com.happykiller.weightlimit.api.ICarryWeightModifier; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.util.ITickable; public class TileEntityUpgradeStation extends TileEntity implements ITickable, ISidedInventory { private final String name = "Upgrade Station"; private final String tagName = "WLUpgradeStation"; public static final int INV_SIZE = 3; public final int SLOT_UPGRADE = 0; public final int SLOT_MATERIAL = 1; public final int SLOT_RESULT = 2; ItemStack[] inventory = new ItemStack[iNV_SIZE]; public boolean inventoryChanged; public int getSizeInventory() { return inventory.length; } public ItemStack getStackInSlot(int index) { return inventory[index]; } public ItemStack decrStackSize(int slot, int amount) { ItemStack stack = getStackInSlot(slot); if(stack != null) { if(stack.stackSize > amount) { stack = stack.splitStack(amount); if(stack.stackSize == 0) { setInventorySlotContents(slot, null); } }else { setInventorySlotContents(slot, null); } this.markDirty(); } return stack; } public ItemStack getStackInSlotOnClosing(int slot) { ItemStack stack = getStackInSlot(slot); if(stack != null) { setInventorySlotContents(slot, null); } return stack; } public void setInventorySlotContents(int index, ItemStack stack) { this.inventory[index] = stack; if(stack != null && stack.stackSize > this.getInventoryStackLimit()) { stack.stackSize = this.getInventoryStackLimit(); } this.markDirty(); } public int getInventoryStackLimit() { return 64; } public boolean isUseableByPlayer(EntityPlayer player) { return true; } public void openInventory(EntityPlayer player) {} public void closeInventory(EntityPlayer player) {} public boolean isItemValidForSlot(int index, ItemStack stack) { if(index == this.SLOT_UPGRADE && stack.getItem() instanceof ICarryWeightModifier) return true; else return false; } public void writeToNBT(NBTTagCompound tag) { NBTTagList tagList = new NBTTagList(); for(int i = 0; i < this.getSizeInventory(); i++) { if(this.getStackInSlot(i) != null) { NBTTagCompound tag1 = new NBTTagCompound(); tag1.setByte("Slot", (byte)i); this.getStackInSlot(i).writeToNBT(tag1); tagList.appendTag(tag1); } } tag.setTag(tagName, tagList); } public void readFromNBT(NBTTagCompound tag) { NBTTagList items = tag.getTagList(tagName, tag.getId()); for(int i = 0; i < items.tagCount(); i++) { NBTTagCompound item = items.getCompoundTagAt(i); int j = item.getByte("Slot"); ItemStack stack = ItemStack.loadItemStackFromNBT(item); if(stack != null) { if(j >= 0 && j < this.inventory.length) { this.inventory[j] = stack; } } } } public void markDirty() { for(int i = 0; i < this.getSizeInventory(); i++) { if(this.getStackInSlot(i) != null && this.getStackInSlot(i).stackSize == 0) this.setInventorySlotContents(i, null); } this.inventoryChanged = true; } public int getField(int id) { return 0; } public void setField(int id, int value) {} public int getFieldCount() { return 0; } public void clear() { for(int i = 0; i < inventory.length; i++) { inventory[i] = null; } } public String getCommandSenderName() { return name; } public boolean hasCustomName() { return name.length() > 0; } public IChatComponent getDisplayName() { return new ChatComponentText(name); } public int[] getSlotsForFace(EnumFacing side) { return null; } public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) { return this.isItemValidForSlot(index, itemStackIn); } public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) { return false; } public void update() { if(getStackInSlot(SLOT_UPGRADE) != null) { ItemStack backpack = getStackInSlot(SLOT_UPGRADE); if(backpack != null && backpack.getItem() instanceof ICarryWeightModifier) { ICarryWeightModifier itemProps = (ICarryWeightModifier)backpack.getItem(); int amount = itemProps.getAmount(); Item material = itemProps.getMaterial(); Item result = itemProps.getChild(); if(getStackInSlot(this.SLOT_MATERIAL) != null) { ItemStack materialIn = getStackInSlot(this.SLOT_MATERIAL); if(materialIn.stackSize == amount) {//Do slots this.setInventorySlotContents(SLOT_RESULT, new ItemStack(result, 1, 0)); }else { this.setInventorySlotContents(SLOT_RESULT, null); } } } } } }
-
[1.8.8] Can't activate block while holding something
HappyKiller1O1 replied to HappyKiller1O1's topic in Modder Support
It happens while standing. Has this been happening to anyone else? -
[1.8.8] Can't activate block while holding something
HappyKiller1O1 replied to HappyKiller1O1's topic in Modder Support
Seems like I can activate it with an item in my hand, but not a block. -
[1.8.8] Can't activate block while holding something
HappyKiller1O1 replied to HappyKiller1O1's topic in Modder Support
I'm not sure. It seems when I hold anything in my hand, it won't activate. This has never happened before, so perhaps it is a 1.8 bug? -
[1.8.8] Can't activate block while holding something
HappyKiller1O1 posted a topic in Modder Support
This isn't more of a problem, as it is plainly annoying. I am creating a block with a Gui, Container, and all that fancy work. When I right click my block, the container opens just fine. But, when I attempt to right click it with an item in my hand, it doesn't seem to work. #onBlockActivated in my block class: public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { if(world.isRemote || player.isSneaking()) { return false; }else { FMLNetworkHandler.openGui(player, ModMain.instance, ModMain.GUI_UPGRADE_STATION, world, pos.getX(), pos.getY(), pos.getZ()); return true; } } If you need any other classes, just ask! -
[1.8.8][SOLVED] Dropping item from custom slot on death
HappyKiller1O1 replied to HappyKiller1O1's topic in Modder Support
I completely forgot I had a reference in my ExtendedProps! Thank you for pointing out my stupid mistake. -
[1.8.8][SOLVED] Dropping item from custom slot on death
HappyKiller1O1 replied to HappyKiller1O1's topic in Modder Support
I tried it while using the LivingDeathEvent; same result. Perhaps I should use LivingHurtEvent, and spawn the item when the player is at 0 HP? -
I've been having some trouble with dropping an item from my custom slot on the player's death. I thought using LivingDropsEvent would do it, but it seems to always return my slot contents as null: @SubscribeEvent public void onLivingDrop(LivingDropsEvent event) { System.out.println("LivingDrop Called!"); if(event.entity instanceof EntityPlayer) { System.out.println("Entity Was Player"); EntityPlayer player = (EntityPlayer)event.entity; InventoryWeightLimit inv = new InventoryWeightLimit(player); System.out.println(inv.getStackInSlot(inv.SLOT_BACKPACK)); if(inv.getStackInSlot(inv.SLOT_BACKPACK) != null) { System.out.println("Slot was not null!"); ItemStack stack = inv.getStackInSlot(inv.SLOT_BACKPACK); EntityItem item = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, stack); event.drops.add(item); inv.setInventorySlotContents(inv.SLOT_BACKPACK, null); } } } I am guessing this is perhaps because, somehow, the slot is set to null on the player's death? Any advice on how to achieve this?
-
I honestly completely missed that part of the tutorial. Just thought I'd mention it to him in case he misses it too.
-
[1.8.8] Getting a stack in my custom inventory slot
HappyKiller1O1 replied to HappyKiller1O1's topic in Modder Support
You're right about that. I do tend to ask questions about something, try it, then revert my question once it's completed. Thank you everyone! -
[1.8.8] Getting a stack in my custom inventory slot
HappyKiller1O1 replied to HappyKiller1O1's topic in Modder Support
That's what I thought. I am guessing I would send the packet to the client every time the inventory updates? -
[1.7.10] Changing texture based on item in Gui slot
HappyKiller1O1 replied to shmcrae's topic in Modder Support
I would say either use metadata (change the meta when a certain item is in your staff), or use NBT to tell the game what texture to use. This would also require you to use the onUpdate method in Item to update the texture. -
[1.8.8] Getting a stack in my custom inventory slot
HappyKiller1O1 replied to HappyKiller1O1's topic in Modder Support
I do, but my problem is that in my Layer Render, when referencing this; it is always null. The entity is the player, it apparently creates an instance of the Inventory just fine. But, the stack is null, even though I am checking the correct slot. Method: private ItemStack getBackpackInSlot(EntityLivingBase entity) { ItemStack stack = null; if(entity instanceof EntityPlayer) { System.out.println("Entity was player!"); EntityPlayer player = (EntityPlayer)entity; InventoryWeightLimit inv = new InventoryWeightLimit(player); stack = inv.getStackInSlot(inv.SLOT_BACKPACK); } return stack; } Perhaps this is because I am only calling it client side? Would I need to send a packet from the server to tell the client what is there? -
So, I've been having trouble detecting what stack is in the slot on my custom player inventory. I need this to determine whether or not to render my model on the player. I couldn't seem to find any ways of doing this, and would appreciate some help!
-
This means one of your mods is either client-side only (can only be loaded on the client, and not the server), or one of them does not use proxies (doesn't know how to communicate with the server from the client). Perhaps the Cosmetic Armor Rework, but I'm not sure. You can either one: go to each mod page and check if they are client only. Or, two: Load each mod one by one to your server, and see which mod crashes it.