Added Advanced Waste Handler

This commit is contained in:
Harrison Deng 2015-11-26 21:53:37 -05:00
parent f1581ef2fc
commit 42bec8abb9
21 changed files with 223 additions and 525 deletions

View File

@ -1,7 +1,9 @@
package org.bitbucket.alltra101ify.advancedsatelliteutilization.modGUIs;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityAdvancedWasteHandler;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityEnderCoreGenerator;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityNetherCoreGenerator;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modcontainers.ContainerAdvancedWasteHandler;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modcontainers.ContainerEnderCoreGenerator;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modcontainers.ContainerNetherCoreGenerator;
@ -20,6 +22,8 @@ public class ASUGuiHandler implements IGuiHandler {
case ModGUIs.ENDERCOREGENERATORID: if (tileentity instanceof TileEntityEnderCoreGenerator) returned = new ContainerEnderCoreGenerator(player.inventory, (TileEntityEnderCoreGenerator)tileentity);
break;
case ModGUIs.NETHERCOREGENERATORID: if (tileentity instanceof TileEntityNetherCoreGenerator) returned = new ContainerNetherCoreGenerator(player.inventory, (TileEntityNetherCoreGenerator)tileentity);
break;
case ModGUIs.ADVANCEDWASTEHANDLERID: if (tileentity instanceof TileEntityAdvancedWasteHandler) returned = new ContainerAdvancedWasteHandler(player.inventory, (TileEntityAdvancedWasteHandler)tileentity);
}
return returned;
@ -37,6 +41,7 @@ public class ASUGuiHandler implements IGuiHandler {
break;
case ModGUIs.NETHERCOREGENERATORID: if (tileentity instanceof TileEntityNetherCoreGenerator) returned = new GuiNetherCoreGenerator(player.inventory, (TileEntityNetherCoreGenerator)tileentity);
break;
case ModGUIs.ADVANCEDWASTEHANDLERID: if (tileentity instanceof TileEntityAdvancedWasteHandler) returned = new GuiAdvancedWasteHandler(player.inventory, (TileEntityAdvancedWasteHandler)tileentity);
}
return returned;

View File

@ -18,7 +18,9 @@ import net.minecraft.world.World;
public class GuiEnderCoreGenerator extends GuiContainer {
int scaledtobar, scaledtopercentage, scaledtofueltransfer, currentcooldown, currentpower;
int scaledtobar, scaledtopercentage, scaledtofueltransfer, currentcooldown;
float currentpower;
private ResourceLocation resource = new ResourceLocation(ModInfo.MODID + ":" + "textures/gui/GuiCoreGenerator.png");
private TileEntityEnderCoreGenerator tileentity;

View File

@ -16,7 +16,9 @@ import net.minecraft.inventory.Container;
import net.minecraft.util.ResourceLocation;
public class GuiNetherCoreGenerator extends GuiContainer {
int scaledtobar, scaledtopercentage, scaledtofueltransfer, currentcooldown, currentpower;
int scaledtobar, scaledtopercentage, scaledtofueltransfer, currentcooldown;
float currentpower;
private ResourceLocation resource = new ResourceLocation(ModInfo.MODID + ":" + "textures/gui/GUICoreGenerator.png");
private TileEntityNetherCoreGenerator tileentity;

View File

@ -4,5 +4,6 @@ public class ModGUIs {
public static final byte ENDERCOREGENERATORID = 0;
public static final byte NETHERCOREGENERATORID = 1;
public static final byte ADVANCEDWASTEHANDLERID = 2;
}

View File

@ -5,7 +5,7 @@ import org.bitbucket.alltra101ify.advancedsatelliteutilization.moditems.ModItems
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.ModCreativeTabs;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.ModInfo;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.ModMachineBlock;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.TileEntityCoreGenerator;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.TileEntityGenerator;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
@ -51,7 +51,7 @@ public class CoreStabilizer extends ModMachineBlock {
if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == ModItems.wrench) {
int[] info = this.wrenched(player, world, x, y, z, false, 0, (byte) 0, new ItemStack(ModBlocks.CoreStabilizer, 1));
}
return true;
return false;
}
@Override
@ -61,13 +61,15 @@ public class CoreStabilizer extends ModMachineBlock {
}
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 TileEntityGenerator) {
world.scheduleBlockUpdate(x, y+1, z, world.getBlock(x, y+1, z), 0);
} else if (world.getTileEntity(x, y-1, z) instanceof TileEntityCoreGenerator) {
} else if (world.getTileEntity(x, y-1, z) instanceof TileEntityGenerator) {
world.scheduleBlockUpdate(x, y-1, z, world.getBlock(x, y-1, z), 0);
} else {
((TileEntityCoreStabilizer)world.getTileEntity(x, y, z)).multiblock = false;
world.markBlockForUpdate(x, y, z);
}
}
}

View File

@ -10,7 +10,7 @@ import org.bitbucket.alltra101ify.advancedsatelliteutilization.moditems.ModItems
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.ModCreativeTabs;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.ModInfo;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.ModMachineBlock;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.TileEntityCoreGenerator;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.TileEntityGenerator;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
@ -44,7 +44,7 @@ public class EnderCoreGenerator extends ModMachineBlock {
@Override
public void onBlockAdded(World world, int x, int y, int z) {
((TileEntityCoreGenerator)world.getTileEntity(x, y, z)).setCoords(x, y, z);
((TileEntityGenerator)world.getTileEntity(x, y, z)).setCoords(x, y, z);
super.onBlockAdded(world, x, y, z);
}
@ -69,7 +69,7 @@ public class EnderCoreGenerator extends ModMachineBlock {
@Override
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) {
int[] info = this.wrenched(player, world, x, y, z, ((TileEntityEnderCoreGenerator)world.getTileEntity(x, y, z)).multiblock, ((TileEntityEnderCoreGenerator)world.getTileEntity(x, y, z)).currentPower, (byte) ((TileEntityEnderCoreGenerator)world.getTileEntity(x, y, z)).powerScaled(100), new ItemStack(ModBlocks.EnderCoreGenerator, 1));
int[] info = this.wrenched(player, world, x, y, z, ((TileEntityEnderCoreGenerator)world.getTileEntity(x, y, z)).multiblock, (int) ((TileEntityEnderCoreGenerator)world.getTileEntity(x, y, z)).currentPower, (byte) ((TileEntityEnderCoreGenerator)world.getTileEntity(x, y, z)).powerScaled(100), new ItemStack(ModBlocks.EnderCoreGenerator, 1));
switch (info[1]) {
case 0: ((TileEntityEnderCoreGenerator)world.getTileEntity(x, y, z)).currentPower = info[0];
@ -81,8 +81,9 @@ public class EnderCoreGenerator extends ModMachineBlock {
}
} else if (world.getTileEntity(x, y, z) != null && ((TileEntityEnderCoreGenerator)world.getTileEntity(x, y, z)).humanInterface() && !world.isRemote && ((TileEntityEnderCoreGenerator)world.getTileEntity(x, y, z)).multiblock) {
FMLNetworkHandler.openGui(player, AdvancedSatelliteUtilization.instance, ModGUIs.ENDERCOREGENERATORID, world, x, y, z);
return true;
}
return true;
return false;
}
public void isMultiBlock(World world, int x, int y, int z) {
@ -107,5 +108,18 @@ public class EnderCoreGenerator extends ModMachineBlock {
}
world.markBlockForUpdate(x, y, z);
}
@Override
public int getRenderType() {
return -1;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
}

View File

@ -12,6 +12,8 @@ public class ModBlocks {
public static Block ASUPedestal = new ASUPedestal();
public static Block EnderCoreGenerator = new EnderCoreGenerator();
public static Block CoreStabilizer = new CoreStabilizer();
public static Block AdvancedWasteHandler_active = new AdvancedWasteHandler(true);
public static Block AdvancedWasteHandler = new AdvancedWasteHandler(false);
public static Block quaridiumOre = new QuaridiumOre(Material.iron);
public static Block blockofashadwithquaridium = new blockOfASHADWithQuaridium(Material.iron);
public static Block netherCoreGenerator = new NetherCoreGenerator();
@ -25,5 +27,7 @@ public class ModBlocks {
ASURegistryHelper.registerBlock(quaridiumOre);
ASURegistryHelper.registerBlock(blockofashadwithquaridium);
ASURegistryHelper.registerBlock(netherCoreGenerator);
ASURegistryHelper.registerBlock(AdvancedWasteHandler);
ASURegistryHelper.registerBlock(AdvancedWasteHandler_active);
}
}

View File

@ -18,7 +18,7 @@ import org.bitbucket.alltra101ify.advancedsatelliteutilization.moditems.ModItems
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.ModCreativeTabs;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.ModInfo;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.ModMachineBlock;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.TileEntityCoreGenerator;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.TileEntityGenerator;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
@ -55,14 +55,14 @@ public class NetherCoreGenerator extends ModMachineBlock {
@Override
public void onBlockAdded(World world, int x, int y, int z) {
((TileEntityCoreGenerator)world.getTileEntity(x, y, z)).setCoords(x, y, z);
((TileEntityGenerator)world.getTileEntity(x, y, z)).setCoords(x, y, z);
super.onBlockAdded(world, x, y, z);
}
@Override
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) {
int[] info = this.wrenched(player, world, x, y, z, ((TileEntityNetherCoreGenerator)world.getTileEntity(x, y, z)).multiblock, ((TileEntityNetherCoreGenerator)world.getTileEntity(x, y, z)).currentPower, (byte) ((TileEntityNetherCoreGenerator)world.getTileEntity(x, y, z)).powerScaled(100), new ItemStack(ModBlocks.netherCoreGenerator, 1));
int[] info = this.wrenched(player, world, x, y, z, ((TileEntityNetherCoreGenerator)world.getTileEntity(x, y, z)).multiblock, (int) ((TileEntityNetherCoreGenerator)world.getTileEntity(x, y, z)).currentPower, (byte) ((TileEntityNetherCoreGenerator)world.getTileEntity(x, y, z)).powerScaled(100), new ItemStack(ModBlocks.netherCoreGenerator, 1));
switch (info[1]) {
case 0: ((TileEntityNetherCoreGenerator)world.getTileEntity(x, y, z)).currentPower = info[0];
@ -73,14 +73,13 @@ public class NetherCoreGenerator extends ModMachineBlock {
}
} else if (world.getTileEntity(x, y, z) != null && ((TileEntityNetherCoreGenerator)world.getTileEntity(x, y, z)).humanInterface() && !world.isRemote && ((TileEntityNetherCoreGenerator)world.getTileEntity(x, y, z)).multiblock) {
FMLNetworkHandler.openGui(player, AdvancedSatelliteUtilization.instance, ModGUIs.NETHERCOREGENERATORID, world, x, y, z);
return true;
}
return true;
return false;
}
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) {
world.setBlock(x, y+1, z, ModBlocks.CoreStabilizer);
world.setBlock(x, y-1, z, ModBlocks.CoreStabilizer);
((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;
@ -90,16 +89,26 @@ public class NetherCoreGenerator extends ModMachineBlock {
((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.setBlock(x, y+1, z, ModBlocks.CoreStabilizer);
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.setBlock(x, y, z, ModBlocks.CoreStabilizer);
world.markBlockForUpdate(x, y-1, z);
}
}
world.markBlockForUpdate(x, y, z);
}
@Override
public int getRenderType() {
return -1;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
}

View File

@ -9,6 +9,8 @@ public class ModTileEntities {
ASURegistryHelper.registerTileEntity(TileEntityASUPedestal.class, "ASUPedestal");
ASURegistryHelper.registerTileEntity(TileEntityEnderCoreGenerator.class, "EnderCore");
ASURegistryHelper.registerTileEntity(TileEntityNetherCoreGenerator.class, "NetherCore");
ASURegistryHelper.registerTileEntity(TileEntityAdvancedWasteHandler.class, "AdvancedWasteHandler_true");
ASURegistryHelper.registerTileEntity(TileEntityAdvancedWasteHandler.class, "AdvancedWasteHandler_false");
}
}

View File

@ -1,13 +1,13 @@
package org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.TileEntityCoreGenerator;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.TileEntityGenerator;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
public class TileEntityEnderCoreGenerator extends TileEntityCoreGenerator implements ISidedInventory {
public class TileEntityEnderCoreGenerator extends TileEntityGenerator implements ISidedInventory {
int[] fuelqueue;
public TileEntityEnderCoreGenerator() {
@ -17,70 +17,73 @@ public class TileEntityEnderCoreGenerator extends TileEntityCoreGenerator implem
configureVars(fuelqueue);
configureVars(150);
setMaxPower(40000);
setItems(new ItemStack[4]);
setUpgradeslotstart(1);
setFuelConversionSpeed(15F);
}
@Override
public void readFromNBT(NBTTagCompound var1) {
this.rotationY = var1.getFloat("rotationY");
this.rotationX = var1.getFloat("rotationX");
this.speed = var1.getFloat("speed");
this.toggle = var1.getBoolean("toggle");
this.speedSlower = var1.getFloat("speedSlower");
this.currentPower = var1.getInteger("currentPower");
this.multiblock = var1.getBoolean("multiblock");
this.currentPower = var1.getInteger("currentPower");
this.currentfuelqueue = var1.getInteger("Fuel");
this.currentcooldown = var1.getInteger("currentCooldown");
this.cooldown = var1.getInteger("cooldown");
NBTTagList slots = var1.getTagList("items", 10);
this.items = new ItemStack[getSizeInventory()];
for (int i = 0; i < slots.tagCount(); i++) {
NBTTagCompound item = slots.getCompoundTagAt(i);
byte itemPos = item.getByte("itemPos");
if (itemPos >= 0 && itemPos < this.items.length) {
this.items[itemPos] = ItemStack.loadItemStackFromNBT(item);
}
if (var1.hasKey("customName")) {
this.setCustomInventoryName(var1.getString("customName"));
}
}
super.readFromNBT(var1);
}
@Override
public void writeToNBT(NBTTagCompound var1) {
var1.setFloat("rotationY", this.rotationY);
var1.setFloat("rotationX", this.rotationX);
var1.setFloat("speed", this.speed);
var1.setBoolean("toggle", this.toggle);
var1.setFloat("speedSlower", this.speedSlower);
var1.setBoolean("multiblock", this.multiblock);
var1.setInteger("currentPower", this.currentPower);
var1.setInteger("Fuel", this.currentfuelqueue);
var1.setInteger("currentCooldown", this.currentcooldown);
var1.setInteger("cooldown", this.cooldown);
NBTTagList slots = new NBTTagList();
for (int i = 0; i < items.length; i++) {
if (this.items[i] != null) {
NBTTagCompound item = new NBTTagCompound();
item.setByte("itemPos", (byte) i);
this.items[i].writeToNBT(item);
slots.appendTag(item);
}
}
if (this.hasCustomInventoryName()) {
var1.setString("customName", this.customName);
}
var1.setTag("items", slots);
super.writeToNBT(var1);
}
// @Override
// public void readFromNBT(NBTTagCompound var1) {
// this.rotationY = var1.getFloat("rotationY");
// this.rotationX = var1.getFloat("rotationX");
// this.speed = var1.getFloat("speed");
// this.toggle = var1.getBoolean("toggle");
// this.speedSlower = var1.getFloat("speedSlower");
// this.currentPower = var1.getInteger("currentPower");
// this.multiblock = var1.getBoolean("multiblock");
// this.currentPower = var1.getInteger("currentPower");
// this.currentfuelqueue = var1.getInteger("Fuel");
// this.currentcooldown = var1.getInteger("currentCooldown");
// this.cooldown = var1.getInteger("cooldown");
//
// NBTTagList slots = var1.getTagList("items", 10);
// this.items = new ItemStack[getSizeInventory()];
//
// for (int i = 0; i < slots.tagCount(); i++) {
// NBTTagCompound item = slots.getCompoundTagAt(i);
// byte itemPos = item.getByte("itemPos");
//
// if (itemPos >= 0 && itemPos < this.items.length) {
// this.items[itemPos] = ItemStack.loadItemStackFromNBT(item);
// }
//
// if (var1.hasKey("customName")) {
// this.setCustomInventoryName(var1.getString("customName"));
// }
//
// }
//
// super.readFromNBT(var1);
// }
//
// @Override
// public void writeToNBT(NBTTagCompound var1) {
// var1.setFloat("rotationY", this.rotationY);
// var1.setFloat("rotationX", this.rotationX);
// var1.setFloat("speed", this.speed);
// var1.setBoolean("toggle", this.toggle);
// var1.setFloat("speedSlower", this.speedSlower);
// var1.setBoolean("multiblock", this.multiblock);
// var1.setInteger("currentPower", this.currentPower);
// var1.setInteger("Fuel", this.currentfuelqueue);
// var1.setInteger("currentCooldown", this.currentcooldown);
// var1.setInteger("cooldown", this.cooldown);
//
// NBTTagList slots = new NBTTagList();
// for (int i = 0; i < items.length; i++) {
// if (this.items[i] != null) {
// NBTTagCompound item = new NBTTagCompound();
// item.setByte("itemPos", (byte) i);
// this.items[i].writeToNBT(item);
// slots.appendTag(item);
// }
// }
//
// if (this.hasCustomInventoryName()) {
// var1.setString("customName", this.customName);
// }
// var1.setTag("items", slots);
// super.writeToNBT(var1);
//
// }
}

View File

@ -7,9 +7,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.TileEntityCoreGenerator;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.TileEntityGenerator;
public class TileEntityNetherCoreGenerator extends TileEntityCoreGenerator implements ISidedInventory {
public class TileEntityNetherCoreGenerator extends TileEntityGenerator implements ISidedInventory {
Item[] item;
int[] fuel;
public TileEntityNetherCoreGenerator() {
@ -19,71 +19,74 @@ public class TileEntityNetherCoreGenerator extends TileEntityCoreGenerator imple
item[0] = Items.blaze_rod;
setParticle("flame");
configureVars(fuel, 30000, 125);
ItemValidityByItem(item);
ItemValidityByItem(item);
setItems(new ItemStack[4]);
setUpgradeslotstart(1);
setFuelConversionSpeed(15F);
}
@Override
public void readFromNBT(NBTTagCompound var1) {
this.rotationY = var1.getFloat("rotationY");
this.rotationX = var1.getFloat("rotationX");
this.speed = var1.getFloat("speed");
this.toggle = var1.getBoolean("toggle");
this.speedSlower = var1.getFloat("speedSlower");
this.currentPower = var1.getInteger("currentPower");
this.multiblock = var1.getBoolean("multiblock");
this.currentPower = var1.getInteger("currentPower");
this.currentfuelqueue = var1.getInteger("Fuel");
this.currentcooldown = var1.getInteger("currentCooldown");
this.cooldown = var1.getInteger("cooldown");
NBTTagList slots = var1.getTagList("items", 10);
this.items = new ItemStack[getSizeInventory()];
for (int i = 0; i < slots.tagCount(); i++) {
NBTTagCompound item = slots.getCompoundTagAt(i);
byte itemPos = item.getByte("itemPos");
if (itemPos >= 0 && itemPos < this.items.length) {
this.items[itemPos] = ItemStack.loadItemStackFromNBT(item);
}
if (var1.hasKey("customName")) {
this.setCustomInventoryName(var1.getString("customName"));
}
}
super.readFromNBT(var1);
}
@Override
public void writeToNBT(NBTTagCompound var1) {
var1.setFloat("rotationY", this.rotationY);
var1.setFloat("rotationX", this.rotationX);
var1.setFloat("speed", this.speed);
var1.setBoolean("toggle", this.toggle);
var1.setFloat("speedSlower", this.speedSlower);
var1.setBoolean("multiblock", this.multiblock);
var1.setInteger("currentPower", this.currentPower);
var1.setInteger("Fuel", this.currentfuelqueue);
var1.setInteger("currentCooldown", this.currentcooldown);
var1.setInteger("cooldown", this.cooldown);
NBTTagList slots = new NBTTagList();
for (int i = 0; i < items.length; i++) {
if (this.items[i] != null) {
NBTTagCompound item = new NBTTagCompound();
item.setByte("itemPos", (byte) i);
this.items[i].writeToNBT(item);
slots.appendTag(item);
}
}
if (this.hasCustomInventoryName()) {
var1.setString("customName", this.customName);
}
var1.setTag("items", slots);
super.writeToNBT(var1);
}
// @Override
// public void readFromNBT(NBTTagCompound var1) {
// this.rotationY = var1.getFloat("rotationY");
// this.rotationX = var1.getFloat("rotationX");
// this.speed = var1.getFloat("speed");
// this.toggle = var1.getBoolean("toggle");
// this.speedSlower = var1.getFloat("speedSlower");
// this.currentPower = var1.getInteger("currentPower");
// this.multiblock = var1.getBoolean("multiblock");
// this.currentPower = var1.getInteger("currentPower");
// this.currentfuelqueue = var1.getInteger("Fuel");
// this.currentcooldown = var1.getInteger("currentCooldown");
// this.cooldown = var1.getInteger("cooldown");
//
// NBTTagList slots = var1.getTagList("items", 10);
// this.items = new ItemStack[getSizeInventory()];
//
// for (int i = 0; i < slots.tagCount(); i++) {
// NBTTagCompound item = slots.getCompoundTagAt(i);
// byte itemPos = item.getByte("itemPos");
//
// if (itemPos >= 0 && itemPos < this.items.length) {
// this.items[itemPos] = ItemStack.loadItemStackFromNBT(item);
// }
//
// if (var1.hasKey("customName")) {
// this.setCustomInventoryName(var1.getString("customName"));
// }
//
// }
//
// super.readFromNBT(var1);
// }
//
// @Override
// public void writeToNBT(NBTTagCompound var1) {
// var1.setFloat("rotationY", this.rotationY);
// var1.setFloat("rotationX", this.rotationX);
// var1.setFloat("speed", this.speed);
// var1.setBoolean("toggle", this.toggle);
// var1.setFloat("speedSlower", this.speedSlower);
// var1.setBoolean("multiblock", this.multiblock);
// var1.setInteger("currentPower", this.currentPower);
// var1.setInteger("Fuel", this.currentfuelqueue);
// var1.setInteger("currentCooldown", this.currentcooldown);
// var1.setInteger("cooldown", this.cooldown);
//
// NBTTagList slots = new NBTTagList();
// for (int i = 0; i < items.length; i++) {
// if (this.items[i] != null) {
// NBTTagCompound item = new NBTTagCompound();
// item.setByte("itemPos", (byte) i);
// this.items[i].writeToNBT(item);
// slots.appendTag(item);
// }
// }
//
// if (this.hasCustomInventoryName()) {
// var1.setString("customName", this.customName);
// }
// var1.setTag("items", slots);
// super.writeToNBT(var1);
//
// }
}

View File

@ -9,16 +9,15 @@ import net.minecraft.item.ItemStack;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityEnderCoreGenerator;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modcontainers.modslots.EnderCoreGeneratorSlot;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.moditems.ModItems;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.TileEntityCoreGenerator;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.TileEntityGenerator;
public class ContainerEnderCoreGenerator extends Container {
public static final int INPUT_1 = 0;
public static final byte INPUT_1 = 0;
public TileEntityEnderCoreGenerator endercoregenerator;
public ContainerEnderCoreGenerator(InventoryPlayer inventoryplayer,
TileEntityEnderCoreGenerator tileentity) {
public ContainerEnderCoreGenerator(InventoryPlayer inventoryplayer, TileEntityEnderCoreGenerator tileentity) {
this.endercoregenerator = tileentity;
this.addSlotToContainer(new EnderCoreGeneratorSlot(tileentity, INPUT_1, 7, 28, tileentity));

View File

@ -16,8 +16,7 @@ public class ContainerNetherCoreGenerator extends Container {
private TileEntityNetherCoreGenerator nethercoregenerator;
public ContainerNetherCoreGenerator(InventoryPlayer inventoryplayer,
TileEntityNetherCoreGenerator tileentity) {
public ContainerNetherCoreGenerator(InventoryPlayer inventoryplayer, TileEntityNetherCoreGenerator tileentity) {
this.nethercoregenerator = tileentity;
this.addSlotToContainer(new NetherCoreGeneratorSlot(tileentity, INPUT_1, 7, 28, tileentity));

View File

@ -2,7 +2,7 @@ package org.bitbucket.alltra101ify.advancedsatelliteutilization.packets;
import net.minecraft.tileentity.TileEntity;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.TileEntityCoreGenerator;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.TileEntityGenerator;
import io.netty.buffer.ByteBuf;
import cpw.mods.fml.common.network.ByteBufUtils;
@ -45,10 +45,10 @@ public class ASUCoreTogglePacket implements IMessage {
@Override
public IMessage onMessage(ASUCoreTogglePacket message, MessageContext ctx) {
TileEntity tileentity = ctx.getServerHandler().playerEntity.getEntityWorld().getTileEntity(message.x, message.y, message.z);
if (tileentity instanceof TileEntityCoreGenerator && message.toggle == 1) {
((TileEntityCoreGenerator)tileentity).toggle = true;
if (tileentity instanceof TileEntityGenerator && message.toggle == 1) {
((TileEntityGenerator)tileentity).toggle = true;
} else {
((TileEntityCoreGenerator)tileentity).toggle = false;
((TileEntityGenerator)tileentity).toggle = false;
}
return null;
}

View File

@ -17,11 +17,22 @@ import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
public abstract class ModMachineBlock extends BlockContainer {
protected ModMachineBlock(Material material) {
super(material);
}
/**
*
* @param player EntityPlayer
* @param world world
* @param x x coordinate
* @param y y coordinate
* @param z z coordinate
* @param multiblock if this is a multiblock or not. If does not belong to a multiblock, always true.
* @param currentPower current power of the block. For debugging purposes.
* @param scale percentage of power
* @param itemtogive item to return when using wrench to break
* @return returns 1 on array [1] on servers if it is valid for opening gui while 2 is for destroying and giving item to player. array [0] is to set the new power.
*/
public int[] wrenched(EntityPlayer player, World world, int x, int y, int z, boolean multiblock, int currentPower, byte scale, ItemStack itemtogive) {
int[] info = new int[2];
info[0] = currentPower;
@ -57,17 +68,4 @@ public abstract class ModMachineBlock extends BlockContainer {
return info;
}
@Override
public int getRenderType() {
return -1;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
}

View File

@ -1,346 +0,0 @@
package org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference;
import java.util.Random;
import org.bitbucket.alltra101ify.advancedsatelliteutilization.moditems.ModItems;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
public class TileEntityCoreGenerator extends TileEntity implements ISidedInventory {
protected ItemStack[] items = new ItemStack[4];
public boolean toggle, multiblock;
protected String customName;
public int currentfuelqueue, maxpower, currentPower, cooldown, currentcooldown, fuelqueue[];
public float rotationX, rotationY, speed, speedSlower;
Item[] validItemByItem;
String validItemByString, particle;
protected int x, y, z;
@Override
public void updateEntity() {
if (currentcooldown != 0) {
currentcooldown--;
}
for (int i = 1; i < items.length; i++) {
if (items[i] != null) {
if (currentcooldown >= 1 && items[i].getItem() == ModItems.fanModule) {
currentcooldown--;
} else if (toggle && items[i].getItem() == ModItems.conversionSpeedUpgrade && currentfuelqueue >= 2) {
currentfuelqueue = currentfuelqueue - 2;
currentPower = currentPower + 2;
}
}
}
if (!multiblock && toggle) {
toggle = false;
}
if (currentfuelqueue > maxpower) {
currentfuelqueue = maxpower;
}
if (currentPower >= maxpower) {
currentPower = maxpower;
}
if (currentPower <= 0) {
currentPower = 0;
}
if (toggle) {
//Register fuel and such using item and fuel index system
if (items[0] != null && this.validItemByItem != null) {
for (int i = 0; i < validItemByItem.length; i++) {
if (currentcooldown == 0 && currentfuelqueue <= maxpower - fuelqueue[i] && items[0].getItem() == validItemByItem[i]) {
if (items[0].stackSize == 1) {
this.items[0] = null;
} else {
items[0].splitStack(1);
if (this.items[0].stackSize == 0) {
this.items[0] = null;
}
}
this.currentfuelqueue += fuelqueue[i];
this.currentcooldown = cooldown;
}
}
}
//Register fuel and such by default or customized index fuel
if (items[0] != null && this.validItemByString !=null) {
if (currentfuelqueue <= maxpower - fuelqueue[0] && currentcooldown == 0) {
if (items[0].stackSize == 1) {
this.items[0] = null;
} else {
items[0].splitStack(1);
if (this.items[0].stackSize == 0) {
this.items[0] = null;
}
}
this.currentfuelqueue += fuelqueue[0];
this.currentcooldown = cooldown;
}
}
if (currentfuelqueue > 0 && currentPower != maxpower) {
if (currentfuelqueue >= 10) {
currentfuelqueue -= 10;
currentPower += 10;
} else if (currentfuelqueue == 1) {
currentfuelqueue --;
currentfuelqueue ++;
}
}
}
rotationY += speed;
if (rotationY > 6.3f) {
rotationY = 0f;
}
rotationX += speedSlower;
if (rotationX >= 6.3f) {
rotationX = 0f;
}
if (toggle && speed < 0.055f) {
speed += 0.0005f;
speedSlower += 0.00007f;
} else if (toggle == false && speed > 0f) {
speed -= 0.0005f;
speedSlower -= 0.00007f;
}
}
public int powerScaled(int scale) {
return (this.currentPower * scale / maxpower);
}
public int genscaled(int scale) {
return (this.currentfuelqueue * scale / maxpower);
}
public int cooldownscaled(int scale) {
return (this.currentcooldown * scale / cooldown);
}
public boolean humanInterface() {
for (int i = 1; i < items.length; i++) {
if (items[i] != null && items[i].getItem() == ModItems.humanInterfaceGate) {
return true;
}
}
return false;
}
public Packet getDescriptionPacket() {
NBTTagCompound tag = new NBTTagCompound();
writeToNBT(tag);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, tag);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
readFromNBT(pkt.func_148857_g());
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@Override
public int getSizeInventory() {
return this.items.length;
}
@Override
public ItemStack getStackInSlot(int slotNumber) {
return this.items[slotNumber];
}
@Override
public ItemStack decrStackSize(int slotNumber, int amountDecr) {
if (this.items[slotNumber] != null) {
//how much is returned to the hand
ItemStack itemstack;
if (this.items[slotNumber].stackSize <= amountDecr) {
itemstack = this.items[slotNumber];
this.items[slotNumber] = null;
} else {
itemstack = items[slotNumber].splitStack(amountDecr);
if (this.items[slotNumber].stackSize == 0) {
this.items[slotNumber] = null;
}
}
return itemstack;
}
return null;
}
@Override
public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
return null;
}
@Override
public void setInventorySlotContents(int slotNumber, ItemStack itemstack) {
this.items[slotNumber] = itemstack;
if (itemstack != null
&& itemstack.stackSize > this.getInventoryStackLimit()) {
itemstack.stackSize = this.getInventoryStackLimit();
}
}
protected void setCustomInventoryName(String customName) {
this.customName = customName;
}
@Override
public boolean hasCustomInventoryName() {
boolean customname = false;
if (customName != null) {
customname = true;
}
return customname;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
return true;
}
@Override
public void openInventory() {
}
@Override
public void closeInventory() {
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
return null;
}
@Override
public boolean canInsertItem(int p_1020071_, ItemStack p_102007_2_,
int p_102007_3_) {
return false;
}
@Override
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_,
int p_102008_3_) {
return false;
}
@Override
public String getInventoryName() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
return isItemValidForFuelSlot(itemstack);
}
public boolean isItemValidForFuelSlot(ItemStack itemstack) {
boolean itemvalid = false;
if (this.validItemByString != null && itemstack.getItem().getUnlocalizedName().toLowerCase().contains(this.validItemByString)) {
itemvalid = true;
} else if (this.validItemByItem != null) {
for (int i1 = 0; i1 < this.validItemByItem.length; i1++) {
if (itemstack.getItem().equals(this.validItemByItem[i1])) {
itemvalid = true;
break;
}
}
}
return itemvalid;
}
/**
* @param fuelqueue how much more fuel do we give?
* @param maxpower self-explanatory
* @param cooldown cool down time to transfer next item to fuel (in ticks)
*/
public void configureVars(int[] fuelqueue, int maxpower, int cooldown) {
this.fuelqueue = fuelqueue;
this.maxpower = maxpower;
this.cooldown = cooldown;
}
public void configureVars (int[] fuelqueue) {
this.fuelqueue = fuelqueue;
}
public void configureVars (int cooldown) {
this.cooldown = cooldown;
}
public void setMaxPower (int maxpower) {
this.maxpower = maxpower;
}
public void ItemValidityByItem(Item[] item) {
this.validItemByItem = item;
}
/**
*
* @param string (should only be used for testing as there is very little control) Sets what is valid by name of item.
*/
public void itemValidityByString(String 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;
}
}

View File

@ -13,8 +13,7 @@ import net.minecraft.util.ResourceLocation;
public class RenderCoreStabilizer extends TileEntitySpecialRenderer {
byte type;
private ModelCoreStabilizer modelASU = new ModelCoreStabilizer();
public static ResourceLocation[] texture = new ResourceLocation[3];
public void renderTileEntityAt(TileEntityCoreStabilizer tileentity, double x,
@ -28,7 +27,7 @@ public class RenderCoreStabilizer extends TileEntitySpecialRenderer {
GL11.glTranslatef((float) x + 0.5f, (float) y + 1.5f, (float) z + 0.5f);
GL11.glRotatef(180, 0f, 0f, 1f);
this.bindTexture(texture[type]);
this.bindTexture(texture[1]);
modelASU.renderModel(0.0625f);

View File

@ -21,4 +21,6 @@ tile.HolographicLight.name=Holographic Light
tile.QuaridiumOre.name=Quaridium Ore
tile.BlockOfASHADWithQuaridium.name=Block of ASHAD with Quaridium
tile.NetherCoreGenerator.name=Nether Core Generator
tile.AdvancedWasteHandler_false.name=Advanced Waste Disposer
tile.AdvancedWasteHandler_true.name=Advanced Waste Disposer
itemGroup.asu=Advanced Satellite Utilization

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB