added generator overrides to API

This commit is contained in:
brandon3055 committed 2015-07-11 02:49:22 +10:00
1 parent 05a36d8a89
commit 09d5547c71
49 files changed
+1368 -79

No files matched your search

@@ -0,0 +1,21 @@
package com.brandon3055.draconicevolution.api;
import com.brandon3055.draconicevolution.common.world.WorldGenEnderComet;
import com.brandon3055.draconicevolution.common.world.WorldGenEnderIsland;
import net.minecraft.world.World;
import java.util.Random;
/**
* Created by Brandon on 11/7/2015.
*/
public class GeneratorOverride {
public void spawnCometAt(World world, int x, int y, int z, Random rand) {
new WorldGenEnderComet().generate(world, rand, x, y, z);
}
public void spawnChaosIslendAt(World world, int x, int y, int z, Random rand) {
new WorldGenEnderIsland().generate(world, rand, x, y, z);
}
}
@@ -28,7 +28,8 @@ import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnerg
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyPylon;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileEnergyStorageCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer;
import com.brandon3055.draconicevolution.common.utills.UpdateChecker;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
@@ -156,6 +157,7 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEnergyTransceiver.class, new RenderTileCrystal());
ClientRegistry.bindTileEntitySpecialRenderer(TileWirelessEnergyTransceiver.class, new RenderTileCrystal());
ClientRegistry.bindTileEntitySpecialRenderer(TileReactorCore.class, new RenderTileReactorCore());
ClientRegistry.bindTileEntitySpecialRenderer(TileReactorStabilizer.class, new RenderTileReactorStabilizer());
//Entitys
RenderingRegistry.registerEntityRenderingHandler(EntityCustomDragon.class, new RenderDragon());
@@ -0,0 +1,121 @@
package com.brandon3055.draconicevolution.client.gui;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Brandon on 30/6/2015.
*/
public class GUIFlowGate extends GuiScreen {
public TileGate tile;
public GUIFlowGate(TileGate gate){
this.tile = gate;
}
@Override
public void initGui() {
int guiLeft = (width / 2) - (197 / 2);
int guiTop = (height / 2) - (88 / 2);
buttonList.clear();
buttonList.add(new GuiTextureButton(0, guiLeft + 20, guiTop + 20, 0, 108, 18, 18, ""));
buttonList.add(new GuiTextureButton(1, guiLeft + 159, guiTop + 20, 0, 54, 18, 18, ""));
buttonList.add(new GuiTextureButton(2, guiLeft + 20, guiTop + 50, 0, 108, 18, 18, ""));
buttonList.add(new GuiTextureButton(3, guiLeft + 159, guiTop + 50, 0, 54, 18, 18, ""));
}
@Override
public void drawScreen(int x, int y, float pt) {
int guiLeft = (width / 2) - (197 / 2);
int guiCrt = (width / 2);
int guiTop = (height / 2) - (88 / 2);
drawDefaultBackground();
ResourceHandler.bindResource("textures/gui/ToolConfig.png");
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 197, 88);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.flowGate.name"), guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.flowGate.name")) / 2), guiTop+5, 0x2c2c2c);
String flowRSLow = tile.getFlowSetting(0);
String flowRSHeigh = tile.getFlowSetting(1);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.flowGateRSHigh.name"), guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.flowGateRSHigh.name")) / 2), guiTop+20, 0xff0000);
fontRendererObj.drawString(flowRSHeigh, guiCrt - (fontRendererObj.getStringWidth(flowRSHeigh) / 2), guiTop+31, 0x2c2c2c);
fontRendererObj.drawString(StatCollector.translateToLocal("gui.de.flowGateRSLow.name"), guiCrt - (fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.flowGateRSLow.name")) / 2), guiTop+50, 0x660000);
fontRendererObj.drawString(flowRSLow, guiCrt - (fontRendererObj.getStringWidth(flowRSLow) / 2), guiTop+61, 0x2c2c2c);
String flow = StatCollector.translateToLocal("gui.de.flowGateCurrentFlow.name") + ": " + Utills.addCommas(tile.getActualFlow());
fontRendererObj.drawString(flow, guiCrt - (fontRendererObj.getStringWidth(flow) / 2), guiTop+76, 0x2c2c2c);
fontRendererObj.drawSplitString(StatCollector.translateToLocal("gui.de.flowGatePartialSignal.name"), guiLeft + 5, guiTop + 90, 197, 0xFFFFFF);
fontRendererObj.drawSplitString(StatCollector.translateToLocal("gui.de.ctrlAndShift.name"), guiLeft + 200, guiTop + 5, 100, 0xFFFFFF);
ResourceHandler.bindResource("textures/gui/Widgets.png");
super.drawScreen(x, y, pt);
List<String> hoverText = new ArrayList<String>();
boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
boolean ctrl = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
if (GuiHelper.isInRect(guiLeft + 20, guiTop + 20, 18, 18, x, y)){ hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name") + " " + tile.getToolTip(1, shift, ctrl)); }
if (GuiHelper.isInRect(guiLeft + 159, guiTop + 20, 18, 18, x, y)){ hoverText.add(StatCollector.translateToLocal("gui.de.increment.name") + " " + tile.getToolTip(1, shift, ctrl)); }
if (GuiHelper.isInRect(guiLeft + 20, guiTop + 50, 18, 18, x, y)){ hoverText.add(StatCollector.translateToLocal("gui.de.decrement.name") + " " + tile.getToolTip(0, shift, ctrl)); }
if (GuiHelper.isInRect(guiLeft + 159, guiTop + 50, 18, 18, x, y)){ hoverText.add(StatCollector.translateToLocal("gui.de.increment.name") + " " + tile.getToolTip(0, shift, ctrl)); }
if (!hoverText.isEmpty()) {
hoverText.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("gui.de.pressOrScroll.name"));
drawHoveringText(hoverText, x - (x < width / 2 ? fontRendererObj.getStringWidth(StatCollector.translateToLocal("gui.de.decrement.name") + " " + tile.getToolTip(1, shift, ctrl)) + 25: 0), y, fontRendererObj);
}
}
@Override
protected void mouseClicked(int x, int y, int button) {
int guiLeft = (width / 2) - (197 / 2);
int guiTop = (height / 2) - (88 / 2);
boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
boolean ctrl = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
if (GuiHelper.isInRect(guiLeft + 20, guiTop + 20, 18, 18, x, y)){ tile.incrementFlow(1, ctrl, shift, false, button); }
if (GuiHelper.isInRect(guiLeft + 159, guiTop + 20, 18, 18, x, y)){ tile.incrementFlow(1, ctrl, shift, true, button); }
if (GuiHelper.isInRect(guiLeft + 20, guiTop + 50, 18, 18, x, y)){ tile.incrementFlow(0, ctrl, shift, false, button); }
if (GuiHelper.isInRect(guiLeft + 159, guiTop + 50, 18, 18, x, y)){ tile.incrementFlow(0, ctrl, shift, true, button); }
super.mouseClicked(x, y, button);
}
@Override
public void handleMouseInput() {
int guiLeft = (width / 2) - (197 / 2);
int guiTop = (height / 2) - (88 / 2);
int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
boolean ctrl = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
int i = org.lwjgl.input.Mouse.getEventDWheel();
if (GuiHelper.isInRect(guiLeft + 20, guiTop + 20, 18, 18, x, y)){ }
if (GuiHelper.isInRect(guiLeft + 159, guiTop + 20, 18, 18, x, y)){ }
if (GuiHelper.isInRect(guiLeft + 20, guiTop + 50, 18, 18, x, y)){ }
if (GuiHelper.isInRect(guiLeft + 159, guiTop + 50, 18, 18, x, y)){ }
super.handleMouseInput();
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
}
@@ -6,6 +6,7 @@ import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig;
import com.brandon3055.draconicevolution.common.container.*;
import com.brandon3055.draconicevolution.common.inventory.InventoryTool;
import com.brandon3055.draconicevolution.common.tileentities.*;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import net.minecraft.entity.player.EntityPlayer;
@@ -26,6 +27,7 @@ public class GuiHandler implements IGuiHandler {
public static final int GUIID_DISSENCHANTER = 10;
public static final int GUIID_DRACONIC_CHEST = 11;
public static final int GUIID_TOOL_CONFIG = 12;
public static final int GUIID_FLOW_GATE = 13;
public static final int GUIID_CONTAINER_TEMPLATE = 100;
public GuiHandler() {
@@ -159,7 +161,8 @@ public class GuiHandler implements IGuiHandler {
break;
case GUIID_TOOL_CONFIG:
return new GUIToolConfig(player, new ContainerAdvTool(player.inventory, new InventoryTool(player, null)));
case GUIID_FLOW_GATE:
return world.getTileEntity(x, y, z) instanceof TileGate ? new GUIFlowGate((TileGate)world.getTileEntity(x, y, z)) : null;
// case GUIID_CONTAINER_TEMPLATE:
// TileEntity containerTemp = world.getTileEntity(x, y, z);
@@ -0,0 +1,58 @@
package com.brandon3055.draconicevolution.client.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import org.lwjgl.opengl.GL11;
/**
* Created by Brandon on 30/6/2015.
*/
public class GuiTextureButton extends GuiButton {
public int textureXPos;
public int textureYPos;
public GuiTextureButton(int id, int xPos, int yPos, int textureXPos, int textureYPos, int xSise, int ySise, String text) {
super(id, xPos, yPos, xSise, ySise, text);
this.textureXPos = textureXPos;
this.textureYPos = textureYPos;
}
@Override
public void drawButton(Minecraft mc, int x, int y)
{
if (this.visible)
{
FontRenderer fontrenderer = mc.fontRenderer;
// mc.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height;
int k = this.getHoverState(this.field_146123_n);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.xPosition, this.yPosition, textureXPos, textureYPos + k * height, this.width, this.height);
this.mouseDragged(mc, x, y);
int l = 14737632;
if (packedFGColour != 0)
{
l = packedFGColour;
}
else if (!this.enabled)
{
l = 10526880;
}
else if (this.field_146123_n)
{
l = 16777120;
}
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l);
}
}
}
@@ -0,0 +1,293 @@
package com.brandon3055.draconicevolution.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.entity.Entity;
import org.lwjgl.opengl.GL11;
/**
* ReactorStabilizerCore - brandon3055
* Created using Tabula 5.0.0
*/
public class ModelReactorStabilizerCore extends ModelBase {
public ModelRenderer hub1;
public ModelRenderer hub2;
public ModelRenderer rotor1R;
public ModelRenderer rotor2R;
public ModelRenderer rotor1R_1;
public ModelRenderer rotor1R_2;
public ModelRenderer rotor1R_3;
public ModelRenderer rotor1R_4;
public ModelRenderer rotor1L;
public ModelRenderer rotor1L_1;
public ModelRenderer rotor1L_2;
public ModelRenderer rotor1L_3;
public ModelRenderer rotor1L_4;
public ModelRenderer rotor2R_1;
public ModelRenderer rotor2R_2;
public ModelRenderer rotor2R_3;
public ModelRenderer rotor2R_4;
public ModelRenderer rotor2R_5;
public ModelRenderer rotor2R_6;
public ModelRenderer rotor2L;
public ModelRenderer rotor2L_1;
public ModelRenderer rotor2L_2;
public ModelRenderer rotor2L_3;
public ModelRenderer rotor2L_4;
public ModelRenderer rotor2L_5;
public ModelRenderer rotor2L_6;
public ModelRenderer basePlate;
public ModelRenderer frame1;
public ModelRenderer frame2;
public ModelRenderer frame3;
public ModelRenderer frame4;
public ModelRenderer frame5;
public ModelRenderer frame6;
public ModelRenderer frame7;
public ModelRenderer frame8;
public ModelRenderer frame9;
public ModelRenderer frame10;
public ModelRenderer frame11;
public ModelRenderer frame12;
public ModelRenderer backSpoke1;
public ModelRenderer backSpoke2;
public ModelRenderer coreElement2;
public ModelRenderer coreElement1;
public ModelReactorStabilizerCore() {
this.textureWidth = 64;
this.textureHeight = 32;
this.coreElement2 = new ModelRenderer(this, 32, 20);
this.coreElement2.setRotationPoint(0.0F, 0.0F, 0.0F);
this.coreElement2.addBox(-0.5F, -0.5F, -2.0F, 1, 1, 4, 0.0F);
this.rotor2L_1 = new ModelRenderer(this, 0, 4);
this.rotor2L_1.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor2L_1.addBox(4.5F, -0.5F, -7.0F, 1, 1, 13, 0.0F);
this.setRotateAngle(rotor2L_1, 0.0F, 0.0F, -3.3213615665452094F);
this.rotor2L_5 = new ModelRenderer(this, 0, 4);
this.rotor2L_5.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor2L_5.addBox(4.5F, -0.5F, -7.0F, 1, 1, 13, 0.0F);
this.setRotateAngle(rotor2L_5, 0.0F, 0.0F, 2.602285914723545F);
this.rotor1L_3 = new ModelRenderer(this, 28, 2);
this.rotor1L_3.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor1L_3.addBox(3.0F, -0.5F, -6.0F, 1, 1, 11, 0.0F);
this.setRotateAngle(rotor1L_3, 0.0F, 0.0F, 3.637266161156183F);
this.rotor2L_6 = new ModelRenderer(this, 0, 4);
this.rotor2L_6.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor2L_6.addBox(4.5F, -0.5F, -7.0F, 1, 1, 13, 0.0F);
this.setRotateAngle(rotor2L_6, 0.0F, 0.0F, 3.6808993924560407F);
this.frame12 = new ModelRenderer(this, 0, 4);
this.frame12.setRotationPoint(0.0F, 0.0F, 0.0F);
this.frame12.addBox(7.0F, -6.0F, 7.0F, 1, 12, 1, 0.0F);
this.frame10 = new ModelRenderer(this, 0, 4);
this.frame10.setRotationPoint(0.0F, 0.0F, 0.0F);
this.frame10.addBox(-8.0F, -6.0F, -8.0F, 1, 12, 1, 0.0F);
this.rotor2L_3 = new ModelRenderer(this, 0, 4);
this.rotor2L_3.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor2L_3.addBox(4.5F, -0.5F, -7.0F, 1, 1, 13, 0.0F);
this.setRotateAngle(rotor2L_3, 0.0F, 0.0F, -3.501130479500625F);
this.rotor2R_6 = new ModelRenderer(this, 0, 4);
this.rotor2R_6.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor2R_6.addBox(4.5F, -0.5F, -7.0F, 1, 1, 13, 0.0F);
this.setRotateAngle(rotor2R_6, 0.0F, 0.0F, 0.5393067388662478F);
this.coreElement1 = new ModelRenderer(this, 32, 14);
this.coreElement1.setRotationPoint(0.0F, 0.0F, 0.0F);
this.coreElement1.addBox(-1.0F, -1.0F, 2.0F, 2, 2, 4, 0.0F);
this.rotor1L_4 = new ModelRenderer(this, 28, 2);
this.rotor1L_4.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor1L_4.addBox(3.0F, -0.5F, -6.0F, 1, 1, 11, 0.0F);
this.setRotateAngle(rotor1L_4, 0.0F, 0.0F, 2.6459191460234033F);
this.basePlate = new ModelRenderer(this, 0, 18);
this.basePlate.setRotationPoint(0.0F, 0.0F, 0.0F);
this.basePlate.addBox(-4.0F, -4.0F, 6.0F, 8, 8, 2, 0.0F);
this.rotor1L_2 = new ModelRenderer(this, 28, 2);
this.rotor1L_2.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor1L_2.addBox(3.0F, -0.5F, -6.0F, 1, 1, 11, 0.0F);
this.setRotateAngle(rotor1L_2, 0.0F, 0.0F, 2.8937558998065986F);
this.frame1 = new ModelRenderer(this, 12, 14);
this.frame1.setRotationPoint(0.0F, 0.0F, 0.0F);
this.frame1.addBox(6.0F, 6.0F, -8.0F, 2, 2, 16, 0.0F);
this.rotor1L_1 = new ModelRenderer(this, 28, 2);
this.rotor1L_1.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor1L_1.addBox(3.0F, -0.5F, -6.0F, 1, 1, 11, 0.0F);
this.setRotateAngle(rotor1L_1, 0.0F, 0.0F, -2.8937558998065986F);
this.frame5 = new ModelRenderer(this, 14, 0);
this.frame5.setRotationPoint(0.0F, 0.0F, 0.0F);
this.frame5.addBox(-6.0F, -8.0F, -8.0F, 12, 1, 1, 0.0F);
this.frame11 = new ModelRenderer(this, 0, 4);
this.frame11.setRotationPoint(0.0F, 0.0F, 0.0F);
this.frame11.addBox(7.0F, -6.0F, -8.0F, 1, 12, 1, 0.0F);
this.rotor1R_3 = new ModelRenderer(this, 28, 2);
this.rotor1R_3.setRotationPoint(0.0F, 0.0F, 1.0F);
this.rotor1R_3.addBox(3.0F, -0.5F, -7.0F, 1, 1, 11, 0.0F);
this.setRotateAngle(rotor1R_3, 0.0F, 0.0F, -0.49567350756638956F);
this.rotor2R_3 = new ModelRenderer(this, 0, 4);
this.rotor2R_3.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor2R_3.addBox(4.5F, -0.5F, -7.0F, 1, 1, 13, 0.0F);
this.setRotateAngle(rotor2R_3, 0.0F, 0.0F, 0.3595378259108319F);
this.frame3 = new ModelRenderer(this, 12, 14);
this.frame3.setRotationPoint(0.0F, 0.0F, 0.0F);
this.frame3.addBox(6.0F, -8.0F, -8.0F, 2, 2, 16, 0.0F);
this.rotor2R_5 = new ModelRenderer(this, 0, 4);
this.rotor2R_5.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor2R_5.addBox(4.5F, -0.5F, -7.0F, 1, 1, 13, 0.0F);
this.setRotateAngle(rotor2R_5, 0.0F, 0.0F, -0.5393067388662478F);
this.rotor2R_2 = new ModelRenderer(this, 0, 4);
this.rotor2R_2.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor2R_2.addBox(4.5F, -0.5F, -7.0F, 1, 1, 13, 0.0F);
this.setRotateAngle(rotor2R_2, 0.0F, 0.0F, 0.17976891295541594F);
this.backSpoke2 = new ModelRenderer(this, 52, 0);
this.backSpoke2.setRotationPoint(0.0F, 0.0F, 0.0F);
this.backSpoke2.addBox(-0.5F, -9.5F, 6.95F, 1, 19, 1, 0.0F);
this.setRotateAngle(backSpoke2, 0.0F, 0.0F, 0.7853981633974483F);
this.frame6 = new ModelRenderer(this, 14, 0);
this.frame6.setRotationPoint(0.0F, 0.0F, 0.0F);
this.frame6.addBox(-6.0F, 7.0F, -8.0F, 12, 1, 1, 0.0F);
this.rotor1R_2 = new ModelRenderer(this, 28, 2);
this.rotor1R_2.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor1R_2.addBox(3.0F, -0.5F, -6.0F, 1, 1, 11, 0.0F);
this.setRotateAngle(rotor1R_2, 0.0F, 0.0F, 0.24783675378319478F);
this.hub1 = new ModelRenderer(this, 0, 0);
this.hub1.setRotationPoint(0.0F, 0.0F, -0.02F);
this.hub1.addBox(-3.0F, -0.5F, 4.0F, 6, 1, 1, 0.0F);
this.rotor2R_1 = new ModelRenderer(this, 0, 4);
this.rotor2R_1.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor2R_1.addBox(4.5F, -0.5F, -7.0F, 1, 1, 13, 0.0F);
this.setRotateAngle(rotor2R_1, 0.0F, 0.0F, -0.17976891295541594F);
this.hub2 = new ModelRenderer(this, 0, 2);
this.hub2.setRotationPoint(0.0F, 0.0F, -0.01F);
this.hub2.addBox(-4.5F, -0.5F, 5.0F, 9, 1, 1, 0.0F);
this.backSpoke1 = new ModelRenderer(this, 52, 0);
this.backSpoke1.setRotationPoint(0.0F, 0.0F, 0.0F);
this.backSpoke1.addBox(-0.5F, -9.5F, 6.95F, 1, 19, 1, 0.0F);
this.setRotateAngle(backSpoke1, 0.0F, 0.0F, -0.7853981633974483F);
this.rotor1R_4 = new ModelRenderer(this, 28, 2);
this.rotor1R_4.setRotationPoint(0.0F, 0.0F, 1.0F);
this.rotor1R_4.addBox(3.0F, -0.5F, -7.0F, 1, 1, 11, 0.0F);
this.setRotateAngle(rotor1R_4, 0.0F, 0.0F, 0.49567350756638956F);
this.rotor1R = new ModelRenderer(this, 28, 2);
this.rotor1R.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor1R.addBox(3.0F, -0.5F, -6.0F, 1, 1, 11, 0.0F);
this.rotor2L_4 = new ModelRenderer(this, 0, 4);
this.rotor2L_4.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor2L_4.addBox(4.5F, -0.5F, -7.0F, 1, 1, 13, 0.0F);
this.setRotateAngle(rotor2L_4, 0.0F, 0.0F, -2.7820548276789614F);
this.frame4 = new ModelRenderer(this, 12, 14);
this.frame4.setRotationPoint(0.0F, 0.0F, 0.0F);
this.frame4.addBox(-8.0F, -8.0F, -8.0F, 2, 2, 16, 0.0F);
this.rotor2R = new ModelRenderer(this, 0, 4);
this.rotor2R.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor2R.addBox(4.5F, -0.5F, -7.0F, 1, 1, 13, 0.0F);
this.rotor2R_4 = new ModelRenderer(this, 0, 4);
this.rotor2R_4.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor2R_4.addBox(4.5F, -0.5F, -7.0F, 1, 1, 13, 0.0F);
this.setRotateAngle(rotor2R_4, 0.0F, 0.0F, -0.3595378259108319F);
this.rotor2L_2 = new ModelRenderer(this, 0, 4);
this.rotor2L_2.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor2L_2.addBox(4.5F, -0.5F, -7.0F, 1, 1, 13, 0.0F);
this.setRotateAngle(rotor2L_2, 0.0F, 0.0F, -2.961823740634377F);
this.frame9 = new ModelRenderer(this, 0, 4);
this.frame9.setRotationPoint(0.0F, 0.0F, 0.0F);
this.frame9.addBox(-8.0F, -6.0F, 7.0F, 1, 12, 1, 0.0F);
this.rotor2L = new ModelRenderer(this, 0, 4);
this.rotor2L.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor2L.addBox(4.5F, -0.5F, -7.0F, 1, 1, 13, 0.0F);
this.setRotateAngle(rotor2L, 0.0F, 0.0F, -3.141592653589793F);
this.rotor1L = new ModelRenderer(this, 28, 2);
this.rotor1L.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor1L.addBox(3.0F, -0.5F, -6.0F, 1, 1, 11, 0.0F);
this.setRotateAngle(rotor1L, 0.0F, 0.0F, -3.141592653589793F);
this.frame8 = new ModelRenderer(this, 14, 0);
this.frame8.setRotationPoint(0.0F, 0.0F, 0.0F);
this.frame8.addBox(-6.0F, 7.0F, 7.0F, 12, 1, 1, 0.0F);
this.frame2 = new ModelRenderer(this, 12, 14);
this.frame2.setRotationPoint(0.0F, 0.0F, 0.0F);
this.frame2.addBox(-8.0F, 6.0F, -8.0F, 2, 2, 16, 0.0F);
this.frame7 = new ModelRenderer(this, 14, 0);
this.frame7.setRotationPoint(0.0F, 0.0F, 0.0F);
this.frame7.addBox(-6.0F, -8.0F, 7.0F, 12, 1, 1, 0.0F);
this.rotor1R_1 = new ModelRenderer(this, 28, 2);
this.rotor1R_1.setRotationPoint(0.0F, 0.0F, 0.0F);
this.rotor1R_1.addBox(3.0F, -0.5F, -6.0F, 1, 1, 11, 0.0F);
this.setRotateAngle(rotor1R_1, 0.0F, 0.0F, -0.24783675378319478F);
this.basePlate.addChild(this.coreElement2);
this.rotor2R.addChild(this.rotor2L_1);
this.rotor2R.addChild(this.rotor2L_5);
this.rotor1R.addChild(this.rotor1L_3);
this.rotor2R.addChild(this.rotor2L_6);
this.basePlate.addChild(this.frame12);
this.basePlate.addChild(this.frame10);
this.rotor2R.addChild(this.rotor2L_3);
this.rotor2R.addChild(this.rotor2R_6);
this.basePlate.addChild(this.coreElement1);
this.rotor1R.addChild(this.rotor1L_4);
this.rotor1R.addChild(this.rotor1L_2);
this.basePlate.addChild(this.frame1);
this.rotor1R.addChild(this.rotor1L_1);
this.basePlate.addChild(this.frame5);
this.basePlate.addChild(this.frame11);
this.rotor1R.addChild(this.rotor1R_3);
this.rotor2R.addChild(this.rotor2R_3);
this.basePlate.addChild(this.frame3);
this.rotor2R.addChild(this.rotor2R_5);
this.rotor2R.addChild(this.rotor2R_2);
this.basePlate.addChild(this.backSpoke2);
this.basePlate.addChild(this.frame6);
this.rotor1R.addChild(this.rotor1R_2);
this.rotor2R.addChild(this.rotor2R_1);
this.basePlate.addChild(this.backSpoke1);
this.rotor1R.addChild(this.rotor1R_4);
this.rotor2R.addChild(this.rotor2L_4);
this.basePlate.addChild(this.frame4);
this.rotor2R.addChild(this.rotor2R_4);
this.rotor2R.addChild(this.rotor2L_2);
this.basePlate.addChild(this.frame9);
this.rotor2R.addChild(this.rotor2L);
this.rotor1R.addChild(this.rotor1L);
this.basePlate.addChild(this.frame8);
this.basePlate.addChild(this.frame2);
this.basePlate.addChild(this.frame7);
this.rotor1R.addChild(this.rotor1R_1);
}
@Override
public void render(Entity entity, float rotation, float brightness, float f2, float f3, float f4, float f5) {
GL11.glPushMatrix();
this.basePlate.render(f5);
GL11.glRotatef(rotation, 0F, 0F, 1F);
this.hub1.render(f5);
GL11.glRotatef(rotation * 2F, 0F, 0F, -1F);
this.hub2.render(f5);
float lastBrightnessX = OpenGlHelper.lastBrightnessX;
float lastBrightnessY = OpenGlHelper.lastBrightnessY;
float b = brightness * 200F;
float colour = Math.min(2F, (brightness*2F) + 0.1F);
if (brightness > 0F) GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, Math.min(200F, lastBrightnessX + b), Math.min(200F, lastBrightnessY + b));
GL11.glColor4f(colour, colour, colour, 1F);
this.rotor2R.render(f5);
GL11.glRotatef(rotation * 2F, 0F, 0F, 1F);
this.rotor1R.render(f5);
GL11.glColor4f(1F, 1F, 1F, 1F);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY);
if (brightness > 0F) GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
/**
* This is a helper function from Tabula to set the rotation of model parts
*/
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
@@ -0,0 +1,229 @@
package com.brandon3055.draconicevolution.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.entity.Entity;
import org.lwjgl.opengl.GL11;
/**
* EnergyStabilizer - brandon3055
* Created using Tabula 5.0.0
*/
public class ModelReactorStabilizerRing extends ModelBase {
public ModelRenderer ringElement1;
public ModelRenderer ringElement2;
public ModelRenderer ringElement3;
public ModelRenderer ringElement4;
public ModelRenderer ringElement5;
public ModelRenderer ringElement6;
public ModelRenderer ringElement7;
public ModelRenderer ringElement8;
public ModelRenderer ringElement9;
public ModelRenderer ringElement10;
public ModelRenderer ringElement11;
public ModelRenderer ringElement12;
public ModelRenderer hing1;
public ModelRenderer hing2;
public ModelRenderer hing3;
public ModelRenderer hing4;
public ModelRenderer emitter1;
public ModelRenderer emitter2;
public ModelRenderer emitter3;
public ModelRenderer emitter4;
public ModelReactorStabilizerRing() {
this.textureWidth = 32;
this.textureHeight = 16;
this.ringElement9 = new ModelRenderer(this, 0, 0);
this.ringElement9.setRotationPoint(6.7F, 0.01F, -1.55F);
this.ringElement9.addBox(0.0F, 0.0F, 0.0F, 4, 1, 1, 0.0F);
this.setRotateAngle(ringElement9, 0.0F, 2.0943951023931953F, 0.0F);
this.ringElement10 = new ModelRenderer(this, 0, 0);
this.ringElement10.setRotationPoint(1.55F, 0.02F, -6.7F);
this.ringElement10.addBox(-4.0F, 0.0F, 0.0F, 4, 1, 1, 0.0F);
this.setRotateAngle(ringElement10, 0.0F, 2.6179938779914944F, 0.0F);
this.ringElement1 = new ModelRenderer(this, 0, 0);
this.ringElement1.setRotationPoint(-2.0F, 0.01F, 6.6F);
this.ringElement1.addBox(0.0F, 0.0F, 0.0F, 4, 1, 1, 0.0F);
this.ringElement7 = new ModelRenderer(this, 0, 0);
this.ringElement7.setRotationPoint(-1.55F, 0.02F, -6.7F);
this.ringElement7.addBox(0.0F, 0.0F, 0.0F, 4, 1, 1, 0.0F);
this.setRotateAngle(ringElement7, 0.0F, -2.6179938779914944F, 0.0F);
this.hing4 = new ModelRenderer(this, 15, 0);
this.hing4.setRotationPoint(1.75F, -0.5F, 6.95F);
this.hing4.addBox(0.0F, 0.0F, 0.0F, 1, 1, 7, 0.0F);
this.setRotateAngle(hing4, 0.0F, -1.5716689914208934F, 0.0F);
this.ringElement8 = new ModelRenderer(this, 0, 0);
this.ringElement8.setRotationPoint(-6.7F, 0.01F, -1.55F);
this.ringElement8.addBox(-4.0F, 0.0F, 0.0F, 4, 1, 1, 0.0F);
this.setRotateAngle(ringElement8, 0.0F, -2.0943951023931953F, 0.0F);
this.emitter4 = new ModelRenderer(this, 0, 2);
this.emitter4.setRotationPoint(2.25F, -0.3F, 7.1F);
this.emitter4.addBox(-0.5F, -0.8F, 0.0F, 3, 1, 9, 0.0F);
this.setRotateAngle(emitter4, 0.0F, -1.5707963267948966F, 0.0F);
this.emitter2 = new ModelRenderer(this, 0, 2);
this.emitter2.setRotationPoint(-7.1F, -0.3F, 2.25F);
this.emitter2.addBox(-0.5F, -0.8F, 0.0F, 3, 1, 9, 0.0F);
this.setRotateAngle(emitter2, 0.0F, 3.141592653589793F, 0.0F);
this.emitter1 = new ModelRenderer(this, 0, 2);
this.emitter1.setRotationPoint(7.1F, -0.3F, -2.25F);
this.emitter1.addBox(-0.5F, -0.8F, 0.0F, 3, 1, 9, 0.0F);
this.hing2 = new ModelRenderer(this, 15, 0);
this.hing2.setRotationPoint(6.95F, -0.5F, -1.75F);
this.hing2.addBox(0.0F, 0.0F, 0.0F, 1, 1, 7, 0.0F);
this.ringElement2 = new ModelRenderer(this, 0, 0);
this.ringElement2.setRotationPoint(2.0F, 0.01F, -6.6F);
this.ringElement2.addBox(0.0F, 0.0F, 0.0F, 4, 1, 1, 0.0F);
this.setRotateAngle(ringElement2, 0.0F, 3.141592653589793F, 0.0F);
this.ringElement5 = new ModelRenderer(this, 0, 0);
this.ringElement5.setRotationPoint(-6.7F, 0.01F, 1.55F);
this.ringElement5.addBox(0.0F, 0.0F, 0.0F, 4, 1, 1, 0.0F);
this.setRotateAngle(ringElement5, 0.0F, -1.0471975511965976F, 0.0F);
this.ringElement12 = new ModelRenderer(this, 0, 0);
this.ringElement12.setRotationPoint(1.55F, 0.02F, 6.7F);
this.ringElement12.addBox(0.0F, 0.0F, 0.0F, 4, 1, 1, 0.0F);
this.setRotateAngle(ringElement12, 0.0F, 0.5235987755982988F, 0.0F);
this.hing1 = new ModelRenderer(this, 15, 0);
this.hing1.setRotationPoint(-7.45F, -0.5F, -1.75F);
this.hing1.addBox(0.0F, 0.0F, 0.0F, 1, 1, 7, 0.0F);
this.ringElement6 = new ModelRenderer(this, 0, 0);
this.ringElement6.setRotationPoint(-1.55F, 0.02F, 6.7F);
this.ringElement6.addBox(-4.0F, 0.0F, 0.0F, 4, 1, 1, 0.0F);
this.setRotateAngle(ringElement6, 0.0F, -0.5235987755982988F, 0.0F);
this.ringElement11 = new ModelRenderer(this, 0, 0);
this.ringElement11.setRotationPoint(6.7F, 0.01F, 1.55F);
this.ringElement11.addBox(-4.0F, 0.0F, 0.0F, 4, 1, 1, 0.0F);
this.setRotateAngle(ringElement11, 0.0F, 1.0471975511965976F, 0.0F);
this.emitter3 = new ModelRenderer(this, 0, 2);
this.emitter3.setRotationPoint(-2.25F, -0.3F, -7.1F);
this.emitter3.addBox(-0.5F, -0.8F, 0.0F, 3, 1, 9, 0.0F);
this.setRotateAngle(emitter3, 0.0F, 1.5707963267948966F, 0.0F);
this.ringElement4 = new ModelRenderer(this, 0, 0);
this.ringElement4.setRotationPoint(-6.6F, 0.0F, -2.0F);
this.ringElement4.addBox(0.0F, 0.0F, 0.0F, 4, 1, 1, 0.0F);
this.setRotateAngle(ringElement4, 0.0F, -1.5707963267948966F, 0.0F);
this.hing3 = new ModelRenderer(this, 15, 0);
this.hing3.setRotationPoint(1.75F, -0.5F, -7.45F);
this.hing3.addBox(0.0F, 0.0F, 0.0F, 1, 1, 7, 0.0F);
this.setRotateAngle(hing3, 0.0F, -1.5716689914208934F, 0.0F);
this.ringElement3 = new ModelRenderer(this, 0, 0);
this.ringElement3.setRotationPoint(6.6F, 0.0F, 2.0F);
this.ringElement3.addBox(0.0F, 0.0F, 0.0F, 4, 1, 1, 0.0F);
this.setRotateAngle(ringElement3, 0.0F, 1.5707963267948966F, 0.0F);
}
@Override
public void render(Entity entity, float embitterRotation, float brightness, float f2, float f3, float f4, float scale) {
this.ringElement1.render(scale);
this.ringElement2.render(scale);
this.ringElement3.render(scale);
this.ringElement4.render(scale);
this.ringElement5.render(scale);
this.ringElement6.render(scale);
this.ringElement7.render(scale);
this.ringElement8.render(scale);
this.ringElement9.render(scale);
this.ringElement10.render(scale);
this.ringElement11.render(scale);
this.ringElement12.render(scale);
GL11.glPushMatrix();
GL11.glTranslated(this.hing1.offsetX, this.hing1.offsetY, this.hing1.offsetZ);
GL11.glTranslated(this.hing1.rotationPointX * scale, this.hing1.rotationPointY * scale, this.hing1.rotationPointZ * scale);
GL11.glScaled(0.5D, 0.5D, 0.5D);
GL11.glTranslated(-this.hing1.offsetX, -this.hing1.offsetY, -this.hing1.offsetZ);
GL11.glTranslated(-this.hing1.rotationPointX * scale, -this.hing1.rotationPointY * scale, -this.hing1.rotationPointZ * scale);
this.hing1.render(scale);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(this.hing2.offsetX, this.hing2.offsetY, this.hing2.offsetZ);
GL11.glTranslated(this.hing2.rotationPointX * scale, this.hing2.rotationPointY * scale, this.hing2.rotationPointZ * scale);
GL11.glScaled(0.5D, 0.5D, 0.5D);
GL11.glTranslated(-this.hing2.offsetX, -this.hing2.offsetY, -this.hing2.offsetZ);
GL11.glTranslated(-this.hing2.rotationPointX * scale, -this.hing2.rotationPointY * scale, -this.hing2.rotationPointZ * scale);
this.hing2.render(scale);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(this.hing3.offsetX, this.hing3.offsetY, this.hing3.offsetZ);
GL11.glTranslated(this.hing3.rotationPointX * scale, this.hing3.rotationPointY * scale, this.hing3.rotationPointZ * scale);
GL11.glScaled(0.5D, 0.5D, 0.5D);
GL11.glTranslated(-this.hing3.offsetX, -this.hing3.offsetY, -this.hing3.offsetZ);
GL11.glTranslated(-this.hing3.rotationPointX * scale, -this.hing3.rotationPointY * scale, -this.hing3.rotationPointZ * scale);
this.hing3.render(scale);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(this.hing4.offsetX, this.hing4.offsetY, this.hing4.offsetZ);
GL11.glTranslated(this.hing4.rotationPointX * scale, this.hing4.rotationPointY * scale, this.hing4.rotationPointZ * scale);
GL11.glScaled(0.5D, 0.5D, 0.5D);
GL11.glTranslated(-this.hing4.offsetX, -this.hing4.offsetY, -this.hing4.offsetZ);
GL11.glTranslated(-this.hing4.rotationPointX * scale, -this.hing4.rotationPointY * scale, -this.hing4.rotationPointZ * scale);
this.hing4.render(scale);
GL11.glPopMatrix();
// float lastBrightnessX = OpenGlHelper.lastBrightnessX;
// float lastBrightnessY = OpenGlHelper.lastBrightnessY;
// OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F);
float lastBrightnessX = OpenGlHelper.lastBrightnessX;
float lastBrightnessY = OpenGlHelper.lastBrightnessY;
float b = brightness * 200F;
float colour = Math.min(2F, (brightness*2F) + 0.1F);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, Math.min(200F, lastBrightnessX + b), Math.min(200F, lastBrightnessY + b));
GL11.glColor4f(colour, colour, colour, 1F);
if (brightness > 0F) GL11.glDisable(GL11.GL_LIGHTING);
GL11.glPushMatrix();
GL11.glTranslated(this.emitter1.offsetX, this.emitter1.offsetY, this.emitter1.offsetZ);
GL11.glTranslated(this.emitter1.rotationPointX * scale, this.emitter1.rotationPointY * scale, this.emitter1.rotationPointZ * scale);
GL11.glRotatef(embitterRotation, 0, 0, 1);
GL11.glScaled(0.5D, 0.5D, 0.5D);
GL11.glTranslated(-this.emitter1.offsetX, -this.emitter1.offsetY, -this.emitter1.offsetZ);
GL11.glTranslated(-this.emitter1.rotationPointX * scale, -this.emitter1.rotationPointY * scale, -this.emitter1.rotationPointZ * scale);
this.emitter1.render(scale);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(this.emitter2.offsetX, this.emitter2.offsetY, this.emitter2.offsetZ);
GL11.glTranslated(this.emitter2.rotationPointX * scale, this.emitter2.rotationPointY * scale, this.emitter2.rotationPointZ * scale);
GL11.glRotatef(embitterRotation, 0, 0, -1);
GL11.glScaled(0.5D, 0.5D, 0.5D);
GL11.glTranslated(-this.emitter2.offsetX, -this.emitter2.offsetY, -this.emitter2.offsetZ);
GL11.glTranslated(-this.emitter2.rotationPointX * scale, -this.emitter2.rotationPointY * scale, -this.emitter2.rotationPointZ * scale);
this.emitter2.render(scale);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(this.emitter3.offsetX, this.emitter3.offsetY, this.emitter3.offsetZ);
GL11.glTranslated(this.emitter3.rotationPointX * scale, this.emitter3.rotationPointY * scale, this.emitter3.rotationPointZ * scale);
GL11.glRotatef(embitterRotation, 1, 0, 0);
GL11.glScaled(0.5D, 0.5D, 0.5D);
GL11.glTranslated(-this.emitter3.offsetX, -this.emitter3.offsetY, -this.emitter3.offsetZ);
GL11.glTranslated(-this.emitter3.rotationPointX * scale, -this.emitter3.rotationPointY * scale, -this.emitter3.rotationPointZ * scale);
this.emitter3.render(scale);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(this.emitter4.offsetX, this.emitter4.offsetY, this.emitter4.offsetZ);
GL11.glTranslated(this.emitter4.rotationPointX * scale, this.emitter4.rotationPointY * scale, this.emitter4.rotationPointZ * scale);
GL11.glRotatef(embitterRotation, -1, 0, 0);
GL11.glScaled(0.5D, 0.5D, 0.5D);
GL11.glTranslated(-this.emitter4.offsetX, -this.emitter4.offsetY, -this.emitter4.offsetZ);
GL11.glTranslated(-this.emitter4.rotationPointX * scale, -this.emitter4.rotationPointY * scale, -this.emitter4.rotationPointZ * scale);
this.emitter4.render(scale);
GL11.glPopMatrix();
if (brightness > 0F) GL11.glEnable(GL11.GL_LIGHTING);
GL11.glColor4f(1F, 1F, 1F, 1F);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lastBrightnessX, lastBrightnessY);
GL11.glEnable(GL11.GL_LIGHTING);
}
/**
* This is a helper function from Tabula to set the rotation of model parts
*/
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
@@ -664,9 +664,9 @@ public class RenderTileParticleGen extends TileEntitySpecialRenderer
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
//
// GL11.glEnable(GL11.GL_LIGHTING);
// GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
@@ -2,7 +2,7 @@ package com.brandon3055.draconicevolution.client.render.tile;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@@ -47,7 +47,7 @@ public class RenderTileReactorCore extends TileEntitySpecialRenderer {
double a = ff < 0.1 ? (ff * 10) + 0.5 : 1;
ResourceHandler.bindResource("textures/models/reactorCore.png");
GL11.glScaled(2F, 2F, 2F);
//GL11.glScaled(2F, 2F, 2F);
GL11.glRotatef(rotation, 0.5F, 1F, 0.5F);
reactorModel.renderAll();
@@ -0,0 +1,108 @@
package com.brandon3055.draconicevolution.client.render.tile;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.client.model.ModelReactorStabilizerCore;
import com.brandon3055.draconicevolution.client.model.ModelReactorStabilizerRing;
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
/**
* Created by Brandon on 6/7/2015.
*/
public class RenderTileReactorStabilizer extends TileEntitySpecialRenderer {
public static ModelReactorStabilizerRing modelStabilizerRing = new ModelReactorStabilizerRing();
public static ModelReactorStabilizerCore modelStabilizerCore = new ModelReactorStabilizerCore();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
renderCore((TileReactorStabilizer) tileEntity, partialTick);
renderEffects((TileReactorStabilizer) tileEntity, partialTick);
GL11.glPopMatrix();
}
private void renderCore(TileReactorStabilizer tile, float partialTick) {
float scale = (1F / 16F);
float coreRotation = tile.coreRotation + (partialTick * tile.coreSpeed);
float ringRotation = tile.ringRotation + (partialTick * tile.ringSpeed);
switch (tile.facingDirection){
case 0: GL11.glRotated(90, -1, 0, 0); break;
case 1: GL11.glRotated(90, 1, 0, 0); break;
case 3: GL11.glRotated(180, 1, 0, 0); break;
case 4: GL11.glRotated(90, 0, 1, 0); break;
case 5: GL11.glRotated(90, 0, -1, 0);
}
ResourceHandler.bindResource("textures/models/reactorStabilizerCore.png");
modelStabilizerCore.render(null, coreRotation, tile.modelIllumination, 0F, 0F, 0F, scale);
GL11.glPushMatrix();
ResourceHandler.bindResource("textures/models/reactorStabilizerRing.png");
GL11.glRotated(90, 1, 0, 0);
GL11.glTranslated(0, -0.58, 0);
GL11.glScaled(0.95, 0.95, 0.95);
GL11.glRotatef(ringRotation, 0, 1, 0);
modelStabilizerRing.render(null, 0F, tile.modelIllumination, 0F, 0F, 0F, scale);
GL11.glPopMatrix();
}
private void renderEffects(TileReactorStabilizer tile, float partialTick) {
if (tile.isValid)
{
float someRotation = tile.tick;
MultiblockHelper.TileLocation master = tile.masterLocation;
float f2 = someRotation + partialTick;
float f3 = MathHelper.sin(f2 * 0.2F) / 2.0F + 0.5F;
f3 = (f3 * f3 + f3) * 0.2F;
float f4 = (float)(master.posX - tile.xCoord - (0 - 0) * (double)(1.0F - partialTick));
float f5 = (float)((double)f3 + master.posY - 1.0D - tile.yCoord - (0 - 0) * (double)(1.0F - partialTick));
float f6 = (float)(master.posZ - tile.zCoord - (0 - 0) * (double)(1.0F - partialTick));
float f7 = MathHelper.sqrt_float(f4 * f4 + f6 * f6);
float f8 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6);
GL11.glPushMatrix();
// GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_ + 2.0F, (float)p_76986_6_);
GL11.glRotatef((float)(-Math.atan2((double)f6, (double)f4)) * 180.0F / (float)Math.PI - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef((float)(-Math.atan2((double)f7, (double)f5)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, 0.0F);
Tessellator tessellator = Tessellator.instance;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_CULL_FACE);
ResourceHandler.bindTexture(new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png"));
GL11.glShadeModel(GL11.GL_SMOOTH);
float f9 = 0.0F - ((float)tile.tick + partialTick) * 0.01F;
float f10 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6) / 32.0F - ((float)tile.tick + partialTick) * 0.01F;
tessellator.startDrawing(5);
byte b0 = 8;
for (int i = 0; i <= b0; ++i)
{
float f11 = MathHelper.sin((float)(i % b0) * (float)Math.PI * 2.0F / (float)b0) * 0.75F;
float f12 = MathHelper.cos((float)(i % b0) * (float)Math.PI * 2.0F / (float)b0) * 0.75F;
float f13 = (float)(i % b0) * 1.0F / (float)b0;
tessellator.setColorOpaque_I(0);
tessellator.addVertexWithUV((double)(f11 * 0.2F), (double)(f12 * 0.2F), 0.0D, (double)f13, (double)f10);
tessellator.setColorOpaque_I(16777215);
tessellator.addVertexWithUV((double)f11, (double)f12, (double)f8, (double)f13, (double)f9);
}
tessellator.draw();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glShadeModel(GL11.GL_FLAT);
RenderHelper.enableStandardItemLighting();
GL11.glPopMatrix();
}
}
}
@@ -20,7 +20,11 @@ import com.brandon3055.draconicevolution.common.tileentities.*;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyRelay;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileEnergyTransceiver;
import com.brandon3055.draconicevolution.common.tileentities.energynet.TileWirelessEnergyTransceiver;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluidGate;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluxGate;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.*;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator;
import cpw.mods.fml.common.FMLCommonHandler;
@@ -143,6 +147,9 @@ public class CommonProxy {
GameRegistry.registerTileEntity(TileDislocatorReceptacle.class, References.RESOURCESPREFIX + "TileDislocatorReceptacle");
GameRegistry.registerTileEntity(TilePortalBlock.class, References.RESOURCESPREFIX + "TilePortalBlock");
GameRegistry.registerTileEntity(TileReactorCore.class, References.RESOURCESPREFIX + "TileReactorCore");
GameRegistry.registerTileEntity(TileFluxGate.class, References.RESOURCESPREFIX + "TileFluxGate");
GameRegistry.registerTileEntity(TileFluidGate.class, References.RESOURCESPREFIX + "TileFluidGate");
GameRegistry.registerTileEntity(TileReactorStabilizer.class, References.RESOURCESPREFIX + "TileReactorStabilizer");
if (DraconicEvolution.debug) {
GameRegistry.registerTileEntity(TileTestBlock.class, References.RESOURCESPREFIX + "TileTestBlock");
GameRegistry.registerTileEntity(TileContainerTemplate.class, References.RESOURCESPREFIX + "TileContainerTemplate");
@@ -45,6 +45,7 @@ public class ModBlocks {
public static BlockDE portal;
public static BlockDE reactorCore;
public static BlockDE flowGate;
public static BlockDE reactorStabilizer;
public static Block safetyFlame;
public static ItemStack resurrectionStone;
@@ -81,6 +82,7 @@ public class ModBlocks {
portal = new Portal();
reactorCore = new ReactorCore();
flowGate = new FlowGate();
reactorStabilizer = new ReactorStabilizer();
longRangeDislocator = new LongRangeDislocator();
@@ -1,13 +1,19 @@
package com.brandon3055.draconicevolution.common.blocks.machine;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.gui.GuiHandler;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.blocks.itemblocks.ItemBlockFrowGate;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluidGate;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileFluxGate;
import com.brandon3055.draconicevolution.common.tileentities.gates.TileGate;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
@@ -18,6 +24,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@@ -47,8 +54,7 @@ public class FlowGate extends BlockDE {
@Override
public TileEntity createTileEntity(World world, int metadata) {
LogHelper.info(metadata);
return super.createTileEntity(world, metadata);
return metadata < 6 ? new TileFluxGate() : new TileFluidGate();
}
@Override
@@ -100,6 +106,8 @@ public class FlowGate extends BlockDE {
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
int d = determineOrientation(world, x, y, z, entity) + stack.getItemDamage();
TileGate gate = (TileGate)world.getTileEntity(x, y, z);
gate.output = ForgeDirection.getOrientation(d % 6);
world.setBlockMetadataWithNotify(x, y, z, d, 2);
}
@@ -179,13 +187,43 @@ public class FlowGate extends BlockDE {
}
}
((TileGate)worldObj.getTileEntity(x, y, z)).output = facing;
worldObj.setBlockMetadataWithNotify(x, y, z, facing.ordinal() + (type * 6), 2);
return false;
Utills.updateNeabourBlocks(worldObj, x, y, z);
return true;
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
return new ItemStack(this, 1, (world.getBlockMetadata(x, y, z) / 6) * 6);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
if (world.isRemote && !(player.getHeldItem() != null && player.getHeldItem().getItem().equals(ModItems.wrench))) player.openGui(DraconicEvolution.instance, GuiHandler.GUIID_FLOW_GATE, world, x, y, z);
return true;
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
updateSignal(world, x, y, z);
}
@Override
public void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) {
updateSignal(world, x, y, z);
}
private void updateSignal(IBlockAccess world, int x, int y, int z){
TileGate gate = world.getTileEntity(x, y, z) instanceof TileGate ? (TileGate)world.getTileEntity(x, y, z) : null;
if (gate != null && world instanceof World) {
gate.signal = ((World) world).getStrongestIndirectPower(x, y, z);
((World) world).markBlockForUpdate(x, y, z);
}
}
@Override
public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) {
return true;
}
}
@@ -1,6 +1,8 @@
package com.brandon3055.draconicevolution.common.blocks.multiblock;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
/**
@@ -10,55 +12,53 @@ public class MultiblockHelper {
public static class TileLocation {
protected int xCoord;
protected int yCoord;
protected int zCoord;
public static class TileLocation extends ChunkCoordinates {
public TileLocation(){
}
public TileLocation(int x, int y, int z){
this.xCoord = x;
this.yCoord = y;
this.zCoord = z;
this.posX = x;
this.posY = y;
this.posZ = z;
}
public int getXCoord(){
return xCoord;
return posX;
}
public int getYCoord(){
return yCoord;
return posY;
}
public int getZCoord(){
return zCoord;
return posY;
}
public void setXCoord(int x){
xCoord = x;
posX = x;
}
public void setYCoord(int y){
yCoord = y;
posY = y;
}
public void setZCoord(int z){
zCoord = z;
posZ = z;
}
public TileEntity getTileEntity(World world) { return world.getTileEntity(posX, posY, posZ); }
public void writeToNBT(NBTTagCompound compound, String key) {
compound.setInteger("X_"+key, xCoord);
compound.setInteger("Y_"+key, yCoord);
compound.setInteger("Z_"+key, zCoord);
compound.setInteger("X_"+key, posX);
compound.setInteger("Y_"+key, posY);
compound.setInteger("Z_"+key, posZ);
}
public void readFromNBT(NBTTagCompound compound, String key) {
xCoord = compound.getInteger("X_"+key);
yCoord = compound.getInteger("Y_"+key);
zCoord = compound.getInteger("Z_"+key);
posX = compound.getInteger("X_"+key);
posY = compound.getInteger("Y_"+key);
posZ = compound.getInteger("Z_"+key);
}
}
@@ -5,9 +5,12 @@ import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileDislocatorReceptacle;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TilePortalBlock;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
@@ -30,6 +33,12 @@ public class Portal extends BlockDE implements ITileEntityProvider{
ModBlocks.register(this);
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "transparency");
}
@Override
public int getRenderType() {
return References.idPortal;
@@ -3,7 +3,8 @@ package com.brandon3055.draconicevolution.common.blocks.multiblock;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.TileReactorCore;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -25,7 +26,7 @@ public class ReactorCore extends BlockDE {
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "transparency");
}
@Override
@@ -0,0 +1,67 @@
package com.brandon3055.draconicevolution.common.blocks.multiblock;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.ModBlocks;
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorStabilizer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Created by Brandon on 5/7/2015.
*/
public class ReactorStabilizer extends BlockDE {
public ReactorStabilizer() {
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
this.setBlockName("reactorStabilizer");
ModBlocks.register(this);
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "transparency");
}
@Override
public int getRenderType() {
return -1;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean hasTileEntity(int metadata) {
return true;
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
return new TileReactorStabilizer();
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
int d = Utills.determineOrientation(x, y, z, entity);
TileReactorStabilizer tile = (TileReactorStabilizer)world.getTileEntity(x, y, z);
tile.facingDirection = ForgeDirection.getOrientation(d).getOpposite().ordinal();
tile.onPlaced();
}
}
@@ -107,10 +107,10 @@ public class Wrench extends ItemDE implements IHudDisplayItem {
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
if (world.isRemote) return false;
Block clicked = world.getBlock(x, y, z);
if (clicked.rotateBlock(world, x, y, z, ForgeDirection.getOrientation(side))) return true;
if (clicked.rotateBlock(world, x, y, z, ForgeDirection.getOrientation(side)) && !world.isRemote) return true;
if (world.isRemote) return false;
TileEntity tileClicked = world.getTileEntity(x, y, z);
if (tileClicked instanceof TileRemoteEnergyBase) return false;
@@ -86,7 +86,7 @@ public class TileObjectPacket implements IMessage{
{
if (!(Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z) instanceof TileObjectSync))
return null;
((TileObjectSync) Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z)).receiveObject(message.index, message.object);
((TileObjectSync) Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z)).receiveObjectFromServer(message.index, message.object);
}
}
else
@@ -100,7 +100,7 @@ public class TileObjectPacket implements IMessage{
{
if (!(ctx.getServerHandler().playerEntity.worldObj.getTileEntity(message.x, message.y, message.z) instanceof TileObjectSync))
return null;
((TileObjectSync) ctx.getServerHandler().playerEntity.worldObj.getTileEntity(message.x, message.y, message.z)).receiveObject(message.index, message.object);
((TileObjectSync) ctx.getServerHandler().playerEntity.worldObj.getTileEntity(message.x, message.y, message.z)).receiveObjectFromClient(message.index, message.object);
}
}
return null;
@@ -61,11 +61,6 @@ public class TileDraconiumChest extends TileEntity implements ISidedInventory, I
@Override
public void updateEntity() {
//int t = (tick/20) % 12;
//if (!worldObj.isRemote) LogHelper.info(t / 6 + " : " + t % 6 + " : " + t);
// Resynchronize clients with the server state
if (worldObj != null && !this.worldObj.isRemote && this.numUsingPlayers != 0 && (this.ticksSinceSync + this.xCoord + this.yCoord + this.zCoord) % 200 == 0) {
this.numUsingPlayers = 0;
@@ -25,7 +25,7 @@ import java.util.Random;
public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver, ISidedInventory {
ItemStack[] items = new ItemStack[1];
public EnergyStorage energy = new EnergyStorage(1000000);
public int maxInput = 81920;
public int maxInput = 1000000;
public boolean running = false;
public boolean runningCach = false;
private int tick = 0;
@@ -170,17 +170,17 @@ public class TileEnergyInfuser extends TileObjectSync implements IEnergyReceiver
public void detectAndSendChanges(boolean sendAnyway){
if (runningCach != running || sendAnyway) {
runningCach = (Boolean)sendObject(References.BOOLEAN_ID, 0, running);
runningCach = (Boolean) sendObjectToClient(References.BOOLEAN_ID, 0, running);
}
if (transferCach != transfer || sendAnyway) {
transferCach = (Boolean)sendObject(References.BOOLEAN_ID, 1, transfer);
transferCach = (Boolean) sendObjectToClient(References.BOOLEAN_ID, 1, transfer);
}
}
@SideOnly(Side.CLIENT)
@Override
public void receiveObject(int index, Object object) {
public void receiveObjectFromServer(int index, Object object) {
if (index == 0) running = (Boolean)object;
if (index == 1) transfer = (Boolean)object;
}
@@ -255,12 +255,12 @@ public class TileGenerator extends TileObjectSync implements ISidedInventory, IE
}
private void detectAndSentChanges(boolean sendAnyway){
if (isBurning != isBurningCach || sendAnyway) isBurningCach = (Boolean)sendObject(References.BOOLEAN_ID, 0, isBurning);
if (isBurning != isBurningCach || sendAnyway) isBurningCach = (Boolean) sendObjectToClient(References.BOOLEAN_ID, 0, isBurning);
}
@SideOnly(Side.CLIENT)
@Override
public void receiveObject(int index, Object object) {
public void receiveObjectFromServer(int index, Object object) {
if (isBurning != (Boolean) object){
isBurning = (Boolean) object;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
@@ -384,7 +384,7 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne
@SideOnly(Side.CLIENT)
@Override
public void receiveObject(int index, Object object) {
public void receiveObjectFromServer(int index, Object object) {
if (index == 0 && disabled != (Boolean) object) {
disabled = (Boolean) object;
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
@@ -397,10 +397,10 @@ public class TileGrinder extends TileObjectSync implements ISidedInventory, IEne
private void detectAndSendChanges(boolean sendAnyway){
if (disabledCach != disabled || sendAnyway) {
disabledCach = (Boolean)sendObject(References.BOOLEAN_ID, 0, disabled);
disabledCach = (Boolean) sendObjectToClient(References.BOOLEAN_ID, 0, disabled);
}
if (hasPowerCach != hasPower || sendAnyway) {
hasPowerCach = (Boolean)sendObject(References.BOOLEAN_ID, 1, hasPower);
hasPowerCach = (Boolean) sendObjectToClient(References.BOOLEAN_ID, 1, hasPower);
}
}
@@ -3,8 +3,6 @@ package com.brandon3055.draconicevolution.common.tileentities;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.common.network.TileObjectPacket;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.tileentity.TileEntity;
/**
@@ -12,15 +10,25 @@ import net.minecraft.tileentity.TileEntity;
*/
public abstract class TileObjectSync extends TileEntity {
public Object sendObject(byte dataType, int index, Object object){
return sendObject(dataType, index, object, new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64));
/**Sends a primitive to the client in the form of an object*/
public Object sendObjectToClient(byte dataType, int index, Object object){
return sendObjectToClient(dataType, index, object, new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 64));
}
public Object sendObject(byte dataType, int index, Object object, TargetPoint point){
/**Sends a primitive to the client in the form of an object*/
public Object sendObjectToClient(byte dataType, int index, Object object, TargetPoint point){
DraconicEvolution.network.sendToAllAround(new TileObjectPacket(this, dataType, index, object), point);
return object;
}
@SideOnly(Side.CLIENT)
public abstract void receiveObject(int index, Object object);
public Object sendObjectToServer(byte dataType, int index, Object object){
DraconicEvolution.network.sendToServer(new TileObjectPacket(this, dataType, index, object));
return object;
}
/**Receives an object from the server*/
public void receiveObjectFromClient(int index, Object object) {}
/**Receives an object from the server*/
public void receiveObjectFromServer(int index, Object object) {}
}
@@ -75,7 +75,7 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler {
// if (worldObj.isRemote) modelRotation += 0.5;
//LogHelper.info(modelRotation);
//LogHelper.info(modelCoreRotation);
@@ -152,17 +152,17 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe
{
if (index >= 0 && (linkedDevices.get(index).energyFlow != linkedDevices.get(index).lastTickEnergyFlow || forceSend))
{
sendObject(References.INT_PAIR_ID, 0, new DataUtills.IntPair(index, (int) linkedDevices.get(index).energyFlow));
sendObjectToClient(References.INT_PAIR_ID, 0, new DataUtills.IntPair(index, (int) linkedDevices.get(index).energyFlow));
linkedDevices.get(index).lastTickEnergyFlow = linkedDevices.get(index).energyFlow;
}
if (storage.getEnergyStored() != lastTickEnergy || forceSend) sendObject(References.INT_ID, 1, storage.getEnergyStored());
if (storage.getEnergyStored() != lastTickEnergy || forceSend) sendObjectToClient(References.INT_ID, 1, storage.getEnergyStored());
}
}
@SideOnly(Side.CLIENT)
@Override
public void receiveObject(int index, Object object) {
public void receiveObjectFromServer(int index, Object object) {
if (index == 0 && object instanceof DataUtills.IntPair && linkedDevices.size() > ((DataUtills.IntPair) object).i1)
{
linkedDevices.get(((DataUtills.IntPair) object).i1).energyFlow = ((DataUtills.IntPair) object).i2;
@@ -87,15 +87,15 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase {
if (sent > Short.MAX_VALUE) sent = Short.MAX_VALUE;
if (sent > 0) sendObject(References.SHORT_ID, 10 + receiverList.indexOf(receiver), (short)sent);
if (sent > 0) sendObjectToClient(References.SHORT_ID, 10 + receiverList.indexOf(receiver), (short) sent);
}
}
}
@SideOnly(Side.CLIENT)
@Override
public void receiveObject(int index, Object object) {
super.receiveObject(index, object);
public void receiveObjectFromServer(int index, Object object) {
super.receiveObjectFromServer(index, object);
if (index >= 10)
{
@@ -0,0 +1,87 @@
package com.brandon3055.draconicevolution.common.tileentities.gates;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.*;
/**
* Created by Brandon on 29/6/2015.
*/
public class TileFluidGate extends TileGate implements IFluidHandler {
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
IFluidHandler target = getOutputTarget();
if (target == null) return 0;
int transfer = Math.min(getActualFlow(), target.fill(from, resource, false));
if (transfer < resource.amount){
FluidStack newStack = resource.copy();
newStack.amount = transfer;
resource.amount -= transfer;
return target.fill(from, newStack, doFill);
}
return target.fill(from, resource, doFill);
}
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
return null;
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
return null;
}
@Override
public boolean canFill(ForgeDirection from, Fluid fluid) {
IFluidHandler target = getOutputTarget();
LogHelper.info(target != null && target.canFill(from, fluid));
return target != null && target.canFill(from, fluid);
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid) {
return false;
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
return new FluidTankInfo[0];
}
private IFluidHandler getOutputTarget(){
TileEntity tile = worldObj.getTileEntity(xCoord + output.offsetX, yCoord + output.offsetY, zCoord + output.offsetZ);
return tile instanceof IFluidHandler ? (IFluidHandler) tile : null;
}
@Override
public String getFlowSetting(int selector) {
return selector == 0 ? Utills.addCommas(flowRSLow) + " MB/t" : Utills.addCommas(flowRSHigh) + " MB/t";
}
@Override
public void incrementFlow(int selector, boolean ctrl, boolean shift, boolean add, int button) {
int amount = button == 0 ? shift ? ctrl ? 1000 : 100 : ctrl ? 50 : 5 : shift ? ctrl ? 100 : 50 : ctrl ? 10 : 1;
if (selector == 0) {
flowRSLow += add ? amount : -amount;
if (flowRSLow < 0) flowRSLow = 0;
if (worldObj.isRemote) sendObjectToServer(References.INT_ID, 0, flowRSLow);
}
else {
flowRSHigh += add ? amount : -amount;
if (flowRSHigh < 0) flowRSHigh = 0;
if (worldObj.isRemote) sendObjectToServer(References.INT_ID, 1, flowRSHigh);
}
}
@Override
public String getToolTip(int selector, boolean shift, boolean ctrl) {
int b1 = shift ? ctrl ? 1000 : 100 : ctrl ? 50 : 5;
int b2 = shift ? ctrl ? 100 : 50 : ctrl ? 10 : 1;
return b1 + "/" + b2 + " MB/t";
}
}
@@ -0,0 +1,72 @@
package com.brandon3055.draconicevolution.common.tileentities.gates;
import cofh.api.energy.IEnergyReceiver;
import com.brandon3055.brandonscore.common.utills.Utills;
import com.brandon3055.draconicevolution.common.lib.References;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Created by Brandon on 29/6/2015.
*/
public class TileFluxGate extends TileGate implements IEnergyReceiver {
@Override
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
IEnergyReceiver target = getOutputTarget();
return target == null ? 0 : target.receiveEnergy(from, Math.min(getActualFlow(), target.receiveEnergy(from, maxReceive, true)), simulate);
}
@Override
public int getEnergyStored(ForgeDirection from) {
IEnergyReceiver target = getOutputTarget();
return target == null ? 0 : target.getEnergyStored(from);
}
@Override
public int getMaxEnergyStored(ForgeDirection from) {
IEnergyReceiver target = getOutputTarget();
return target == null ? 0 : target.getMaxEnergyStored(from);
}
@Override
public boolean canConnectEnergy(ForgeDirection from) {
return from == output || from == output.getOpposite();
}
private IEnergyReceiver getOutputTarget(){
TileEntity tile = worldObj.getTileEntity(xCoord + output.offsetX, yCoord + output.offsetY, zCoord + output.offsetZ);
return tile instanceof IEnergyReceiver ? (IEnergyReceiver) tile : null;
}
@Override
public String getFlowSetting(int selector) {
return selector == 0 ? Utills.addCommas(flowRSLow) + " RF/t" : Utills.addCommas(flowRSHigh) + " RF/t";
}
@Override
public void incrementFlow(int selector, boolean ctrl, boolean shift, boolean add, int button) {
int amount = button == 0 ? shift ? ctrl ? 10000 : 1000 : ctrl ? 5 : 50 : shift ? ctrl ? 1000 : 100 : ctrl ? 1 : 10;
if (selector == 0) {
if (ctrl && shift && button == 0) amount += flowRSLow / 100000 * 1000;
flowRSLow += (add ? amount : -amount);
if (flowRSLow < 0) flowRSLow = 0;
if (worldObj.isRemote) sendObjectToServer(References.INT_ID, 0, flowRSLow);
}
else {
if (ctrl && shift && button == 0) amount += flowRSHigh / 100000 * 1000;
flowRSHigh += add ? amount : -amount;
if (flowRSHigh < 0) flowRSHigh = 0;
if (worldObj.isRemote) sendObjectToServer(References.INT_ID, 1, flowRSHigh);
}
}
@Override
public String getToolTip(int selector, boolean shift, boolean ctrl) {
int i = selector == 0 ? flowRSLow / 100000 * 10000 : flowRSHigh / 100000 * 10000;
int b1 = shift ? ctrl ? 10000 + i : 1000 : ctrl ? 5 : 50;
int b2 = shift ? ctrl ? 1000 : 100 : ctrl ? 1 : 10;
return b1 + "/" + b2 + " RF/t";
}
}
@@ -0,0 +1,67 @@
package com.brandon3055.draconicevolution.common.tileentities.gates;
import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Created by Brandon on 29/6/2015.
*/
public abstract class TileGate extends TileObjectSync {
public ForgeDirection output = ForgeDirection.DOWN;
public int flowRSLow = 0;
public int flowRSHigh = 1000;
public int signal = -1;
public abstract String getFlowSetting(int selector);
public abstract void incrementFlow(int selector, boolean ctrl, boolean shift, boolean add, int button);
public abstract String getToolTip(int selector, boolean shift, boolean ctrl);
public int getActualFlow(){
if (signal == -1 ) signal = worldObj.getStrongestIndirectPower(xCoord, yCoord, zCoord);
return flowRSLow + (int) (((double)signal / 15D) * (double)(flowRSHigh - flowRSLow));
}
@Override
public void receiveObjectFromClient(int index, Object object) {
if (index == 0) flowRSLow = (Integer)object;
else if (index == 1) flowRSHigh = (Integer)object;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound compound = new NBTTagCompound();
writeToNBT(compound);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, compound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
readFromNBT(pkt.func_148857_g());
}
@Override
public void writeToNBT(NBTTagCompound compound) {
super.writeToNBT(compound);
compound.setInteger("Output", output.ordinal());
compound.setInteger("FlowRSLow", flowRSLow);
compound.setInteger("FlowRSHigh", flowRSHigh);
compound.setInteger("Signal", signal);
}
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
output = ForgeDirection.getOrientation(compound.getInteger("Output"));
flowRSLow = compound.getInteger("FlowRSLow");
flowRSHigh = compound.getInteger("FlowRSHigh");
signal = compound.getInteger("Signal");
}
}
@@ -299,14 +299,14 @@ public class TileEnergyPylon extends TileObjectSync implements IEnergyHandler, I
}
private void detectAndSendChanges(){
if (lastTickActive != active) lastTickActive = (Boolean) sendObject(References.BOOLEAN_ID, 0, active, new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 256));
if (lastTickReciveEnergy != reciveEnergy) lastTickReciveEnergy = (Boolean) sendObject(References.BOOLEAN_ID, 1, reciveEnergy, new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 256));
if (lastTickParticleRate != particleRate) lastTickParticleRate = (Byte) sendObject(References.BYTE_ID, 2, particleRate);
if (lastTickActive != active) lastTickActive = (Boolean) sendObjectToClient(References.BOOLEAN_ID, 0, active, new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 256));
if (lastTickReciveEnergy != reciveEnergy) lastTickReciveEnergy = (Boolean) sendObjectToClient(References.BOOLEAN_ID, 1, reciveEnergy, new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 256));
if (lastTickParticleRate != particleRate) lastTickParticleRate = (Byte) sendObjectToClient(References.BYTE_ID, 2, particleRate);
}
@SideOnly(Side.CLIENT)
@Override
public void receiveObject(int index, Object object) {
public void receiveObjectFromServer(int index, Object object) {
switch (index) {
case 0:
active = (Boolean) object;
@@ -786,11 +786,11 @@ public class TileEnergyStorageCore extends TileObjectSync {
private void detectAndRendChanges(){
int diff = (int)Math.abs(lastTickCapacity - energy);
if (diff > 1000) lastTickCapacity = (Double)sendObject(References.DOUBLE_ID, 0, energy, new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 20));
if (diff > 1000) lastTickCapacity = (Double) sendObjectToClient(References.DOUBLE_ID, 0, energy, new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 20));
}
@Override
public void receiveObject(int index, Object object) {
public void receiveObjectFromServer(int index, Object object) {
energy = (Double) object;
}
}
@@ -1,4 +1,4 @@
package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles;
package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor;
import net.minecraft.tileentity.TileEntity;
@@ -0,0 +1,94 @@
package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor;
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Created by Brandon on 5/7/2015.
*/
public class TileReactorStabilizer extends TileEntity {
public float coreRotation = 0F;
public float ringRotation = 0F;
public float coreSpeed = 1F;
public float ringSpeed = 1F;
public float modelIllumination = 0F;
public int facingDirection = ForgeDirection.UP.ordinal();
public TileLocation masterLocation = new TileLocation();
public boolean isValid = false;
public int tick = 0;
@Override
public void updateEntity() {
tick++;
if (worldObj.isRemote) {
coreRotation += coreSpeed;
ringRotation += ringSpeed;
coreSpeed = 30F;
ringSpeed = 5F;
modelIllumination = 1F;
}
}
public void onPlaced() {
checkForMaster();
}
public boolean checkForMaster(){
for (int i = 1; i < 10; i++) {
ForgeDirection dir = ForgeDirection.getOrientation(facingDirection);
int x = xCoord + (dir.offsetX*i);
int y = yCoord + (dir.offsetY*i);
int z = zCoord + (dir.offsetZ*i);
if (worldObj.getTileEntity(x, y, z) instanceof TileReactorCore){
masterLocation.set(x, y, z);
isValid = true;
worldObj.markBlockForUpdate(x, y, z);
return true;
}
}
isValid = false;
return false;
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound compound = new NBTTagCompound();
masterLocation.writeToNBT(compound, "Master");
compound.setInteger("Facing", facingDirection);
compound.setBoolean("IsValid", isValid);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, compound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
NBTTagCompound compound = pkt.func_148857_g();
masterLocation.readFromNBT(compound, "Master");
facingDirection = compound.getInteger("Facing");
isValid = compound.getBoolean("IsValid");
super.onDataPacket(net, pkt);
}
@Override
public void writeToNBT(NBTTagCompound compound) {
super.writeToNBT(compound);
masterLocation.writeToNBT(compound, "Master");
compound.setInteger("Facing", facingDirection);
compound.setBoolean("IsValid", isValid);
}
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
masterLocation.readFromNBT(compound, "Master");
facingDirection = compound.getInteger("Facing");
isValid = compound.getBoolean("IsValid");
}
}