Jump to content

invizzble

Members
  • Posts

    59
  • Joined

  • Last visited

Everything posted by invizzble

  1. Thanks man, that worked! I feel such a noob right now.
  2. Hello everybody While trying to make a cable block, I wanted to make the itemblock for the cable, so it could render in the inventory (because the bock has a special rendering). But whatever I do, the texture doesn't seem to wanna work. I checked if the texture was recognized, it was, but why isn't it being used? ItemBlockCable package com.invizzble.SC.item; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import com.invizzble.SC.lib.Info; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ItemBlockCable extends ItemBlock{ long hexaString; public ItemBlockCable(Block block, Long red, Long green, Long blue) { super(block); hexaString = Long.valueOf(Long.toHexString(red)+Long.toHexString(green)+Long.toHexString(blue), 16); } // @SideOnly(Side.CLIENT) // @Override // public int getColorFromItemStack(ItemStack stack, int par1) { // return (int)hexaString; // } // @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { itemIcon = iconRegister.registerIcon(Info.MOD_ID+":cable"); } } Cable block package com.invizzble.SC.block; import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import com.invizzble.SC.lib.BlockInfo; import com.invizzble.SC.lib.Info; import com.invizzble.SC.tileEntities.BaseTileEntityCable; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public abstract class SCBlockCable extends SCBlockMachine { public SCBlockCable() { setBlockBounds(BlockInfo.CABLE_MIN_CONSTANT, BlockInfo.CABLE_MIN_CONSTANT, BlockInfo.CABLE_MIN_CONSTANT, BlockInfo.CABLE_MAX_CONSTANT, BlockInfo.CABLE_MAX_CONSTANT, BlockInfo.CABLE_MAX_CONSTANT); } @Override public boolean isOpaqueCube() { return false; } @Override public int getRenderType() { return -1; } @Override public boolean renderAsNormalBlock() { return false; } @Override public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { BaseTileEntityCable cable = (BaseTileEntityCable) world.getTileEntity( x, y, z); if (cable != null) { float minX = BlockInfo.CABLE_MIN_CONSTANT - (cable.isCableConnected(ForgeDirection.WEST) ? (6 / 16F): 0); float maxX = BlockInfo.CABLE_MAX_CONSTANT + (cable.isCableConnected(ForgeDirection.EAST) ? (6 / 16F): 0); float minY = BlockInfo.CABLE_MIN_CONSTANT - (cable.isCableConnected(ForgeDirection.DOWN) ? (6 / 16F): 0); float maxY = BlockInfo.CABLE_MAX_CONSTANT + (cable.isCableConnected(ForgeDirection.UP) ? (6 / 16F): 0); float minZ = BlockInfo.CABLE_MIN_CONSTANT - (cable.isCableConnected(ForgeDirection.NORTH) ? (6 / 16F): 0); float maxZ = BlockInfo.CABLE_MAX_CONSTANT + (cable.isCableConnected(ForgeDirection.SOUTH) ? (6 / 16F): 0); setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ); } return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ); } // @Override // public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, // int y, int z) { // // return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z // + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ); // } @Override public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axisAlignedBB, List list, Entity entity) { BaseTileEntityCable cable = (BaseTileEntityCable) world.getTileEntity(x, y, z); if (cable != null) { float minX = BlockInfo.CABLE_MIN_CONSTANT - (cable.isCableConnected(ForgeDirection.WEST) ? (6 / 16F): 0); float maxX = BlockInfo.CABLE_MAX_CONSTANT + (cable.isCableConnected(ForgeDirection.EAST) ? (6 / 16F): 0); float minY = BlockInfo.CABLE_MIN_CONSTANT - (cable.isCableConnected(ForgeDirection.DOWN) ? (6 / 16F): 0); float maxY = BlockInfo.CABLE_MAX_CONSTANT + (cable.isCableConnected(ForgeDirection.UP) ? (6 / 16F): 0); float minZ = BlockInfo.CABLE_MIN_CONSTANT - (cable.isCableConnected(ForgeDirection.NORTH) ? (6 / 16F): 0); float maxZ = BlockInfo.CABLE_MAX_CONSTANT + (cable.isCableConnected(ForgeDirection.SOUTH) ? (6 / 16F): 0); setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ); } super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity); } } registering GameRegistry.registerBlock(copperCable, ItemBlockCable.class, "copperCable", (long)255, (long)255, (long)255); Anyway, thanks for reading.
  3. Found the solution, i should return new TileEntityMachine() in the createTileEntity
  4. Hello, I've been having a problems with my custom machine in it's interface. Whenever i try to do something with a container (for example add an item), it does that task 2 times. So if i put 1 item in, there are 2 items in the container. And if i right click, it takes a fourth of the stack. My conclussion was that it should excecute 2 times (probably serverside and clientside), but i can't seem to find where. Could you guys please take a look and help me? Anyway thanks for reading. Main class: package com.invizzble.SC; import com.invizzble.SC.block.ModBlocks; import com.invizzble.SC.handler.ConfigurationHandler; import com.invizzble.SC.handler.GUIHandler; import com.invizzble.SC.item.ModItems; import com.invizzble.SC.lib.Info; import com.invizzble.SC.proxies.CommonProxy; import com.invizzble.SC.recipes.ShapedRecipes; import com.invizzble.SC.tileEntities.ModTileEntities; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @Mod(modid = Info.MOD_ID , name=Info.MOD_NAME,version = Info.MOD_VERSION) public class SC { @SidedProxy(clientSide = Info.PROXY_CLIENT, serverSide = Info.PROXY_SERVER) public static CommonProxy proxy; @Instance(Info.MOD_ID) public static SC instance; @EventHandler public void preInit(FMLPreInitializationEvent event){ ConfigurationHandler.init(event.getSuggestedConfigurationFile()); FMLCommonHandler.instance().bus().register(new ConfigurationHandler()); //adds the Blocks ModBlocks.init(); //adds the Items ModItems.init(); } @EventHandler public void init(FMLInitializationEvent event){ //registers the tile entities ModTileEntities.registerTileEntities(); //registers the recipes for my mod's Items ShapedRecipes.init(); //registers the creativeTab(s) <- at this point there's only one buth there's room for expansion if i implement the different sciences //register the gui handler new GUIHandler(); } @EventHandler public void postInit(FMLPostInitializationEvent event){ } } GUIHandler: package com.invizzble.SC.handler; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentText; import net.minecraft.world.World; import com.invizzble.SC.SC; import com.invizzble.SC.client.gui.ContainerMachine; import com.invizzble.SC.client.gui.GUISciPad; import com.invizzble.SC.client.gui.GuiMachine; import com.invizzble.SC.item.ItemSciPad; import com.invizzble.SC.tileEntities.TileEntityMachine; import com.invizzble.SC.util.LogHelper; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class GUIHandler implements IGuiHandler{ public GUIHandler(){ NetworkRegistry.INSTANCE.registerGuiHandler(SC.instance, this); } public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { switch(ID){ case 1: TileEntity te = world.getTileEntity(x, y, z); if(te != null && te instanceof TileEntityMachine){ return new ContainerMachine(player.inventory, (TileEntityMachine)te); } break; } return null; } public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { switch(ID){ case 1: TileEntity te = world.getTileEntity(x, y, z); if(te != null && te instanceof TileEntityMachine){ return new GuiMachine(new ContainerMachine(player.inventory, (TileEntityMachine)world.getTileEntity(x, y, z)), (TileEntityMachine)world.getTileEntity(x, y, z)); } break; case 2: Item it = player.getCurrentEquippedItem().getItem(); if(it != null && it instanceof ItemSciPad){ return new GUISciPad(); } } return null; } } MachineContainer: package com.invizzble.SC.client.gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import com.invizzble.SC.tileEntities.TileEntityMachine; public class ContainerMachine extends Container{ private TileEntityMachine machine; public ContainerMachine(InventoryPlayer invPlayer, TileEntityMachine machine){ this.machine = machine; //Slot(IInventory (the machine),int slotId, xCord, yCord) addSlotToContainer(new SlotMachine(machine, 0, 26, 17)); addSlotToContainer(new SlotMachine(machine, 1, 26, 53)); addSlotToContainer(new SlotMachine(machine, 2, 116, 35)); //hotbar for(int i = 0; i < 9; i++){ addSlotToContainer(new Slot(invPlayer, i, i*18+8, 142)); } //player inv for (int y = 0; y < 3; y++){ for(int x = 0; x < 9; x++){ addSlotToContainer(new Slot(invPlayer, (x+9)+y*9, x*18+8, y*18+84)); } } } @Override public boolean canInteractWith(EntityPlayer entityplayer) { // TODO Auto-generated method stub return machine.isUseableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer player, int i){ return null; } } Machine gui: package com.invizzble.SC.client.gui; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Container; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import com.invizzble.SC.block.BlockAtomizer; import com.invizzble.SC.lib.BlockInfo; import com.invizzble.SC.tileEntities.TileEntityMachine; public class GuiMachine extends GuiContainer { static String textureName; private static final ResourceLocation texture=new ResourceLocation(BlockInfo.TEXTURE_LOCATION, "textures/gui/machine.png"); TileEntityMachine machine; public GuiMachine(Container container, TileEntityMachine _machine) { super(container); xSize = 176; ySize = 166; machine = _machine; } @Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glColor4f(1, 1, 1, 1); Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); if(machine.getBlockType() instanceof BlockAtomizer){ } } } BlockMachine : package com.invizzble.SC.block; import net.minecraft.block.material.Material; import net.minecraft.client.gui.inventory.GuiFurnace; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; import com.invizzble.SC.SC; import com.invizzble.SC.lib.Info; import com.invizzble.SC.tileEntities.TileEntityMachine; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public abstract class SCBlockMachine extends SCBlock{ IIcon front; IIcon defaultIcon; String frontName; String defaultName; int guiId; TileEntityMachine machine; public SCBlockMachine(){ super(Material.iron); machine = new TileEntityMachine(); GuiFurnace f; } public void setIcons(String _frontName, String _defaultName){ frontName = _frontName; defaultName = _defaultName; } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister p_149651_1_) { front= p_149651_1_.registerIcon(Info.MOD_ID+":"+frontName); defaultIcon = p_149651_1_.registerIcon(Info.MOD_ID+":"+defaultName); } /** * Side: * 0:Top * 1:Bottom * 2:North * 3:East * 4:South * 5:West **/ @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { return (side != 1 && side != 0)?front:defaultIcon; } protected abstract void setMachineProperties(); @Override public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return machine; } protected void setGuiId(int id){ guiId = id; } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){ if(!world.isRemote){ FMLNetworkHandler.openGui(player, SC.instance, guiId, world, x, y, z); } return true; } } TileEntityMachine package com.invizzble.SC.tileEntities; import java.util.ArrayList; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentText; import com.invizzble.SC.block.BlockAtomizer; import com.invizzble.SC.util.LogHelper; public class TileEntityMachine extends TileEntity implements ISidedInventory { private ItemStack[] items; private ArrayList<ItemStack> allowedItems; int maxStackSize; String name; int powerCapacity; int powerAmount; int powerUsage; int maxPowerTransfer; public TileEntityMachine(){ items = new ItemStack[3]; } public void setMachineName(String _name) { name = _name; } public void addAllowedItem(ItemStack item) { allowedItems.add(item); } /** * * @param maxTransfer * the maximum amount power that can be transported at one time */ public void setMaxTransfer(int maxTransfer) { maxPowerTransfer = maxTransfer; } public void setMaxStackSize(int _maxStackSize) { maxStackSize = _maxStackSize; } public void setPowerCapacity(int capacity) { powerCapacity = capacity; } public void setPowerUsage(int usage) { powerUsage = usage; } @Override public int getSizeInventory() { return items.length; } @Override public ItemStack getStackInSlot(int slot) { return items[slot]; } @Override public ItemStack decrStackSize(int i, int count) { ItemStack itemstack = getStackInSlot(i); if (itemstack != null) { if (itemstack.stackSize <= count) { setInventorySlotContents(i, null); }else{ itemstack = itemstack.splitStack(count); } } return itemstack; } @Override public ItemStack getStackInSlotOnClosing(int slot) { if (items[slot] != null) { ItemStack stack = items[slot]; items[slot] = null; return stack; } else { return null; } } @Override public void setInventorySlotContents(int slot, ItemStack stack) { items[slot] = stack; if (stack != null && stack.stackSize > this.getInventoryStackLimit()) { stack.stackSize = this.getInventoryStackLimit(); } } @Override public String getInventoryName() { return name; } @Override public boolean hasCustomInventoryName() { return name != null ? true : false; } @Override public int getInventoryStackLimit() { return 64; } @Override public boolean isUseableByPlayer(EntityPlayer player) { return player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) <= 64; } @Override public void openInventory() { } @Override public void closeInventory() { } @Override public boolean isItemValidForSlot(int slot, ItemStack stack) { return slot == 2?false:true; } @Override public int[] getAccessibleSlotsFromSide(int side) { return null; } @Override public boolean canInsertItem(int slot, ItemStack stack, int side) { return isItemValidForSlot(slot, stack); } @Override public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) { return true; } @Override public void updateEntity() { //processItem(); } @Override public void writeToNBT(NBTTagCompound tag) { super.writeToNBT(tag); NBTTagList list = new NBTTagList(); for (int i = 0; i < items.length; i++) { if(getStackInSlot(i) != null){ NBTTagCompound nbtTag = new NBTTagCompound(); nbtTag.setByte("Slot", (byte) i); items[i].writeToNBT(nbtTag); list.appendTag(nbtTag); } } tag.setTag("Items", list); } @Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); NBTTagList tagList = tag.getTagList("Items", 10); for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound nbttagcompound1 = tagList.getCompoundTagAt(i); byte slot = nbttagcompound1.getByte("Slot"); if (slot >= 0 && slot < items.length) { items[slot] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } } public boolean canProcess(){ if(getStackInSlot(0) != null){ ItemStack stack = null; if(getBlockType() instanceof BlockAtomizer){ stack = FurnaceRecipes.smelting().getSmeltingResult(getStackInSlot(0)); } if(stack != null){ if(getStackInSlot(2) == null || (getStackInSlot(2) == stack && getStackInSlot(2).stackSize + stack.stackSize <= getInventoryStackLimit())){ return true; }else{ return false; } }else{ return false; } }else{ return false; } } public void processItem() { if (this.canProcess()) { ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(items[0]); if (items[2] == null) { items[2] = itemstack.copy(); } else if (items[2].getItem() == itemstack.getItem()) { items[2].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items } --items[0].stackSize; if (items[0].stackSize <= 0) { items[0] = null; } } } }
  5. make an array string for the names ,use metadata for the blocks and in your languageRegistry just do this for(int i = 0; i < <block_string array>.lenght; i++){ LanguageRegistry.addName(new ItemStack(<block id>, 1, i), <block_string array>); } (the words between <> are things you have to fill in yourself) and then just make sure that whenever you rightclick the block you switch your metadata (don't know what method that is anymore, i think something aroud onBlockActivated and some paremeters but i'm not sure) Hope it helped!
  6. What am I doing wrong? package invizzble.mods.nc.items; import invizzble.mods.nc.entities.projectiles.EntityStaffODarknessAmmo; import invizzble.mods.nc.lib.Strings; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ToolStaffODarkness extends Item{ public ToolStaffODarkness (int id){ super (id ); this.setUnlocalizedName(Strings.STAFFODARKNESS_NAME); this.setMaxStackSize(1); this.setCreativeTab(CreativeTabs.tabCombat); this.setMaxDamage(19); } @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,EntityPlayer par3EntityPlayer) { if(this.getMaxDamage() > 0) { par2World.playSoundAtEntity(par3EntityPlayer, "nc:StaffODarkness", 1.0F, 1.0F); { par2World.spawnEntityInWorld(new EntityStaffODarknessAmmo(par2World, par3EntityPlayer)); } this.DamageItem(par1ItemStack, par3EntityPlayer); } return par1ItemStack; } public void DamageItem(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase){ par1ItemStack.damageItem(1, par2EntityLivingBase); } @SideOnly(Side.CLIENT) @Override public void registerIcons(IconRegister iconRegister)//updateIcons { itemIcon = iconRegister.registerIcon("NC:StaffODarkness"); } } package invizzble.mods.nc.events; import java.net.URL; import invizzble.mods.nc.NM; import invizzble.mods.nc.lib.References; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; public class SoundRegistering { @ForgeSubscribe public void onSound(SoundLoadEvent event) { try { String [] soundFiles = { "StaffODarkness.wav" }; for (int i = 0; i < soundFiles.length; i++){ event.manager.soundPoolSounds.addSound(soundFiles[i]); System.err.println("NC:Sounds Registered"); } } catch (Exception e) { System.err.println("NightmareCraft: Failed to register one or more sounds."); } } } package invizzble.mods.nc; import invizzble.mods.nc.biomes.ModBiomes; import invizzble.mods.nc.blocks.ModBlocks; import invizzble.mods.nc.configuration.ConfigurationHandler; import invizzble.mods.nc.configuration.ServerProxy; import invizzble.mods.nc.configuration.registers.DimensionRegister; import invizzble.mods.nc.configuration.registers.EventManager; import invizzble.mods.nc.configuration.registers.LanguageRegistryBlocks; import invizzble.mods.nc.configuration.registers.LanguageRegistryCreativetab; import invizzble.mods.nc.configuration.registers.LanguageRegistryItem; import invizzble.mods.nc.configuration.registers.LanguageRegistryTools; import invizzble.mods.nc.core.handlers.FuelHandlerNightmareCraft; import invizzble.mods.nc.creativetab.CreativeTab; import invizzble.mods.nc.events.SoundRegistering; import invizzble.mods.nc.items.ModItems; import invizzble.mods.nc.items.ModTools; import invizzble.mods.nc.lib.References; import invizzble.mods.nc.recipes.ShapedRecipes; import invizzble.mods.nc.recipes.ShapelessRecipes; import java.io.File; import net.minecraft.creativetab.CreativeTabs; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid=References.MOD_ID, name=References.MOD_NAME, version= References.VERSION) @NetworkMod(clientSideRequired=true, serverSideRequired=false) public class NM { @SidedProxy(clientSide= "invizzble.mods.nc.configuration.ClientProxy", serverSide= "invizzble.mods.nc.configuration.ServerProxy") public static ServerProxy proxy; //creativetab public static CreativeTabs tabsNightmareCrafts= new CreativeTab(CreativeTabs.getNextID(), References.MOD_ID); @PreInit public void preInit (FMLPreInitializationEvent event){ // Initialize the configuration ConfigurationHandler.init(new File(event.getModConfigurationDirectory().getAbsolutePath()+File.separator + References.CHANNEL_NAME + References.MOD_ID + ".cfg")); //initialize the ModBlocks ModBlocks.init(); //initialize the Mod Items ModItems.init(); //registers modtools ModTools.init(); //registers sound if(FMLCommonHandler.instance().getSide().isClient()) { MinecraftForge.EVENT_BUS.register(new SoundRegistering()); } } @Init public void Init(FMLInitializationEvent event){ //Registers names of blocks LanguageRegistryBlocks.init(); // Registers the names of the Items LanguageRegistryItem.init(); //fixes the creativetab name bug LanguageRegistryCreativetab.init(); //registers the Shapeless Recipes ShapelessRecipes.init(); //registers Shaped Recipes ShapedRecipes.init(); //registers FuelHandler GameRegistry.registerFuelHandler(new FuelHandlerNightmareCraft()); //register CraftingHandler //GameRegistry.registerCraftingHandler(new CraftingHandlerNightmareCraft()); //registers events EventManager.init(); //registers tool Language LanguageRegistryTools.init(); //registers dimensions DimensionRegister.init(); //registers bioemes ModBiomes.init(); //registers the server proxy proxy.registerRenderThings(); } @PostInit public void PostInit(FMLPostInitializationEvent event){ } } help please
  7. Nightmarecraft v alpha 1.0: It Started with a dream. Steve lived happy in his world... but it had to happen... nightmares came to the world and tried to dominate... can you survive this story? Or are you going to die in the madness of the nightmares... Try it out now!Recipes: Video Download and installing: Testing Zone: Planned Features: Terms Of license: Known bugs Remember this is an alpha (and so is the logo http://static.minecraftforum.net//public/style_emoticons/default/smile.png[/img] ) so it doesn't add that much (just yet) to the game, stay tuned for newer versions! If you have any questions or suggestions, post them here below or email me at : [email protected].
  8. is it in your inventory or just when you wear it?
  9. SamHalloMods needs to be samhallomods, forge for mc 1.6 doesn't like capital letters
  10. i'm using at this point the latest version of forge (build 784) and the animations aren't working correctly, they're saying that it isn't an animation, now my question is, are the animations changed from 1.5 or is it just forge that didn't implement them yet in their build...
  11. hello guys it's again me with my entity now what i want to ask is if there is a specific code for if an entity projectile hits a block i wanna have that my entity projectile only explodes on block but now it's also exploding on entitys, so yeah... corect my code please package invizzble.mods.nc.entities.projectiles; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.effect.EntityWeatherEffect; import net.minecraft.entity.monster.EntityBlaze; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; public class EntityStaffODarknessAmmo extends EntityThrowable{ public EntityStaffODarknessAmmo(World par1World) { super(par1World); } public EntityStaffODarknessAmmo(World par1World,EntityLivingBase par2EntityLivingBase) { super(par1World, par2EntityLivingBase); } private int explosionRadius= 3; @Override protected void onImpact(MovingObjectPosition par1Movingobjectposition) { if (par1Movingobjectposition.entityHit != null) { byte b0 = 30; par1Movingobjectposition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)b0); this.setDead(); } if(!this.worldObj.isRemote){ this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, explosionRadius, true); this.setDead(); } } @Override protected float getGravityVelocity() { return 0F; } }
  12. yes that one was already fixed you know, it's like 2am here
  13. My entity doesn't explode if it hits a block while a say it has to ,, am i using the wrong if statement? package invizzble.mods.nc.entities.projectiles; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.effect.EntityWeatherEffect; import net.minecraft.entity.monster.EntityBlaze; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; public class EntityStaffODarknessAmmo extends EntityThrowable{ public EntityStaffODarknessAmmo(World par1World) { super(par1World); } public EntityStaffODarknessAmmo(World par1World,EntityLivingBase par2EntityLivingBase) { super(par1World, par2EntityLivingBase); } private int explosionRadius= 3; @Override protected void onImpact(MovingObjectPosition par1Movingobjectposition) { if (par1Movingobjectposition.entityHit != null) { byte b0 = 30; par1Movingobjectposition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)b0); this.setDead(); } if(!this.worldObj.isRemote){ // i found the !this.worldObj.isRemote int the entityEgg and the EntitySnowball, why doesn't it explode? this.worldObj.createExplosion(this, this.chunkCoordX, this.chunkCoordY, this.chunkCoordZ, explosionRadius, true); } } @Override protected float getGravityVelocity() { return 0F; } }
  14. I think we need to wait 'till theres a stable build of forge ...
  15. did forge change the ore spawn code ? because i had some ores wich spawned perfectly i my own dimension buth now since 1.6 they don't spawn any more, this is my code : orespanwers package invizzble.mods.nc.world.gen; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenMinable; public class OreSpawners { public void addOreSpawnNether(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chancesToSpawn, int minY, int maxY) { @SuppressWarnings("unused") int maxPossY = minY + (maxY - 1); assert maxY > minY: "The maximum Y must be greater than the Minimum Y"; assert maxX > 0 && maxX <= 16: "addOreSpawn: The Maximum X must be greater than 0 and less than 16"; assert minY > 0: "addOreSpawn: The Minimum Y must be greater than 0"; assert maxY < 256 && maxY > 0: "addOreSpawn: The Maximum Y must be less than 256 but greater than 0"; assert maxZ > 0 && maxZ <= 16: "addOreSpawn: The Maximum Z must be greater than 0 and less than 16"; int diffBtwnMinMaxY = maxY - minY; for(int x = 0; x < chancesToSpawn; x++) { int posX = blockXPos + random.nextInt(maxX); int posY = minY + random.nextInt(diffBtwnMinMaxY); int posZ = blockZPos + random.nextInt(maxZ); (new ModWorldGenNetherOres(block.blockID, maxVeinSize)).generate(world, random, posX, posY, posZ); } } public void addOreSpawnSurface(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chancesToSpawn, int minY, int maxY) { @SuppressWarnings("unused") int maxPossY = minY + (maxY - 1); assert maxY > minY: "The maximum Y must be greater than the Minimum Y"; assert maxX > 0 && maxX <= 16: "addOreSpawn: The Maximum X must be greater than 0 and less than 16"; assert minY > 0: "addOreSpawn: The Minimum Y must be greater than 0"; assert maxY < 256 && maxY > 0: "addOreSpawn: The Maximum Y must be less than 256 but greater than 0"; assert maxZ > 0 && maxZ <= 16: "addOreSpawn: The Maximum Z must be greater than 0 and less than 16"; int diffBtwnMinMaxY = maxY - minY; for(int x = 0; x < chancesToSpawn; x++) { int posX = blockXPos + random.nextInt(maxX); int posY = minY + random.nextInt(diffBtwnMinMaxY); int posZ = blockZPos + random.nextInt(maxZ); (new WorldGenMinable(block.blockID, maxVeinSize)).generate(world, random, posX, posY, posZ); } } public void addOreSpawnNightmare(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chancesToSpawn, int minY, int maxY) { @SuppressWarnings("unused") int maxPossY = minY + (maxY - 1); assert maxY > minY: "The maximum Y must be greater than the Minimum Y"; assert maxX > 0 && maxX <= 16: "addOreSpawn: The Maximum X must be greater than 0 and less than 16"; assert minY > 0: "addOreSpawn: The Minimum Y must be greater than 0"; assert maxY < 256 && maxY > 0: "addOreSpawn: The Maximum Y must be less than 256 but greater than 0"; assert maxZ > 0 && maxZ <= 16: "addOreSpawn: The Maximum Z must be greater than 0 and less than 16"; int diffBtwnMinMaxY = maxY - minY; for(int x = 0; x < chancesToSpawn; x++) { int posX = blockXPos + random.nextInt(maxX); int posY = minY + random.nextInt(diffBtwnMinMaxY); int posZ = blockZPos + random.nextInt(maxZ); (new ModWorldGenNetherOres(block.blockID, maxVeinSize)).generate(world, random, posX, posY, posZ); } } } and this is my other code page oreworldgen package invizzble.mods.nc.world.gen; import invizzble.mods.nc.blocks.ModBlocks; import invizzble.mods.nc.lib.DimensionReferences; import java.util.Random; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import cpw.mods.fml.common.IWorldGenerator; public class ModWorldGenOres implements IWorldGenerator{ OreSpawners Ore = new OreSpawners(); public static final int NightmareDimensionID= DimensionReferences.NIGHTMAREDIMENSION_ID; public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch (world.provider.dimensionId){ case -1: GenerateNether(world, random, chunkX*16, chunkZ*16); case 0: generateSurface(world ,random, chunkX *16, chunkZ *16); case 1: GenerateEnd (world, random, chunkX*16, chunkZ*16); case NightmareDimensionID: generateNightmare(world, random, chunkX*16, chunkZ*16); } } private void generateNightmare(World world, Random random, int blockXPos, int blockZPos) { Ore.addOreSpawnNightmare(ModBlocks.NightMareDiamondORE, world, random, blockXPos, blockZPos, 16, 16, 5, 1000, 6, 64); Ore.addOreSpawnNightmare(ModBlocks.CreepyCoalOre, world, random, blockXPos, blockZPos, 16, 16, 10, 15, 6, 64); } private void generateSurface(World world, Random random, int blockXPos, int blockZPos) { Ore.addOreSpawnSurface(ModBlocks.MoonMeteorite, world, random, blockXPos, blockZPos, 16, 16, 15, 4, 30, 64); Ore.addOreSpawnSurface(ModBlocks.DarkBlock, world, random, blockXPos, blockZPos, 16, 16, 10, 4, 30, 64); } private void GenerateNether(World world, Random random, int blockXPos, int blockZPos) { } private void GenerateEnd(World world, Random random, int x, int z) { } } so yeah, let me now if it's changed or removed or not implemented yet (because there isn't yet a stable build)...
  16. I actually just found it before you posted this i looked up in the sword class and there i saw the code i wanted to use and now it's like this package invizzble.mods.nc.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import invizzble.mods.nc.entities.projectiles.EntityStaffODarknessAmmo; import invizzble.mods.nc.lib.Strings; import invizzble.mods.nc.lib.ToolIds; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ToolStaffODarkness extends Item{ public ToolStaffODarkness (int id){ super (id ); this.setUnlocalizedName(Strings.STAFFODARKNESS_NAME); this.setMaxStackSize(1); this.setCreativeTab(CreativeTabs.tabCombat); this.setMaxDamage(20); } @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,EntityPlayer par3EntityPlayer) { if(this.getMaxDamage() > 0) { par2World.playSoundAtEntity(par3EntityPlayer, "StaffODarkness", 0.5F, 0.4F); { par2World.spawnEntityInWorld(new EntityStaffODarknessAmmo(par2World, par3EntityPlayer)); } this.DamageItem(par1ItemStack, par3EntityPlayer); } if (this.getMaxDamage() == 0){ par3EntityPlayer.inventory.consumeInventoryItem(ToolIds.STAFFODARKNESS_DEFAULT); } return par1ItemStack; } public void DamageItem(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase){ par1ItemStack.damageItem(1, par2EntityLivingBase); } @SideOnly(Side.CLIENT) @Override public void registerIcons(IconRegister iconRegister)//updateIcons { itemIcon = iconRegister.registerIcon("NC:StaffODarkness"); } } It works but if you see something that isn't correct ,, say it please to me
  17. hello everybody, i tried to made a sort of weapon wich doesn't have any ammo or somethin els and i can make it shoot without the ammo buth i can't get the itemdamage decrease , i tried some things (you will see them in the code ) but they didn't work and so yeah... i've come here... can somebody help me to make this item decrease his damage whenever the player is using it? package invizzble.mods.nc.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import invizzble.mods.nc.entities.projectiles.EntityStaffODarknessAmmo; import invizzble.mods.nc.lib.Strings; import invizzble.mods.nc.lib.ToolIds; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ToolStaffODarkness extends Item{ public ToolStaffODarkness (int id){ super (id ); this.setUnlocalizedName(Strings.STAFFODARKNESS_NAME); this.setMaxStackSize(1); this.setCreativeTab(CreativeTabs.tabCombat); this.setMaxDamage(20); } @Override public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,EntityPlayer par3EntityPlayer) { if(this.getMaxDamage() > 0) { int maxdamage; maxdamage= this.getMaxDamage(); par2World.playSoundAtEntity(par3EntityPlayer, "StaffODarkness", 0.5F, 0.4F); { par2World.spawnEntityInWorld(new EntityStaffODarknessAmmo(par2World, par3EntityPlayer)); } maxdamage--; this.setMaxDamage(maxdamage) ; } if (this.getMaxDamage() == 0){ par3EntityPlayer.inventory.consumeInventoryItem(ToolIds.STAFFODARKNESS_DEFAULT); } return par1ItemStack; } @SideOnly(Side.CLIENT) @Override public void registerIcons(IconRegister iconRegister)//updateIcons { itemIcon = iconRegister.registerIcon("NC:StaffODarkness"); } } anyway thanks for reading
  18. the main problem is that both methods won't accept the location of my sounds, if i try to give it, they give me an error...
  19. but how can i import them now into minecraft ...
  20. really, i've readed on some forums that it doesn't has to be like that anymore...
  21. I've looked to a lot of tutorials but still my sound won't register... can somebody please check for any mistakes... package invizzble.mods.nc.events; import invizzble.mods.nc.NM; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; public class SoundRegistering { @ForgeSubscribe public void onbSound(SoundLoadEvent event){ try{ String[] soundFiles = { "StaffODarkness.1.wav" }; for (int i = 0; i < soundFiles.length; i++){ event.manager.soundPoolSounds.addSound(soundFiles[i] ); } } catch (Exception e) { System.err.println("NightmareCraft: Failed to register one or more sounds."); } } }
  22. have found it already, just didn't know that you need to add an argument anyway thanks for spending time on me, i'm gonna thank you
  23. Does anyone know why the fire/portal textures won't work...
  24. this may sound noob but where can i find that ...
×
×
  • Create New...

Important Information

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