• 0

    posted a message on [Server Manager][Backup] Linux Minecraft Server Manager (LMSM)

    Linux Minecraft Server Manager (LMSM)


    Created by Jared_Brian_


    This is a simple program designed to run over your Minecraft server in order to run your server cleanly and without having to type in commands every time you want to start a server. You can also create and manage backups easily or not at all (if you want).


    This program is specifically designed for Linux systems however this is a bash script and from what I understand is also supported on mac however it hasn't been tested on any mac and I have no idea if it works on the mac OS at all (if someone can let me know if it does if you have a mac that would be great). And unless you are some kind of wizard it won't work on windows at all.


    Also, This is an open source project and you can use this to your heart's content, just make sure to give credit :)


    screenshot


    Features


    *This program has noGUI and must be run in a terminal (which shouldn't be a problem because normally you would have to run a Linux server in a terminal anyway) it is designed to be as simplistic as possible as to be easy to use and require very little interaction after initial setup.


    *It makes it so you can run a server with a desktop icon or launcher if setup correctly or with a single command in the terminal.


    *It will create backups (or not at all) after you stop the server and will automatically delete the oldest backup after the max backup limit is passed (default is 4) and store the backups in any folder you want (as long as it was empty).


    *I haven't tested this fully but it should theoretically work with all types of servers. Vanilla, modded, bukkit, alpha 1.0 to the newest snapshots but if you find a version that doesn't work please let me know.


    *All of the same server commands such as /stop and /stay work and are unaffected.


    *The files can be put anywhere on your computer and can run a server placed anywhere else as long as you set up the config correctly.


    *It Can run the server with or without the Minecraft server GUI (not recommend as on Linux it creates a lot of lag).


    *It Can run a server with any amount of ram you want.


    Install Instructions


    There should be 3 files in the .zip file, a runnable bash file named LMSM, a LMSM.cfg file, and a README file.


    To run the manager (the LMSM bash file) make sure you have given the bash file permission to run and have Java installed.

    (on Linux mint 18.1 right click on the file go to properties then to permissions and check the box saying allow executing file as program).

    then open up the LMSM config and adjust all of the settings as necessary.


    ***note if this is your first time using this program you will have to change the config in order for the server to run.

    You can edit the config by opening the LMSM.cfg file and following the instructions there, for the first time setup, the most you should have to change is the server directory and the world name.

    Then just double click on the bash file and click run in terminal and that's it.


    ***These next instructions are specifically for Linux Mint 18.1 it depending on your Linux distro you may have to do your own research on this but from what I understand these instructions should be the same for most people.


    If you would like to be able to make a desktop launcher for your server you can do that by making a "bin" folder in your home folder.

    (if you do not already have one you may have to restart your computer after making the bin folder).

    and then placing the entire LMSM file into there.


    That will allow you to open any terminal and type LMSM and it will run the server.

    *** if this does not work for some reason use the next set of instructions

    So using this make a new launcher, right-click on your desktop and then go to Create new launcher here...

    Then all you need to do is give it a name, enter LMSM as the command and check the box that says run in terminal and click Ok.

    Now you can just run that launcher to start your server.


    ***note running the command LMSM will not work if it is not in your bin folder and requires at least one restart for your computer to see the bin folder as a place to see commands.

    If you want to have it in a different directory you can just click the browse option in the launcher creation window and then find where you have your LMSM bash file located and it will do the same thing.


    If you want multiple servers or more than one LMSM file in your bin folder you can just rename the LMSM bash file and folder to whatever you want.

    ex) StartMyMultyiplayerServer)

    ***note the folder name and the bash file name do not have to be the same.

    and then the new name of the bash file will be your new command to run the server with.


    Just as long as you don't change the name of the config file or move it into a different directory the server will run.

    ***IMPORTANT***

    The backups folder will delete anything else that is in there (or at least most of it) besides the backups it creates so please do not use an existing folder for backups.


    To reload a world from your backups folder all you have to do is delete the date given to the backup or rename the backup to exactly to what the world file is called and place it in your server directory (replacing the current one).


    I am not responsible for any deleted files or corrupted game worlds. please use at your own risk.


    Trouble Shooting


    *if you are unable to just run LMSM or whatever you have the name as in the terminal


    make sure the whole LMSM file is in your bin folder


    make sure you are typing the command correctly


    *if you get this error "/FILE_TO_LMSM_DIRECTORY/LMSM: line 8: /FILE_TO_LMSM_DIRECTORY/LMSM.cfg: No such file or directory"


    make sure the config file is the same folder as the bash file


    *if you get this error "Error: Unable to access jarfile minecraft_server.VERSION.jar" or find: ‘backups/*’: No such file or directory


    make sure all of your paths in the config are set correctly and that you have the correct version of Minecraft set


    make sure if any of the directories have a space in the name that you use a \ just before the space

    ex) "User/Home/Minecraft/Minecraft\ Servers/Example\ Server"


    also, the version of Minecraft has to equal the version that is on the Minecraft jar file and has to be the default name

    ex) minecraft_server.1.11.2.jar

    *if you get this error Error occurred during initialization of VM Too small initial heap


    make sure you have the correct unit of memory on the end of your allocatedMemory slot in the config

    ex) 2G or 2048M


    this error could also mean your value is too low it should be at least 1G or 1024M

    *if you get this error message cp: cannot stat 'NAME_OF_MINECRAFT_WORLD': No such file or directory mv: cannot stat 'BACKUP_DIRECTORY/NAME_OF_MINECRAFT_WORLD': No such file or directory


    make sure you have your Minecraft world name set correctly in the config

    and if there are any spaces in the name to use a \ just before the space

    ex) Minecraft\ World


    *if you get a lot more lag than usual


    make sure that the Gui is set to false in the config

    *if you are still having problems set the debug mode slot in the config and that might help you find errors in the config file


    *** if none of these help you look in the comment section below and see if there is a solution there and if not give me the details and ill try to help you


    Downloads

    Posted in: Minecraft Tools
  • 0

    posted a message on Block rotation and icon probs

    No unfortunately that doesn't help because there already isn't a second entity parameter in my model class so i cant remove it like you suggested to do in his case.

    Thanks

    -Jared_Brian_

    Posted in: Modification Development
  • 0

    posted a message on Block rotation and icon probs

    i got an error at the model.renderAll in the tileEntityRenderer class so i tried changing it to this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); like it is in the renderTileEntityAt method and it removed the error however nothing changed in game


    TileEntityTelescopeRenderer


    package com.planetaryalignmentmod.render;

    import net.minecraft.block.Block;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.renderer.OpenGlHelper;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    import net.minecraft.entity.Entity;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.World;

    import org.lwjgl.opengl.GL11;
    import org.lwjgl.opengl.GL12;

    import com.planetaryalignmentmod.blocks.Telescope;
    import com.planetaryalignmentmod.lib.PlanetaryAlignmentMod;
    import com.planetaryalignmentmod.model.TelescopeModel;
    import com.planetaryalignmentmod.tileentities.TileEntityTelescope;

    public class TileEntityTelescopeRenderer extends TileEntitySpecialRenderer {

    private final TelescopeModel model;

    public TileEntityTelescopeRenderer() {
    this.model = new TelescopeModel();
    }

    private void adjustRotatePivotViaMeta(World world, int x, int y, int z) {
    int meta = world.getBlockMetadata(x, y, z);
    GL11.glPushMatrix();
    GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
    GL11.glPopMatrix();
    }

    public void renderTileEntityAt(TileEntityTelescope tileentity, double x, double y, double z, float f)
    {

    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    ResourceLocation textures = (new ResourceLocation("planetaryAlignmentMod:textures/blocks/telescope.png"));
    Minecraft.getMinecraft().renderEngine.bindTexture(textures);

    int metadata = tileentity.getBlockMetadata();
    int rotationAngle = 0;

    if (metadata%4 == 0)//south
    {
    //System.out.println("Meta data 0 triggered");
    rotationAngle = 0;
    }

    if (metadata%4 == 1)//west
    {
    //System.out.println("Meta data 1 triggered");
    rotationAngle = 90;
    }

    if (metadata%4 == 2)//north
    {
    //System.out.println("Meta data 2 triggered");
    rotationAngle = 180;

    }

    if (metadata%4 == 3) //east
    {
    //System.out.println("Meta data 3 triggered");
    rotationAngle = -90;
    }

    GL11.glPushMatrix();

    GL11.glRotatef(180F, 0F, 0F, 1F);
    GL11.glRotatef(rotationAngle, 0F, 1F, 0F);


    this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
    GL11.glPopMatrix();
    }

    private void adjustLightFixture(World world, int i, int j, int k, Block block) {
    Tessellator tess = Tessellator.instance;
    float brightness = block.getLightValue(world, i, j, k);
    int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
    int modulousModifier = skyLight % 65536;
    int divModifier = skyLight / 65536;
    tess.setColorOpaque_F(brightness, brightness, brightness);
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
    }

    @Override
    public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f)
    {

    renderTileEntityAt((TileEntityTelescope)tileentity, d, d1, d2, f);

    }

    public void renderHand(double x, double y, double z)
    {
    GL11.glPushMatrix();

    GL11.glTranslatef((float) x, (float) y, (float) z);
    Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("planetaryAlignmentMod:textures/blocks/telescope.png"));

    GL11.glPushMatrix();
    this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); //model.renderAll();

    GL11.glPopMatrix();
    GL11.glPopMatrix();
    }

    public void renderInventory(double x, double y, double z)
    {
    GL11.glPushMatrix();

    GL11.glTranslatef((float) x, (float) y - 0.2F, (float) z);
    Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("planetaryAlignmentMod:textures/blocks/telescope.png"));

    GL11.glPushMatrix();
    GL11.glScaled(1.5D, 1.5D, 1.5D);
    this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); //model.renderAll();

    GL11.glPopMatrix();
    GL11.glPopMatrix();

    }
    }


    TelescopeModel


    package com.planetaryalignmentmod.model;

    import net.minecraft.client.model.ModelBase;
    import net.minecraft.client.model.ModelRenderer;
    import net.minecraft.entity.Entity;
    import net.minecraft.tileentity.TileEntity;

    public class TelescopeModel extends ModelBase
    {
    //fields
    ModelRenderer Leg1;
    ModelRenderer Leg2;
    ModelRenderer Leg3;
    ModelRenderer legBase;
    ModelRenderer scopeStandPt1;
    ModelRenderer scopeStandPt2;
    ModelRenderer scopeStandPt3;
    ModelRenderer Scope;
    ModelRenderer sight1;
    ModelRenderer knob1;
    ModelRenderer knob2;
    ModelRenderer scopeEnd1;
    ModelRenderer sight2;
    ModelRenderer ScopeEnd2;

    public TelescopeModel()
    {
    textureWidth = 32;
    textureHeight = 32;

    Leg1 = new ModelRenderer(this, 24, 0);
    Leg1.addBox(0F, 0F, 0F, 2, 20, 2);
    Leg1.setRotationPoint(1F, 6F, -2F);
    Leg1.setTextureSize(32, 32);
    Leg1.mirror = true;
    setRotation(Leg1, -0.4F, -1F, 0F);
    Leg2 = new ModelRenderer(this, 24, 0);
    Leg2.addBox(0F, 0F, 0F, 2, 20, 2);
    Leg2.setRotationPoint(-2F, 6F, -1F);
    Leg2.setTextureSize(32, 32);
    Leg2.mirror = true;
    setRotation(Leg2, -0.4F, 1F, 0F);
    Leg3 = new ModelRenderer(this, 24, 0);
    Leg3.addBox(0F, 0F, 0F, 2, 20, 2);
    Leg3.setRotationPoint(-1F, 6F, 0F);
    Leg3.setTextureSize(32, 32);
    Leg3.mirror = true;
    setRotation(Leg3, 0.3F, 0F, 0F);
    legBase = new ModelRenderer(this, 0, 4);
    legBase.addBox(0F, 0F, 0F, 4, 1, 4);
    legBase.setRotationPoint(-2F, 5F, -2F);
    legBase.setTextureSize(32, 32);
    legBase.mirror = true;
    setRotation(legBase, 0F, 0F, 0F);
    scopeStandPt1 = new ModelRenderer(this, 0, 9);
    scopeStandPt1.addBox(0F, 0F, 0F, 2, 2, 2);
    scopeStandPt1.setRotationPoint(-1F, 3F, -1F);
    scopeStandPt1.setTextureSize(32, 32);
    scopeStandPt1.mirror = true;
    setRotation(scopeStandPt1, 0F, 0F, 0F);
    scopeStandPt2 = new ModelRenderer(this, 0, 0);
    scopeStandPt2.addBox(0F, 0F, 0F, 1, 3, 1);
    scopeStandPt2.setRotationPoint(1F, 3.5F, 0.5F);
    scopeStandPt2.setTextureSize(32, 32);
    scopeStandPt2.mirror = true;
    setRotation(scopeStandPt2, -2.617994F, 0F, 0F);
    scopeStandPt3 = new ModelRenderer(this, 0, 0);
    scopeStandPt3.addBox(0F, 0F, 0F, 1, 3, 1);
    scopeStandPt3.setRotationPoint(-2F, 3.5F, 0.5F);
    scopeStandPt3.setTextureSize(32, 32);
    scopeStandPt3.mirror = true;
    setRotation(scopeStandPt3, -2.617994F, 0F, 0F);
    Scope = new ModelRenderer(this, 16, 0);
    Scope.addBox(0F, 0F, 0F, 2, 10, 2);
    Scope.setRotationPoint(-1F, 3.5F, -6F);
    Scope.setTextureSize(32, 32);
    Scope.mirror = true;
    setRotation(Scope, 1.850049F, 0F, 0F);
    sight1 = new ModelRenderer(this, 4, 0);
    sight1.addBox(0F, 0F, 0F, 1, 2, 1);
    sight1.setRotationPoint(-0.5F, 2F, -6F);
    sight1.setTextureSize(32, 32);
    sight1.mirror = true;
    setRotation(sight1, -1.308997F, 0F, 0F);
    knob1 = new ModelRenderer(this, 8, 0);
    knob1.addBox(0F, 0F, 0F, 1, 1, 1);
    knob1.setRotationPoint(-1.5F, 2.25F, -7.5F);
    knob1.setTextureSize(32, 32);
    knob1.mirror = true;
    setRotation(knob1, 0F, 0F, 0F);
    knob2 = new ModelRenderer(this, 8, 0);
    knob2.addBox(0F, 0F, 0F, 1, 1, 1);
    knob2.setRotationPoint(0.5F, 2.3F, -7.5F);
    knob2.setTextureSize(32, 32);
    knob2.mirror = true;
    setRotation(knob2, 0F, 0F, 0F);
    scopeEnd1 = new ModelRenderer(this, 0, 13);
    scopeEnd1.addBox(0F, 0F, 0F, 4, 4, 5);
    scopeEnd1.setRotationPoint(-2F, -3F, 6F);
    scopeEnd1.setTextureSize(32, 32);
    scopeEnd1.mirror = true;
    setRotation(scopeEnd1, 0.2617994F, 0F, 0F);
    sight2 = new ModelRenderer(this, 4, 0);
    sight2.addBox(0F, 0F, 0F, 1, 3, 1);
    sight2.setRotationPoint(-0.5F, 2.8F, -7F);
    sight2.setTextureSize(32, 32);
    sight2.mirror = true;
    setRotation(sight2, -2.356194F, 0F, 0F);
    ScopeEnd2 = new ModelRenderer(this, 0, 22);
    ScopeEnd2.addBox(0F, 0F, 0F, 3, 3, 5);
    ScopeEnd2.setRotationPoint(-1.5F, -1.3F, 2F);
    ScopeEnd2.setTextureSize(32, 32);
    ScopeEnd2.mirror = true;
    setRotation(ScopeEnd2, 0.2617994F, 0F, 0F);
    }

    public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
    {
    super.render(entity, f, f1, f2, f3, f4, f5);
    setRotationAngles(f, f1, f2, f3, f4, f5, entity); //add entity here
    Leg1.render(f5);
    Leg2.render(f5);
    Leg3.render(f5);
    legBase.render(f5);
    scopeStandPt1.render(f5);
    scopeStandPt2.render(f5);
    scopeStandPt3.render(f5);
    Scope.render(f5);
    sight1.render(f5);
    knob1.render(f5);
    knob2.render(f5);
    scopeEnd1.render(f5);
    sight2.render(f5);
    ScopeEnd2.render(f5);
    }

    private void setRotation(ModelRenderer model, float x, float y, float z)
    {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
    }

    public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity e)

    {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, e);
    }

    }


    clientProxy


    package com.planetaryalignmentmod.proxy;

    import net.minecraft.item.Item;
    import net.minecraftforge.client.MinecraftForgeClient;

    import com.planetaryalignmentmod.blocks.ModBlocks;
    import com.planetaryalignmentmod.render.ItemTelescopeRenderer;
    import com.planetaryalignmentmod.render.TileEntityStandRenderer;
    import com.planetaryalignmentmod.render.TileEntityTelescopeRenderer;
    import com.planetaryalignmentmod.tileentities.TileEntityStand;
    import com.planetaryalignmentmod.tileentities.TileEntityTelescope;

    import cpw.mods.fml.client.registry.ClientRegistry;
    import cpw.mods.fml.client.registry.RenderingRegistry;

    public class ClientProxy extends CommonProxy{

    public static void registerRenderThings() {
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTelescope.class, new TileEntityTelescopeRenderer());
    MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.telescope), new ItemTelescopeRenderer());

    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityStand.class, new TileEntityStandRenderer());
    }
    }


    ItemTelescopeRenderer


    package com.planetaryalignmentmod.render;

    import net.minecraft.item.ItemStack;
    import net.minecraftforge.client.IItemRenderer;

    public class ItemTelescopeRenderer implements IItemRenderer
    {

    @Override
    public boolean handleRenderType(ItemStack item, ItemRenderType type)
    {
    return true;
    }

    @Override
    public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
    {
    return true;
    }

    @Override
    public void renderItem(ItemRenderType type, ItemStack item, Object... data)
    {
    switch (type)
    {
    case INVENTORY:
    (new TileEntityTelescopeRenderer()).renderInventory(0.0D, 0.0D, 0.0D);
    break;
    default:
    (new TileEntityTelescopeRenderer()).renderHand(0.0D, 0.0D, 0.0D);
    }
    }

    }


    i also voided out the original icon method in my block class so there wouldn't be conflicting icons.

    should there be a renderAll method in my model class?


    Thanks

    -Jared_Brian_

    Posted in: Modification Development
  • 0

    posted a message on Block rotation and icon probs

    IT WORKS so what i found out is that you put the angle you want the model to rotate in the first parameter then you put either a 1 or a 0 for true or false on either the X Y or Z to indicate that you want that rotation angle to apply to that axis

    so first set the rotation angle to 180 then told it to use that angle to rotate it along the z axis then i told it to use the rotationAngle and apply it to the y axis


    TileEntityRenderer


    package com.planetaryalignmentmod.tileentities;

    import net.minecraft.block.Block;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.renderer.OpenGlHelper;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    import net.minecraft.entity.Entity;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.World;

    import org.lwjgl.opengl.GL11;
    import org.lwjgl.opengl.GL12;

    import com.planetaryalignmentmod.blocks.Telescope;
    import com.planetaryalignmentmod.lib.PlanetaryAlignmentMod;

    public class TileEntityTelescopeRenderer extends TileEntitySpecialRenderer {

    private final TelescopeModel model;

    public TileEntityTelescopeRenderer() {
    this.model = new TelescopeModel();
    }

    private void adjustRotatePivotViaMeta(World world, int x, int y, int z) {
    int meta = world.getBlockMetadata(x, y, z);
    GL11.glPushMatrix();
    GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
    GL11.glPopMatrix();
    }

    public void renderTileEntityAt(TileEntityTelescope tileentity, double x, double y, double z, float f)
    {

    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    ResourceLocation textures = (new ResourceLocation("planetaryAlignmentMod:textures/blocks/telescope.png"));
    Minecraft.getMinecraft().renderEngine.bindTexture(textures);

    int metadata = tileentity.getBlockMetadata();
    int rotationAngle = 0;

    if (metadata%4 == 0)//south
    {
    //System.out.println("Meta data 0 triggered");
    rotationAngle = 0;
    }

    if (metadata%4 == 1)//west
    {
    //System.out.println("Meta data 1 triggered");
    rotationAngle = 90;
    }

    if (metadata%4 == 2)//north
    {
    //System.out.println("Meta data 2 triggered");
    rotationAngle = 180;

    }

    if (metadata%4 == 3) //east
    {
    //System.out.println("Meta data 3 triggered");
    rotationAngle = -90;
    }

    GL11.glPushMatrix();

    GL11.glRotatef(180F, 0F, 0F, 1F); // rotates the whole model so its not upside down
    GL11.glRotatef(rotationAngle, 0F, 1F, 0F); //rotates the model dependent on which way you place it


    this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
    GL11.glPopMatrix();
    }

    private void adjustLightFixture(World world, int i, int j, int k, Block block) {
    Tessellator tess = Tessellator.instance;
    float brightness = block.getLightValue(world, i, j, k);
    int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
    int modulousModifier = skyLight % 65536;
    int divModifier = skyLight / 65536;
    tess.setColorOpaque_F(brightness, brightness, brightness);
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
    }

    @Override
    public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f)
    {

    renderTileEntityAt((TileEntityTelescope)tileentity, d, d1, d2, f);

    }
    }


    Now i just need to know how to render the icon properly as you can see in the picture i posted it just shows the texture instead of the model

    Thanks

    -Jared_Brian_

    Posted in: Modification Development
  • 0

    posted a message on Block rotation and icon probs

    well now unfortunately I'm at school so I can't test this but from previous testing I thought that if the first parameter wasn't 180 then the modle would render upsidedown so could i change it to GL11.glRotatef(rotationAngle, 180, 0F, 0F);? Instead and still have have it render right side up

    Thanks

    -Jared_Brian_

    Posted in: Modification Development
  • 0

    posted a message on Block rotation and icon probs

    interestingly enough they all do get triggered and what i found out is meta data 0 should be facing south, 1 west, 2 north, and 3 east

    again thank you so much for your help

    -Jared_Brian_

    Posted in: Modification Development
  • 0

    posted a message on Block rotation and icon probs

    i changed the two and unfortunately the same result :/

    Posted in: Modification Development
  • 0

    posted a message on Block rotation and icon probs

    woopse no duh ok so i took the onBlockPlacedBy method from the furnace class and now it works for the north and south directions but when you place it from the east or west it points north


    Block class:


    package com.planetaryalignmentmod.blocks;

    import com.planetaryalignmentmod.lib.ModCreativeTabs;
    import com.planetaryalignmentmod.lib.PlanetaryAlignmentMod;
    import com.planetaryalignmentmod.tileentities.TileEntityTelescope;

    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockContainer;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.ItemStack;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.tileentity.TileEntityFurnace;
    import net.minecraft.util.IIcon;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;

    import java.util.List;

    public class Telescope extends BlockContainer {

    private String name = "telescope";

    public Telescope() {
    super(Material.wood);
    this.setBlockName(PlanetaryAlignmentMod.MODID + "_" + name);
    this.setCreativeTab(ModCreativeTabs.tabPlanetaryAlignment);
    GameRegistry.registerBlock(this, name);
    //setBlockTextureName(PlanetaryAlignmentMod.MODID + ":" + name);
    this.setHardness(2.0f);
    this.setBlockBounds(0.4F, 0.0F, 0.4F, 0.6F, 1.5F, 0.6F);
    }

    @Override
    public TileEntity createNewTileEntity(World world, int p_149915_2_) {
    return new TileEntityTelescope();
    }

    @Override
    public int getRenderType() {
    return -1;
    }

    @Override
    public boolean isOpaqueCube() {
    return false;
    }

    public boolean renderAsNormalBlock() {
    return false;
    }

    public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack)
    {
    int l = MathHelper.floor_double((double)(entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

    if (l == 0)
    {
    world.setBlockMetadataWithNotify(x, y, z, 0, 2);
    }

    if (l == 1)
    {
    world.setBlockMetadataWithNotify(x, y, z, 1, 2);
    }

    if (l == 2)
    {
    world.setBlockMetadataWithNotify(x, y, z, 2, 2);
    }

    if (l == 3)
    {
    world.setBlockMetadataWithNotify(x, y, z, 3, 2);
    }

    }


    public int getMetadata(int meta) {

    return meta;
    }

    @Override
    public void registerBlockIcons(IIconRegister iconRegister)
    {
    this.blockIcon = iconRegister.registerIcon(PlanetaryAlignmentMod.MODID + ":" + "telescope");
    }

    }

    and don't worry about it you've helped a ton already :)

    -Jared_Brian_

    Posted in: Modification Development
  • 0

    posted a message on Block rotation and icon probs

    Ok so now i have implemented the Meta data on the block and used the rotation method from the link but still no luck. I'm guessing i have some stupid error having to do with the meta data.


    Block class:


    package com.planetaryalignmentmod.blocks;

    import com.planetaryalignmentmod.lib.ModCreativeTabs;
    import com.planetaryalignmentmod.lib.PlanetaryAlignmentMod;
    import com.planetaryalignmentmod.tileentities.TileEntityTelescope;

    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockContainer;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.ItemStack;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.IIcon;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;

    import java.util.List;

    public class Telescope extends BlockContainer {

    private String name = "telescope";

    public Telescope() {
    super(Material.wood);
    this.setBlockName(PlanetaryAlignmentMod.MODID + "_" + name);
    this.setCreativeTab(ModCreativeTabs.tabPlanetaryAlignment);
    GameRegistry.registerBlock(this, name);
    //setBlockTextureName(PlanetaryAlignmentMod.MODID + ":" + name);
    this.setHardness(2.0f);
    this.setBlockBounds(0.4F, 0.0F, 0.4F, 0.6F, 1.5F, 0.6F);
    }

    @Override
    public TileEntity createNewTileEntity(World world, int p_149915_2_) {
    return new TileEntityTelescope();
    }

    @Override
    public int getRenderType() {
    return -1;
    }

    @Override
    public boolean isOpaqueCube() {
    return false;
    }

    public boolean renderAsNormalBlock() {
    return false;
    }

    public int getMetadata(int meta) {

    return meta;
    }

    @Override
    public void registerBlockIcons(IIconRegister iconRegister)
    {
    this.blockIcon = iconRegister.registerIcon(PlanetaryAlignmentMod.MODID + ":" + "telescope");
    }

    }


    TileEntityRenderer:


    package com.planetaryalignmentmod.tileentities;

    import net.minecraft.block.Block;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.renderer.OpenGlHelper;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    import net.minecraft.entity.Entity;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.World;

    import org.lwjgl.opengl.GL11;
    import org.lwjgl.opengl.GL12;

    import com.planetaryalignmentmod.blocks.Telescope;
    import com.planetaryalignmentmod.lib.PlanetaryAlignmentMod;

    public class TileEntityTelescopeRenderer extends TileEntitySpecialRenderer {

    private final TelescopeModel model;

    public TileEntityTelescopeRenderer() {
    this.model = new TelescopeModel();
    }

    private void adjustRotatePivotViaMeta(World world, int x, int y, int z) {
    int meta = world.getBlockMetadata(x, y, z);
    GL11.glPushMatrix();
    GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
    GL11.glPopMatrix();
    }

    public void renderTileEntityAt(TileEntityTelescope tileentity, double x, double y, double z, float f)
    {

    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    ResourceLocation textures = (new ResourceLocation("planetaryAlignmentMod:textures/blocks/telescope.png"));
    Minecraft.getMinecraft().renderEngine.bindTexture(textures);

    int metadata = tileentity.getBlockMetadata();
    int rotationAngle = 0;

    if (metadata%4 == 0)
    {
    rotationAngle = 0;
    }

    if (metadata%4 == 1)
    {
    rotationAngle = 180;
    }

    if (metadata%4 == 2)
    {
    rotationAngle = 100000;

    }

    if (metadata%4 == 3)
    {
    rotationAngle = -180;
    }

    GL11.glPushMatrix();

    GL11.glRotatef(180F, rotationAngle, 0F, 1F);

    //GL11.glRotatef(180F, 0F, 0F, 1F);
    this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
    GL11.glPopMatrix();
    }

    private void adjustLightFixture(World world, int i, int j, int k, Block block) {
    Tessellator tess = Tessellator.instance;
    float brightness = block.getLightValue(world, i, j, k);
    int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
    int modulousModifier = skyLight % 65536;
    int divModifier = skyLight / 65536;
    tess.setColorOpaque_F(brightness, brightness, brightness);
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
    }

    @Override
    public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f)
    {

    renderTileEntityAt((TileEntityTelescope)tileentity, d, d1, d2, f);

    }
    }


    ItemBlock:


    package com.planetaryalignmentmod.lib;

    import net.minecraft.block.Block;
    import net.minecraft.item.ItemBlock;

    public class ItemBlockTelescope extends ItemBlock {

    public ItemBlockTelescope(Block block) {

    super(block);
    setHasSubtypes(true);
    }
    }


    Again thank you so much for your help

    -Jared_Brian_

    Posted in: Modification Development
  • 0

    posted a message on Block rotation and icon probs

    So how would i check for a player activation like onBlockActivated within the render class?

    could i just copy paste the whole onBlockActivated method from my block class and put it in the renderer? or is there another method i would have to use?

    Thanks

    -Jared_Brian_

    Posted in: Modification Development
  • 0

    posted a message on Block rotation and icon probs

    So after further trial and error i still have yet to figure out how to get the block to face depending on which way you place it down but i did try and make it so it rotates when you right click it but with little success as it will flicker in the turned position and then always return to its original position as well as cause all the other blocks of the same type to turn as well.


    Here's the code


    The Block Class:


    package com.planetaryalignmentmod.blocks;

    import com.planetaryalignmentmod.lib.ModCreativeTabs;
    import com.planetaryalignmentmod.lib.PlanetaryAlignmentMod;
    import com.planetaryalignmentmod.tileentities.TileEntityTelescope;

    import cpw.mods.fml.common.registry.GameRegistry;
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockContainer;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.ItemStack;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.IIcon;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;

    import java.util.List;

    public class Telescope extends BlockContainer {

    private String name = "telescope";
    public static int Facing = 0;

    public Telescope() {
    super(Material.wood);
    this.setBlockName(PlanetaryAlignmentMod.MODID + "_" + name);
    this.setCreativeTab(ModCreativeTabs.tabPlanetaryAlignment);
    GameRegistry.registerBlock(this, name);
    //setBlockTextureName(PlanetaryAlignmentMod.MODID + ":" + name);
    this.setHardness(2.0f);
    this.setBlockBounds(0.4F, 0.0F, 0.4F, 0.6F, 1.5F, 0.6F);
    }

    @Override
    public TileEntity createNewTileEntity(World world, int p_149915_2_) {
    return new TileEntityTelescope();
    }

    @Override
    public int getRenderType() {
    return -1;
    }

    @Override
    public boolean isOpaqueCube() {
    return false;
    }

    public boolean renderAsNormalBlock() {
    return false;
    }

    @Override
    public void registerBlockIcons(IIconRegister iconRegister)
    {
    this.blockIcon = iconRegister.registerIcon(PlanetaryAlignmentMod.MODID + ":" + "telescope");
    }

    @Override
    public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer player, int i1, float f1, float f2, float f3)
    {
    Facing++;
    if(Facing == 4){
    Facing = 0;
    }
    int wait = 0;
    while (wait < 5000) { //to try and delay the time in between right clicks
    wait = wait + 1;
    }
    return true;
    }

    }


    The TileEntity Class:


    package com.planetaryalignmentmod.tileentities;

    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.item.ItemStack;
    import net.minecraft.tileentity.TileEntity;

    public class TileEntityTelescope extends TileEntity {

    }


    The TileEntityRenderer Class:


    package com.planetaryalignmentmod.tileentities;

    import net.minecraft.block.Block;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.renderer.OpenGlHelper;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    import net.minecraft.entity.Entity;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.World;

    import org.lwjgl.opengl.GL11;
    import org.lwjgl.opengl.GL12;

    import com.planetaryalignmentmod.blocks.Telescope;
    import com.planetaryalignmentmod.lib.PlanetaryAlignmentMod;

    public class TileEntityTelescopeRenderer extends TileEntitySpecialRenderer {

    private final TelescopeModel model;

    public TileEntityTelescopeRenderer() {
    this.model = new TelescopeModel();
    }

    private void adjustRotatePivotViaMeta(World world, int x, int y, int z) {
    int meta = world.getBlockMetadata(x, y, z);
    GL11.glPushMatrix();
    GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
    GL11.glPopMatrix();
    }

    @Override
    public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {

    GL11.glPushMatrix();
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    ResourceLocation textures = (new ResourceLocation("planetaryAlignmentMod:textures/blocks/telescope.png"));
    Minecraft.getMinecraft().renderEngine.bindTexture(textures);

    int facing = Telescope.Facing;

    int k = 0;
    if (facing == 0) {
    k = 0;
    }
    if (facing == 1) {
    k = 90;
    }
    if (facing == 1) {
    k = 180;
    }
    if (facing == 3) {
    k = 270;
    }
    GL11.glPushMatrix();
    GL11.glRotatef(180F, k, 0F, 1F);

    //GL11.glRotatef(180F, 0F, 0F, 1F);
    this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
    GL11.glPopMatrix();
    }

    private void adjustLightFixture(World world, int i, int j, int k, Block block) {
    Tessellator tess = Tessellator.instance;
    float brightness = block.getLightValue(world, i, j, k);
    int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
    int modulousModifier = skyLight % 65536;
    int divModifier = skyLight / 65536;
    tess.setColorOpaque_F(brightness, brightness, brightness);
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
    }
    }



    Again i am very new to modding and have little experience so any help you could offer will be greatly appreciated :)

    Posted in: Modification Development
  • 0

    posted a message on Block rotation and icon probs

    Ok so i've looked all around and i cant seem to figure out how to get a block to point different directions based on which way your facing when you place the block down.


    I've also having trouble getting the block icon (how it renders in your inventory) to show up properly.


    Here's the code


    The block class:


    package com.planetaryalignmentmod.blocks;

    import com.planetaryalignmentmod.lib.IZoom;
    import com.planetaryalignmentmod.lib.ModCreativeTabs;
    import com.planetaryalignmentmod.lib.PlanetaryAlignmentMod;
    import com.planetaryalignmentmod.tileentities.TileEntityTelescope;

    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockContainer;
    import net.minecraft.block.ITileEntityProvider;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.ItemStack;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.AxisAlignedBB;
    import net.minecraft.util.IIcon;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.IBlockAccess;
    import net.minecraft.world.World;

    import java.util.List;

    public class Telescope extends BlockContainer {

    private String name = "telescope";

    //Treat it like a normal block here. The Block Bounds are a good idea - the first three are X Y and Z of the botton-left corner,
    //And the second three are the top-right corner.
    public Telescope() {
    super(Material.rock);
    this.setBlockName(PlanetaryAlignmentMod.MODID + "_" + name);
    this.setCreativeTab(ModCreativeTabs.tabPlanetaryAlignment);
    GameRegistry.registerBlock(this, name);
    //setBlockTextureName(PlanetaryAlignmentMod.MODID + ":" + name);
    this.setHardness(2.0f);
    this.setBlockBounds(0.4F, 0.0F, 0.4F, 0.6F, 1.5F, 0.6F);
    }

    @Override
    public TileEntity createNewTileEntity(World world, int p_149915_2_) {
    return new TileEntityTelescope();
    }

    @Override
    public int getRenderType() {
    return -1;
    }

    @Override
    public boolean isOpaqueCube() {
    return false;
    }

    public boolean renderAsNormalBlock() {
    return false;
    }

    @Override
    public void registerBlockIcons(IIconRegister iconRegister)
    {
    this.blockIcon = iconRegister.registerIcon(PlanetaryAlignmentMod.MODID + ":" + "telescope");
    }

    public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_)
    {
    int l = MathHelper.floor_double((double)(p_149689_5_.rotationYaw * 4.0F / 360.0F) + 1.5D) & 3;

    if (l == 0)
    {
    p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 1, 2);
    }

    if (l == 1)
    {
    p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 4, 2);
    }

    if (l == 2)
    {
    p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 3, 2);
    }

    if (l == 3)
    {
    p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 2, 2);
    }
    }
    }


    The TileEntity Class:


    package com.planetaryalignmentmod.tileentities;

    import net.minecraft.tileentity.TileEntity;

    public class TileEntityTelescope extends TileEntity {

    }


    The TileEntityRenderer:


    package com.planetaryalignmentmod.tileentities;

    import net.minecraft.block.Block;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.renderer.OpenGlHelper;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    import net.minecraft.entity.Entity;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.World;

    import org.lwjgl.opengl.GL11;
    import org.lwjgl.opengl.GL12;

    import com.planetaryalignmentmod.blocks.Telescope;
    import com.planetaryalignmentmod.lib.PlanetaryAlignmentMod;

    public class TileEntityTelescopeRenderer extends TileEntitySpecialRenderer {

    private final TelescopeModel model;

    public TileEntityTelescopeRenderer() {
    this.model = new TelescopeModel();
    }

    private void adjustRotatePivotViaMeta(World world, int x, int y, int z) {
    int meta = world.getBlockMetadata(x, y, z);
    GL11.glPushMatrix();
    GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F);
    GL11.glPopMatrix();
    }

    @Override
    public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {

    GL11.glPushMatrix();

    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);

    ResourceLocation textures = (new ResourceLocation("planetaryAlignmentMod:textures/blocks/telescope.png"));

    Minecraft.getMinecraft().renderEngine.bindTexture(textures);

    GL11.glPushMatrix();

    GL11.glRotatef(180F, 0F, 0F, 1.0F);
    this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
    GL11.glPopMatrix();
    }

    private void adjustLightFixture(World world, int i, int j, int k, Block block) {
    Tessellator tess = Tessellator.instance;
    float brightness = block.getLightValue(world, i, j, k);
    int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
    int modulousModifier = skyLight % 65536;
    int divModifier = skyLight / 65536;
    tess.setColorOpaque_F(brightness, brightness, brightness);
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
    }
    }



    Any help you can offer will be greatly appreciated :)

    (also i am still pretty new to modding so i'm still a bit nooby so there very well could be some completely obvious mistakes)

    Posted in: Modification Development
  • 0

    posted a message on custom block model help needed
    bump
    Posted in: Modification Development
  • 0

    posted a message on custom block model help needed
    because if it doesn't show the missing block texture there might be an error in the resource location here is the file route:

    C:\Documents and Settings\DELL\My Documents\Modding\forge-1.7.10-10.13.0.1180-src\src\main\resources\assets\planetaryalignmentmod\textures\models\telescope.png

    is that how it is supposed to be? or am i missing something
    Posted in: Modification Development
  • 0

    posted a message on custom block model help needed
    bump
    Posted in: Modification Development
  • To post a comment, please .