add ultimate factories

first test
This commit is contained in:
maggi373 committed 2026-09-16 19:53:11 +02:00
1 parent dc88525536
commit 96e627c5d3
104 files changed
+723 -101

No files matched your search

@@ -92,9 +92,8 @@ for spec in "${expected[@]}"; do
;;
Ultimate)
require_exact_entry 'mcmod.info' "$artifact"
if ! grep -q '\.class$' "$listing"; then
echo "::warning file=$artifact::Ultimate currently contains metadata only and will be published as beta."
fi
require_exact_entry 'mekanism/ultimate/common/MekanismUltimate.class' "$artifact"
require_exact_entry 'mekanism/ultimate/common/tile/TileEntityUltimateFactory.class' "$artifact"
;;
esac
+6 -3
View File
@@ -97,7 +97,7 @@ task coreJar(type: Jar) {
}
from zipTree(jar.outputs.getFiles().getSingleFile()).matching {
exclude 'mekanism/tools/**', 'mekanism/generators/**', 'mekanism/defense/**', 'defense/**', 'assets/defense/**', 'mcmod.info', 'mekanism/ultimate/**'
exclude 'mekanism/tools/**', 'mekanism/generators/**', 'mekanism/defense/**', 'defense/**', 'assets/defense/**', 'mcmod.info', 'mekanism/ultimate/**', 'assets/mekanism/gui/factory/GuiUltimateFactory.png', 'assets/mekanism/textures/blocks/factory/ultimate/**'
}
}
@@ -112,7 +112,7 @@ task alltJar(type: Jar) {
expand 'version': mod_version, 'mc_version': minecraft_version, 'fmp_version': FMP_version
}
from zipTree(jar.outputs.getFiles().getSingleFile()).matching {
exclude 'mcmod.info', 'mekanism/defense/**', 'defense/**', 'assets/defense/**', 'mekanism/ultimate/**'
exclude 'mcmod.info', 'mekanism/defense/**', 'defense/**', 'assets/defense/**', 'mekanism/ultimate/**', 'assets/mekanism/gui/factory/GuiUltimateFactory.png', 'assets/mekanism/textures/blocks/factory/ultimate/**'
}
}
@@ -161,9 +161,12 @@ task ultimateJar(type: Jar) {
include '*.info'
expand 'version': mod_version, 'mc_version': minecraft_version, 'fmp_version': FMP_version
}
from('etc/ultimate') {
include 'logo.png'
}
from zipTree(jar.outputs.getFiles().getSingleFile()).matching {
include 'mekanism/ultimate/**'
include 'mekanism/ultimate/**', 'assets/mekanism/gui/factory/GuiUltimateFactory.png', 'assets/mekanism/textures/blocks/factory/ultimate/**'
exclude 'mcmod.info'
}
}
@@ -35,6 +35,10 @@ public class GuiFactory extends GuiMekanism
tileEntity = tentity;
ySize += 11;
if(tileEntity.tier == FactoryTier.ULTIMATE)
{
ySize += 16;
}
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.tier.guiLocation));
guiElements.add(new GuiSecurityTab(this, tileEntity, tileEntity.tier.guiLocation));
@@ -62,12 +66,16 @@ public class GuiFactory extends GuiMekanism
fontRendererObj.drawString(tileEntity.getInventoryName(), (xSize/2)-(fontRendererObj.getStringWidth(tileEntity.getInventoryName())/2), 4, 0x404040);
fontRendererObj.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 93) + 2, 0x404040);
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
int energyX = tileEntity.tier == FactoryTier.ULTIMATE ? 171 : 165;
if(xAxis >= energyX && xAxis <= energyX + 4 && yAxis >= 17 && yAxis <= 69)
{
drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis);
}
if(xAxis >= 8 && xAxis <= 168 && yAxis >= 78 && yAxis <= 83)
int gaugeX = tileEntity.tier == FactoryTier.ULTIMATE ? 52 : 8;
int gaugeY = tileEntity.tier == FactoryTier.ULTIMATE ? 83 : 78;
int gaugeWidth = tileEntity.tier == FactoryTier.ULTIMATE ? 116 : 160;
if(xAxis >= gaugeX && xAxis <= gaugeX + gaugeWidth && yAxis >= gaugeY && yAxis <= gaugeY + 5)
{
if(tileEntity.recipeType.usesFuel())
{
@@ -97,12 +105,13 @@ public class GuiFactory extends GuiMekanism
int displayInt;
displayInt = tileEntity.getScaledEnergyLevel(52);
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
int energyX = tileEntity.tier == FactoryTier.ULTIMATE ? 171 : 165;
drawTexturedModalRect(guiWidth + energyX, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
int xOffset = tileEntity.tier == FactoryTier.BASIC ? 59 : (tileEntity.tier == FactoryTier.ADVANCED ?
39 : 33);
39 : (tileEntity.tier == FactoryTier.ELITE ? 33 : 11));
int xDistance = tileEntity.tier == FactoryTier.BASIC ? 38 : (tileEntity.tier == FactoryTier.ADVANCED ?
26 : 19);
26 : (tileEntity.tier == FactoryTier.ELITE ? 19 : 18));
for(int i = 0; i < tileEntity.tier.processes; i++)
{
@@ -116,14 +125,16 @@ public class GuiFactory extends GuiMekanism
{
if(tileEntity.getScaledGasLevel(160) > 0)
{
displayGauge(8, 78, tileEntity.getScaledGasLevel(160), 5, tileEntity.gasTank.getGas().getGas().getIcon());
int gaugeWidth = tileEntity.tier == FactoryTier.ULTIMATE ? 116 : 160;
displayGauge(tileEntity.tier == FactoryTier.ULTIMATE ? 52 : 8, tileEntity.tier == FactoryTier.ULTIMATE ? 83 : 78, tileEntity.getScaledGasLevel(gaugeWidth), 5, tileEntity.gasTank.getGas().getGas().getIcon());
}
}
else if(tileEntity.recipeType == RecipeType.INFUSING)
{
if(tileEntity.getScaledInfuseLevel(160) > 0)
{
displayGauge(8, 78, tileEntity.getScaledInfuseLevel(160), 5, tileEntity.infuseStored.type.icon);
int gaugeWidth = tileEntity.tier == FactoryTier.ULTIMATE ? 116 : 160;
displayGauge(tileEntity.tier == FactoryTier.ULTIMATE ? 52 : 8, tileEntity.tier == FactoryTier.ULTIMATE ? 83 : 78, tileEntity.getScaledInfuseLevel(gaugeWidth), 5, tileEntity.infuseStored.type.icon);
}
}
@@ -154,7 +165,8 @@ public class GuiFactory extends GuiMekanism
int xAxis = (x - (width - xSize) / 2);
int yAxis = (y - (height - ySize) / 2);
if(xAxis > 144 && xAxis < 168 && yAxis > 83 && yAxis < 93)
int dumpY = tileEntity.tier == FactoryTier.ULTIMATE ? 99 : 83;
if(xAxis > 144 && xAxis < 168 && yAxis > dumpY && yAxis < dumpY + 10)
{
ArrayList data = new ArrayList();
data.add(1);
+2 -1
View File
@@ -217,7 +217,8 @@ public final class Tier
{
BASIC(3, new ResourceLocation("mekanism", "gui/factory/GuiBasicFactory.png")),
ADVANCED(5, new ResourceLocation("mekanism", "gui/factory/GuiAdvancedFactory.png")),
ELITE(7, new ResourceLocation("mekanism", "gui/factory/GuiEliteFactory.png"));
ELITE(7, new ResourceLocation("mekanism", "gui/factory/GuiEliteFactory.png")),
ULTIMATE(9, new ResourceLocation("mekanism", "gui/factory/GuiUltimateFactory.png"));
public final int processes;
public final ResourceLocation guiLocation;
@@ -23,79 +23,62 @@ public class ContainerFactory extends Container
{
tileEntity = tentity;
addSlotToContainer(new SlotDischarge(tentity, 1, 7, 13));
int utilityY = tileEntity.tier == FactoryTier.ULTIMATE ? 82 : 13;
int extraX = tileEntity.tier == FactoryTier.ULTIMATE ? 29 : 7;
addSlotToContainer(new SlotDischarge(tentity, 1, 7, utilityY));
addSlotToContainer(new Slot(tentity, 2, 180, 75));
addSlotToContainer(new Slot(tentity, 3, 180, 112));
addSlotToContainer(new Slot(tentity, 4, 7, 57));
addSlotToContainer(new Slot(tentity, 4, extraX, tileEntity.tier == FactoryTier.ULTIMATE ? 82 : 57));
if(tileEntity.tier == FactoryTier.BASIC)
for(int i = 0; i < tileEntity.tier.processes; i++)
{
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xAxis = 55 + (i*38);
addSlotToContainer(new Slot(tentity, 5+i, xAxis, 13));
}
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xAxis = 55 + (i*38);
addSlotToContainer(new SlotOutput(tentity, tileEntity.tier.processes+5+i, xAxis, 57));
}
}
else if(tileEntity.tier == FactoryTier.ADVANCED)
{
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xAxis = 35 + (i*26);
addSlotToContainer(new Slot(tentity, 5+i, xAxis, 13));
}
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xAxis = 35 + (i*26);
addSlotToContainer(new SlotOutput(tentity, tileEntity.tier.processes+5+i, xAxis, 57));
}
}
else if(tileEntity.tier == FactoryTier.ELITE)
{
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xAxis = 29 + (i*19);
addSlotToContainer(new Slot(tentity, 5+i, xAxis, 13));
}
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xAxis = 29 + (i*19);
addSlotToContainer(new SlotOutput(tentity, tileEntity.tier.processes+5+i, xAxis, 57));
}
addSlotToContainer(new Slot(tentity, 5+i, getProcessX(i), 13));
}
for(int i = 0; i < tileEntity.tier.processes; i++)
{
addSlotToContainer(new SlotOutput(tentity, tileEntity.tier.processes+5+i, getProcessX(i), 57));
}
int inventoryY = tileEntity.tier == FactoryTier.ULTIMATE ? 111 : 95;
int slotY;
for(slotY = 0; slotY < 3; slotY++)
{
for(int slotX = 0; slotX < 9; slotX++)
{
addSlotToContainer(new Slot(inventory, slotX + slotY * 9 + 9, 8 + slotX * 18, 95 + slotY * 18));
addSlotToContainer(new Slot(inventory, slotX + slotY * 9 + 9, 8 + slotX * 18, inventoryY + slotY * 18));
}
}
for(int slotX = 0; slotX < 9; slotX++)
{
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 153));
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, inventoryY + 58));
}
tileEntity.open(inventory.player);
tileEntity.openInventory();
}
private int getProcessX(int process)
{
if(tileEntity.tier == FactoryTier.BASIC)
{
return 55 + process * 38;
}
else if(tileEntity.tier == FactoryTier.ADVANCED)
{
return 35 + process * 26;
}
else if(tileEntity.tier == FactoryTier.ELITE)
{
return 29 + process * 19;
}
return 7 + process * 18;
}
@Override
public void onContainerClosed(EntityPlayer entityplayer)
{
@@ -61,11 +61,13 @@ import mekanism.common.util.InventoryUtils;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.StatUtils;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -147,7 +149,12 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
}
public TileEntityFactory(FactoryTier type, MachineType machine) {
super("null", machine.name, machine.baseEnergy);
this(type, machine.name, machine.baseEnergy);
}
/** Constructor for factory tiers supplied by an optional module. */
protected TileEntityFactory(FactoryTier type, String name, double baseEnergy) {
super("null", name, baseEnergy);
tier = type;
inventory = new ItemStack[5 + type.processes * 2];
@@ -160,12 +167,24 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
@Override
public boolean upgrade(BaseTier upgradeTier) {
if (upgradeTier.ordinal() != tier.ordinal() + 1 || tier == FactoryTier.ELITE) {
if (upgradeTier.ordinal() != tier.ordinal() + 1 || tier == FactoryTier.ULTIMATE) {
return false;
}
Block targetBlock = MekanismBlocks.MachineBlock;
int targetMetadata = 5 + upgradeTier.ordinal();
if (upgradeTier == BaseTier.ULTIMATE) {
targetBlock = GameRegistry.findBlock("MekanismUltimate", "UltimateFactory");
targetMetadata = 0;
if (targetBlock == null) {
return false;
}
}
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
worldObj.setBlock(xCoord, yCoord, zCoord, MekanismBlocks.MachineBlock, 5 + tier.ordinal() + 1, 3);
worldObj.setBlock(xCoord, yCoord, zCoord, targetBlock, targetMetadata, 3);
TileEntityFactory factory = (TileEntityFactory)worldObj.getTileEntity(xCoord, yCoord, zCoord);
@@ -344,15 +363,11 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
public void sortInventory() {
if (sorting) {
boolean didOp = false;
int[] inputSlots = null;
int[] inputSlots = new int[tier.processes];
List<InvID> invStacks = new ArrayList<InvID>();
if (tier == FactoryTier.BASIC) {
inputSlots = new int[] {5, 6, 7};
} else if (tier == FactoryTier.ADVANCED) {
inputSlots = new int[] {5, 6, 7, 8, 9};
} else if (tier == FactoryTier.ELITE) {
inputSlots = new int[] {5, 6, 7, 8, 9, 10, 11};
for (int i = 0; i < inputSlots.length; i++) {
inputSlots[i] = getInputSlot(i);
}
for (int id : inputSlots) {
@@ -460,11 +475,7 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
public boolean canExtractItem(int slotID, ItemStack itemstack, int side) {
if (slotID == 1) {
return ChargeUtils.canBeOutputted(itemstack, false);
} else if (tier == FactoryTier.BASIC && slotID >= 8 && slotID <= 10) {
return true;
} else if (tier == FactoryTier.ADVANCED && slotID >= 10 && slotID <= 14) {
return true;
} else if (tier == FactoryTier.ELITE && slotID >= 12 && slotID <= 18) {
} else if (slotID >= getOutputSlot(0) && slotID < getOutputSlot(0) + tier.processes) {
return true;
}
return false;
@@ -472,24 +483,10 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
@Override
public boolean isItemValidForSlot(int slotID, ItemStack itemstack) {
if (tier == FactoryTier.BASIC) {
if (slotID >= 8 && slotID <= 10) {
return false;
} else if (slotID >= 5 && slotID <= 7) {
return recipeType.getAnyRecipe(itemstack, gasTank.getGasType(), infuseStored) != null;
}
} else if (tier == FactoryTier.ADVANCED) {
if (slotID >= 10 && slotID <= 14) {
return false;
} else if (slotID >= 5 && slotID <= 9) {
return recipeType.getAnyRecipe(itemstack, gasTank.getGasType(), infuseStored) != null;
}
} else if (tier == FactoryTier.ELITE) {
if (slotID >= 12 && slotID <= 18) {
return false;
} else if (slotID >= 5 && slotID <= 11) {
return recipeType.getAnyRecipe(itemstack, gasTank.getGasType(), infuseStored) != null;
}
if (slotID >= getOutputSlot(0) && slotID < getOutputSlot(0) + tier.processes) {
return false;
} else if (slotID >= getInputSlot(0) && slotID < getInputSlot(0) + tier.processes) {
return recipeType.getAnyRecipe(itemstack, gasTank.getGasType(), infuseStored) != null;
}
if (slotID == 0) {
@@ -949,4 +946,4 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
public TileComponentSecurity getSecurity() {
return securityComponent;
}
}
}
@@ -89,6 +89,7 @@ import buildcraft.api.tools.IToolWrench;
import cofh.api.item.IToolHammer;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -275,7 +276,21 @@ public final class MekanismUtils
*/
public static ItemStack getFactory(FactoryTier tier, RecipeType type)
{
ItemStack itemstack = new ItemStack(MekanismBlocks.MachineBlock, 1, 5+tier.ordinal());
Block factoryBlock = MekanismBlocks.MachineBlock;
int metadata = 5 + tier.ordinal();
if(tier == FactoryTier.ULTIMATE)
{
factoryBlock = GameRegistry.findBlock("MekanismUltimate", "UltimateFactory");
metadata = 0;
if(factoryBlock == null)
{
return null;
}
}
ItemStack itemstack = new ItemStack(factoryBlock, 1, metadata);
((IFactory)itemstack.getItem()).setRecipeType(type.ordinal(), itemstack);
return itemstack;
}
@@ -31,6 +31,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.registry.GameRegistry;
public class RecipeUtils
{
@@ -87,7 +88,10 @@ public class RecipeUtils
private static boolean isFactory(ItemStack stack)
{
return MachineType.get(stack) == MachineType.BASIC_FACTORY || MachineType.get(stack) == MachineType.ADVANCED_FACTORY || MachineType.get(stack) == MachineType.ELITE_FACTORY;
MachineType type = MachineType.get(stack);
Block ultimateFactory = GameRegistry.findBlock("MekanismUltimate", "UltimateFactory");
return type == MachineType.BASIC_FACTORY || type == MachineType.ADVANCED_FACTORY || type == MachineType.ELITE_FACTORY ||
(ultimateFactory != null && Block.getBlockFromItem(stack.getItem()) == ultimateFactory);
}
public static ItemStack getCraftingResult(InventoryCrafting inv, ItemStack toReturn)
@@ -0,0 +1,40 @@
package mekanism.ultimate.client;
import mekanism.client.gui.GuiFactory;
import mekanism.client.render.tileentity.RenderConfigurableMachine;
import mekanism.ultimate.client.render.UltimateFactoryItemRenderer;
import mekanism.ultimate.common.UltimateBlocks;
import mekanism.ultimate.common.UltimateCommonProxy;
import mekanism.ultimate.common.tile.TileEntityUltimateFactory;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class UltimateClientProxy extends UltimateCommonProxy
{
@Override
public void registerTileEntities()
{
ClientRegistry.registerTileEntity(TileEntityUltimateFactory.class, "MekanismUltimateUltimateFactory", new RenderConfigurableMachine());
}
@Override
public void registerRenderInformation()
{
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(UltimateBlocks.UltimateFactory), new UltimateFactoryItemRenderer());
}
@Override
public GuiScreen getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
TileEntity tile = world.getTileEntity(x, y, z);
return id == 0 && tile instanceof TileEntityUltimateFactory ? new GuiFactory(player.inventory, (TileEntityUltimateFactory)tile) : null;
}
}
@@ -0,0 +1,38 @@
package mekanism.ultimate.client.render;
import mekanism.client.render.MekanismRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class UltimateFactoryItemRenderer implements IItemRenderer
{
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
GL11.glPushMatrix();
if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON)
{
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
MekanismRenderer.renderCustomItem((RenderBlocks)data[0], item);
GL11.glPopMatrix();
}
}
@@ -0,0 +1,103 @@
package mekanism.ultimate.common;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import mekanism.api.MekanismConfig;
import mekanism.common.Mekanism;
import mekanism.common.Tier.BaseTier;
import mekanism.common.Tier.FactoryTier;
import mekanism.common.Version;
import mekanism.common.base.IFactory.RecipeType;
import mekanism.common.base.IModule;
import mekanism.common.recipe.ShapedMekanismRecipe;
import mekanism.common.util.MekanismUtils;
import mekanism.ultimate.common.item.ItemBlockUltimateFactory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = MekanismUltimate.MODID, name = "Mekanism Community Edition: Ultimate", version = "GRADLE_MODVERSION", dependencies = "required-after:Mekanism")
public class MekanismUltimate implements IModule
{
public static final String MODID = "MekanismUltimate";
@Instance(MODID)
public static MekanismUltimate instance;
@SidedProxy(clientSide = "mekanism.ultimate.client.UltimateClientProxy", serverSide = "mekanism.ultimate.common.UltimateCommonProxy")
public static UltimateCommonProxy proxy;
public static Version versionNumber = new Version(GRADLE_VERSIONMOD);
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
GameRegistry.registerBlock(UltimateBlocks.UltimateFactory, ItemBlockUltimateFactory.class, "UltimateFactory");
}
@EventHandler
public void init(FMLInitializationEvent event)
{
proxy.registerTileEntities();
proxy.registerRenderInformation();
NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy);
Mekanism.modulesLoaded.add(this);
addRecipes();
Mekanism.logger.info("Loaded MekanismUltimate module.");
}
private void addRecipes()
{
if (!MekanismConfig.recipes.enableFactories)
{
return;
}
for (RecipeType type : RecipeType.values())
{
ItemStack result = MekanismUtils.getFactory(FactoryTier.ULTIMATE, type);
ItemStack eliteFactory = MekanismUtils.getFactory(FactoryTier.ELITE, type);
CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(result, new Object[] {
"ACA", "IPI", "ACA",
Character.valueOf('A'), "alloyUltimate",
Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ULTIMATE),
Character.valueOf('I'), "gemDiamond",
Character.valueOf('P'), eliteFactory
}));
}
}
@Override
public Version getVersion()
{
return versionNumber;
}
@Override
public String getName()
{
return "Ultimate";
}
@Override
public void writeConfig(ByteBuf dataStream) throws IOException
{
}
@Override
public void readConfig(ByteBuf dataStream) throws IOException
{
}
@Override
public void resetClient()
{
}
}
@@ -0,0 +1,13 @@
package mekanism.ultimate.common;
import mekanism.ultimate.common.block.BlockUltimateFactory;
import net.minecraft.block.Block;
public final class UltimateBlocks
{
public static final Block UltimateFactory = new BlockUltimateFactory().setBlockName("UltimateFactory");
private UltimateBlocks()
{
}
}
@@ -0,0 +1,34 @@
package mekanism.ultimate.common;
import mekanism.common.inventory.container.ContainerFactory;
import mekanism.ultimate.common.tile.TileEntityUltimateFactory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameRegistry;
public class UltimateCommonProxy implements IGuiHandler
{
public void registerTileEntities()
{
GameRegistry.registerTileEntity(TileEntityUltimateFactory.class, "MekanismUltimateUltimateFactory");
}
public void registerRenderInformation()
{
}
@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
TileEntity tile = world.getTileEntity(x, y, z);
return id == 0 && tile instanceof TileEntityUltimateFactory ? new ContainerFactory(player.inventory, (TileEntityUltimateFactory)tile) : null;
}
@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
return null;
}
}
@@ -0,0 +1,177 @@
package mekanism.ultimate.common.block;
import java.util.List;
import buildcraft.api.tools.IToolWrench;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.render.MekanismRenderer.DefIcon;
import mekanism.common.Tier.BaseTier;
import mekanism.common.Tier.FactoryTier;
import mekanism.common.base.IFactory;
import mekanism.common.base.IFactory.RecipeType;
import mekanism.common.block.BlockMachine;
import mekanism.common.tile.TileEntityFactory;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.SecurityUtils;
import mekanism.ultimate.common.MekanismUltimate;
import mekanism.ultimate.common.tile.TileEntityUltimateFactory;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockUltimateFactory extends BlockMachine
{
public BlockUltimateFactory()
{
super(MachineBlock.MACHINE_BLOCK_1);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register)
{
BASE_ICON = register.registerIcon("mekanism:SteelCasing");
for (RecipeType type : RecipeType.values())
{
MekanismRenderer.loadDynamicTextures(register,
"factory/ultimate/" + type.getUnlocalizedName().toLowerCase() + "/" + BaseTier.ULTIMATE.getName() + type.getUnlocalizedName() + "Factory",
factoryIcons[FactoryTier.ULTIMATE.ordinal()][type.ordinal()],
DefIcon.getActivePair(register.registerIcon("mekanism:factory/ultimate/UltimateFactoryFront"), 2).setOverrides(false),
DefIcon.getActivePair(register.registerIcon("mekanism:factory/ultimate/UltimateFactoryTop"), 1).setOverrides(false),
DefIcon.getActivePair(register.registerIcon("mekanism:factory/ultimate/UltimateFactoryBottom"), 0).setOverrides(false),
DefIcon.getActivePair(register.registerIcon("mekanism:factory/ultimate/UltimateFactorySide"), 3, 4, 5).setOverrides(false));
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(ItemStack stack, int side)
{
int recipe = ((IFactory)stack.getItem()).getRecipeType(stack);
if (recipe < 0 || recipe >= RecipeType.values().length)
{
recipe = 0;
}
return factoryIcons[FactoryTier.ULTIMATE.ordinal()][recipe][side];
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata)
{
return factoryIcons[FactoryTier.ULTIMATE.ordinal()][RecipeType.SMELTING.ordinal()][side];
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
{
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileEntityFactory))
{
return getIcon(side, 0);
}
TileEntityFactory factory = (TileEntityFactory)tile;
boolean active = MekanismUtils.isActive(world, x, y, z);
int orientation = MekanismUtils.getBaseOrientation(side, factory.facing);
return factoryIcons[FactoryTier.ULTIMATE.ordinal()][factory.recipeType.ordinal()][orientation + (active ? 6 : 0)];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list)
{
for (RecipeType type : RecipeType.values())
{
ItemStack stack = new ItemStack(item);
((IFactory)stack.getItem()).setRecipeType(type.ordinal(), stack);
list.add(stack);
}
}
@Override
public TileEntity createTileEntity(World world, int metadata)
{
return new TileEntityUltimateFactory();
}
@Override
public TileEntity createNewTileEntity(World world, int metadata)
{
return new TileEntityUltimateFactory();
}
@Override
public int damageDropped(int metadata)
{
return 0;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float posX, float posY, float posZ)
{
if (world.isRemote)
{
return true;
}
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileEntityUltimateFactory))
{
return false;
}
TileEntityUltimateFactory factory = (TileEntityUltimateFactory)tile;
ItemStack held = player.getCurrentEquippedItem();
if (held != null && MekanismUtils.hasUsableWrench(player, x, y, z))
{
if (!SecurityUtils.canAccess(player, factory))
{
SecurityUtils.displayNoAccess(player);
return true;
}
if (player.isSneaking())
{
dismantleBlock(world, x, y, z, false);
return true;
}
if (MekanismUtils.isBCWrench(held.getItem()))
{
((IToolWrench)held.getItem()).wrenchUsed(player, x, y, z);
}
int change = ForgeDirection.ROTATION_MATRIX[ForgeDirection.UP.ordinal()][factory.facing];
factory.setFacing((short)change);
world.notifyBlocksOfNeighborChange(x, y, z, this);
return true;
}
if (!player.isSneaking())
{
if (SecurityUtils.canAccess(player, factory))
{
player.openGui(MekanismUltimate.instance, 0, world, x, y, z);
}
else
{
SecurityUtils.displayNoAccess(player);
}
return true;
}
return false;
}
}
@@ -0,0 +1,79 @@
package mekanism.ultimate.common.item;
import java.util.List;
import mekanism.api.EnumColor;
import mekanism.api.MekanismConfig.usage;
import mekanism.client.MekanismKeyHandler;
import mekanism.common.Tier.BaseTier;
import mekanism.common.Tier.FactoryTier;
import mekanism.common.base.IFactory.RecipeType;
import mekanism.common.item.ItemBlockMachine;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemBlockUltimateFactory extends ItemBlockMachine
{
public ItemBlockUltimateFactory(Block block)
{
super(block);
}
@Override
public String getUnlocalizedName(ItemStack stack)
{
return "tile.UltimateFactory";
}
@Override
public String getItemStackDisplayName(ItemStack stack)
{
RecipeType recipe = RecipeType.values()[getRecipeType(stack)];
String key = "tile.Ultimate" + recipe.getUnlocalizedName() + "Factory";
if (StatCollector.canTranslate(key))
{
return LangUtils.localize(key);
}
return BaseTier.ULTIMATE.getLocalizedName() + " " + recipe.getLocalizedName() + " " + LangUtils.localize("tile.MachineBlock.Factory.name");
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced)
{
if (MekanismKeyHandler.getIsKeyPressed(MekanismKeyHandler.sneakKey) && MekanismKeyHandler.getIsKeyPressed(MekanismKeyHandler.modeSwitchKey))
{
list.addAll(MekanismUtils.splitTooltip(LangUtils.localize("tooltip.Factory"), stack));
return;
}
super.addInformation(stack, player, list, advanced);
if (MekanismKeyHandler.getIsKeyPressed(MekanismKeyHandler.sneakKey))
{
list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.recipeType") + ": " + EnumColor.GREY + RecipeType.values()[getRecipeType(stack)].getLocalizedName());
}
}
@Override
public double getMaxEnergy(ItemStack stack)
{
return MekanismUtils.getMaxEnergy(stack, usage.factoryUsage * FactoryTier.ULTIMATE.processes * 400);
}
@Override
public BaseTier getBaseTier(ItemStack stack)
{
return BaseTier.ULTIMATE;
}
@Override
public void setBaseTier(ItemStack stack, BaseTier tier)
{
}
}
@@ -0,0 +1,49 @@
package mekanism.ultimate.common.tile;
import mekanism.api.EnumColor;
import mekanism.api.MekanismConfig.usage;
import mekanism.api.transmitters.TransmissionType;
import mekanism.common.SideData;
import mekanism.common.Tier.FactoryTier;
import mekanism.common.Upgrade;
import mekanism.common.tile.TileEntityFactory;
import mekanism.common.tile.component.TileComponentConfig;
import mekanism.common.tile.component.TileComponentEjector;
import mekanism.common.tile.component.TileComponentUpgrade;
import mekanism.common.util.InventoryUtils;
public class TileEntityUltimateFactory extends TileEntityFactory
{
public TileEntityUltimateFactory()
{
super(FactoryTier.ULTIMATE, "Factory", usage.factoryUsage * FactoryTier.ULTIMATE.processes * 400);
int[] inputSlots = new int[FactoryTier.ULTIMATE.processes];
int[] outputSlots = new int[FactoryTier.ULTIMATE.processes];
for (int i = 0; i < FactoryTier.ULTIMATE.processes; i++)
{
inputSlots[i] = getInputSlot(i);
outputSlots[i] = getOutputSlot(i);
}
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY, TransmissionType.GAS);
configComponent.addOutput(TransmissionType.ITEM, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Input", EnumColor.DARK_RED, inputSlots));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Output", EnumColor.DARK_BLUE, outputSlots));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Energy", EnumColor.DARK_GREEN, new int[] {1}));
configComponent.addOutput(TransmissionType.ITEM, new SideData("Extra", EnumColor.PURPLE, new int[] {4}));
configComponent.setConfig(TransmissionType.ITEM, new byte[] {4, 0, 0, 3, 1, 2});
configComponent.addOutput(TransmissionType.GAS, new SideData("None", EnumColor.GREY, InventoryUtils.EMPTY));
configComponent.addOutput(TransmissionType.GAS, new SideData("Gas", EnumColor.DARK_RED, new int[] {0}));
configComponent.fillConfig(TransmissionType.GAS, 1);
configComponent.setCanEject(TransmissionType.GAS, false);
configComponent.setInputConfig(TransmissionType.ENERGY);
upgradeComponent = new TileComponentUpgrade(this, 0);
upgradeComponent.setSupported(Upgrade.MUFFLING);
ejectorComponent = new TileComponentEjector(this);
ejectorComponent.setOutputData(TransmissionType.ITEM, configComponent.getOutputs(TransmissionType.ITEM).get(2));
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

@@ -0,0 +1,25 @@
{
"animation": {
"frametime": 1,
"frames": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
10,
7,
4,
1,
0,
0
]
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

@@ -0,0 +1,25 @@
{
"animation": {
"frametime": 1,
"frames": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
10,
7,
4,
1,
0,
0
]
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

@@ -0,0 +1,25 @@
{
"animation": {
"frametime": 1,
"frames": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
10,
7,
4,
1,
0,
0
]
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Loaded 100 of 104 files, more files were not shown because too many files have changed in this diff. Show more