Jump to content

Jordor

Members
  • Posts

    19
  • Joined

  • Last visited

Posts posted by Jordor

  1. I had the exact same idea one year ago, but after some problems with a trans dimensional CCTV system I paused the development of my mod.

     

    I would use simething similar to the invis potion. But you also have to make sure, that the players are not show on the player list, that no running particles are spawned and and and...

     

    oh come on there must be a way xD

     

    As for the particles i don't actually care. I may do a potion effect that does exactly the same as the invisibility potion but without them.

    And the list, well, not a problem at all, since they are playing in the server.

     

    So the point is: how do you tell minecraft to change all textures? loading a texture pack is just too long, making a pool with them and post-rendering might be the answer.

     

    Who know about this?

     

    help much appreciated!

  2. Making every block change in one dimension affect the other is going to be neigh impossible.

     

    Thank! Now i know that way is just not the adequate :P

     

    So now it's all about making a masive texture switch, or a render filter or something. I don't actually know what to do because i don't know enough. Can you guide me towards what kind of classes i could make use of? I will explore them, no need of a super complete tutorial :)

  3. Hey forge community.

     

    My idea is to make a parallel dimension, but not so fast! It's not the nether or end-like cases.

     

    Here's the way i want it to work:

    - Exactly the same shape as overworld (thus, maybe same generator and seed)

    - Every block is changed to one of my mod's.

    -Whenever you modify the overworld, this dimension gets modified as well in the exact same way, and viceversa.

     

    Where to begin:

    - I thought maybe making another dimension and using an eventHandler to trigger the updating my custom dimension.

    - Making a complete retexturing on the overworld and drop changing when some effect is made, creating the illusion of being in another dimension.

     

    What is better? what solution makes the least impact on performace?

     

    Tell me please what do you think!

     

    thanks!

     

     

     

  4. Hello.

     

    Since you got a tileEntity, you can store in it the values for the rotation of your model. Use updateEntity to change a variable called rotation (or the name you choose, usually public float). Since every tileEntity is unique, in the renderer you can import the tileEntity for xCoord, yCoord and zCoord (TileEntity tile = world.getTileEntity() and cast it to the entity you are talking about) and then take that particular rotation (tile.rotation), then aplly it to the figure you want to rotate (render.figureX(tile.rotation)). for example:

     

    TileEntity

     

    
    public void updateEntity() {
    
    if (!worldObj.isRemote) {
    
    	} else {
    		BatRotation += 0.05F;
    	}
    }
    

     

     

    renderer

     

     

    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(
    			"AncientCraft:textures/blocks/BatteryReceptacle.png"));
    
    	Minecraft.getMinecraft().renderEngine.bindTexture(textures);
    
    
    	GL11.glPushMatrix();
    	GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    
    
    	TileEntityBatReceptacle tileBat = (TileEntityBatReceptacle) te;
    
    	stack = tileBat.getStackInSlot(0);
    
    	if (stack != null) {
    		if (stack.getItem() == AncientCraft.ItemCorruptBattery) {
    			this.model.batteryRotation = true;
    		}
    
    	} else {
    		this.model.batteryRotation = false;
    	}
    
    	//THIS IS THE PLACE I CHANGE ROTATION
                    //getBatRotation is a function of the tileEntity i made because BatRotation is private.
    	this.model.Battery.rotateAngleY = tileBat.getBatRotation();
    
    
    	int meta = te.getBlockMetadata();
    
    	this.model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F,
    			0.0625F, meta);
    
    
    	GL11.glPopMatrix();
    	GL11.glPopMatrix();
    }
    

     

  5. SOLVED

     

    Thank you very much.

     

    This is what i added to the TileEntity:

     

    public Packet getDescriptionPacket() {
    	NBTTagCompound nbttagcompound = new NBTTagCompound();
    	this.writeToNBT(nbttagcompound);
    	return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord,
    			this.zCoord, 5, nbttagcompound);
    }
    
    public void onDataPacket(NetworkManager net,
    		S35PacketUpdateTileEntity packet) {
    
    	readFromNBT(packet.func_148857_g());
    }

     

    :D

  6. I got a TileEntity that has also a Container and a Gui.

     

    That said, it has only one slot and i write the contents to NBT and also read it.

     

    When i put the itemstack inside all works perfectly. But when i log out and relog in, the server seems to be working fine (things are happening) but the client is not recognising the item inside unless i open the gui. Then all the animations that depend on that item can trigger after that.

     

    Anything i missed? Packets? Sever or client only things? "!world.isRemote"?

     

    EDIT: this is the TileEntityCode. I'll explain a bit.

     

    public class TileEntityBatReceptacle extends TileEntityMachine implements
    	IInventory {
    public ItemStack item;
    
    public float BatRotation = 0.0F;
    public Block[] bottomBlocks = new Block[9];
    public boolean[] bottomBlocksValid = new boolean[9];
    public boolean charge;
    
    public TileEntityBatReceptacle() {
    	EnergyAmount = 0;
    	charge = true;
    }
    
    @Override
    public void writeToNBT(NBTTagCompound compound) {
    
    	NBTTagList items = new NBTTagList();
    
    	for (int i = 0; i < getSizeInventory(); i++) {
    
    		ItemStack stack = getStackInSlot(i);
    
    		if (stack != null) {
    			NBTTagCompound item = new NBTTagCompound();
    			item.setByte("Slot", (byte) i);
    			stack.writeToNBT(item);
    			items.appendTag(item);
    
    		}
    
    	}
    	compound.setTag("Items", items);
    	compound.setFloat("rotaion", BatRotation);
    	compound.setBoolean("charge", charge);
    
    	super.writeToNBT(compound);
    
    }
    
    @Override
    public void readFromNBT(NBTTagCompound compound) {
    
    	super.readFromNBT(compound);
    
    	NBTTagList items = compound.getTagList("Items", 10);
    
    	for (int i = 0; i < items.tagCount(); i++) {
    		NBTTagCompound item = items.getCompoundTagAt(i);
    		int slot = item.getByte("Slot");
    
    		if (slot >= 0 && slot < getSizeInventory()) {
    			setInventorySlotContents(slot,
    					ItemStack.loadItemStackFromNBT(item));
    		}
    
    	}
    
    	BatRotation = compound.getFloat("rotation");
    	charge = compound.getBoolean("charge");
    
    }
    
    public void updateEntity() {
    
    	for (int i = 0; i < bottomBlocksValid.length; i++) {
    		bottomBlocksValid[i] = false;
    	}
    	charge = true;
    	/**
    	 * SE ENCARGA DE OBTENER EL NIVEL DE ENERGÍA DE LA BATERÍA E IGUALARLO
    	 * AL DEL RECEPTÁCULO.
    	 */
    
    	ItemStack battery = getStackInSlot(0);
    
    	if (battery != null) {
    		if (battery.getItem() == AncientCraft.ItemCorruptBattery) {
    			NBTTagCompound compound = battery.getTagCompound();
    
    			EnergyAmount = compound.getInteger("EnergyAmount");
    		} else {
    			EnergyAmount = 0;
    		}
    	} else {
    		EnergyAmount = 0;
    	}
    
    	/**
    	 * SE ENCARGA DE INCREMENTAR LA CARGA DE LA BATERÍA CUANDO HAY UN
    	 * ALIONITEORE DEBAJO Y EL CONSTRUCTO NECESARIO
    	 */
    	for (int i = 0; i < 3; i++) {
    		for (int j = 0; j < 3; j++) {
    			bottomBlocks[i * 3 + j] = worldObj.getBlock(xCoord - 1 + i,
    					yCoord - 1, zCoord - 1 + j);
    			if (bottomBlocks[i * 3 + j] == AncientCraft.AlionOreShell
    					&& i * 3 + j != 4) {
    				bottomBlocksValid[i * 3 + j] = true;
    
    			} else if (bottomBlocks[i * 3 + j] == AncientCraft.AlioniteOre
    					&& i * 3 + j == 4) {
    				bottomBlocksValid[i * 3 + j] = true;
    			}
    		}
    	}
    
    	for (int i = 0; i < 9; i++) {
    		if (bottomBlocksValid[i] == false) {
    			charge = false;
    		}
    	}
    
    	if (charge == true) {
    		if (battery != null) {
    			if (battery.getItem() == AncientCraft.ItemCorruptBattery) {
    
    				NBTTagCompound compound = battery.getTagCompound();
    
    				if (compound != null) {
    					if (EnergyAmount < Reference.MAX_BATTERY_LEVEL) {
    						compound.setInteger("EnergyAmount",
    								EnergyAmount + 1);
    					}
    				}
    			}
    		}
    	}
    
    	/**
    	 * rotación de la bartía en el renderizado.
    	 */
    	if (!worldObj.isRemote) {
    
    	} else {
    		BatRotation += 0.05F;
    	}
    
    }
    
    public float getBatRotation() {
    
    	return BatRotation;
    }
    
    /**
     * Funciones que gestionan los objetos.
     */
    
    @Override
    public int getSizeInventory() {
    
    	return 1;
    }
    
    @Override
    public ItemStack getStackInSlot(int i) {
    
    	return item;
    }
    
    @Override
    public ItemStack decrStackSize(int i, int count) {
    
    	ItemStack itemstack = getStackInSlot(i);
    
    	if (itemstack != null) {
    		if (count >= itemstack.stackSize) {
    			setInventorySlotContents(i, null);
    
    		} else {
    			itemstack = itemstack.splitStack(count);
    
    		}
    	}
    
    	markDirty();
    
    	return itemstack;
    }
    
    @Override
    public ItemStack getStackInSlotOnClosing(int i) {
    
    	ItemStack item = getStackInSlot(i);
    
    	setInventorySlotContents(i, null);
    
    	markDirty();
    
    	return item;
    
    }
    
    @Override
    public void setInventorySlotContents(int i, ItemStack itemstack) {
    
    	item = itemstack;
    
    	if (itemstack != null) {
    		if (item.stackSize > getInventoryStackLimit()) {
    			item.stackSize = getInventoryStackLimit();
    		}
    
    	}
    
    	markDirty();
    }
    
    @Override
    public String getInventoryName() {
    
    	return null;
    }
    
    @Override
    public boolean hasCustomInventoryName() {
    
    	return false;
    }
    
    @Override
    public int getInventoryStackLimit() {
    
    	return 1;
    }
    
    @Override
    public boolean isUseableByPlayer(EntityPlayer player) {
    	return player.getDistanceSq(xCoord, yCoord, zCoord) <= 64;
    }
    
    @Override
    public void openInventory() {
    
    }
    
    @Override
    public void closeInventory() {
    
    }
    
    @Override
    public boolean isItemValidForSlot(int slotn, ItemStack itemStack) {
    	return true;
    }
    }
    

     

  7. After walking through the interface, it looks like each piece is assigned an absorption ratio less than one, and if the sum of the pieces adds up to one, then all damage is absorbed. To make sure that some damage leaks through, assign absorption ratios that add to less than one (e.g. 0.2 for each of four standard pieces, adding to 80% absorption with 20% reaching the wearer).

     

    You probably don't want your armor to ever add up to more than one, because then the pieces would take excess damage on themselves, reducing entity damage to a negative number, and that neg would be rectified to zero in the calling method (but the excess damage to the armor would remain).

     

    I suggest that you lower your shield's absorption ratio significantly.

     

    Thanks for answering.

     

    You may have noticed also that the interface provides a method called "damageArmor" that says how to damage the armor instead of vanilla way. That resolves the excess damage you are talking about. Explanation: Shield absorbs ALL damage once every once in a while. Damage armor damages the itemStack only 1 point.

     

    Code here

     

     

    @Override
    public void damageArmor(EntityLivingBase entity, ItemStack stack,
    		DamageSource source, int damage, int slot) {
    	if (stack != null) {
    
    		NBTTagCompound compound = stack.getTagCompound();
    
    		if (compound != null) {
    
    			int durability = compound.getInteger("structure");
    
    			if (durability > 0) {
    				durability--;
    			} else {
    				stack.damageItem(1, entity);
    			}
    
    			compound.setInteger("structure", durability);
    
    		}
    	}
    }
    
    

     

     

    The problem is when i place a 0.2 or 0.25, no damage is absorbed and thus, it is dealt to the player, even with the 4 pieces on him (getting attacked by a giant slime).

     

    i'm trying to see why this happens right now xD.

  8. Well you totally got me there...

     

    only trick i imagine right now is to make the TileEntity pick up an ItemStack, set it to null and put it back in the grid the next tick once every few ticks automatically. I don't know if that is able to fire onCraftMatrixChanged.

     

    Kind of derpy but if it works...

  9. Of course the TileEntity can check for the Mana but I can't get the container from the TE.

    I need to update the Container.

     

    So, you mean, your craftting does not show any results unless you got enough mana? and you want that the result appears when the player gets enough mana, isn't it?

  10. Heyho Guys!

    I created a special CraftingTable which consumes some Mana from the player while crafting. I added the Mana as an ExtendedProperty a while ago. Now I recognized that the Mana value of the container of the crafting GUI is only updated when I change something in the Slots (onCraftMatrixChange). But I want it to update every tick to update the crafting when the Player has regenerated enough Mana. How can I achieve this update feature? Which method do I have to override?

     

    I don't know about Those properties yet but... a container goes with a tileEntity. I think that updateEntity (which runs every tick) can check mana as often as you want.

     

    I may have misunderstood :/

  11. Hello modders!!

     

    I was messing around with ISpecialArmor. Armor properties accept 3 parameters: priority, ratio and max.

     

    priority is self explanatory.

    ratio is also quite easy (it a double). In the code it seems that all 4 pieces share the same ratio, meaning that 0.25 ratio on each piece grants a 100% absorption of damage when all 4 pieces are equipped.

    max is an int, and seems to be, again in the code, the maximum amount of damage that can be absorbed by the piece.

     

     

    Let's say a Slime (giant) attacks me and deals 2 hearts:

    - is that 4 damage points?

    - if all 4 pieces absorb 0.25, do they take 1 point (0.5 hearts) each?

     

    i've been trying to work with an armor but it does not seem to be absorbing anything.

     

    here is the relevant code (skills[2] takes a value of 1 in this case).

     

     

     

    @Override

    public ArmorProperties getProperties(EntityLivingBase player,

    ItemStack armor, DamageSource source, double damage, int slot) {

     

    ArmorProperties properties = new ArmorProperties(0, 0, 0);

     

    NBTTagCompound compound = armor.getTagCompound();

     

    if (compound != null) {

    int[] skills = compound.getIntArray("skills");

    int Shield = compound.getInteger("Shield");

     

    if (armor.getItem() == AncientCraft.CorruptChestplate) {

     

    if (Shield > 0) {

    properties = new ArmorProperties(0, 1, 200);

    if (damage > 0) {

    Shield--;

    }

    } else {

    properties = new ArmorProperties(0, 0.25, skills[2]);

    }

     

    } else {

    properties = new ArmorProperties(0, 0.25, skills[2]);

    }

     

    compound.setInteger("Shield", Shield);

    }

     

    return properties;

     

    }

     

     

     

     

  12. Hello forge community. Kinda new in here but already messed with some forge.

     

    I was trying to figure out how to make an armor that changes it's protection according to custom variables. But the ArmorMaterial damagereduction array is final and cannot be recalculated in every armor set and tick because we are talking about Items (not ItemStacks).

     

    The objective is to create an armor that has a certain damage reduction depending on how it was crafted without making a material for every single combination.

     

    If someone has an idea i would very glad to read it and possibly i'll be a little less noob :D

     

    Jordor.

×
×
  • Create New...

Important Information

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