mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-21 04:32:23 +00:00
Corporea networks.
This commit is contained in:
1 parent
19fbd0f8ca
commit
f0364a0bc6
5 files changed
+44
-4
No files matched your search
@@ -10,6 +10,9 @@
|
||||
*/
|
||||
package vazkii.botania.client.render.entity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraft.util.IIcon;
|
||||
import vazkii.botania.common.entity.EntityCorporeaSpark;
|
||||
import vazkii.botania.common.item.ItemCorporeaSpark;
|
||||
@@ -20,5 +23,16 @@ public class RenderCorporeaSpark extends RenderSparkBase<EntityCorporeaSpark> {
|
||||
public IIcon getBaseIcon(EntityCorporeaSpark entity) {
|
||||
return entity.isMaster() ? ItemCorporeaSpark.worldIconMaster : ItemCorporeaSpark.worldIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void colorSpinningIcon(EntityCorporeaSpark entity) {
|
||||
int network = Math.min(15, entity.getNetwork());
|
||||
GL11.glColor3f(EntitySheep.fleeceColorTable[network][0], EntitySheep.fleeceColorTable[network][1], EntitySheep.fleeceColorTable[network][2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getSpinningIcon(EntityCorporeaSpark entity) {
|
||||
return ItemCorporeaSpark.iconColorStar;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -58,6 +58,7 @@ public class RenderSparkBase<T extends Entity> extends RenderEntity {
|
||||
if(spinningIcon != null) {
|
||||
GL11.glTranslatef(-0.02F + (float) Math.sin(time / 20) * 0.2F, 0.24F + (float) Math.cos(time / 20) * 0.2F, 0.005F);
|
||||
GL11.glScalef(0.2F, 0.2F, 0.2F);
|
||||
colorSpinningIcon(tEntity);
|
||||
func_77026_a(tessellator, spinningIcon);
|
||||
}
|
||||
|
||||
@@ -72,6 +73,10 @@ public class RenderSparkBase<T extends Entity> extends RenderEntity {
|
||||
return ItemSpark.worldIcon;
|
||||
}
|
||||
|
||||
public void colorSpinningIcon(T entity) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public IIcon getSpinningIcon(T entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -100,6 +100,9 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
|
||||
displayRelatives(new ArrayList(), master);
|
||||
didStartupParticles = true;
|
||||
}
|
||||
|
||||
if(master != null && master.getNetwork() != getNetwork())
|
||||
master = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,8 +136,15 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
|
||||
}
|
||||
|
||||
public void restartNetwork() {
|
||||
if(master != null)
|
||||
master.registerConnections(master, this, new ArrayList());
|
||||
connections = new ArrayList();
|
||||
relatives = new ArrayList();
|
||||
|
||||
if(master != null) {
|
||||
ICorporeaSpark oldMaster = master;
|
||||
master = null;
|
||||
|
||||
oldMaster.registerConnections(oldMaster, this, new ArrayList());
|
||||
}
|
||||
}
|
||||
|
||||
void displayRelatives(ArrayList<ICorporeaSpark> checked, ICorporeaSpark spark) {
|
||||
@@ -208,7 +218,17 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
|
||||
didStartupParticles = false;
|
||||
return true;
|
||||
}
|
||||
} // TODO Dyeing
|
||||
} else if(stack.getItem() == ModItems.dye) {
|
||||
int color = stack.getItemDamage();
|
||||
if(color != getNetwork()) {
|
||||
setNetwork(color);
|
||||
restartNetwork();
|
||||
stack.stackSize--;
|
||||
firstUpdate = true;
|
||||
if(player.worldObj.isRemote)
|
||||
player.swingItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -28,7 +28,7 @@ import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
public class ItemCorporeaSpark extends ItemMod {
|
||||
|
||||
public static IIcon invIcon, worldIcon, invIconMaster, worldIconMaster;
|
||||
public static IIcon invIcon, worldIcon, invIconMaster, worldIconMaster, iconColorStar;
|
||||
|
||||
public ItemCorporeaSpark() {
|
||||
setUnlocalizedName(LibItemNames.CORPOREA_SPARK);
|
||||
@@ -65,6 +65,7 @@ public class ItemCorporeaSpark extends ItemMod {
|
||||
worldIcon = IconHelper.forItem(par1IconRegister, this, 1);
|
||||
invIconMaster = IconHelper.forItem(par1IconRegister, this, 2);
|
||||
worldIconMaster = IconHelper.forItem(par1IconRegister, this, 3);
|
||||
iconColorStar = IconHelper.forItem(par1IconRegister, this, "Star");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user