Jump to content

hydroflame

Members
  • Posts

    1511
  • Joined

  • Last visited

Posts posted by hydroflame

  1. I had taken the files from the bin folder in the elclipse workspace directory.

     

    well the bin directory is not obfuscated so its normal it crash

     

    reobfuscating does not return any files for me, my mod is in a separate folder but it dosnt work when i drag the package in the minecraft source folder either.

    i dont understand why peopel do that, it only causes problem later :\

  2. time for today funny mojang code

     

    BlockCarpet.java (extends Block btw)

     

    protected void func_111047_d(int par1)
        {
            byte b0 = 0;
            float f = (float)(1 * (1 + b0)) / 16.0F;
            this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
        }

    this function does NOT override anythign in Block

     

    the argument par1 has absolutelly NO use in the function

    b0 is specificly set to something :\

     

    theres a "1*somethign"... why would you do that ?

     

     

    basicly this is the same thing as:

    this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1/16f, 1.0F);

  3. Well I assume this works in eclipse just not when exported to MC?

     

     

    Three things then:

     

    1. Is your modid lowercase only? if not you will have problems when exporting.

    2. Are your package names lowercase only?

    3. Have you reobfuscated the files before throwing them into mc?

    i didnt know about package lowercase, java convention is to not use uppercase for package anyway but thats good to know

    (yes i know not a lot of people follow java convention)

  4. but it shouldn't push me out with a special one either.

    no no of course, but at least we know theres nothign super weird goign on

     

    public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)

        {

            return AxisAlignedBB.getAABBPool().getAABB((double)par2 + this.minX, (double)par3 + this.minY, (double)par4 + this.minZ, (double)par2 + this.maxX, (double)par3 + this.maxY, (double)par4 + this.maxZ);

        }

    vanilla is doign it a biiiit differently, im thinking maybe you have a mismatch :\, maybe try something that is closer to what vanilla is doing ?

    or actually BlockHalfSlab doesnt even override that method.

     

    ps: i dont really know whats the problem, im jsut trying to debug with you :)

  5. Nah, I'll just stick with a TickHandler. I think I'll need it later in a little bit.

    *hydroflame goes suspicisous mode.... hmmmm*

     

    anyway

    hum you are returning null

     

    @Override
    public EnumSet<TickType> ticks(){
    	return null;
    }

    and you should be returning something :

    @Override
    public EnumSet<TickType> ticks() {
    	return EnumSet.of(TickType.PLAYER);
    }

  6. why would you need a packet handler ? its a key press

     

    example:

    import java.util.EnumSet;
    
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.settings.KeyBinding;
    
    import org.lwjgl.input.Keyboard;
    
    import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
    import cpw.mods.fml.common.TickType;
    
    public class HBKeyHandler extends KeyHandler {
    
    public HBKeyHandler() {
    	super(new KeyBinding[]{new KeyBinding("configure health bar", Keyboard.KEY_C)}, new boolean[]{false});
    }
    
    @Override
    public String getLabel() {
    	return "hbkh";
    }
    
    @Override
    public void keyDown(EnumSet<TickType> types, KeyBinding kb,
    		boolean tickEnd, boolean isRepeat) {
    	if(Minecraft.getMinecraft().inGameHasFocus){
    		Minecraft.getMinecraft().thePlayer.openGui(MainMod.instance, 0, Minecraft.getMinecraft().theWorld, 0, 0, 0);
    	}
    }
    
    @Override
    public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) {
    
    }
    
    @Override
    public EnumSet<TickType> ticks() {
    	return null;
    }
    
    }
    

    also, your TickHandler is not working because you are not returning null in "public EnumSet<TickType> ticks()"

  7. ok i figured a few thing

     

    for 1, for a reason i wont explain , you cannot use glTranslated, you have to surroudn your code with

    tessellator.addTranslation(x, y, z);

     

    and finish with

    tessellator.addTranslation(-x, -y, -z);

     

    now this will make place the tessellator where something like this

    tess.addVertex(0, 0, 0);
    tess.addVertex(0, 1, 0);
    tess.addVertex(1, 1, 0);
    tess.addVertex(1, 0, 0);
    

    will cover the entire face of a block (the one you want to render)

     

    after that you can easilly use the tessellator normally to render wtv u want

     

    unless you intended to render models (like IModelCustom) then you would need another layer of setup (which i can explain if you want)

  8. which I might be over estimating

    i think you are, unless you are expecting people to make network over hundreds and hundreds of block away it should be instant (at least to you)

     

    also, if the other block is literally hundreds of block away, you still need to get there and minecraft doesn't have a lot of fast travel methods so you probably wouldn't even see the difference.

     

     

  9. thats the beauty, you DONT have to know what are the child class

     

    		List<Object> classList = new ArrayList<Object>();
    		ClassPath cp = ClassPath.from(TheMod.class.getClassLoader());
    		for(ClassPath.ClassInfo info: cp.getTopLevelClassesRecursive("com.hydroflame")){//iterate every class in my mod
    			Class c;
    
    				c = Class.forName(info.getName());//get the class for the name aka this will get EVERY class one by one
    				if(MyInterface.class.isAssignableFrom(c)){
                                                    List weapons = ((MyInterface)c.newInstance()).getNewWeapons();//retreive the new weapons from the class 
                                            }
    
    
    
    

     

    sorry about formatting

     

    and

     

    i remove all try catch block to make it easier to read

  10. just little warning, if you use System.nanoTime, ALL your block will be extremelly synchronized

    when i mean extremmelly, i mean like very very synchro

    (btw my code is synchonized but thats just because i did not have time to implement the synchro break

    to "break" this synchro you will need to use value that change from one block to another, the one i recommend using is x, y, z that is coviniently given to you by the method

     

    now we need to use those to differentiate one animation from the other

    imagine that all our animation are based on one factor

     

    lets say:

    float f = System.nanoTime()/1000000f;

    now that would mean everything is synchro, what would happen if we were to add somethign to differentiate them from one another:

    int loopFactor = 50;
    float f = System.nanoTime()/1000000f + (x%loopFactor)/attenuationFactor;

    and attenuationFactor im not sure what is a good value, to high will make it look weird, too low too :P

     

    basicly we introduced the x variable of the TE to make sure 2 TE with 2 different x will not be in synchronization, repeat for y and z to make sure that nothign is synchro ever

     

    of course this will only make the animation be at different "time" in their loop, but at least it looks nice

     

    now i know this isnt very clear, please ask if you want another explanation :)

  11. However I don't understand how to use it to get subclasses, or classes that implement an interface.

    that more a question of knowing exactly which function to use

     

    in the case to check is some class is child of another

     

    Parent.class.isAssignableFrom(PotentialChild.class);

     

    or if you're usign an object:

     

    Parent.class.isAssignableFrom(myObject.getClass());

     

     

    in a minecraft related example:

     

    Block.class.isAssignableFrom(BlockOre.class)

     

    will return always true because BlockOre extends Block

     

    same thing for interfaces

     

    ISimpleBlockRenderingHandler.class.isAssignableFrom(MyISBRH.class)

     

    will return true because MyISBRH implements ISimpleBlockRenderingHandler

  12. But how did you time the animation of the texture

    can you give me your deffinition of that, because we could think 2 different stuff when we read that

    im thinking 3d texture or multiple texture that gets dispalyed one after the other

     

    how did I do it? well i personally like to use cyclic animation (the same thing over and over)

    since all i want is somethign that moves, i usually take the system and transform it into the matrix transform i want to apply it to

     

    hard to type but heres a real live example from my mod:

     

    //sorry about extremmelly shitty quality

     

    code that does that:

     

    import org.lwjgl.opengl.GL11;
    
    import com.hydroflame.mod.ForgeRevCommonProxy;
    import com.hydroflame.mod.TheMod;
    
    import net.minecraft.block.Block;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.renderer.OpenGlHelper;
    import net.minecraft.client.renderer.RenderBlocks;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.IBlockAccess;
    import net.minecraftforge.client.model.AdvancedModelLoader;
    import net.minecraftforge.client.model.IModelCustom;
    import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
    
    public class RenderTeleporter extends TileEntitySpecialRenderer{
    private IModelCustom teleporter;
    private ResourceLocation texture = new ResourceLocation(TheMod.modid, "/models/textures/teleporter.png");
    private float[] pos;
    int displayList = -1;
    
    public RenderTeleporter(){
    	teleporter = AdvancedModelLoader.loadModel("/teleporter.obj");
    	pos = new float[30];
    	for(int i = 0; i < pos.length; i++){
    		pos[i] = (float) Math.random()*2;
    	}
    }
    
    @Override
    public void renderTileEntityAt(TileEntity tileentity, double d0, double d1,
    		double d2, float f) {
    
    
    	//here
    	for(int i =0; i < pos.length; i++){
    	}
    	float size = 0.1f;
    	Tessellator tess = Tessellator.instance;
    	for(int i = 0; i < pos.length; i++){
    		pos[i]+=0.01f;
    		if(pos[i] > 2){ 
    			pos[i] = 0;
    		}
    	}
    	Minecraft.getMinecraft().renderEngine.func_110577_a(ForgeRevCommonProxy.portalParticle);
    	GL11.glPushMatrix();
    	GL11.glTranslated(d0+0.5, d1+1, d2+0.5);
    	for(int i = 0; i < pos.length; i++){
    		GL11.glRotated(360/pos.length, 0, 1, 0);
    		GL11.glPushMatrix();
    		GL11.glTranslated(0, pos[i], 1);
    		tess.startDrawingQuads();
    		tess.addVertexWithUV(-size, -size, 0, 0, 0);
    		tess.addVertexWithUV(-size, size, 0, 0, 1);
    		tess.addVertexWithUV(size, size, 0, 1, 1);
    		tess.addVertexWithUV(size, -size, 0, 1, 0);
    
    		tess.addVertexWithUV(-size, -size, 0, 0, 0);
    		tess.addVertexWithUV(size, -size, 0, 1, 0);
    		tess.addVertexWithUV(size, size, 0, 1, 1);
    		tess.addVertexWithUV(-size, size, 0, 0, 1);
    		tess.draw();
    		GL11.glPopMatrix();
    	}
    	GL11.glPopMatrix();
    	GL11.glColor3f(1, 1, 1);
    	Minecraft.getMinecraft().renderEngine.func_110577_a(texture);
    	GL11.glPushMatrix();
    	GL11.glTranslated(d0+0.5, d1+1, d2+0.5);
    	GL11.glScaled(1.3, 1.3, 1.3);
    	Tessellator.instance.setColorOpaque_F(1, 1, 1);
    	teleporter.renderAll();
    	Minecraft.getMinecraft().renderEngine.func_110577_a(ForgeRevCommonProxy.portalRune);
    	GL11.glTranslated(0, 0.2, 0);
    	GL11.glRotated(System.nanoTime()/100000000f, 0, 1, 0);
    	tess.startDrawingQuads();
    	tess.addVertexWithUV(-0.5, 0, -0.5, 0, 0);
    	tess.addVertexWithUV(-0.5, 0, 0.5, 0, 1);
    	tess.addVertexWithUV(0.5, 0, 0.5, 1, 1);
    	tess.addVertexWithUV(0.5, 0, -0.5, 1, 0);
    	tess.draw();
    	GL11.glPopMatrix();
    }
    }
    

     

  13. well look up java reflection on google, theres ton of beautifull content for it (and seiously reflection is soooo sexy :D)

     

    but yeah, basicly make every "submod" implements a interface X

    use reflection to find all those class

    then use the interface to get the requried information

     

    like idk

     

    public interface extraMod{

        public List<Item> getExtraItems();

        public List<Block> getExtraBlocks();

        public List<Object> getExtraEventHandlers();

    }

×
×
  • Create New...

Important Information

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