Fixed code, changed textures, and more logic!
@ -17,7 +17,9 @@ import net.minecraft.util.ResourceLocation;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class GuiEnderCoreGenerator extends GuiContainer {
|
public class GuiEnderCoreGenerator extends GuiContainer {
|
||||||
|
|
||||||
|
int scaledtobar, scaledtopercentage, scaledtofueltransfer, currentcooldown, currentpower;
|
||||||
|
|
||||||
private ResourceLocation resource = new ResourceLocation(ModInfo.MODID + ":" + "textures/gui/GuiCoreGenerator.png");
|
private ResourceLocation resource = new ResourceLocation(ModInfo.MODID + ":" + "textures/gui/GuiCoreGenerator.png");
|
||||||
private TileEntityEnderCoreGenerator tileentity;
|
private TileEntityEnderCoreGenerator tileentity;
|
||||||
|
|
||||||
@ -58,11 +60,11 @@ public class GuiEnderCoreGenerator extends GuiContainer {
|
|||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float f, int mx, int my) {
|
protected void drawGuiContainerBackgroundLayer(float f, int mx, int my) {
|
||||||
this.mc.getTextureManager().bindTexture(resource);
|
this.mc.getTextureManager().bindTexture(resource);
|
||||||
int scaledtobar = this.tileentity.powerScaled(100);
|
scaledtobar = this.tileentity.powerScaled(100);
|
||||||
int scaledtopercentage = this.tileentity.powerScaled(100);
|
scaledtopercentage = this.tileentity.powerScaled(100);
|
||||||
int scaledtofueltransfer = this.tileentity.genscaled(100);
|
scaledtofueltransfer = this.tileentity.genscaled(100);
|
||||||
int cooldown = this.tileentity.cooldownscaled(100);
|
currentcooldown = this.tileentity.cooldownscaled(100);
|
||||||
int currentpower = this.tileentity.currentPower;
|
currentpower = this.tileentity.currentPower;
|
||||||
int percentagefontcolor;
|
int percentagefontcolor;
|
||||||
|
|
||||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||||
@ -70,7 +72,7 @@ public class GuiEnderCoreGenerator extends GuiContainer {
|
|||||||
|
|
||||||
drawTexturedModalRect(guiLeft+7, guiTop+8, 0, 149, scaledtobar, 16);
|
drawTexturedModalRect(guiLeft+7, guiTop+8, 0, 149, scaledtobar, 16);
|
||||||
drawTexturedModalRect(guiLeft+7, guiTop+8 + 12, 100, 149, scaledtofueltransfer, 4);
|
drawTexturedModalRect(guiLeft+7, guiTop+8 + 12, 100, 149, scaledtofueltransfer, 4);
|
||||||
drawTexturedModalRect(guiLeft+7, guiTop+8 + 12 + 3, 100, 149 + 4, cooldown, 3);
|
drawTexturedModalRect(guiLeft+7, guiTop+8 + 12 + 3, 100, 149 + 4, currentcooldown, 3);
|
||||||
|
|
||||||
|
|
||||||
drawCenteredString(fontRendererObj, "Ender Core Generator", guiLeft+90, guiTop-10, 0xFFFFFF);
|
drawCenteredString(fontRendererObj, "Ender Core Generator", guiLeft+90, guiTop-10, 0xFFFFFF);
|
||||||
@ -83,15 +85,10 @@ public class GuiEnderCoreGenerator extends GuiContainer {
|
|||||||
|
|
||||||
drawString(fontRendererObj, scaledtofueltransfer + "% fuel", guiLeft+40, guiTop+38, percentagefontcolor);
|
drawString(fontRendererObj, scaledtofueltransfer + "% fuel", guiLeft+40, guiTop+38, percentagefontcolor);
|
||||||
|
|
||||||
if (mx >= guiLeft+7 && mx <= guiLeft +7+100 && my >= guiTop + 8 && my <= guiTop + 16 + 8) {
|
if (mx >= guiLeft+7 && mx <= guiLeft +7+100 && my >= guiTop +8 && my <= guiTop + 16 +8) {
|
||||||
|
|
||||||
drawString(fontRendererObj, "Current MoE: " + currentpower, mx+10, my, 0xa8a8a8);
|
drawString(fontRendererObj, "MoE: " + currentpower + "/" + tileentity.maxpower, guiLeft+12, guiTop+12, 0xa8a8a8);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void drawGuiContainerForegroundLayer(int mx, int my) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ import net.minecraft.inventory.Container;
|
|||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class GuiNetherCoreGenerator extends GuiContainer {
|
public class GuiNetherCoreGenerator extends GuiContainer {
|
||||||
|
int scaledtobar, scaledtopercentage, scaledtofueltransfer, currentcooldown, currentpower;
|
||||||
|
|
||||||
private ResourceLocation resource = new ResourceLocation(ModInfo.MODID + ":" + "textures/gui/GUICoreGenerator.png");
|
private ResourceLocation resource = new ResourceLocation(ModInfo.MODID + ":" + "textures/gui/GUICoreGenerator.png");
|
||||||
private TileEntityNetherCoreGenerator tileentity;
|
private TileEntityNetherCoreGenerator tileentity;
|
||||||
|
|
||||||
@ -56,24 +58,23 @@ public class GuiNetherCoreGenerator extends GuiContainer {
|
|||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float f, int mx, int my) {
|
protected void drawGuiContainerBackgroundLayer(float f, int mx, int my) {
|
||||||
this.mc.getTextureManager().bindTexture(resource);
|
this.mc.getTextureManager().bindTexture(resource);
|
||||||
int scaledtobar = this.tileentity.powerScaled(100);
|
scaledtobar = this.tileentity.powerScaled(100);
|
||||||
int scaledtopercentage = this.tileentity.powerScaled(100);
|
scaledtopercentage = this.tileentity.powerScaled(100);
|
||||||
int scaledtofueltransfer = this.tileentity.genscaled(100);
|
scaledtofueltransfer = this.tileentity.genscaled(100);
|
||||||
int cooldown = this.tileentity.cooldownscaled(100);
|
currentcooldown = this.tileentity.cooldownscaled(100);
|
||||||
int currentpower = this.tileentity.currentPower;
|
currentpower = this.tileentity.currentPower;
|
||||||
int percentagefontcolor;
|
int percentagefontcolor;
|
||||||
int White;
|
|
||||||
|
|
||||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||||
|
|
||||||
|
|
||||||
drawTexturedModalRect(guiLeft+7, guiTop+8, 0, 149, scaledtobar, 16);
|
drawTexturedModalRect(guiLeft+7, guiTop+8, 0, 149, scaledtobar, 16);
|
||||||
drawTexturedModalRect(guiLeft+7, guiTop+8 + 12, 100, 149, scaledtofueltransfer, 4);
|
drawTexturedModalRect(guiLeft+7, guiTop+8 + 12, 100, 149, scaledtofueltransfer, 4);
|
||||||
drawTexturedModalRect(guiLeft+7, guiTop+8 + 12 + 3, 100, 149 + 4, cooldown, 3);
|
drawTexturedModalRect(guiLeft+7, guiTop+8 + 12 + 3, 100, 149 + 4, currentcooldown, 3);
|
||||||
|
|
||||||
|
|
||||||
drawCenteredString(fontRendererObj, "Nether Core Generator", guiLeft+90, guiTop-10, 0xFFFFFF);
|
drawCenteredString(fontRendererObj, "Nether Core Generator", guiLeft+90, guiTop-10, 0xFFFFFF);
|
||||||
if (currentpower ==0) {
|
if (currentpower == 0) {
|
||||||
percentagefontcolor = 0xFF0000;
|
percentagefontcolor = 0xFF0000;
|
||||||
} else {
|
} else {
|
||||||
percentagefontcolor = 1111111;
|
percentagefontcolor = 1111111;
|
||||||
@ -83,8 +84,7 @@ public class GuiNetherCoreGenerator extends GuiContainer {
|
|||||||
drawString(fontRendererObj, scaledtofueltransfer + "% fuel", guiLeft+40, guiTop+38, percentagefontcolor);
|
drawString(fontRendererObj, scaledtofueltransfer + "% fuel", guiLeft+40, guiTop+38, percentagefontcolor);
|
||||||
|
|
||||||
if (mx >= guiLeft+7 && mx <= guiLeft +7+100 && my >= guiTop +8 && my <= guiTop + 16 +8) {
|
if (mx >= guiLeft+7 && mx <= guiLeft +7+100 && my >= guiTop +8 && my <= guiTop + 16 +8) {
|
||||||
|
drawString(fontRendererObj, "MoE: " + currentpower + "/" + tileentity.maxpower, guiLeft+12, guiTop+12, 0xa8a8a8);
|
||||||
drawString(fontRendererObj, "Current MoE: " + currentpower + "/" + tileentity.maxpower, mx+10, my, 0xa8a8a8);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,26 +61,13 @@ public class CoreStabilizer extends ModMachineBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void isMultBlock(World world, int x, int y, int z) {
|
public void isMultBlock(World world, int x, int y, int z) {
|
||||||
|
|
||||||
if (world.getTileEntity(x, y+1, z) instanceof TileEntityCoreGenerator) {
|
if (world.getTileEntity(x, y+1, z) instanceof TileEntityCoreGenerator) {
|
||||||
world.scheduleBlockUpdate(x, y+1, z, world.getBlock(x, y+1, z), 0);
|
world.scheduleBlockUpdate(x, y+1, z, world.getBlock(x, y+1, z), 0);
|
||||||
((TileEntityCoreStabilizer)world.getTileEntity(x, y, z)).version = 2;
|
|
||||||
if (((TileEntityCoreGenerator)world.getTileEntity(x, y+1, z)).multiblock == true) {
|
|
||||||
((TileEntityCoreStabilizer)world.getTileEntity(x, y, z)).multiblock = true;
|
|
||||||
} else {
|
|
||||||
((TileEntityCoreStabilizer)world.getTileEntity(x, y, z)).multiblock = false;
|
|
||||||
}
|
|
||||||
} else if (world.getTileEntity(x, y-1, z) instanceof TileEntityCoreGenerator) {
|
} else if (world.getTileEntity(x, y-1, z) instanceof TileEntityCoreGenerator) {
|
||||||
world.scheduleBlockUpdate(x, y-1, z, world.getBlock(x, y-1, z), 0);
|
world.scheduleBlockUpdate(x, y-1, z, world.getBlock(x, y-1, z), 0);
|
||||||
((TileEntityCoreStabilizer)world.getTileEntity(x, y, z)).version = 1;
|
|
||||||
if (((TileEntityCoreGenerator)world.getTileEntity(x, y-1, z)).multiblock == true) {
|
|
||||||
((TileEntityCoreStabilizer)world.getTileEntity(x, y, z)).multiblock = true;
|
|
||||||
} else {
|
|
||||||
((TileEntityCoreStabilizer)world.getTileEntity(x, y, z)).multiblock = false;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
((TileEntityCoreStabilizer)world.getTileEntity(x, y, z)).version = 0;
|
((TileEntityCoreStabilizer)world.getTileEntity(x, y, z)).multiblock = false;
|
||||||
|
world.markBlockForUpdate(x, y, z);
|
||||||
}
|
}
|
||||||
world.markBlockForUpdate(x, y, z);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.util.Random;
|
|||||||
|
|
||||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.AdvancedSatelliteUtilization;
|
import org.bitbucket.alltra101ify.advancedsatelliteutilization.AdvancedSatelliteUtilization;
|
||||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modGUIs.ModGUIs;
|
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modGUIs.ModGUIs;
|
||||||
|
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityCoreStabilizer;
|
||||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityEnderCoreGenerator;
|
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityEnderCoreGenerator;
|
||||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.moditems.ModItems;
|
import org.bitbucket.alltra101ify.advancedsatelliteutilization.moditems.ModItems;
|
||||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.ModCreativeTabs;
|
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.ModCreativeTabs;
|
||||||
@ -41,6 +42,12 @@ public class EnderCoreGenerator extends ModMachineBlock {
|
|||||||
this.isBlockContainer = true;
|
this.isBlockContainer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockAdded(World world, int x, int y, int z) {
|
||||||
|
((TileEntityCoreGenerator)world.getTileEntity(x, y, z)).setCoords(x, y, z);
|
||||||
|
super.onBlockAdded(world, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int var) {
|
public TileEntity createNewTileEntity(World world, int var) {
|
||||||
return new TileEntityEnderCoreGenerator();
|
return new TileEntityEnderCoreGenerator();
|
||||||
@ -81,8 +88,22 @@ public class EnderCoreGenerator extends ModMachineBlock {
|
|||||||
public void isMultiBlock(World world, int x, int y, int z) {
|
public void isMultiBlock(World world, int x, int y, int z) {
|
||||||
if (world.getBlock(x, y+1, z) == ModBlocks.CoreStabilizer && world.getBlock(x, y-1, z) == ModBlocks.CoreStabilizer && world.getBlock(x, y-2, z) == ModBlocks.blockofashadwithquaridium && world.getBlock(x, y+2, z) == ModBlocks.blockofashadwithquaridium) {
|
if (world.getBlock(x, y+1, z) == ModBlocks.CoreStabilizer && world.getBlock(x, y-1, z) == ModBlocks.CoreStabilizer && world.getBlock(x, y-2, z) == ModBlocks.blockofashadwithquaridium && world.getBlock(x, y+2, z) == ModBlocks.blockofashadwithquaridium) {
|
||||||
((TileEntityEnderCoreGenerator)world.getTileEntity(x, y, z)).multiblock = true;
|
((TileEntityEnderCoreGenerator)world.getTileEntity(x, y, z)).multiblock = true;
|
||||||
|
((TileEntityCoreStabilizer)world.getTileEntity(x, y+1, z)).multiblock = true;
|
||||||
|
((TileEntityCoreStabilizer)world.getTileEntity(x, y-1, z)).multiblock = true;
|
||||||
|
world.markBlockForUpdate(x, y+1, z);
|
||||||
|
world.markBlockForUpdate(x, y-1, z);
|
||||||
} else {
|
} else {
|
||||||
((TileEntityEnderCoreGenerator)world.getTileEntity(x, y, z)).multiblock = false;
|
((TileEntityEnderCoreGenerator)world.getTileEntity(x, y, z)).multiblock = false;
|
||||||
|
if (world.getTileEntity(x, y+1, z) instanceof TileEntityCoreStabilizer) {
|
||||||
|
((TileEntityCoreStabilizer)world.getTileEntity(x, y+1, z)).multiblock = false;
|
||||||
|
((TileEntityCoreStabilizer)world.getTileEntity(x, y+1, z)).version = 0;
|
||||||
|
world.markBlockForUpdate(x, y+1, z);
|
||||||
|
}
|
||||||
|
if (world.getTileEntity(x, y-1, z) instanceof TileEntityCoreStabilizer) {
|
||||||
|
((TileEntityCoreStabilizer)world.getTileEntity(x, y-1, z)).multiblock = false;
|
||||||
|
((TileEntityCoreStabilizer)world.getTileEntity(x, y-1, z)).version = 0;
|
||||||
|
world.markBlockForUpdate(x, y-1, z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
world.markBlockForUpdate(x, y, z);
|
world.markBlockForUpdate(x, y, z);
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import net.minecraft.world.World;
|
|||||||
|
|
||||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.AdvancedSatelliteUtilization;
|
import org.bitbucket.alltra101ify.advancedsatelliteutilization.AdvancedSatelliteUtilization;
|
||||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modGUIs.ModGUIs;
|
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modGUIs.ModGUIs;
|
||||||
|
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityCoreStabilizer;
|
||||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityEnderCoreGenerator;
|
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityEnderCoreGenerator;
|
||||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityNetherCoreGenerator;
|
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityNetherCoreGenerator;
|
||||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.moditems.ModItems;
|
import org.bitbucket.alltra101ify.advancedsatelliteutilization.moditems.ModItems;
|
||||||
@ -37,7 +38,6 @@ public class NetherCoreGenerator extends ModMachineBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int var) {
|
public TileEntity createNewTileEntity(World world, int var) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return new TileEntityNetherCoreGenerator();
|
return new TileEntityNetherCoreGenerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +53,12 @@ public class NetherCoreGenerator extends ModMachineBlock {
|
|||||||
super.updateTick(world, x, y, z, r);
|
super.updateTick(world, x, y, z, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockAdded(World world, int x, int y, int z) {
|
||||||
|
((TileEntityCoreGenerator)world.getTileEntity(x, y, z)).setCoords(x, y, z);
|
||||||
|
super.onBlockAdded(world, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||||
if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == ModItems.wrench) {
|
if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == ModItems.wrench) {
|
||||||
@ -74,9 +80,20 @@ public class NetherCoreGenerator extends ModMachineBlock {
|
|||||||
public void isMultiBlock(World world, int x, int y, int z) {
|
public void isMultiBlock(World world, int x, int y, int z) {
|
||||||
if (world.getBlock(x, y+1, z) == ModBlocks.CoreStabilizer && world.getBlock(x, y-1, z) == ModBlocks.CoreStabilizer && world.getBlock(x, y-2, z) == ModBlocks.blockofashadwithquaridium && world.getBlock(x, y+2, z) == ModBlocks.blockofashadwithquaridium) {
|
if (world.getBlock(x, y+1, z) == ModBlocks.CoreStabilizer && world.getBlock(x, y-1, z) == ModBlocks.CoreStabilizer && world.getBlock(x, y-2, z) == ModBlocks.blockofashadwithquaridium && world.getBlock(x, y+2, z) == ModBlocks.blockofashadwithquaridium) {
|
||||||
((TileEntityNetherCoreGenerator)world.getTileEntity(x, y, z)).multiblock = true;
|
((TileEntityNetherCoreGenerator)world.getTileEntity(x, y, z)).multiblock = true;
|
||||||
|
((TileEntityCoreStabilizer)world.getTileEntity(x, y+1, z)).multiblock = true;
|
||||||
|
((TileEntityCoreStabilizer)world.getTileEntity(x, y-1, z)).multiblock = true;
|
||||||
|
world.markBlockForUpdate(x, y+1, z);
|
||||||
|
world.markBlockForUpdate(x, y-1, z);
|
||||||
} else {
|
} else {
|
||||||
((TileEntityNetherCoreGenerator)world.getTileEntity(x, y, z)).multiblock = false;
|
((TileEntityNetherCoreGenerator)world.getTileEntity(x, y, z)).multiblock = false;
|
||||||
|
if (world.getTileEntity(x, y+1, z) instanceof TileEntityCoreStabilizer) {
|
||||||
|
((TileEntityCoreStabilizer)world.getTileEntity(x, y+1, z)).multiblock = false;
|
||||||
|
world.markBlockForUpdate(x, y+1, z);
|
||||||
|
}
|
||||||
|
if (world.getTileEntity(x, y-1, z) instanceof TileEntityCoreStabilizer) {
|
||||||
|
((TileEntityCoreStabilizer)world.getTileEntity(x, y-1, z)).multiblock = false;
|
||||||
|
world.markBlockForUpdate(x, y-1, z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
world.markBlockForUpdate(x, y, z);
|
world.markBlockForUpdate(x, y, z);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities;
|
package org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities;
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
@ -9,10 +8,8 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class TileEntityCoreStabilizer extends TileEntity {
|
public class TileEntityCoreStabilizer extends TileEntity {
|
||||||
World world;
|
|
||||||
|
|
||||||
public TileEntityCoreStabilizer(World world) {
|
public TileEntityCoreStabilizer(World world) {
|
||||||
this.world = world;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileEntityCoreStabilizer() {
|
public TileEntityCoreStabilizer() {
|
||||||
@ -20,30 +17,19 @@ public class TileEntityCoreStabilizer extends TileEntity {
|
|||||||
|
|
||||||
public float rotationY;
|
public float rotationY;
|
||||||
float speed;
|
float speed;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean onOff = false;
|
|
||||||
|
|
||||||
public boolean multiblock;
|
|
||||||
|
|
||||||
public byte version;
|
public byte version;
|
||||||
|
public boolean multiblock;
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
|
||||||
if (!multiblock && onOff) {
|
|
||||||
onOff = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
rotationY += speed;
|
rotationY += speed;
|
||||||
if (rotationY >= 6.3f) {
|
if (rotationY >= 6.3f) {
|
||||||
rotationY = 0f;
|
rotationY = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onOff && speed < 0.055f) {
|
if (multiblock && speed < 0.08f) {
|
||||||
speed += 0.001f;
|
speed += 0.001f;
|
||||||
} else if (onOff == false && speed > 0f) {
|
} else if (multiblock == false && speed > 0f) {
|
||||||
speed -= 0.001f;
|
speed -= 0.001f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +39,7 @@ public class TileEntityCoreStabilizer extends TileEntity {
|
|||||||
public void readFromNBT(NBTTagCompound var1) {
|
public void readFromNBT(NBTTagCompound var1) {
|
||||||
this.rotationY = var1.getFloat("rotationY");
|
this.rotationY = var1.getFloat("rotationY");
|
||||||
this.speed = var1.getFloat("speed");
|
this.speed = var1.getFloat("speed");
|
||||||
this.onOff = var1.getBoolean("onOff");
|
this.multiblock = var1.getBoolean("multiblock");
|
||||||
super.readFromNBT(var1);
|
super.readFromNBT(var1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +47,7 @@ public class TileEntityCoreStabilizer extends TileEntity {
|
|||||||
public void writeToNBT(NBTTagCompound var1) {
|
public void writeToNBT(NBTTagCompound var1) {
|
||||||
var1.setFloat("rotationY", this.rotationY);
|
var1.setFloat("rotationY", this.rotationY);
|
||||||
var1.setFloat("speed", this.speed);
|
var1.setFloat("speed", this.speed);
|
||||||
var1.setBoolean("onOff", this.onOff);
|
var1.setBoolean("multiblock", this.multiblock);
|
||||||
super.writeToNBT(var1);
|
super.writeToNBT(var1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import net.minecraft.nbt.NBTTagList;
|
|||||||
|
|
||||||
public class TileEntityEnderCoreGenerator extends TileEntityCoreGenerator implements ISidedInventory {
|
public class TileEntityEnderCoreGenerator extends TileEntityCoreGenerator implements ISidedInventory {
|
||||||
int[] fuelqueue;
|
int[] fuelqueue;
|
||||||
|
|
||||||
public TileEntityEnderCoreGenerator() {
|
public TileEntityEnderCoreGenerator() {
|
||||||
fuelqueue = new int[1];
|
fuelqueue = new int[1];
|
||||||
fuelqueue[0] = 100;
|
fuelqueue[0] = 100;
|
||||||
|
@ -13,15 +13,13 @@ public class TileEntityNetherCoreGenerator extends TileEntityCoreGenerator imple
|
|||||||
Item[] item;
|
Item[] item;
|
||||||
int[] fuel;
|
int[] fuel;
|
||||||
public TileEntityNetherCoreGenerator() {
|
public TileEntityNetherCoreGenerator() {
|
||||||
|
|
||||||
fuel = new int[1];
|
fuel = new int[1];
|
||||||
item = new Item[1];
|
item = new Item[1];
|
||||||
fuel[0] = 110;
|
fuel[0] = 110;
|
||||||
item[0] = Items.blaze_rod;
|
item[0] = Items.blaze_rod;
|
||||||
|
setParticle("flame");
|
||||||
configureVars(fuel, 30000, 125);
|
configureVars(fuel, 30000, 125);
|
||||||
ItemValidityByItem(item);
|
ItemValidityByItem(item);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,35 +27,13 @@ public class Wrench extends Item {
|
|||||||
setCreativeTab(ModCreativeTabs.TabASU);
|
setCreativeTab(ModCreativeTabs.TabASU);
|
||||||
setUnlocalizedName("WrenchUtility");
|
setUnlocalizedName("WrenchUtility");
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
|
setTextureName(ModInfo.MODID + ":" + getUnlocalizedName().substring(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFull3D() {
|
public boolean isFull3D() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerIcons(IIconRegister register) {
|
|
||||||
iconArray = new IIcon[2];
|
|
||||||
|
|
||||||
for (int i = 0; i < iconArray.length; ++i) {
|
|
||||||
iconArray[i] = register.registerIcon(ModInfo.MODID + ":" + "WrenchUtility/" + getUnlocalizedName().substring(5) + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.itemIcon = iconArray[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIcon(ItemStack stack, int renderPass) {
|
|
||||||
if (stack.stackTagCompound != null && stack.stackTagCompound.getByte("Mode") == -1) {
|
|
||||||
return iconArray[0];
|
|
||||||
} else if (stack.stackTagCompound != null && stack.stackTagCompound.getByte("Mode") != -1) {
|
|
||||||
return iconArray[1];
|
|
||||||
}
|
|
||||||
return iconArray[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreated(ItemStack itemstack, World world, EntityPlayer player) {
|
public void onCreated(ItemStack itemstack, World world, EntityPlayer player) {
|
||||||
NBTSetup(itemstack, world, player);
|
NBTSetup(itemstack, world, player);
|
||||||
|
@ -45,7 +45,7 @@ public class ASUCoreTogglePacket implements IMessage {
|
|||||||
@Override
|
@Override
|
||||||
public IMessage onMessage(ASUCoreTogglePacket message, MessageContext ctx) {
|
public IMessage onMessage(ASUCoreTogglePacket message, MessageContext ctx) {
|
||||||
TileEntity tileentity = ctx.getServerHandler().playerEntity.getEntityWorld().getTileEntity(message.x, message.y, message.z);
|
TileEntity tileentity = ctx.getServerHandler().playerEntity.getEntityWorld().getTileEntity(message.x, message.y, message.z);
|
||||||
if (message.toggle == 1) {
|
if (tileentity instanceof TileEntityCoreGenerator && message.toggle == 1) {
|
||||||
((TileEntityCoreGenerator)tileentity).toggle = true;
|
((TileEntityCoreGenerator)tileentity).toggle = true;
|
||||||
} else {
|
} else {
|
||||||
((TileEntityCoreGenerator)tileentity).toggle = false;
|
((TileEntityCoreGenerator)tileentity).toggle = false;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference;
|
package org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.moditems.ModItems;
|
import org.bitbucket.alltra101ify.advancedsatelliteutilization.moditems.ModItems;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -15,38 +17,13 @@ import net.minecraft.tileentity.TileEntity;
|
|||||||
|
|
||||||
public class TileEntityCoreGenerator extends TileEntity implements ISidedInventory {
|
public class TileEntityCoreGenerator extends TileEntity implements ISidedInventory {
|
||||||
protected ItemStack[] items = new ItemStack[4];
|
protected ItemStack[] items = new ItemStack[4];
|
||||||
|
public boolean toggle, multiblock;
|
||||||
public boolean inputItems;
|
|
||||||
public boolean outputPower;
|
|
||||||
|
|
||||||
public boolean toggle;
|
|
||||||
|
|
||||||
public boolean multiblock;
|
|
||||||
|
|
||||||
protected String customName;
|
protected String customName;
|
||||||
|
public int currentfuelqueue, maxpower, currentPower, cooldown, currentcooldown, fuelqueue[];
|
||||||
protected int currentfuelqueue;
|
public float rotationX, rotationY, speed, speedSlower;
|
||||||
|
|
||||||
private int fuelqueue[];
|
|
||||||
|
|
||||||
public float rotationY;
|
|
||||||
|
|
||||||
public float rotationX;
|
|
||||||
|
|
||||||
public int maxpower;
|
|
||||||
|
|
||||||
public int currentPower;
|
|
||||||
|
|
||||||
protected float speed;
|
|
||||||
|
|
||||||
protected float speedSlower;
|
|
||||||
|
|
||||||
protected int cooldown;
|
|
||||||
|
|
||||||
public int currentcooldown;
|
|
||||||
|
|
||||||
Item[] validItemByItem;
|
Item[] validItemByItem;
|
||||||
String validItemByString;
|
String validItemByString, particle;
|
||||||
|
protected int x, y, z;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
@ -74,19 +51,17 @@ public class TileEntityCoreGenerator extends TileEntity implements ISidedInvento
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentPower >= maxpower) {
|
if (currentPower >= maxpower) {
|
||||||
inputItems = false;
|
|
||||||
currentPower = maxpower;
|
currentPower = maxpower;
|
||||||
}
|
}
|
||||||
if (currentPower <= 0) {
|
if (currentPower <= 0) {
|
||||||
outputPower = false;
|
|
||||||
currentPower = 0;
|
currentPower = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toggle) {
|
if (toggle) {
|
||||||
//Register fuel and such using item and fuel index system
|
//Register fuel and such using item and fuel index system
|
||||||
if (items[0] != null && this.validItemByItem != null) {
|
if (items[0] != null && this.validItemByItem != null) {
|
||||||
for (int i = 0; i < validItemByItem.length; i++) {
|
for (int i = 0; i < validItemByItem.length; i++) {
|
||||||
if (currentfuelqueue <= maxpower - fuelqueue[i] && currentcooldown == 0 && items[0].getItem() == validItemByItem[i]) {
|
if (currentcooldown == 0 && currentfuelqueue <= maxpower - fuelqueue[i] && items[0].getItem() == validItemByItem[i]) {
|
||||||
if (items[0].stackSize == 1) {
|
if (items[0].stackSize == 1) {
|
||||||
this.items[0] = null;
|
this.items[0] = null;
|
||||||
} else {
|
} else {
|
||||||
@ -145,7 +120,6 @@ public class TileEntityCoreGenerator extends TileEntity implements ISidedInvento
|
|||||||
|
|
||||||
} else if (toggle == false && speed > 0f) {
|
} else if (toggle == false && speed > 0f) {
|
||||||
speed -= 0.0005f;
|
speed -= 0.0005f;
|
||||||
|
|
||||||
speedSlower -= 0.00007f;
|
speedSlower -= 0.00007f;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -352,5 +326,21 @@ public class TileEntityCoreGenerator extends TileEntity implements ISidedInvento
|
|||||||
this.validItemByString = string;
|
this.validItemByString = string;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public int RetrievePower (int amountofpower) {
|
||||||
|
if (currentPower >= amountofpower) {
|
||||||
|
currentPower = currentPower - amountofpower;
|
||||||
|
}
|
||||||
|
return amountofpower;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCoords(int x, int y, int z) {
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParticle(String particle) {
|
||||||
|
this.particle = particle;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -26,7 +26,7 @@ public class RenderCoreStabilizer extends TileEntitySpecialRenderer {
|
|||||||
|
|
||||||
GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f);
|
GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f);
|
||||||
GL11.glRotatef(180, 0f, 0f, 1f);
|
GL11.glRotatef(180, 0f, 0f, 1f);
|
||||||
this.bindTexture(texture[tileentity.version]);
|
this.bindTexture(texture[1]);
|
||||||
|
|
||||||
modelASU.renderModel(0.0625f);
|
modelASU.renderModel(0.0625f);
|
||||||
|
|
||||||
@ -35,9 +35,9 @@ public class RenderCoreStabilizer extends TileEntitySpecialRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public RenderCoreStabilizer() {
|
public RenderCoreStabilizer() {
|
||||||
texture[0] = new ResourceLocation(ModInfo.MODID + ":" + "/textures/models/CoreStabilizer/ModelCoreStabilizer0.png");
|
for (int i = 0; i < texture.length; i++) {
|
||||||
texture[1] = new ResourceLocation(ModInfo.MODID + ":" + "/textures/models/CoreStabilizer/ModelCoreStabilizer1.png");
|
texture[i] = new ResourceLocation(ModInfo.MODID + ":" + "/textures/models/CoreStabilizer/ModelCoreStabilizer" + i +".png");
|
||||||
texture[2] = new ResourceLocation(ModInfo.MODID + ":" + "/textures/models/CoreStabilizer/ModelCoreStabilizer2.png");
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 261 B |
BIN
src/main/resources/assets/asu/textures/items/WrenchUtility.png
Normal file
After Width: | Height: | Size: 336 B |
Before Width: | Height: | Size: 340 B |
Before Width: | Height: | Size: 1.9 KiB |
@ -1,38 +0,0 @@
|
|||||||
{
|
|
||||||
"animation": {
|
|
||||||
"frames": [
|
|
||||||
16,
|
|
||||||
17,
|
|
||||||
18,
|
|
||||||
19,
|
|
||||||
20,
|
|
||||||
21,
|
|
||||||
22,
|
|
||||||
23,
|
|
||||||
24,
|
|
||||||
25,
|
|
||||||
26,
|
|
||||||
27,
|
|
||||||
28,
|
|
||||||
29,
|
|
||||||
30,
|
|
||||||
31,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
4,
|
|
||||||
5,
|
|
||||||
6,
|
|
||||||
7,
|
|
||||||
8,
|
|
||||||
9,
|
|
||||||
10,
|
|
||||||
11,
|
|
||||||
12,
|
|
||||||
13,
|
|
||||||
14,
|
|
||||||
15
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 514 B After Width: | Height: | Size: 443 B |
Before Width: | Height: | Size: 507 B After Width: | Height: | Size: 262 B |