• 0

    posted a message on [Question]How do i code something to break bedrock without editing base classes?
    Quote from ASB2

    I've been trying to modify vanilla minecraft things with out actually changing the base classes and compromising compatibility how can i do such a thing

    Depends on what you are trying to change...
    Posted in: Modification Development
  • 1

    posted a message on [Question]How do i code something to break bedrock without editing base classes?
    Bedrock uses the setUnbreakable method anway so what you're trying to do won't work. It is marked as final so you cannot modify it unless you change the declaration and instantiation in Block. I don't think that AccessTransformers work for this purpose either.
    Posted in: Modification Development
  • 0

    posted a message on Facilitation - Looking for Coders, Graphics Designers (Textures), Alpha Testers
    Quote from AnonymousYoshi

    Oops, didn't mean to put JavaScript, must've been very tired while writing this.

    Or you didn't know there was a difference between the two.
    Posted in: Mods Discussion
  • 0

    posted a message on Facilitation - Looking for Coders, Graphics Designers (Textures), Alpha Testers
    Minecraft is written in Java, not JavaScript. There is a difference.
    Posted in: Mods Discussion
  • 0

    posted a message on Ore Generation Help Please?
    I'm not sure if it is causing the problem or not but you need to put a break in between each case.
    switch (world.provider.dimensionId)
    {
    case -1: generateNether(world, random, chunkX*16, chunkZ*16);
    break;
    case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
    break;
    }
    Posted in: Modification Development
  • 0

    posted a message on TileEntity NBT Help
    Quote from wuffelleffuw

    Meh, your NBT-methods never get called because your TileEntity never gets created, it's that easy. You use createNewTileEntity in a class that extends Block but the method is actually from BlockContainer. So you have to switch Block to BlockContainer or find another way to create your TileEntity on creation of your block.

    (You would've seen that if you'd use @Override btw, it gives you an error everytime you try to use a method from a parent-class that isn't actually there.)

    Forgot about that... Thanks :)
    Posted in: Modification Development
  • 0

    posted a message on TileEntity NBT Help
    Quote from Lolcroc

    Try to use System.err.println(); instead, does it still print out in the console?

    As for your actual problem, try to give channel a value in the constructor, and use an if statement in readEntityFromNBT like this:
    if (par1NBTTagCompound.hasKey("channel")) {
    System.err.println("channel exists in NBT");
    this.channel = par1NBTTagCompound.getInteger("channel");
    }

    Does it print channel exists in NBT?

    The methods aren't called at all so this will not show anything anyway. I did test it just to make sure but nothing is printed at all, not even from prints in the latest code I posted on the previous page.
    Posted in: Modification Development
  • 0

    posted a message on TileEntity NBT Help
    Quote from wuffelleffuw

    Did you try adding the bit of code i posted before? I'm also surprised it lets you use those IDs as either should be in use already.

    If neither of that works I suggest looking into this: http://www.minecraft...Packet_Handling

    It's worth it building your own packets anyway, especially if you plan on doing even more with GUIs in the future.

    I'll give it a go now. The ids are not in use till the 1.5 update. They're only really testing ids anyway, no plan to actually use them in a release.

    Edit: Adding that method didn't work.
    Posted in: Modification Development
  • 0

    posted a message on Leg Movement on Mobs?
    Techne doesn't make the animation code for you. Get the setRotationAngles from ModelBiped or another Vanilla mob model class and change the fields to suit yours.
    Posted in: Modification Development
  • 0

    posted a message on TileEntity NBT Help
    Here's the rest of my code, there would be a problem somewhere else no doubt.
    Registry:

    package techguy.mods.cctv.common;
    
    
    import net.minecraft.block.Block;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.item.Item;
    import net.minecraftforge.common.Configuration;
    import cpw.mods.fml.common.Mod;
    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.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;
    import cpw.mods.fml.common.registry.LanguageRegistry;
    
    @Mod(modid="techguy543CCTV", name="TechGuy's CCTV", version="[MC1.4.7] v0.0.1")
    @NetworkMod
    (
    clientSideRequired = true,
    serverSideRequired = false,
    channels = {"techguy_cctv"},
    packetHandler = CCTVPacketHandler.class
    )
    public class CCTVMainRegistry
    {
    public static int cameraID = 150;
    public static int monitorID = 151;
    
    public static final Block camera = new CCTVBlockCamera(cameraID, 1).setBlockName("cctvCamera").setHardness(1.3F).setCreativeTab(CreativeTabs.tabDecorations);
    public static final Item monitor = new CCTVItemMonitor(monitorID, CCTVEntityMonitor.class).setItemName("cctvMonitor").setCreativeTab(CreativeTabs.tabDecorations).setIconIndex(0);
    
    
    @PreInit
    public void preInit(FMLPreInitializationEvent evt)
    {
    /*Configuration config = new Configuration(evt.getSuggestedConfigurationFile());
    config.load();
    
    cameraID = config.getBlock(Configuration.CATEGORY_BLOCK, "Camera", 3500).getInt();
    config.save();*/
    }
    
    @Init
    public void init(FMLInitializationEvent evt)
    {
    GameRegistry.registerTileEntity(CCTVTileEntityCamera.class, "CCTVCameraEntity");
    GameRegistry.registerBlock(camera, "cctvCamera");
    LanguageRegistry.addName(camera, "CCTV Camera");
    LanguageRegistry.addName(monitor, "CCTV Monitor");
    CCTVCommonProxy.registerRenderInformation();
    }
    
    @PostInit
    public void postInit(FMLPostInitializationEvent evt)
    {
    
    }
    }


    Block:

    package techguy.mods.cctv.common;
    import techguy.mods.cctv.client.CCTVGuiCamera;
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.Minecraft;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.IBlockAccess;
    import net.minecraft.world.World;
    public class CCTVBlockCamera extends Block
    {
    public int channel;
    public CCTVBlockCamera(int i, int j)
    {
    super(i, j, Material.wood);
    }
    
    public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
    {
    Minecraft.getMinecraft().displayGuiScreen(new CCTVGuiCamera(par1World, par5EntityPlayer, Minecraft.getMinecraft()));
    TileEntity tile1 = Minecraft.getMinecraft().getIntegratedServer().worldServers[par5EntityPlayer.dimension].getBlockTileEntity(par2, par3, par4);
    	 return true;
    }
    public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving)
    {
    int l = MathHelper.floor_double((double)((entityliving.rotationYaw * 4F) / 360F) + 0.5D) & 3;
    switch (l)
    {
    case 0:
    world.setBlockMetadataWithNotify(i, j, k, 2);
    break;
    case 1:
    world.setBlockMetadataWithNotify(i, j, k, 5);
    break;
    case 2:
    world.setBlockMetadataWithNotify(i, j, k, 3);
    break;
    case 3:
    world.setBlockMetadataWithNotify(i, j, k, 4);
    break;
    }
    }
    public int getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l)
    {
    return l != iblockaccess.getBlockMetadata(i, j, k) ? blockIndexInTexture : 0;
    }
    /**
    * Returns the block texture based on the side being looked at. Args: side
    */
    public int getBlockTextureFromSide(int i)
    {
    return i != 3 ? blockIndexInTexture : 0;
    }
    
    public TileEntity createNewTileEntity(World par1World)
    {
    	 return new CCTVTileEntityCamera();
    }
    public String getTextureFile()
    {
    return "/CCTV/terrain.png";
    }
    }


    TileEntity:

    package techguy.mods.cctv.common;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.network.packet.Packet;
    import net.minecraft.network.packet.Packet132TileEntityData;
    import net.minecraft.tileentity.TileEntity;
    public class CCTVTileEntityCamera extends TileEntity
    {
    public int channel;
    public CCTVTileEntityCamera()
    {
    }
    public void writeToNBT(NBTTagCompound par1NBTTagCompound)
    {
    super.writeToNBT(par1NBTTagCompound);
    par1NBTTagCompound.setInteger("channel", this.channel);
    System.out.println("writing NBT");
    }
    
    public void readFromNBT(NBTTagCompound par1NBTTagCompound)
    {
    super.readFromNBT(par1NBTTagCompound);
    this.channel = par1NBTTagCompound.getInteger("channel");
    System.out.println("reading NBT");
    }
    
    public Packet getDescriptionPacket() //Not sure if I need this
    {
    	 NBTTagCompound var1 = new NBTTagCompound();
    	 this.writeToNBT(var1);
    	 return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 2, var1);
    }
    
    public void updateEntity()
    {
    	 System.out.println("updateTE");
    }
    }


    Gui:

    package techguy.mods.cctv.client;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.gui.GuiButton;
    import net.minecraft.client.gui.GuiScreen;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.world.World;
    import techguy.mods.cctv.common.CCTVTileEntityCamera;
    public class CCTVGuiCamera extends GuiScreen
    {
    CCTVTileEntityCamera tile = new CCTVTileEntityCamera();
    private Minecraft mc;
    private World world;
    private EntityPlayer entityPlayer;
    
    public CCTVGuiCamera(World world1, EntityPlayer entityPlayer1, Minecraft minecraft)
    {
    world = world1;
    entityPlayer = entityPlayer1;
    mc = minecraft;
    }
    public GuiButton channelPlusOne;
    public GuiButton channelPlusTen;
    public GuiButton channelPlusHundred;
    public GuiButton channelSubtractOne;
    public GuiButton channelSubtractTen;
    public GuiButton channelSubtractHundred;
    public void initGui()
    {
    controlList.clear();
    channelPlusOne = new GuiButton(0, width / 2 + 3, height / 2 - 20, 25, 20, "+");
    controlList.add(channelPlusOne);
    channelPlusTen = new GuiButton(1, width / 2 + 29, height / 2 - 20, 27, 20, "+10");
    controlList.add(channelPlusTen);
    channelPlusHundred = new GuiButton(2, width / 2 + 57, height / 2 - 20, 31, 20, "+100");
    controlList.add(channelPlusHundred);
    channelSubtractOne = new GuiButton(3, width / 2 - 28, height / 2 - 20, 25, 20, "-");
    controlList.add(channelSubtractOne);
    channelSubtractTen = new GuiButton(4, width / 2 - 56, height / 2 - 20, 27, 20, "-10");
    controlList.add(channelSubtractTen);
    channelSubtractHundred = new GuiButton(5, width / 2 - 88, height / 2 - 20, 31, 20, "-100");
    controlList.add(channelSubtractHundred);
    }
    
    public void updateScreen()
    {
    if(tile.channel < 0)
    tile.channel = 0;
    }
    
    protected void actionPerformed(GuiButton guibutton)
    {
    if (guibutton.id == 0)
    {
    tile.channel++;
    }
    if (guibutton.id == 1)
    {
    for( int l = 0; l < 10; l++)
    {
    tile.channel++;
    }
    }
    if (guibutton.id == 2)
    {
    for( int l = 0; l < 100; l++)
    {
    tile.channel++;
    }
    }
    
    if (guibutton.id == 3)
    {
    tile.channel--;
    
    }
    if (guibutton.id == 4)
    {
    for( int l = 0; l < 10; l++)
    {
    tile.channel--;
    }
    }
    if (guibutton.id == 5)
    {
    for( int l = 0; l < 100; l++)
    {
    tile.channel--;
    }
    }
    }
    
    public boolean doesGuiPauseGame()
    {
    return false;
    }
    public void drawScreen(int i, int j, float f)
    {
    mc.renderEngine.bindTexture(mc.renderEngine.getTexture("/CCTV/cameraGui.png"));
    drawTexturedModalRect(width / 2 - 100, height / 2 - 64, 0, 0, 256, 177);
    drawCenteredString(fontRenderer, "CCTV Camera", width / 2, height / 2 - 55, 0xffffff);
    drawCenteredString(fontRenderer, "Channel: " + tile.channel, width / 2, height / 2 - 40, 0xffffff);
    for( int l = 0; l < controlList.size(); l++)
    {
    GuiButton guibutton = (GuiButton)controlList.get(l);
    guibutton.drawButton(mc, i, j);
    }
    }
    }

    Posted in: Modification Development
  • 0

    posted a message on [Tutorial]Creating a Bukkit Server (1.3.2)
    Quote from 3zachm

    DId you put in the ip address because you have to or it's only on your COM. It comes with the ip :25565 for example.


    25565 is the default port that the server uses. It isn't the IP address.
    Posted in: Tutorials
  • 0

    posted a message on (Forge) Multitextured block's face in the same direction you are standing
    What "didn't work" about it.
    Posted in: Modification Development
  • 0

    posted a message on TileEntity NBT Help
    Quote from tarun1998

    These NBT methods in TileEntity are usually not called if the tile has not been registered. Are you using GameRegistry.registerTileEntity in your load method. If you have make sure that updateEntity is been called in your tile. And also:

    Make sure you have createNewTileEntity in your block file as well

    Also need to be syncing your data from client to server using Container.class

    It is registered and createNewTileEntity is being used. I'll give updateEntity a go but I don't specifically require its use. I'm not using a Container.
    Posted in: Modification Development
  • 0

    posted a message on TileEntity NBT Help
    Yes, both the block and TileEntity are registered.
    Posted in: Modification Development
  • 0

    posted a message on TileEntity NBT Help
    I added some prints to my NBT methods and it seems they are never even called. Do you have to call them or is that done automatically in another class? They should just call from super shouldn't they?
    Posted in: Modification Development
  • To post a comment, please .