- Aura Pylon: Models + stuff init

This commit is contained in:
HellFirePvP committed 2015-11-13 00:59:15 +01:00
1 parent be6a56b8d8
commit 6b0d70b10e
15 files changed
+738 -16

No files matched your search

@@ -20,7 +20,9 @@ import makeo.gadomancy.client.renderers.item.ItemRenderFamiliar;
import makeo.gadomancy.client.renderers.item.ItemRenderRemoteJar;
import makeo.gadomancy.client.renderers.item.ItemRenderStoneMachine;
import makeo.gadomancy.client.renderers.item.ItemRenderTileEntity;
import makeo.gadomancy.client.renderers.item.ItemRenderTileEntityMulti;
import makeo.gadomancy.client.renderers.tile.RenderTileArcaneDropper;
import makeo.gadomancy.client.renderers.tile.RenderTileAuraPylon;
import makeo.gadomancy.client.renderers.tile.RenderTileCapEldritch;
import makeo.gadomancy.client.renderers.tile.RenderTileExtendedNode;
import makeo.gadomancy.client.renderers.tile.RenderTileExtendedNodeJar;
@@ -34,6 +36,8 @@ import makeo.gadomancy.client.renderers.tile.RenderTileStickyJar;
import makeo.gadomancy.common.CommonProxy;
import makeo.gadomancy.common.blocks.tiles.TileAdditionalEldritchPortal;
import makeo.gadomancy.common.blocks.tiles.TileArcaneDropper;
import makeo.gadomancy.common.blocks.tiles.TileAuraPylon;
import makeo.gadomancy.common.blocks.tiles.TileAuraPylonTop;
import makeo.gadomancy.common.blocks.tiles.TileExtendedNode;
import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar;
import makeo.gadomancy.common.blocks.tiles.TileInfusionClaw;
@@ -118,6 +122,10 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEldritchAltar.class, new RenderTileCapEldritch("textures/models/obelisk_cap_altar.png"));
ClientRegistry.bindTileEntitySpecialRenderer(TileEldritchCap.class, new RenderTileCapEldritch("textures/models/obelisk_cap.png"));
RenderTileAuraPylon renderTileAuraPylon = new RenderTileAuraPylon();
ClientRegistry.bindTileEntitySpecialRenderer(TileAuraPylon.class, renderTileAuraPylon);
ClientRegistry.bindTileEntitySpecialRenderer(TileAuraPylonTop.class, renderTileAuraPylon);
//Items
TileArcaneDropper fakeTile = new TileArcaneDropper();
fakeTile.blockMetadata = 8 | ForgeDirection.SOUTH.ordinal();
@@ -127,6 +135,10 @@ public class ClientProxy extends CommonProxy {
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ConfigBlocks.blockAiry), new ItemExNodeRenderer());
ItemRenderTileEntityMulti multi = new ItemRenderTileEntityMulti(new ItemRenderTileEntityMulti.RenderSet(renderTileAuraPylon, new TileAuraPylon(), 0),
new ItemRenderTileEntityMulti.RenderSet(renderTileAuraPylon, new TileAuraPylonTop(), 1));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockAuraPylon), multi);
MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemExtendedNodeJar, new ItemJarExtendedNodeRenderer());
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockRemoteJar), new ItemRenderRemoteJar(renderTileRemoteJar));
@@ -14,10 +14,13 @@ import makeo.gadomancy.client.util.FamiliarHandlerClient;
*/
public class ClientTickHandler {
public static int ticks;
@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent event) {
if(event.phase.equals(TickEvent.Phase.END)) {
FamiliarHandlerClient.playerTickEvent();
ticks++;
}
}
@@ -0,0 +1,147 @@
package makeo.gadomancy.client.models;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelAuraPylon extends ModelBase {
ModelRenderer outerpylon;
ModelRenderer lowerconduit;
ModelRenderer inlower1;
ModelRenderer inlower2;
ModelRenderer upperconduit;
ModelRenderer inupper2;
ModelRenderer inupper1;
ModelRenderer outuppersmooth1;
ModelRenderer outuppersmooth2;
ModelRenderer inuppersmooth1;
ModelRenderer inuppersmooth2;
ModelRenderer outlowersmooth2;
ModelRenderer outlowersmooth1;
ModelRenderer inlowersmooth1;
ModelRenderer inlowersmooth2;
public ModelAuraPylon() {
textureWidth = 32;
textureHeight = 32;
outerpylon = new ModelRenderer(this, 0, 0);
outerpylon.addBox(0F, 0F, 0F, 2, 16, 2);
outerpylon.setRotationPoint(5F, 8F, 5F);
outerpylon.setTextureSize(64, 32);
outerpylon.mirror = true;
setRotation(outerpylon, 0F, 0F, 0F);
lowerconduit = new ModelRenderer(this, 8, 0);
lowerconduit.addBox(0F, 0F, 0.2F, 6, 1, 1);
lowerconduit.setRotationPoint(6F, 20F, 7F);
lowerconduit.setTextureSize(64, 32);
lowerconduit.mirror = true;
setRotation(lowerconduit, 0F, 2.356194F, 0F);
inlower1 = new ModelRenderer(this, 8, 2);
inlower1.addBox(0F, 0F, 0F, 1, 1, 3);
inlower1.setRotationPoint(3F, 20F, 3F);
inlower1.setTextureSize(64, 32);
inlower1.mirror = true;
setRotation(inlower1, 0F, 3.141593F, 0F);
inlower2 = new ModelRenderer(this, 8, 2);
inlower2.addBox(0F, 0F, 0F, 3, 1, 1);
inlower2.setRotationPoint(3F, 20F, 3F);
inlower2.setTextureSize(64, 32);
inlower2.mirror = true;
setRotation(inlower2, 0F, 3.141593F, 0F);
upperconduit = new ModelRenderer(this, 8, 0);
upperconduit.addBox(0F, 0F, 0.2F, 6, 1, 1);
upperconduit.setRotationPoint(6F, 11F, 7F);
upperconduit.setTextureSize(64, 32);
upperconduit.mirror = true;
setRotation(upperconduit, 0F, 2.356194F, 0F);
inupper2 = new ModelRenderer(this, 8, 2);
inupper2.addBox(0F, 0F, 0F, 3, 1, 1);
inupper2.setRotationPoint(3F, 11F, 3F);
inupper2.setTextureSize(64, 32);
inupper2.mirror = true;
setRotation(inupper2, 0F, 3.141593F, 0F);
inupper1 = new ModelRenderer(this, 8, 2);
inupper1.addBox(0F, 0F, 0F, 1, 1, 3);
inupper1.setRotationPoint(3F, 11F, 3F);
inupper1.setTextureSize(64, 32);
inupper1.mirror = true;
setRotation(inupper1, 0F, 3.141593F, 0F);
outuppersmooth1 = new ModelRenderer(this, 8, 6);
outuppersmooth1.addBox(-0.5F, 0F, 0.2F, 2, 1, 1);
outuppersmooth1.setRotationPoint(6F, 11F, 6F);
outuppersmooth1.setTextureSize(64, 32);
outuppersmooth1.mirror = true;
setRotation(outuppersmooth1, 0F, 2.792527F, 0F);
outuppersmooth2 = new ModelRenderer(this, 8, 6);
outuppersmooth2.addBox(0F, 0F, 0.1F, 2, 1, 1);
outuppersmooth2.setRotationPoint(5F, 11F, 7F);
outuppersmooth2.setTextureSize(64, 32);
outuppersmooth2.mirror = true;
setRotation(outuppersmooth2, 0F, 1.919862F, 0F);
inuppersmooth1 = new ModelRenderer(this, 8, 6);
inuppersmooth1.addBox(0.25F, 0F, -0.5F, 1, 1, 2);
inuppersmooth1.setRotationPoint(2F, 11F, 2F);
inuppersmooth1.setTextureSize(64, 32);
inuppersmooth1.mirror = true;
setRotation(inuppersmooth1, 0F, 0.3490659F, 0F);
inuppersmooth2 = new ModelRenderer(this, 8, 6);
inuppersmooth2.addBox(0.15F, 0F, 0.3F, 1, 1, 2);
inuppersmooth2.setRotationPoint(1F, 11F, 3F);
inuppersmooth2.setTextureSize(64, 32);
inuppersmooth2.mirror = true;
setRotation(inuppersmooth2, 0F, 1.22173F, 0F);
outlowersmooth2 = new ModelRenderer(this, 8, 6);
outlowersmooth2.addBox(0F, 0F, 0.1F, 2, 1, 1);
outlowersmooth2.setRotationPoint(5F, 20F, 7F);
outlowersmooth2.setTextureSize(64, 32);
outlowersmooth2.mirror = true;
setRotation(outlowersmooth2, 0F, 1.919862F, 0F);
outlowersmooth1 = new ModelRenderer(this, 8, 6);
outlowersmooth1.addBox(-0.5F, 0F, 0.2F, 2, 1, 1);
outlowersmooth1.setRotationPoint(6F, 20F, 6F);
outlowersmooth1.setTextureSize(64, 32);
outlowersmooth1.mirror = true;
setRotation(outlowersmooth1, 0F, 2.792527F, 0F);
inlowersmooth1 = new ModelRenderer(this, 8, 6);
inlowersmooth1.addBox(0.25F, 0F, -0.5F, 1, 1, 2);
inlowersmooth1.setRotationPoint(2F, 20F, 2F);
inlowersmooth1.setTextureSize(64, 32);
inlowersmooth1.mirror = true;
setRotation(inlowersmooth1, 0F, 0.3490659F, 0F);
inlowersmooth2 = new ModelRenderer(this, 8, 6);
inlowersmooth2.addBox(0.15F, 0F, 0.3F, 1, 1, 2);
inlowersmooth2.setRotationPoint(1F, 20F, 3F);
inlowersmooth2.setTextureSize(64, 32);
inlowersmooth2.mirror = true;
setRotation(inlowersmooth2, 0F, 1.22173F, 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);
outerpylon.render(f5);
lowerconduit.render(f5);
inlower1.render(f5);
inlower2.render(f5);
upperconduit.render(f5);
inupper2.render(f5);
inupper1.render(f5);
outuppersmooth1.render(f5);
outuppersmooth2.render(f5);
inuppersmooth1.render(f5);
inuppersmooth2.render(f5);
outlowersmooth2.render(f5);
outlowersmooth1.render(f5);
inlowersmooth1.render(f5);
inlowersmooth2.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z) {
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}
@@ -0,0 +1,116 @@
package makeo.gadomancy.client.models;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelAuraPylonTop extends ModelBase {
ModelRenderer outerpylon;
ModelRenderer lowerconduit;
ModelRenderer inlower1;
ModelRenderer inlower2;
ModelRenderer outlowersmooth2;
ModelRenderer outlowersmooth1;
ModelRenderer inlowersmooth1;
ModelRenderer inlowersmooth2;
ModelRenderer outerpylonmiddle1;
ModelRenderer outerpylonmiddle2;
ModelRenderer outerpylonupper;
public ModelAuraPylonTop() {
textureWidth = 32;
textureHeight = 32;
outerpylon = new ModelRenderer(this, 0, 0);
outerpylon.addBox(0F, 0F, 0F, 2, 8, 2);
outerpylon.setRotationPoint(5F, 16F, 5F);
outerpylon.setTextureSize(64, 32);
outerpylon.mirror = true;
setRotation(outerpylon, 0F, 0F, 0F);
lowerconduit = new ModelRenderer(this, 8, 0);
lowerconduit.addBox(0F, 0F, 0.2F, 6, 1, 1);
lowerconduit.setRotationPoint(6F, 20F, 7F);
lowerconduit.setTextureSize(64, 32);
lowerconduit.mirror = true;
setRotation(lowerconduit, 0F, 2.356194F, 0F);
inlower1 = new ModelRenderer(this, 8, 2);
inlower1.addBox(0F, 0F, 0F, 1, 1, 3);
inlower1.setRotationPoint(3F, 20F, 3F);
inlower1.setTextureSize(64, 32);
inlower1.mirror = true;
setRotation(inlower1, 0F, 3.141593F, 0F);
inlower2 = new ModelRenderer(this, 8, 2);
inlower2.addBox(0F, 0F, 0F, 3, 1, 1);
inlower2.setRotationPoint(3F, 20F, 3F);
inlower2.setTextureSize(64, 32);
inlower2.mirror = true;
setRotation(inlower2, 0F, 3.141593F, 0F);
outlowersmooth2 = new ModelRenderer(this, 8, 6);
outlowersmooth2.addBox(0F, 0F, 0.1F, 2, 1, 1);
outlowersmooth2.setRotationPoint(5F, 20F, 7F);
outlowersmooth2.setTextureSize(64, 32);
outlowersmooth2.mirror = true;
setRotation(outlowersmooth2, 0F, 1.919862F, 0F);
outlowersmooth1 = new ModelRenderer(this, 8, 6);
outlowersmooth1.addBox(-0.5F, 0F, 0.2F, 2, 1, 1);
outlowersmooth1.setRotationPoint(6F, 20F, 6F);
outlowersmooth1.setTextureSize(64, 32);
outlowersmooth1.mirror = true;
setRotation(outlowersmooth1, 0F, 2.792527F, 0F);
inlowersmooth1 = new ModelRenderer(this, 8, 6);
inlowersmooth1.addBox(0.25F, 0F, -0.5F, 1, 1, 2);
inlowersmooth1.setRotationPoint(2F, 20F, 2F);
inlowersmooth1.setTextureSize(64, 32);
inlowersmooth1.mirror = true;
setRotation(inlowersmooth1, 0F, 0.3490659F, 0F);
inlowersmooth2 = new ModelRenderer(this, 8, 6);
inlowersmooth2.addBox(0.15F, 0F, 0.3F, 1, 1, 2);
inlowersmooth2.setRotationPoint(1F, 20F, 3F);
inlowersmooth2.setTextureSize(64, 32);
inlowersmooth2.mirror = true;
setRotation(inlowersmooth2, 0F, 1.22173F, 0F);
outerpylonmiddle1 = new ModelRenderer(this, 0, 0);
outerpylonmiddle1.addBox(0F, 0F, 0F, 2, 4, 1);
outerpylonmiddle1.setRotationPoint(5F, 12F, 5F);
outerpylonmiddle1.setTextureSize(64, 32);
outerpylonmiddle1.mirror = true;
setRotation(outerpylonmiddle1, 0F, 0F, 0F);
outerpylonmiddle2 = new ModelRenderer(this, 0, 0);
outerpylonmiddle2.addBox(0F, 0F, 0F, 1, 4, 1);
outerpylonmiddle2.setRotationPoint(5F, 12F, 6F);
outerpylonmiddle2.setTextureSize(64, 32);
outerpylonmiddle2.mirror = true;
setRotation(outerpylonmiddle2, 0F, 0F, 0F);
outerpylonupper = new ModelRenderer(this, 0, 0);
outerpylonupper.addBox(0F, 0F, 0F, 1, 4, 1);
outerpylonupper.setRotationPoint(5F, 8F, 5F);
outerpylonupper.setTextureSize(64, 32);
outerpylonupper.mirror = true;
setRotation(outerpylonupper, 0F, 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);
outerpylon.render(f5);
lowerconduit.render(f5);
inlower1.render(f5);
inlower2.render(f5);
outlowersmooth2.render(f5);
outlowersmooth1.render(f5);
inlowersmooth1.render(f5);
inlowersmooth2.render(f5);
outerpylonmiddle1.render(f5);
outerpylonmiddle2.render(f5);
outerpylonupper.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z) {
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}
@@ -0,0 +1,72 @@
package makeo.gadomancy.client.renderers.item;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import java.util.HashMap;
import java.util.Map;
/**
* This class is part of the Gadomancy Mod
* Gadomancy is Open Source and distributed under the
* GNU LESSER GENERAL PUBLIC LICENSE
* for more read the LICENSE file
*
* Created by HellFirePvP @ 13.11.2015 00:33
*/
public class ItemRenderTileEntityMulti implements IItemRenderer {
private Map<Integer, RenderSet> renderMap = new HashMap<Integer, RenderSet>();
public ItemRenderTileEntityMulti(RenderSet... renderSets) {
for(RenderSet set : renderSets) {
if(set != null) {
renderMap.put(set.meta, set);
}
}
}
@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) {
GL11.glPushMatrix();
if(type == IItemRenderer.ItemRenderType.ENTITY)
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
if(type == ItemRenderType.INVENTORY)
GL11.glTranslatef(0, -0.1F, 0);
if(renderMap.containsKey(item.getItemDamage())) {
RenderSet set = renderMap.get(item.getItemDamage());
set.renderer.renderTileEntityAt(set.te, 0, 0, 0, 0);
}
GL11.glPopMatrix();
}
public static class RenderSet {
private TileEntitySpecialRenderer renderer;
private TileEntity te;
private int meta;
public RenderSet(TileEntitySpecialRenderer renderer, TileEntity te, int meta) {
this.renderer = renderer;
this.te = te;
this.meta = meta;
}
}
}
@@ -0,0 +1,72 @@
package makeo.gadomancy.client.renderers.tile;
import makeo.gadomancy.client.events.ClientTickHandler;
import makeo.gadomancy.client.models.ModelAuraPylon;
import makeo.gadomancy.client.models.ModelAuraPylonTop;
import makeo.gadomancy.common.blocks.tiles.TileAuraPylon;
import makeo.gadomancy.common.blocks.tiles.TileAuraPylonTop;
import makeo.gadomancy.common.utils.SimpleResourceLocation;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import thaumcraft.client.renderers.entity.RenderPrimalOrb;
/**
* This class is part of the Gadomancy Mod
* Gadomancy is Open Source and distributed under the
* GNU LESSER GENERAL PUBLIC LICENSE
* for more read the LICENSE file
* <p/>
* Created by HellFirePvP @ 12.11.2015 21:33
*/
public class RenderTileAuraPylon extends TileEntitySpecialRenderer {
public static final ModelBase MODEL_AURA_PYLON = new ModelAuraPylon();
public static final ModelBase MODEL_AURA_PYLON_TOP = new ModelAuraPylonTop();
public static final SimpleResourceLocation PYLON_TEXTURE = new SimpleResourceLocation("models/aurapylon.png");
public static RenderPrimalOrb primalOrbRender;
public static TileAuraPylonTop.DummyEntity dummyEntity = new TileAuraPylonTop.DummyEntity();
public void renderTileEntity(TileEntity tile, double x, double y, double z, float partTicks) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y - 0.5, z + 0.5);
bindTexture(PYLON_TEXTURE);
GL11.glPushMatrix();
for(int i = 0; i < 4; i++) {
if(tile instanceof TileAuraPylonTop) {
GL11.glPushMatrix();
GL11.glRotatef(180, 1, 0, 0);
GL11.glTranslatef(0, -2F, 0);
MODEL_AURA_PYLON_TOP.render(null, 0, 0, 0, 0, 0, 0.0625f);
GL11.glPopMatrix();
} else {
MODEL_AURA_PYLON.render(null, 0, 0, 0, 0, 0, 0.0625f);
}
GL11.glRotatef(90, 0, 1, 0);
}
GL11.glPopMatrix();
GL11.glPopMatrix();
if(tile instanceof TileAuraPylonTop && ((TileAuraPylonTop) tile).shouldRenderEffect()) {
dummyEntity.ticksExisted = ClientTickHandler.ticks;
primalOrbRender.renderEntityAt(dummyEntity, x + 0.5, y + 0.7, z + 0.5, 0, partTicks);
}
}
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partTicks) {
renderTileEntity(tileEntity, x, y, z, partTicks);
}
static {
primalOrbRender = new RenderPrimalOrb();
primalOrbRender.setRenderManager(RenderManager.instance);
}
}
@@ -0,0 +1,96 @@
package makeo.gadomancy.common.blocks;
import makeo.gadomancy.common.Gadomancy;
import makeo.gadomancy.common.blocks.tiles.TileAuraPylon;
import makeo.gadomancy.common.blocks.tiles.TileAuraPylonTop;
import makeo.gadomancy.common.registration.RegisteredBlocks;
import makeo.gadomancy.common.registration.RegisteredItems;
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.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import java.util.List;
/**
* This class is part of the Gadomancy Mod
* Gadomancy is Open Source and distributed under the
* GNU LESSER GENERAL PUBLIC LICENSE
* for more read the LICENSE file
*
* Created by HellFirePvP @ 12.11.2015 22:26
*/
public class BlockAuraPylon extends BlockContainer implements IBlockTransparent {
private IIcon icon;
public BlockAuraPylon() {
super(Material.iron);
setHardness(10F);
setResistance(50F);
setStepSound(Block.soundTypeStone);
setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 1, 0.9375F);
setCreativeTab(RegisteredItems.creativeTab);
}
@Override
protected String getTextureName() {
return "minecraft:quartz_block_top";
}
@Override
public void registerBlockIcons(IIconRegister ir) {
icon = ir.registerIcon(Gadomancy.MODID + ":transparent");
super.registerBlockIcons(ir);
}
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
list.add(new ItemStack(item, 1, 0));
list.add(new ItemStack(item, 1, 1));
}
@Override
public boolean canReplace(World world, int x, int y, int z, int side, ItemStack stack) {
int damage = stack.getItemDamage();
if (damage == 1 && (y < 1 || world.getBlock(x, y - 1, z) != RegisteredBlocks.blockAuraPylon) && (y < 1 || world.getBlockMetadata(x, y - 1, z) != 0)) {
return false;
}
return super.canReplace(world, x, y, z, side, stack);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta == 0) {
return new TileAuraPylon();
} else {
return new TileAuraPylonTop();
}
}
@Override
public int getRenderType() {
return RegisteredBlocks.rendererTransparentBlock;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public IIcon getTransparentIcon() {
return icon;
}
}
@@ -5,6 +5,7 @@ import makeo.gadomancy.common.Gadomancy;
import makeo.gadomancy.common.blocks.tiles.TileInfusionClaw;
import makeo.gadomancy.common.registration.RegisteredBlocks;
import makeo.gadomancy.common.registration.RegisteredItems;
import makeo.gadomancy.common.utils.ItemUtils;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
@@ -94,10 +95,7 @@ public class BlockInfusionClaw extends BlockTransparent {
float f2 = RANDOM.nextFloat() * 0.8F + 0.1F;
EntityItem entityItem = new EntityItem(world, x + f, y + f1, z + f2, wandStack.copy());
float f3 = 0.05F;
entityItem.motionX = RANDOM.nextGaussian() * f3;
entityItem.motionY = RANDOM.nextGaussian() * f3 + 0.2F;
entityItem.motionZ = RANDOM.nextGaussian() * f3;
ItemUtils.applyRandomDropOffset(entityItem, world.rand);
world.spawnEntityInWorld(entityItem);
}
@@ -1,8 +1,12 @@
package makeo.gadomancy.common.blocks.tiles;
import makeo.gadomancy.common.blocks.BlockAuraPylon;
import makeo.gadomancy.common.utils.ItemUtils;
import net.minecraft.block.Block;
import net.minecraft.command.IEntitySelector;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
@@ -13,10 +17,12 @@ import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.aspects.IAspectContainer;
import thaumcraft.api.aspects.IEssentiaTransport;
import thaumcraft.common.Thaumcraft;
import thaumcraft.common.entities.EntityPermanentItem;
import thaumcraft.common.entities.EntitySpecialItem;
import thaumcraft.common.items.ItemCrystalEssence;
import java.util.ArrayList;
import java.util.List;
/**
@@ -42,6 +48,8 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
//Input tile handles Essentia IO all 8 ticks and thus provides needed amount information.
private EntityPermanentItem tcPermItem;
private boolean isPartOfMultiblock = false;
private int ticksExisted = 0;
private Aspect holdingAspect;
private int amount = 0;
@@ -54,21 +62,35 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
public void updateEntity() {
ticksExisted++;
if ((ticksExisted & 7) == 0) {
if (checkComponents()) return;
}
if(!worldObj.isRemote) {
if ((ticksExisted & 7) == 0) {
if (checkComponents()) return;
}
if (isInputTile()) {
handleIO();
}
if (isMasterTile()) {
handleCrystal();
if (holdingAspect != null) {
handleEffectDistribution();
if (isInputTile()) {
handleIO();
}
if (isMasterTile()) {
handleCrystal();
if (holdingAspect != null) {
handleEffectDistribution();
}
}
} else {
if(isInputTile() && holdingAspect != null) {
doEssentiaTrail();
}
}
}
//Client-Side input tile only!
private void doEssentiaTrail() {
if((ticksExisted & 1) == 0) return;
TileAuraPylon masterTile = getMasterTile();
if(masterTile == null) return;
Thaumcraft.proxy.essentiaTrailFx(worldObj, xCoord, yCoord, zCoord, masterTile.xCoord, masterTile.yCoord, masterTile.zCoord, 10, holdingAspect.getColor(), 1);
}
//Special to masterTile only!
private void handleEffectDistribution() {
int count = 1;
@@ -217,12 +239,47 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
breakTile();
return true;
}
if(!hasTopTile()) {
breakTile();
return true;
}
return false;
}
private boolean hasTopTile() {
TileAuraPylon master = getMasterTile();
if(master == null) return false;
TileEntity te = worldObj.getTileEntity(master.xCoord, master.yCoord + 1, master.zCoord);
return !(te == null || !(te instanceof TileAuraPylonTop));
}
//Individual.
private void breakTile() {
//TODO break... ?
if(!isPartOfMultiblock || worldObj.isRemote) return;
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
Block pylon = worldObj.getBlock(xCoord, yCoord, zCoord);
if(pylon != null) {
ArrayList<ItemStack> stacks = pylon.getDrops(worldObj, xCoord, yCoord, zCoord, meta, 0);
for(ItemStack i : stacks) {
EntityItem item = new EntityItem(worldObj, xCoord, yCoord, zCoord, i);
ItemUtils.applyRandomDropOffset(item, worldObj.rand);
worldObj.spawnEntityInWorld(item);
}
}
worldObj.removeTileEntity(xCoord, yCoord, zCoord);
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
//Individual
public boolean isPartOfMultiblock() {
return isPartOfMultiblock;
}
//Individual.
public void setPartOfMultiblock(boolean isPartOfMultiblock) {
this.isPartOfMultiblock = isPartOfMultiblock;
}
//Individual.
@@ -303,6 +360,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
}
this.amount = compound.getInteger("amount");
this.maxAmount = compound.getInteger("maxAmount");
this.isPartOfMultiblock = compound.getBoolean("partOfMultiblock");
}
@Override
@@ -314,6 +372,7 @@ public class TileAuraPylon extends SynchronizedTileEntity implements IAspectCont
}
compound.setInteger("amount", amount);
compound.setInteger("maxAmount", maxAmount);
compound.setBoolean("partOfMultiblock", isPartOfMultiblock);
}
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,80 @@
package makeo.gadomancy.common.blocks.tiles;
import makeo.gadomancy.common.utils.ItemUtils;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import java.util.ArrayList;
/**
* This class is part of the Gadomancy Mod
* Gadomancy is Open Source and distributed under the
* GNU LESSER GENERAL PUBLIC LICENSE
* for more read the LICENSE file
*
* Created by HellFirePvP @ 13.11.2015 00:01
*/
public class TileAuraPylonTop extends SynchronizedTileEntity {
private boolean shouldRender = false;
@Override
public void updateEntity() {
TileEntity te = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
if(!worldObj.isRemote) {
if(te == null || !(te instanceof TileAuraPylon)) {
breakTile();
return;
}
TileAuraPylon pylon = (TileAuraPylon) te;
if(pylon.isPartOfMultiblock() && !pylon.isMasterTile()) breakTile();
} else {
shouldRender = !(te == null || !(te instanceof TileAuraPylon));
}
}
private void breakTile() {
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
Block pylon = worldObj.getBlock(xCoord, yCoord, zCoord);
if(pylon != null) {
ArrayList<ItemStack> stacks = pylon.getDrops(worldObj, xCoord, yCoord, zCoord, meta, 0);
for(ItemStack i : stacks) {
EntityItem item = new EntityItem(worldObj, xCoord, yCoord, zCoord, i);
ItemUtils.applyRandomDropOffset(item, worldObj.rand);
worldObj.spawnEntityInWorld(item);
}
}
worldObj.removeTileEntity(xCoord, yCoord, zCoord);
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
public boolean shouldRenderEffect() {
return shouldRender;
}
@Override
public boolean canUpdate() {
return true;
}
public static class DummyEntity extends Entity {
public DummyEntity() {
super(null);
}
@Override
protected void entityInit() {}
@Override
protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {}
@Override
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {}
}
}
@@ -0,0 +1,30 @@
package makeo.gadomancy.common.items;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
/**
* This class is part of the Gadomancy Mod
* Gadomancy is Open Source and distributed under the
* GNU LESSER GENERAL PUBLIC LICENSE
* for more read the LICENSE file
* <p/>
* Created by HellFirePvP @ 13.11.2015 00:43
*/
public class ItemBlockAuraPylon extends ItemBlock {
public ItemBlockAuraPylon(Block block) {
super(block);
}
@Override
public String getUnlocalizedName(ItemStack stack) {
return getUnlocalizedName() + "." + stack.getItemDamage();
}
@Override
public int getMetadata(int metadata) {
return metadata;
}
}
@@ -4,6 +4,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
import makeo.gadomancy.api.ClickBehavior;
import makeo.gadomancy.common.blocks.BlockAdditionalEldritchPortal;
import makeo.gadomancy.common.blocks.BlockArcaneDropper;
import makeo.gadomancy.common.blocks.BlockAuraPylon;
import makeo.gadomancy.common.blocks.BlockExtendedNodeJar;
import makeo.gadomancy.common.blocks.BlockInfusionClaw;
import makeo.gadomancy.common.blocks.BlockNode;
@@ -13,6 +14,8 @@ import makeo.gadomancy.common.blocks.BlockStickyJar;
import makeo.gadomancy.common.blocks.BlockStoneMachine;
import makeo.gadomancy.common.blocks.tiles.TileAdditionalEldritchPortal;
import makeo.gadomancy.common.blocks.tiles.TileArcaneDropper;
import makeo.gadomancy.common.blocks.tiles.TileAuraPylon;
import makeo.gadomancy.common.blocks.tiles.TileAuraPylonTop;
import makeo.gadomancy.common.blocks.tiles.TileBlockProtector;
import makeo.gadomancy.common.blocks.tiles.TileExtendedNode;
import makeo.gadomancy.common.blocks.tiles.TileExtendedNodeJar;
@@ -23,6 +26,7 @@ import makeo.gadomancy.common.blocks.tiles.TileNodeManipulator;
import makeo.gadomancy.common.blocks.tiles.TileRemoteJar;
import makeo.gadomancy.common.blocks.tiles.TileStickyJar;
import makeo.gadomancy.common.items.ItemBlockAdditionalEldritchPortal;
import makeo.gadomancy.common.items.ItemBlockAuraPylon;
import makeo.gadomancy.common.items.ItemBlockRemoteJar;
import makeo.gadomancy.common.items.ItemBlockStoneMachine;
import makeo.gadomancy.common.items.ItemNodeManipulator;
@@ -61,6 +65,7 @@ public class RegisteredBlocks {
public static BlockNodeManipulator blockNodeManipulator;
public static BlockStoneMachine blockStoneMachine;
public static BlockAdditionalEldritchPortal blockAdditionalEldrichPortal;
public static BlockAuraPylon blockAuraPylon;
public static void init() {
registerBlocks();
@@ -82,6 +87,7 @@ public class RegisteredBlocks {
blockNodeManipulator = registerBlock(new BlockNodeManipulator(), ItemNodeManipulator.class);
blockStoneMachine = registerBlock(new BlockStoneMachine(), ItemBlockStoneMachine.class);
blockAdditionalEldrichPortal = registerBlock(new BlockAdditionalEldritchPortal(), ItemBlockAdditionalEldritchPortal.class);
blockAuraPylon = registerBlock(new BlockAuraPylon(), ItemBlockAuraPylon.class);
}
private static <T extends Block> T registerBlock(String name, T block) {
@@ -119,7 +125,8 @@ public class RegisteredBlocks {
registerTile(TileManipulationFocus.class);
registerTile(TileAdditionalEldritchPortal.class);
registerTile(TileBlockProtector.class);
//registerTile(TileAuraPylon.class);
registerTile(TileAuraPylon.class);
registerTile(TileAuraPylonTop.class);
}
private static void registerTile(Class<? extends TileEntity> tile, String name) {
@@ -35,4 +35,10 @@ public class RegisteredMultiblocks {
.addBlock(-3, 0, 0, RegisteredBlocks.blockStoneMachine, 1).addBlock(0, 0, -3, RegisteredBlocks.blockStoneMachine, 1)
.addBlock(1, 0, 1, RegisteredBlocks.blockStoneMachine, 15).addBlock(-1, 0, 1, RegisteredBlocks.blockStoneMachine, 15).addBlock(-1, 0, -1, RegisteredBlocks.blockStoneMachine, 15).addBlock(1, 0, -1, RegisteredBlocks.blockStoneMachine, 15)
.addBlock(1, 1, 1, RegisteredBlocks.blockStoneMachine, 11).addBlock(-1, 1, 1, RegisteredBlocks.blockStoneMachine, 11).addBlock(-1, 1, -1, RegisteredBlocks.blockStoneMachine, 11).addBlock(1, 1, -1, RegisteredBlocks.blockStoneMachine, 11);
public static final MultiblockHelper.MultiblockPattern auraPylonPattern = new MultiblockHelper.MultiblockPattern(RegisteredBlocks.blockAuraPylon, 1)
.addBlock(0, -1, 0, RegisteredBlocks.blockAuraPylon, 0)
.addBlock(0, -2, 0, RegisteredBlocks.blockAuraPylon, 0)
.addBlock(0, -3, 0, RegisteredBlocks.blockAuraPylon, 0)
.addBlock(0, -4, 0, RegisteredBlocks.blockAuraPylon, 0);
}
@@ -0,0 +1,24 @@
package makeo.gadomancy.common.utils;
import net.minecraft.entity.item.EntityItem;
import java.util.Random;
/**
* This class is part of the Gadomancy Mod
* Gadomancy is Open Source and distributed under the
* GNU LESSER GENERAL PUBLIC LICENSE
* for more read the LICENSE file
* <p/>
* Created by HellFirePvP @ 12.11.2015 23:13
*/
public class ItemUtils {
public static void applyRandomDropOffset(EntityItem item, Random rand) {
double xs = rand.nextFloat() * 0.7F - 0.35D;
double ys = rand.nextFloat() * 0.7F - 0.35D;
double zs = rand.nextFloat() * 0.7F - 0.35D;
item.setVelocity(xs, ys, zs);
}
}