Reformatted all the code using the default intelji formatting options.

This commit is contained in:
modmuss50 2015-08-09 11:05:32 +01:00
parent 2f63a24070
commit e0ab0af822
363 changed files with 20524 additions and 23016 deletions
src/main/java/techreborn
Core.java
achievement
api
asm
blocks
client

View file

@ -17,18 +17,13 @@ import net.minecraftforge.common.MinecraftForge;
import org.apache.commons.lang3.time.StopWatch; import org.apache.commons.lang3.time.StopWatch;
import techreborn.achievement.TRAchievements; import techreborn.achievement.TRAchievements;
import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.RecipeHandler;
import techreborn.api.recipe.recipeConfig.RecipeConfig;
import techreborn.api.recipe.recipeConfig.RecipeConfigManager; import techreborn.api.recipe.recipeConfig.RecipeConfigManager;
import techreborn.client.GuiHandler; import techreborn.client.GuiHandler;
import techreborn.command.TechRebornDevCommand; import techreborn.command.TechRebornDevCommand;
import techreborn.compat.CompatManager; import techreborn.compat.CompatManager;
import techreborn.compat.ICompatModule; import techreborn.compat.ICompatModule;
import techreborn.config.ConfigTechReborn; import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks; import techreborn.init.*;
import techreborn.init.ModFluids;
import techreborn.init.ModItems;
import techreborn.init.ModParts;
import techreborn.init.ModRecipes;
import techreborn.lib.ModInfo; import techreborn.lib.ModInfo;
import techreborn.packets.PacketHandler; import techreborn.packets.PacketHandler;
import techreborn.packets.PacketPipeline; import techreborn.packets.PacketPipeline;
@ -42,104 +37,104 @@ import java.io.File;
@Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION, dependencies = ModInfo.MOD_DEPENDENCUIES, guiFactory = ModInfo.GUI_FACTORY_CLASS) @Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION, dependencies = ModInfo.MOD_DEPENDENCUIES, guiFactory = ModInfo.GUI_FACTORY_CLASS)
public class Core { public class Core {
public static ConfigTechReborn config; public static ConfigTechReborn config;
@SidedProxy(clientSide = ModInfo.CLIENT_PROXY_CLASS, serverSide = ModInfo.SERVER_PROXY_CLASS) @SidedProxy(clientSide = ModInfo.CLIENT_PROXY_CLASS, serverSide = ModInfo.SERVER_PROXY_CLASS)
public static CommonProxy proxy; public static CommonProxy proxy;
@Mod.Instance @Mod.Instance
public static Core INSTANCE; public static Core INSTANCE;
public static final PacketPipeline packetPipeline = new PacketPipeline(); public static final PacketPipeline packetPipeline = new PacketPipeline();
public VersionChecker versionChecker; public VersionChecker versionChecker;
@Mod.EventHandler @Mod.EventHandler
public void preinit(FMLPreInitializationEvent event){ public void preinit(FMLPreInitializationEvent event) {
INSTANCE = this; INSTANCE = this;
String path = event.getSuggestedConfigurationFile().getAbsolutePath() String path = event.getSuggestedConfigurationFile().getAbsolutePath()
.replace(ModInfo.MOD_ID, "TechReborn"); .replace(ModInfo.MOD_ID, "TechReborn");
config = ConfigTechReborn.initialize(new File(path)); config = ConfigTechReborn.initialize(new File(path));
for(ICompatModule compatModule : CompatManager.INSTANCE.compatModules){ for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
compatModule.preInit(event); compatModule.preInit(event);
} }
RecipeConfigManager.load(event.getModConfigurationDirectory()); RecipeConfigManager.load(event.getModConfigurationDirectory());
versionChecker = new VersionChecker("TechReborn"); versionChecker = new VersionChecker("TechReborn");
versionChecker.checkVersionThreaded(); versionChecker.checkVersionThreaded();
LogHelper.info("PreInitialization Complete"); LogHelper.info("PreInitialization Complete");
} }
@Mod.EventHandler @Mod.EventHandler
public void init(FMLInitializationEvent event){ public void init(FMLInitializationEvent event) {
// Register ModBlocks // Register ModBlocks
ModBlocks.init(); ModBlocks.init();
// Register Fluids // Register Fluids
ModFluids.init(); ModFluids.init();
// Register ModItems // Register ModItems
ModItems.init(); ModItems.init();
//Multiparts //Multiparts
ModParts.init(); ModParts.init();
// Recipes // Recipes
StopWatch watch = new StopWatch(); StopWatch watch = new StopWatch();
watch.start(); watch.start();
ModRecipes.init(); ModRecipes.init();
LogHelper.all(watch + " : main recipes"); LogHelper.all(watch + " : main recipes");
watch.stop(); watch.stop();
//Client only init, needs to be done before parts system //Client only init, needs to be done before parts system
proxy.init(); proxy.init();
// Compat // Compat
for(ICompatModule compatModule : CompatManager.INSTANCE.compatModules){ for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
compatModule.init(event); compatModule.init(event);
} }
// WorldGen // WorldGen
GameRegistry.registerWorldGenerator(new TROreGen(), 0); GameRegistry.registerWorldGenerator(new TROreGen(), 0);
// DungeonLoot.init(); // DungeonLoot.init();
// Register Gui Handler // Register Gui Handler
NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, new GuiHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, new GuiHandler());
// packets // packets
PacketHandler.setChannels(NetworkRegistry.INSTANCE.newChannel( PacketHandler.setChannels(NetworkRegistry.INSTANCE.newChannel(
ModInfo.MOD_ID + "_packets", new PacketHandler())); ModInfo.MOD_ID + "_packets", new PacketHandler()));
// Achievements // Achievements
TRAchievements.init(); TRAchievements.init();
// Multiblock events // Multiblock events
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler()); MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
// IDSU manager // IDSU manager
IDSUManager.INSTANCE = new IDSUManager(); IDSUManager.INSTANCE = new IDSUManager();
MinecraftForge.EVENT_BUS.register(IDSUManager.INSTANCE); MinecraftForge.EVENT_BUS.register(IDSUManager.INSTANCE);
FMLCommonHandler.instance().bus().register(new MultiblockServerTickHandler()); FMLCommonHandler.instance().bus().register(new MultiblockServerTickHandler());
packetPipeline.initalise(); packetPipeline.initalise();
LogHelper.info("Initialization Complete"); LogHelper.info("Initialization Complete");
} }
@Mod.EventHandler @Mod.EventHandler
public void postinit(FMLPostInitializationEvent event) throws Exception { public void postinit(FMLPostInitializationEvent event) throws Exception {
// Has to be done here as Buildcraft registers there recipes late // Has to be done here as Buildcraft registers there recipes late
for(ICompatModule compatModule : CompatManager.INSTANCE.compatModules){ for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
compatModule.postInit(event); compatModule.postInit(event);
} }
packetPipeline.postInitialise(); packetPipeline.postInitialise();
LogHelper.info(RecipeHandler.recipeList.size() + " recipes loaded"); LogHelper.info(RecipeHandler.recipeList.size() + " recipes loaded");
// RecipeHandler.scanForDupeRecipes(); // RecipeHandler.scanForDupeRecipes();
RecipeConfigManager.save(); RecipeConfigManager.save();
} }
@Mod.EventHandler @Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event){ public void serverStarting(FMLServerStartingEvent event) {
event.registerServerCommand(new TechRebornDevCommand()); event.registerServerCommand(new TechRebornDevCommand());
for(ICompatModule compatModule : CompatManager.INSTANCE.compatModules){ for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
compatModule.serverStarting(event); compatModule.serverStarting(event);
} }
} }
@SubscribeEvent @SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent cfgChange){ public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent cfgChange) {
if (cfgChange.modID.equals("TechReborn")) { if (cfgChange.modID.equals("TechReborn")) {
ConfigTechReborn.Configs(); ConfigTechReborn.Configs();
} }
} }
} }

View file

@ -10,27 +10,24 @@ import java.util.List;
public class AchievementMod extends Achievement { public class AchievementMod extends Achievement {
public static List<Achievement> achievements = new ArrayList(); public static List<Achievement> achievements = new ArrayList();
public AchievementMod(String name, int x, int y, ItemStack icon, public AchievementMod(String name, int x, int y, ItemStack icon,
Achievement parent) Achievement parent) {
{ super("achievement.techreborn:" + name, "TechReborn:" + name, x, y,
super("achievement.techreborn:" + name, "TechReborn:" + name, x, y, icon, parent);
icon, parent); achievements.add(this);
achievements.add(this); registerStat();
registerStat(); }
}
public AchievementMod(String name, int x, int y, Item icon, public AchievementMod(String name, int x, int y, Item icon,
Achievement parent) Achievement parent) {
{ this(name, x, y, new ItemStack(icon), parent);
this(name, x, y, new ItemStack(icon), parent); }
}
public AchievementMod(String name, int x, int y, Block icon, public AchievementMod(String name, int x, int y, Block icon,
Achievement parent) Achievement parent) {
{ this(name, x, y, new ItemStack(icon), parent);
this(name, x, y, new ItemStack(icon), parent); }
}
} }

View file

@ -8,31 +8,27 @@ import net.minecraft.stats.Achievement;
public class AchievementTriggerer { public class AchievementTriggerer {
@SubscribeEvent @SubscribeEvent
public void onItemPickedUp(ItemPickupEvent event) public void onItemPickedUp(ItemPickupEvent event) {
{ ItemStack stack = event.pickedUp.getEntityItem();
ItemStack stack = event.pickedUp.getEntityItem(); if (stack != null && stack.getItem() instanceof IPickupAchievement) {
if (stack != null && stack.getItem() instanceof IPickupAchievement) Achievement achievement = ((IPickupAchievement) stack.getItem())
{ .getAchievementOnPickup(stack, event.player, event.pickedUp);
Achievement achievement = ((IPickupAchievement) stack.getItem()) if (achievement != null)
.getAchievementOnPickup(stack, event.player, event.pickedUp); event.player.addStat(achievement, 1);
if (achievement != null) }
event.player.addStat(achievement, 1); }
}
}
@SubscribeEvent @SubscribeEvent
public void onItemCrafted(ItemCraftedEvent event) public void onItemCrafted(ItemCraftedEvent event) {
{ if (event.crafting != null
if (event.crafting != null && event.crafting.getItem() instanceof ICraftAchievement) {
&& event.crafting.getItem() instanceof ICraftAchievement) Achievement achievement = ((ICraftAchievement) event.crafting
{ .getItem()).getAchievementOnCraft(event.crafting,
Achievement achievement = ((ICraftAchievement) event.crafting event.player, event.craftMatrix);
.getItem()).getAchievementOnCraft(event.crafting, if (achievement != null)
event.player, event.craftMatrix); event.player.addStat(achievement, 1);
if (achievement != null) }
event.player.addStat(achievement, 1); }
}
}
} }

View file

@ -7,7 +7,7 @@ import net.minecraft.stats.Achievement;
public interface ICraftAchievement { public interface ICraftAchievement {
public Achievement getAchievementOnCraft(ItemStack stack, public Achievement getAchievementOnCraft(ItemStack stack,
EntityPlayer player, IInventory matrix); EntityPlayer player, IInventory matrix);
} }

View file

@ -7,7 +7,7 @@ import net.minecraft.stats.Achievement;
public interface IPickupAchievement { public interface IPickupAchievement {
public Achievement getAchievementOnPickup(ItemStack stack, public Achievement getAchievementOnPickup(ItemStack stack,
EntityPlayer player, EntityItem item); EntityPlayer player, EntityItem item);
} }

View file

@ -9,31 +9,30 @@ import techreborn.lib.ModInfo;
public class TRAchievements { public class TRAchievements {
public static AchievementPage techrebornPage; public static AchievementPage techrebornPage;
public static int pageIndex; public static int pageIndex;
public static Achievement ore_PickUp; public static Achievement ore_PickUp;
public static Achievement thermalgen_Craft; public static Achievement thermalgen_Craft;
public static Achievement centrifuge_Craft; public static Achievement centrifuge_Craft;
public static void init() public static void init() {
{ ore_PickUp = new AchievementMod("ore_PickUp", 0, 0, new ItemStack(
ore_PickUp = new AchievementMod("ore_PickUp", 0, 0, new ItemStack( ModBlocks.ore, 1, 0), null);
ModBlocks.ore, 1, 0), null); centrifuge_Craft = new AchievementMod("centrifuge_Craft", 1, 1,
centrifuge_Craft = new AchievementMod("centrifuge_Craft", 1, 1, ModBlocks.centrifuge, ore_PickUp);
ModBlocks.centrifuge, ore_PickUp); thermalgen_Craft = new AchievementMod("thermalgen_Craft", 2, 1,
thermalgen_Craft = new AchievementMod("thermalgen_Craft", 2, 1, ModBlocks.thermalGenerator, ore_PickUp);
ModBlocks.thermalGenerator, ore_PickUp);
pageIndex = AchievementPage.getAchievementPages().size(); pageIndex = AchievementPage.getAchievementPages().size();
techrebornPage = new AchievementPage(ModInfo.MOD_NAME, techrebornPage = new AchievementPage(ModInfo.MOD_NAME,
AchievementMod.achievements AchievementMod.achievements
.toArray(new Achievement[AchievementMod.achievements .toArray(new Achievement[AchievementMod.achievements
.size()])); .size()]));
AchievementPage.registerAchievementPage(techrebornPage); AchievementPage.registerAchievementPage(techrebornPage);
FMLCommonHandler.instance().bus().register(new AchievementTriggerer()); FMLCommonHandler.instance().bus().register(new AchievementTriggerer());
} }
} }

View file

@ -1,6 +1,5 @@
package techreborn.api; package techreborn.api;
public interface IpdaItem public interface IpdaItem {
{ //TODO
//TODO
} }

View file

@ -15,116 +15,94 @@ import java.util.List;
public class RollingMachineRecipe { public class RollingMachineRecipe {
private final List<IRecipe> recipes = new ArrayList<IRecipe>(); private final List<IRecipe> recipes = new ArrayList<IRecipe>();
public static final RollingMachineRecipe instance = new RollingMachineRecipe(); public static final RollingMachineRecipe instance = new RollingMachineRecipe();
public void addRecipe(ItemStack output, Object... components) public void addRecipe(ItemStack output, Object... components) {
{ String s = "";
String s = ""; int i = 0;
int i = 0; int j = 0;
int j = 0; int k = 0;
int k = 0; if (components[i] instanceof String[]) {
if (components[i] instanceof String[]) String as[] = (String[]) components[i++];
{ for (int l = 0; l < as.length; l++) {
String as[] = (String[]) components[i++]; String s2 = as[l];
for (int l = 0; l < as.length; l++) k++;
{ j = s2.length();
String s2 = as[l]; s = (new StringBuilder()).append(s).append(s2).toString();
k++; }
j = s2.length(); } else {
s = (new StringBuilder()).append(s).append(s2).toString(); while (components[i] instanceof String) {
} String s1 = (String) components[i++];
} else k++;
{ j = s1.length();
while (components[i] instanceof String) s = (new StringBuilder()).append(s).append(s1).toString();
{ }
String s1 = (String) components[i++]; }
k++; HashMap hashmap = new HashMap();
j = s1.length(); for (; i < components.length; i += 2) {
s = (new StringBuilder()).append(s).append(s1).toString(); Character character = (Character) components[i];
} ItemStack itemstack1 = null;
} if (components[i + 1] instanceof Item) {
HashMap hashmap = new HashMap(); itemstack1 = new ItemStack((Item) components[i + 1]);
for (; i < components.length; i += 2) } else if (components[i + 1] instanceof Block) {
{ itemstack1 = new ItemStack((Block) components[i + 1], 1, -1);
Character character = (Character) components[i]; } else if (components[i + 1] instanceof ItemStack) {
ItemStack itemstack1 = null; itemstack1 = (ItemStack) components[i + 1];
if (components[i + 1] instanceof Item) }
{ hashmap.put(character, itemstack1);
itemstack1 = new ItemStack((Item) components[i + 1]); }
} else if (components[i + 1] instanceof Block)
{
itemstack1 = new ItemStack((Block) components[i + 1], 1, -1);
} else if (components[i + 1] instanceof ItemStack)
{
itemstack1 = (ItemStack) components[i + 1];
}
hashmap.put(character, itemstack1);
}
ItemStack recipeArray[] = new ItemStack[j * k]; ItemStack recipeArray[] = new ItemStack[j * k];
for (int i1 = 0; i1 < j * k; i1++) for (int i1 = 0; i1 < j * k; i1++) {
{ char c = s.charAt(i1);
char c = s.charAt(i1); if (hashmap.containsKey(Character.valueOf(c))) {
if (hashmap.containsKey(Character.valueOf(c))) recipeArray[i1] = ((ItemStack) hashmap
{ .get(Character.valueOf(c))).copy();
recipeArray[i1] = ((ItemStack) hashmap } else {
.get(Character.valueOf(c))).copy(); recipeArray[i1] = null;
} else }
{ }
recipeArray[i1] = null;
}
}
recipes.add(new ShapedRecipes(j, k, recipeArray, output)); recipes.add(new ShapedRecipes(j, k, recipeArray, output));
} }
public void addShapelessRecipe(ItemStack output, Object... components) public void addShapelessRecipe(ItemStack output, Object... components) {
{ List<ItemStack> ingredients = new ArrayList<ItemStack>();
List<ItemStack> ingredients = new ArrayList<ItemStack>(); for (int j = 0; j < components.length; j++) {
for (int j = 0; j < components.length; j++) Object obj = components[j];
{ if (obj instanceof ItemStack) {
Object obj = components[j]; ingredients.add(((ItemStack) obj).copy());
if (obj instanceof ItemStack) continue;
{ }
ingredients.add(((ItemStack) obj).copy()); if (obj instanceof Item) {
continue; ingredients.add(new ItemStack((Item) obj));
} continue;
if (obj instanceof Item) }
{ if (obj instanceof Block) {
ingredients.add(new ItemStack((Item) obj)); ingredients.add(new ItemStack((Block) obj));
continue; } else {
} throw new RuntimeException("Invalid shapeless recipe!");
if (obj instanceof Block) }
{ }
ingredients.add(new ItemStack((Block) obj));
} else
{
throw new RuntimeException("Invalid shapeless recipe!");
}
}
recipes.add(new ShapelessRecipes(output, ingredients)); recipes.add(new ShapelessRecipes(output, ingredients));
} }
public ItemStack findMatchingRecipe(InventoryCrafting inv, World world) public ItemStack findMatchingRecipe(InventoryCrafting inv, World world) {
{ for (int k = 0; k < recipes.size(); k++) {
for (int k = 0; k < recipes.size(); k++) IRecipe irecipe = (IRecipe) recipes.get(k);
{ if (irecipe.matches(inv, world)) {
IRecipe irecipe = (IRecipe) recipes.get(k); return irecipe.getCraftingResult(inv);
if (irecipe.matches(inv, world)) }
{ }
return irecipe.getCraftingResult(inv);
}
}
return null; return null;
} }
public List<IRecipe> getRecipeList() public List<IRecipe> getRecipeList() {
{ return recipes;
return recipes; }
}
} }

View file

@ -3,24 +3,21 @@ package techreborn.api;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public final class TechRebornAPI { public final class TechRebornAPI {
public static void addRollingMachinceRecipe(ItemStack output,
Object... components)
{
RollingMachineRecipe.instance.addRecipe(output, components);
}
public static void addShapelessRollingMachinceRecipe(ItemStack output, public static void addRollingMachinceRecipe(ItemStack output,
Object... components) Object... components) {
{ RollingMachineRecipe.instance.addRecipe(output, components);
RollingMachineRecipe.instance.addShapelessRecipe(output, components); }
}
public static void addShapelessRollingMachinceRecipe(ItemStack output,
Object... components) {
RollingMachineRecipe.instance.addShapelessRecipe(output, components);
}
} }
class RegisteredItemRecipe extends Exception { class RegisteredItemRecipe extends Exception {
public RegisteredItemRecipe(String message) public RegisteredItemRecipe(String message) {
{ super(message);
super(message); }
}
} }

View file

@ -1,5 +1,4 @@
@API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI") @API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI") package techreborn.api.farm;
package techreborn.api.farm;
import cpw.mods.fml.common.API; import cpw.mods.fml.common.API;

View file

@ -1,5 +1,4 @@
@API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI") @API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI") package techreborn.api;
package techreborn.api;
import cpw.mods.fml.common.API; import cpw.mods.fml.common.API;

View file

@ -4,108 +4,96 @@ import net.minecraftforge.common.util.ForgeDirection;
public interface IEnergyInterfaceTile { public interface IEnergyInterfaceTile {
/** /**
* * @return Amount of energy in the tile
* @return Amount of energy in the tile */
*/ public double getEnergy();
public double getEnergy();
/** /**
* Sets the energy in the tile * Sets the energy in the tile
* *
* @param energy the amount of energy to set. * @param energy the amount of energy to set.
*/ */
public void setEnergy(double energy); public void setEnergy(double energy);
/** /**
* Gets the max stored energy in the tile * Gets the max stored energy in the tile
* @return The max energy *
*/ * @return The max energy
public double getMaxPower(); */
public double getMaxPower();
/** /**
* * @param energy amount of energy to add to the tile
* @param energy amount of energy to add to the tile * @return will return true if can fit all
* */
* @return will return true if can fit all public boolean canAddEnergy(double energy);
*/
public boolean canAddEnergy(double energy);
/** /**
* * Will try add add the full amount of energy.
* Will try add add the full amount of energy. *
* * @param energy amount to add
* @param energy amount to add * @return The amount of energy that was added.
* */
* @return The amount of energy that was added. public double addEnergy(double energy);
*/
public double addEnergy(double energy);
/** /**
* * Will try add add the full amount of energy, if simulate is true it wont add the energy
* Will try add add the full amount of energy, if simulate is true it wont add the energy *
* * @param energy amount to add
* @param energy amount to add * @return The amount of energy that was added.
* */
* @return The amount of energy that was added. public double addEnergy(double energy, boolean simulate);
*/
public double addEnergy(double energy, boolean simulate);
/** /**
* Returns true if it can use the full amount of energy * Returns true if it can use the full amount of energy
* *
* @param energy amount of energy to use from the tile. * @param energy amount of energy to use from the tile.
* * @return if all the energy can be used.
* @return if all the energy can be used. */
*/ public boolean canUseEnergy(double energy);
public boolean canUseEnergy(double energy);
/** /**
* Will try and use the full amount of energy * Will try and use the full amount of energy
* *
* @param energy energy to use * @param energy energy to use
* * @return the amount of energy used
* @return the amount of energy used */
*/ public double useEnergy(double energy);
public double useEnergy(double energy);
/** /**
* Will try and use the full amount of energy, if simulate is true it wont add the energy * Will try and use the full amount of energy, if simulate is true it wont add the energy
* *
* @param energy energy to use * @param energy energy to use
* * @return the amount of energy used
* @return the amount of energy used */
*/ public double useEnergy(double energy, boolean simulate);
public double useEnergy(double energy, boolean simulate);
/** /**
* * @param direction The direction to insert energy into
* @param direction The direction to insert energy into * @return if the tile can accept energy from the direction
* */
* @return if the tile can accept energy from the direction public boolean canAcceptEnergy(ForgeDirection direction);
*/
public boolean canAcceptEnergy(ForgeDirection direction);
/** /**
* * @param direction The direction to provide energy from
* @param direction The direction to provide energy from * @return
* @return */
*/ public boolean canProvideEnergy(ForgeDirection direction);
public boolean canProvideEnergy(ForgeDirection direction);
/** /**
* Gets the max output, set to -1 if you don't want the tile to provide energy * Gets the max output, set to -1 if you don't want the tile to provide energy
* *
* @return the max amount of energy outputted per tick. * @return the max amount of energy outputted per tick.
*/ */
public double getMaxOutput(); public double getMaxOutput();
/** /**
* Return -1 if you don't want to accept power ever. * Return -1 if you don't want to accept power ever.
* *
* @return The max amount of energy that can be added to the tile in one tick. * @return The max amount of energy that can be added to the tile in one tick.
*/ */
public double getMaxInput(); public double getMaxInput();
} }

View file

@ -9,7 +9,7 @@ import java.util.List;
/** /**
* Extend this to add a recipe * Extend this to add a recipe
*/ */
public abstract class BaseRecipe implements IBaseRecipeType , Cloneable { public abstract class BaseRecipe implements IBaseRecipeType, Cloneable {
public ArrayList<ItemStack> inputs; public ArrayList<ItemStack> inputs;
@ -35,17 +35,17 @@ public abstract class BaseRecipe implements IBaseRecipeType , Cloneable {
return outputs.get(i).copy(); return outputs.get(i).copy();
} }
@Override @Override
public int getOutputsSize() { public int getOutputsSize() {
return outputs.size(); return outputs.size();
} }
public void addOutput(ItemStack stack){ public void addOutput(ItemStack stack) {
outputs.add(stack); outputs.add(stack);
} }
@Override @Override
public List<ItemStack> getInputs() { public List<ItemStack> getInputs() {
return inputs; return inputs;
} }
@ -76,17 +76,17 @@ public abstract class BaseRecipe implements IBaseRecipeType , Cloneable {
} }
@Override @Override
public Object clone()throws CloneNotSupportedException{ public Object clone() throws CloneNotSupportedException {
return super.clone(); return super.clone();
} }
@Override @Override
public boolean useOreDic() { public boolean useOreDic() {
return true; return true;
} }
@Override @Override
public List<ItemStack> getOutputs() { public List<ItemStack> getOutputs() {
return outputs; return outputs;
} }
} }

View file

@ -24,17 +24,15 @@ public interface IBaseRecipeType {
*/ */
public ItemStack getOutput(int i); public ItemStack getOutput(int i);
/** /**
* * @return The ammount of outputs
* @return The ammount of outputs */
*/ public int getOutputsSize();
public int getOutputsSize();
/** /**
* * @return get outputs
* @return get outputs */
*/ public List<ItemStack> getOutputs();
public List<ItemStack> getOutputs();
/** /**
* This is the name to check that the recipe is the one that should be used in * This is the name to check that the recipe is the one that should be used in
@ -44,12 +42,12 @@ public interface IBaseRecipeType {
*/ */
public String getRecipeName(); public String getRecipeName();
/** /**
* This should be a user friendly name * This should be a user friendly name
* *
* @return * @return
*/ */
public String getUserFreindlyName(); public String getUserFreindlyName();
/** /**
* This is how long the recipe needs to tick for the crafting operation to complete * This is how long the recipe needs to tick for the crafting operation to complete
@ -77,7 +75,7 @@ public interface IBaseRecipeType {
*/ */
public boolean onCraft(TileEntity tile); public boolean onCraft(TileEntity tile);
public Object clone()throws CloneNotSupportedException; public Object clone() throws CloneNotSupportedException;
public boolean useOreDic(); public boolean useOreDic();
} }

View file

@ -1,6 +1,5 @@
package techreborn.api.recipe; package techreborn.api.recipe;
import ic2.api.energy.prefab.BasicSink;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
@ -72,7 +71,7 @@ public class RecipeCrafter {
public RecipeCrafter(String recipeName, TileMachineBase parentTile, int inputs, int outputs, Inventory inventory, int[] inputSlots, int[] outputSlots) { public RecipeCrafter(String recipeName, TileMachineBase parentTile, int inputs, int outputs, Inventory inventory, int[] inputSlots, int[] outputSlots) {
this.recipeName = recipeName; this.recipeName = recipeName;
this.parentTile = parentTile; this.parentTile = parentTile;
if(parentTile instanceof IEnergyInterfaceTile){ if (parentTile instanceof IEnergyInterfaceTile) {
energy = (IEnergyInterfaceTile) parentTile; energy = (IEnergyInterfaceTile) parentTile;
} }
this.inputs = inputs; this.inputs = inputs;
@ -91,7 +90,7 @@ public class RecipeCrafter {
/** /**
* This is used to change the speed of the crafting operation. * This is used to change the speed of the crafting operation.
* * <p/>
* 0 = none; * 0 = none;
* 0.2 = 20% speed increase * 0.2 = 20% speed increase
* 0.75 = 75% increase * 0.75 = 75% increase
@ -100,7 +99,7 @@ public class RecipeCrafter {
/** /**
* This is used to change the power of the crafting operation. * This is used to change the power of the crafting operation.
* * <p/>
* 1 = none; * 1 = none;
* 1.2 = 20% speed increase * 1.2 = 20% speed increase
* 1.75 = 75% increase * 1.75 = 75% increase
@ -108,20 +107,20 @@ public class RecipeCrafter {
*/ */
double powerMultiplier = 1; double powerMultiplier = 1;
int ticksSinceLastChange; int ticksSinceLastChange;
/** /**
* Call this on the tile tick * Call this on the tile tick
*/ */
public void updateEntity() { public void updateEntity() {
if(parentTile.getWorldObj().isRemote){ if (parentTile.getWorldObj().isRemote) {
return; return;
} }
ticksSinceLastChange ++; ticksSinceLastChange++;
if(ticksSinceLastChange == 20){//Force a has chanced every second if (ticksSinceLastChange == 20) {//Force a has chanced every second
inventory.hasChanged = true; inventory.hasChanged = true;
ticksSinceLastChange = 0; ticksSinceLastChange = 0;
} }
if (currentRecipe == null && inventory.hasChanged) {//It will now look for new recipes. if (currentRecipe == null && inventory.hasChanged) {//It will now look for new recipes.
currentTickTime = 0; currentTickTime = 0;
for (IBaseRecipeType recipe : RecipeHandler.getRecipeClassFromName(recipeName)) { for (IBaseRecipeType recipe : RecipeHandler.getRecipeClassFromName(recipeName)) {
@ -135,9 +134,9 @@ public class RecipeCrafter {
} }
if (canGiveInvAll) { if (canGiveInvAll) {
setCurrentRecipe(recipe);//Sets the current recipe then syncs setCurrentRecipe(recipe);//Sets the current recipe then syncs
this.currentNeededTicks = (int)(currentRecipe.tickTime() * (1.0 - speedMultiplier)); this.currentNeededTicks = (int) (currentRecipe.tickTime() * (1.0 - speedMultiplier));
this.currentTickTime = -1; this.currentTickTime = -1;
syncIsActive(); syncIsActive();
} else { } else {
this.currentTickTime = -0; this.currentTickTime = -0;
} }
@ -147,7 +146,7 @@ public class RecipeCrafter {
if (inventory.hasChanged && !hasAllInputs()) {//If it doesn't have all the inputs reset if (inventory.hasChanged && !hasAllInputs()) {//If it doesn't have all the inputs reset
currentRecipe = null; currentRecipe = null;
currentTickTime = 0; currentTickTime = 0;
syncIsActive(); syncIsActive();
} }
if (currentRecipe != null && currentTickTime >= currentNeededTicks) {//If it has reached the recipe tick time if (currentRecipe != null && currentTickTime >= currentNeededTicks) {//If it has reached the recipe tick time
boolean canGiveInvAll = true; boolean canGiveInvAll = true;
@ -167,7 +166,7 @@ public class RecipeCrafter {
useAllInputs();//this uses all the inputs useAllInputs();//this uses all the inputs
currentRecipe = null;//resets currentRecipe = null;//resets
currentTickTime = 0; currentTickTime = 0;
syncIsActive(); syncIsActive();
} }
} else if (currentRecipe != null && currentTickTime < currentNeededTicks) { } else if (currentRecipe != null && currentTickTime < currentNeededTicks) {
if (energy.canUseEnergy(getEuPerTick())) {//This uses the power if (energy.canUseEnergy(getEuPerTick())) {//This uses the power
@ -176,9 +175,9 @@ public class RecipeCrafter {
} }
} }
} }
if(inventory.hasChanged){ if (inventory.hasChanged) {
inventory.hasChanged = false; inventory.hasChanged = false;
} }
} }
public boolean hasAllInputs() { public boolean hasAllInputs() {
@ -264,14 +263,14 @@ public class RecipeCrafter {
public void readFromNBT(NBTTagCompound tag) { public void readFromNBT(NBTTagCompound tag) {
NBTTagCompound data = tag.getCompoundTag("Crater"); NBTTagCompound data = tag.getCompoundTag("Crater");
if(data.hasKey("currentTickTime")) if (data.hasKey("currentTickTime"))
currentTickTime = data.getInteger("currentTickTime"); currentTickTime = data.getInteger("currentTickTime");
isactive = data.getBoolean("isActive"); isactive = data.getBoolean("isActive");
if(parentTile != null && parentTile.getWorldObj() != null && parentTile.getWorldObj().isRemote){ if (parentTile != null && parentTile.getWorldObj() != null && parentTile.getWorldObj().isRemote) {
parentTile.getWorldObj().markBlockForUpdate(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord); parentTile.getWorldObj().markBlockForUpdate(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord);
parentTile.getWorldObj().markBlockRangeForRenderUpdate(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, parentTile.xCoord, parentTile.yCoord, parentTile.zCoord); parentTile.getWorldObj().markBlockRangeForRenderUpdate(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, parentTile.xCoord, parentTile.yCoord, parentTile.zCoord);
} }
} }
public void writeToNBT(NBTTagCompound tag) { public void writeToNBT(NBTTagCompound tag) {
@ -293,54 +292,54 @@ public class RecipeCrafter {
return isactive; return isactive;
} }
public void addSpeedMulti(double amount){ public void addSpeedMulti(double amount) {
if(speedMultiplier + amount <= 0.99){ if (speedMultiplier + amount <= 0.99) {
speedMultiplier += amount; speedMultiplier += amount;
} else { } else {
speedMultiplier = 0.99; speedMultiplier = 0.99;
} }
} }
public void resetSpeedMulti(){ public void resetSpeedMulti() {
speedMultiplier = 0; speedMultiplier = 0;
} }
public double getSpeedMultiplier(){ public double getSpeedMultiplier() {
return speedMultiplier; return speedMultiplier;
} }
public void addPowerMulti(double amount){ public void addPowerMulti(double amount) {
powerMultiplier += amount; powerMultiplier += amount;
} }
public void resetPowerMulti(){ public void resetPowerMulti() {
powerMultiplier = 1; powerMultiplier = 1;
} }
public double getPowerMultiplier(){ public double getPowerMultiplier() {
return powerMultiplier; return powerMultiplier;
} }
public double getEuPerTick(){ public double getEuPerTick() {
return currentRecipe.euPerTick() * powerMultiplier; return currentRecipe.euPerTick() * powerMultiplier;
} }
public void syncIsActive() { public void syncIsActive() {
if (!parentTile.getWorldObj().isRemote) { if (!parentTile.getWorldObj().isRemote) {
PacketHandler.sendPacketToAllPlayers(getSyncPacket(), PacketHandler.sendPacketToAllPlayers(getSyncPacket(),
parentTile.getWorldObj()); parentTile.getWorldObj());
} }
} }
public Packet getSyncPacket() { public Packet getSyncPacket() {
NBTTagCompound nbtTag = new NBTTagCompound(); NBTTagCompound nbtTag = new NBTTagCompound();
writeToNBT(nbtTag); writeToNBT(nbtTag);
return new S35PacketUpdateTileEntity(this.parentTile.xCoord, this.parentTile.yCoord, return new S35PacketUpdateTileEntity(this.parentTile.xCoord, this.parentTile.yCoord,
this.parentTile.zCoord, 1, nbtTag); this.parentTile.zCoord, 1, nbtTag);
} }
public void setCurrentRecipe(IBaseRecipeType recipe){ public void setCurrentRecipe(IBaseRecipeType recipe) {
try { try {
this.currentRecipe = (IBaseRecipeType) recipe.clone(); this.currentRecipe = (IBaseRecipeType) recipe.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {

View file

@ -62,7 +62,7 @@ public class RecipeHandler {
if (recipeList.contains(recipe)) { if (recipeList.contains(recipe)) {
return; return;
} }
if(!RecipeConfigManager.canLoadRecipe(recipe)){ if (!RecipeConfigManager.canLoadRecipe(recipe)) {
return; return;
} }
if (!machineNames.contains(recipe.getRecipeName())) { if (!machineNames.contains(recipe.getRecipeName())) {
@ -86,11 +86,11 @@ public class RecipeHandler {
for (int i = 0; i < baseRecipeType.getInputs().size(); i++) { for (int i = 0; i < baseRecipeType.getInputs().size(); i++) {
if (ItemUtils.isItemEqual(baseRecipeType.getInputs().get(i), recipe.getInputs().get(i), true, false, false)) { if (ItemUtils.isItemEqual(baseRecipeType.getInputs().get(i), recipe.getInputs().get(i), true, false, false)) {
StringBuffer itemInfo = new StringBuffer(); StringBuffer itemInfo = new StringBuffer();
for(ItemStack inputs : baseRecipeType.getInputs()){ for (ItemStack inputs : baseRecipeType.getInputs()) {
itemInfo.append(":" + inputs.getItem().getUnlocalizedName() + "," + inputs.getDisplayName() + "," + inputs.stackSize); itemInfo.append(":" + inputs.getItem().getUnlocalizedName() + "," + inputs.getDisplayName() + "," + inputs.stackSize);
} }
LogHelper.all(stackMap.get(baseRecipeType)); LogHelper.all(stackMap.get(baseRecipeType));
// throw new Exception("Found a duplicate recipe for " + baseRecipeType.getRecipeName() + " with inputs " + itemInfo.toString()); // throw new Exception("Found a duplicate recipe for " + baseRecipeType.getRecipeName() + " with inputs " + itemInfo.toString());
} }
} }
} }

View file

@ -16,8 +16,8 @@ public class AlloySmelterRecipe extends BaseRecipe {
addOutput(output1); addOutput(output1);
} }
@Override @Override
public String getUserFreindlyName() { public String getUserFreindlyName() {
return "Alloy Smelter"; return "Alloy Smelter";
} }
} }

View file

@ -16,8 +16,8 @@ public class AssemblingMachineRecipe extends BaseRecipe {
addOutput(output1); addOutput(output1);
} }
@Override @Override
public String getUserFreindlyName() { public String getUserFreindlyName() {
return "Assembling Machine"; return "Assembling Machine";
} }
} }

View file

@ -9,9 +9,9 @@ import techreborn.tiles.TileBlastFurnace;
public class BlastFurnaceRecipe extends BaseRecipe { public class BlastFurnaceRecipe extends BaseRecipe {
public int neededHeat; public int neededHeat;
public BlastFurnaceRecipe(ItemStack input1, ItemStack input2, ItemStack output1 , ItemStack output2, int tickTime, int euPerTick, int neededHeat) { public BlastFurnaceRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, int tickTime, int euPerTick, int neededHeat) {
super(Reference.blastFurnaceRecipe, tickTime, euPerTick); super(Reference.blastFurnaceRecipe, tickTime, euPerTick);
if (input1 != null) if (input1 != null)
inputs.add(input1); inputs.add(input1);
@ -22,25 +22,25 @@ public class BlastFurnaceRecipe extends BaseRecipe {
if (output2 != null) if (output2 != null)
addOutput(output2); addOutput(output2);
this.neededHeat = neededHeat; this.neededHeat = neededHeat;
} }
@Override @Override
public String getUserFreindlyName() { public String getUserFreindlyName() {
return "Blast Furnace"; return "Blast Furnace";
} }
@Override @Override
public boolean canCraft(TileEntity tile) { public boolean canCraft(TileEntity tile) {
if(tile instanceof TileBlastFurnace){ if (tile instanceof TileBlastFurnace) {
TileBlastFurnace blastFurnace = (TileBlastFurnace) tile; TileBlastFurnace blastFurnace = (TileBlastFurnace) tile;
return blastFurnace.getHeat() >= neededHeat; return blastFurnace.getHeat() >= neededHeat;
} }
return false; return false;
} }
@Override @Override
public boolean onCraft(TileEntity tile) { public boolean onCraft(TileEntity tile) {
return super.onCraft(tile); return super.onCraft(tile);
} }
} }

View file

@ -22,8 +22,8 @@ public class CentrifugeRecipe extends BaseRecipe {
addOutput(output4); addOutput(output4);
} }
@Override @Override
public String getUserFreindlyName() { public String getUserFreindlyName() {
return "Centrifuge"; return "Centrifuge";
} }
} }

View file

@ -16,8 +16,8 @@ public class ChemicalReactorRecipe extends BaseRecipe {
addOutput(output1); addOutput(output1);
} }
@Override @Override
public String getUserFreindlyName() { public String getUserFreindlyName() {
return "Chemical Reactor"; return "Chemical Reactor";
} }
} }

View file

@ -16,7 +16,7 @@ public class GrinderRecipe extends BaseRecipe {
super(Reference.grinderRecipe, tickTime, euPerTick); super(Reference.grinderRecipe, tickTime, euPerTick);
if (input1 != null) if (input1 != null)
inputs.add(input1); inputs.add(input1);
if( input2 != null) if (input2 != null)
inputs.add(input2); inputs.add(input2);
if (output1 != null) if (output1 != null)
addOutput(output1); addOutput(output1);
@ -29,12 +29,12 @@ public class GrinderRecipe extends BaseRecipe {
this.fluidStack = fluidStack; this.fluidStack = fluidStack;
} }
@Override @Override
public String getUserFreindlyName() { public String getUserFreindlyName() {
return "Grinder"; return "Grinder";
} }
@Override @Override
public boolean canCraft(TileEntity tile) { public boolean canCraft(TileEntity tile) {
if (fluidStack == null) { if (fluidStack == null) {
return true; return true;

View file

@ -18,8 +18,8 @@ public class ImplosionCompressorRecipe extends BaseRecipe {
addOutput(output2); addOutput(output2);
} }
@Override @Override
public String getUserFreindlyName() { public String getUserFreindlyName() {
return "Implosion Compressor"; return "Implosion Compressor";
} }
} }

View file

@ -1,41 +1,36 @@
package techreborn.api.recipe.machines; package techreborn.api.recipe.machines;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidStack;
import techreborn.api.recipe.BaseRecipe; import techreborn.api.recipe.BaseRecipe;
import techreborn.lib.Reference; import techreborn.lib.Reference;
import techreborn.tiles.TileIndustrialElectrolyzer;
public class IndustrialElectrolyzerRecipe extends BaseRecipe { public class IndustrialElectrolyzerRecipe extends BaseRecipe {
public IndustrialElectrolyzerRecipe(ItemStack inputCells, ItemStack input2, ItemStack output1, ItemStack output2, ItemStack output3, ItemStack output4, int tickTime, int euPerTick)
{
super(Reference.industrialElectrolyzerRecipe, tickTime, euPerTick);
if (inputCells != null)
inputs.add(inputCells);
if( input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
if (output3 != null)
addOutput(output3);
if (output4 != null)
addOutput(output4);
}
@Override public IndustrialElectrolyzerRecipe(ItemStack inputCells, ItemStack input2, ItemStack output1, ItemStack output2, ItemStack output3, ItemStack output4, int tickTime, int euPerTick) {
public String getUserFreindlyName() { super(Reference.industrialElectrolyzerRecipe, tickTime, euPerTick);
return "Industrial Electrolyzer"; if (inputCells != null)
} inputs.add(inputCells);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
if (output3 != null)
addOutput(output3);
if (output4 != null)
addOutput(output4);
}
@Override @Override
public boolean useOreDic() public String getUserFreindlyName() {
{ return "Industrial Electrolyzer";
return useOreDictionary; }
}
private boolean useOreDictionary = true; @Override
public boolean useOreDic() {
return useOreDictionary;
}
private boolean useOreDictionary = true;
} }

View file

@ -44,12 +44,12 @@ public class IndustrialSawmillRecipe extends BaseRecipe {
this.canUseOreDict = canUseOreDict; this.canUseOreDict = canUseOreDict;
} }
@Override @Override
public String getUserFreindlyName() { public String getUserFreindlyName() {
return "Industrial Sawmill"; return "Industrial Sawmill";
} }
@Override @Override
public boolean canCraft(TileEntity tile) { public boolean canCraft(TileEntity tile) {
if (fluidStack == null) { if (fluidStack == null) {
return true; return true;
@ -92,8 +92,8 @@ public class IndustrialSawmillRecipe extends BaseRecipe {
return false; return false;
} }
@Override @Override
public boolean useOreDic() { public boolean useOreDic() {
return canUseOreDict; return canUseOreDict;
} }
} }

View file

@ -14,8 +14,8 @@ public class LatheRecipe extends BaseRecipe {
addOutput(output1); addOutput(output1);
} }
@Override @Override
public String getUserFreindlyName() { public String getUserFreindlyName() {
return "Lathe"; return "Lathe";
} }
} }

View file

@ -11,11 +11,11 @@ public class PlateCuttingMachineRecipe extends BaseRecipe {
if (input1 != null) if (input1 != null)
inputs.add(input1); inputs.add(input1);
if (output1 != null) if (output1 != null)
addOutput(output1); addOutput(output1);
} }
@Override @Override
public String getUserFreindlyName() { public String getUserFreindlyName() {
return "Plate Cutting Machine"; return "Plate Cutting Machine";
} }
} }

View file

@ -44,15 +44,15 @@ public class RecipeConfig {
this.machine = machine; this.machine = machine;
} }
public void addInputs(ConfigItem item){ public void addInputs(ConfigItem item) {
if(inputs == null){ if (inputs == null) {
inputs = new ArrayList<ConfigItem>(); inputs = new ArrayList<ConfigItem>();
} }
inputs.add(item); inputs.add(item);
} }
public void addOutputs(ConfigItem item){ public void addOutputs(ConfigItem item) {
if(outputs == null){ if (outputs == null) {
outputs = new ArrayList<ConfigItem>(); outputs = new ArrayList<ConfigItem>();
} }
outputs.add(item); outputs.add(item);

View file

@ -16,14 +16,14 @@ public class RecipeConfigManager {
static File configFile = null; static File configFile = null;
public static void load(File configDir){ public static void load(File configDir) {
if(configFile == null){ if (configFile == null) {
configFile = new File(configDir, "techRebornRecipes.json"); configFile = new File(configDir, "techRebornRecipes.json");
} }
} }
public static void save(){ public static void save() {
if(configFile.exists()){ if (configFile.exists()) {
configFile.delete(); configFile.delete();
} }
Gson gson = new GsonBuilder().setPrettyPrinting().create(); Gson gson = new GsonBuilder().setPrettyPrinting().create();
@ -38,12 +38,12 @@ public class RecipeConfigManager {
} }
public static boolean canLoadRecipe(IBaseRecipeType recipeType){ public static boolean canLoadRecipe(IBaseRecipeType recipeType) {
RecipeConfig config = new RecipeConfig(); RecipeConfig config = new RecipeConfig();
for(ItemStack stack : recipeType.getInputs()){ for (ItemStack stack : recipeType.getInputs()) {
config.addInputs(itemToConfig(stack)); config.addInputs(itemToConfig(stack));
} }
for(ItemStack stack : recipeType.getOutputs()){ for (ItemStack stack : recipeType.getOutputs()) {
config.addOutputs(itemToConfig(stack)); config.addOutputs(itemToConfig(stack));
} }
config.enabled = true; config.enabled = true;
@ -53,7 +53,7 @@ public class RecipeConfigManager {
} }
public static ConfigItem itemToConfig(ItemStack stack){ public static ConfigItem itemToConfig(ItemStack stack) {
ConfigItem newItem = new ConfigItem(); ConfigItem newItem = new ConfigItem();
newItem.setItemName(stack.getItem().getUnlocalizedName()); newItem.setItemName(stack.getItem().getUnlocalizedName());
newItem.setMeta(stack.getItemDamage()); newItem.setMeta(stack.getItemDamage());

View file

@ -5,5 +5,5 @@ import techreborn.api.recipe.RecipeCrafter;
public interface IMachineUpgrade { public interface IMachineUpgrade {
public void processUpgrade(RecipeCrafter crafter, ItemStack stack); public void processUpgrade(RecipeCrafter crafter, ItemStack stack);
} }

View file

@ -8,32 +8,32 @@ import java.util.ArrayList;
public class UpgradeHandler { public class UpgradeHandler {
RecipeCrafter crafter; RecipeCrafter crafter;
Inventory inventory; Inventory inventory;
ArrayList<Integer> slots = new ArrayList<Integer>(); ArrayList<Integer> slots = new ArrayList<Integer>();
public UpgradeHandler(RecipeCrafter crafter, Inventory inventory, int... slots) { public UpgradeHandler(RecipeCrafter crafter, Inventory inventory, int... slots) {
this.crafter = crafter; this.crafter = crafter;
this.inventory = inventory; this.inventory = inventory;
for(int slot : slots){ for (int slot : slots) {
this.slots.add(slot); this.slots.add(slot);
} }
} }
public void tick(){ public void tick() {
if(crafter.parentTile.getWorldObj().isRemote) if (crafter.parentTile.getWorldObj().isRemote)
return; return;
crafter.resetPowerMulti(); crafter.resetPowerMulti();
crafter.resetSpeedMulti(); crafter.resetSpeedMulti();
for(int slot : this.slots){ for (int slot : this.slots) {
ItemStack stack = inventory.getStackInSlot(slot); ItemStack stack = inventory.getStackInSlot(slot);
if(stack != null && stack.getItem() instanceof IMachineUpgrade){ if (stack != null && stack.getItem() instanceof IMachineUpgrade) {
((IMachineUpgrade) stack.getItem()).processUpgrade(crafter, stack); ((IMachineUpgrade) stack.getItem()).processUpgrade(crafter, stack);
} }
} }
if(crafter.currentRecipe != null) if (crafter.currentRecipe != null)
crafter.currentNeededTicks = (int)(crafter.currentRecipe.tickTime() * (1.0 - crafter.getSpeedMultiplier())); crafter.currentNeededTicks = (int) (crafter.currentRecipe.tickTime() * (1.0 - crafter.getSpeedMultiplier()));
} }
} }

View file

@ -1,5 +1,4 @@
@API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI") @API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI") package techreborn.api.upgrade;
package techreborn.api.upgrade;
import cpw.mods.fml.common.API; import cpw.mods.fml.common.API;

View file

@ -15,115 +15,115 @@ import java.util.List;
public class ClassTransformation implements IClassTransformer { public class ClassTransformation implements IClassTransformer {
private static final String[] emptyList = {}; private static final String[] emptyList = {};
static String strippableDesc; static String strippableDesc;
public ClassTransformation() { public ClassTransformation() {
strippableDesc = Type.getDescriptor(Strippable.class); strippableDesc = Type.getDescriptor(Strippable.class);
} }
static boolean strip(ClassNode cn) { static boolean strip(ClassNode cn) {
boolean altered = false; boolean altered = false;
if (cn.methods != null) { if (cn.methods != null) {
Iterator<MethodNode> iter = cn.methods.iterator(); Iterator<MethodNode> iter = cn.methods.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
MethodNode mn = iter.next(); MethodNode mn = iter.next();
if (mn.visibleAnnotations != null) { if (mn.visibleAnnotations != null) {
for (AnnotationNode node : mn.visibleAnnotations) { for (AnnotationNode node : mn.visibleAnnotations) {
if (checkRemove(parseAnnotation(node, strippableDesc), iter)) { if (checkRemove(parseAnnotation(node, strippableDesc), iter)) {
altered = true; altered = true;
break; break;
} }
} }
} }
} }
} }
if (cn.fields != null) { if (cn.fields != null) {
Iterator<FieldNode> iter = cn.fields.iterator(); Iterator<FieldNode> iter = cn.fields.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
FieldNode fn = iter.next(); FieldNode fn = iter.next();
if (fn.visibleAnnotations != null) { if (fn.visibleAnnotations != null) {
for (AnnotationNode node : fn.visibleAnnotations) { for (AnnotationNode node : fn.visibleAnnotations) {
if (checkRemove(parseAnnotation(node, strippableDesc), iter)) { if (checkRemove(parseAnnotation(node, strippableDesc), iter)) {
altered = true; altered = true;
break; break;
} }
} }
} }
} }
} }
return altered; return altered;
} }
static AnnotationInfo parseAnnotation(AnnotationNode node, String desc) { static AnnotationInfo parseAnnotation(AnnotationNode node, String desc) {
AnnotationInfo info = null; AnnotationInfo info = null;
if (node.desc.equals(desc)) { if (node.desc.equals(desc)) {
info = new AnnotationInfo(); info = new AnnotationInfo();
if (node.values != null) { if (node.values != null) {
List<Object> values = node.values; List<Object> values = node.values;
for (int i = 0, e = values.size(); i < e; ) { for (int i = 0, e = values.size(); i < e; ) {
Object k = values.get(i++); Object k = values.get(i++);
Object v = values.get(i++); Object v = values.get(i++);
if ("value".equals(k)) { if ("value".equals(k)) {
if (!(v instanceof List && ((List<?>) v).size() > 0 && ((List<?>) v).get(0) instanceof String)) { if (!(v instanceof List && ((List<?>) v).size() > 0 && ((List<?>) v).get(0) instanceof String)) {
continue; continue;
} }
info.values = ((List<?>) v).toArray(emptyList); info.values = ((List<?>) v).toArray(emptyList);
} }
} }
} }
} }
return info; return info;
} }
static boolean checkRemove(AnnotationInfo node, Iterator<? extends Object> iter) { static boolean checkRemove(AnnotationInfo node, Iterator<? extends Object> iter) {
if (node != null) { if (node != null) {
boolean needsRemoved = false; boolean needsRemoved = false;
String[] value = node.values; String[] value = node.values;
for (int j = 0, l = value.length; j < l; ++j) { for (int j = 0, l = value.length; j < l; ++j) {
String clazz = value[j]; String clazz = value[j];
String mod = clazz.substring(4); String mod = clazz.substring(4);
if (clazz.startsWith("mod:")) { if (clazz.startsWith("mod:")) {
int i = mod.indexOf('@'); int i = mod.indexOf('@');
if (i > 0) { if (i > 0) {
mod = mod.substring(0, i); mod = mod.substring(0, i);
} }
if (!Loader.isModLoaded(mod)) { if (!Loader.isModLoaded(mod)) {
needsRemoved = true; needsRemoved = true;
} }
} }
if (needsRemoved) { if (needsRemoved) {
break; break;
} }
} }
if (needsRemoved) { if (needsRemoved) {
iter.remove(); iter.remove();
return true; return true;
} }
} }
return false; return false;
} }
@Override @Override
public byte[] transform(String name, String transformedName, byte[] bytes) { public byte[] transform(String name, String transformedName, byte[] bytes) {
if (bytes == null) { if (bytes == null) {
return null; return null;
} }
ClassReader cr = new ClassReader(bytes); ClassReader cr = new ClassReader(bytes);
ClassNode cn = new ClassNode(); ClassNode cn = new ClassNode();
cr.accept(cn, 0); cr.accept(cn, 0);
if (strip(cn)) { if (strip(cn)) {
ClassWriter cw = new ClassWriter(0); ClassWriter cw = new ClassWriter(0);
cn.accept(cw); cn.accept(cw);
bytes = cw.toByteArray(); bytes = cw.toByteArray();
LoadingPlugin.stripedClases++; LoadingPlugin.stripedClases++;
} }
return bytes; return bytes;
} }
static class AnnotationInfo { static class AnnotationInfo {
public String side = "NONE"; public String side = "NONE";
public String[] values = emptyList; public String[] values = emptyList;
} }
} }

View file

@ -11,53 +11,53 @@ import java.util.Map;
@IFMLLoadingPlugin.MCVersion("1.7.10") @IFMLLoadingPlugin.MCVersion("1.7.10")
public class LoadingPlugin implements IFMLLoadingPlugin { public class LoadingPlugin implements IFMLLoadingPlugin {
public static boolean runtimeDeobfEnabled = false; public static boolean runtimeDeobfEnabled = false;
public static int stripedClases = 0; public static int stripedClases = 0;
@Override @Override
public String[] getASMTransformerClass() { public String[] getASMTransformerClass() {
return new String[]{"techreborn.asm.ClassTransformation"}; return new String[]{"techreborn.asm.ClassTransformation"};
} }
@Override @Override
public String getModContainerClass() { public String getModContainerClass() {
return DummyMod.class.getName(); return DummyMod.class.getName();
} }
@Override @Override
public String getSetupClass() { public String getSetupClass() {
return DummyMod.class.getName(); return DummyMod.class.getName();
} }
@Override @Override
public void injectData(Map<String, Object> data) { public void injectData(Map<String, Object> data) {
runtimeDeobfEnabled = (Boolean) data.get("runtimeDeobfuscationEnabled"); runtimeDeobfEnabled = (Boolean) data.get("runtimeDeobfuscationEnabled");
} }
@Override @Override
public String getAccessTransformerClass() { public String getAccessTransformerClass() {
return null; return null;
} }
public static class DummyMod extends DummyModContainer implements IFMLCallHook { public static class DummyMod extends DummyModContainer implements IFMLCallHook {
public DummyMod() { public DummyMod() {
super(new ModMetadata()); super(new ModMetadata());
ModMetadata md = getMetadata(); ModMetadata md = getMetadata();
md.autogenerated = true; md.autogenerated = true;
md.modId = ModInfo.MOD_ID + "asm"; md.modId = ModInfo.MOD_ID + "asm";
md.name = md.description = "Techreborn-ASM"; md.name = md.description = "Techreborn-ASM";
md.parent = ModInfo.MOD_ID; md.parent = ModInfo.MOD_ID;
md.version = "000"; md.version = "000";
} }
@Override @Override
public void injectData(Map<String, Object> data) { public void injectData(Map<String, Object> data) {
} }
@Override @Override
public Void call() throws Exception { public Void call() throws Exception {
return null; return null;
} }
} }
} }

View file

@ -1,10 +1,6 @@
package techreborn.asm; package techreborn.asm;
import java.lang.annotation.Documented; import java.lang.annotation.*;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/** /**
* When used on a class, methods from referenced interfaces will not be removed <br> * When used on a class, methods from referenced interfaces will not be removed <br>
@ -17,6 +13,6 @@ import java.lang.annotation.Target;
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE}) @Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE})
public @interface Strippable { public @interface Strippable {
public String[] value(); public String[] value();
} }

View file

@ -12,58 +12,53 @@ import techreborn.Core;
import techreborn.client.GuiHandler; import techreborn.client.GuiHandler;
import techreborn.tiles.TileChunkLoader; import techreborn.tiles.TileChunkLoader;
public class BlockChunkLoader extends BlockMachineBase{ public class BlockChunkLoader extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockChunkLoader(Material material) public BlockChunkLoader(Material material) {
{ super(material);
super(material); setBlockName("techreborn.chunkloader");
setBlockName("techreborn.chunkloader"); }
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_)
{
return new TileChunkLoader();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.chunkloaderID, world, x, y,
z);
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("techreborn:machine/industrial_chunk_loader_side");
this.iconFront = icon.registerIcon("techreborn:machine/industrial_chunk_loader_side");
this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) public TileEntity createNewTileEntity(World world, int p_149915_2_) {
{ return new TileChunkLoader();
}
return metadata == 0 && side == 3 ? this.iconFront @Override
: side == 1 ? this.iconTop : public boolean onBlockActivated(World world, int x, int y, int z,
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
: (side == metadata ? this.iconFront : this.blockIcon)); if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.chunkloaderID, world, x, y,
z);
return true;
}
} @Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) {
this.blockIcon = icon.registerIcon("techreborn:machine/industrial_chunk_loader_side");
this.iconFront = icon.registerIcon("techreborn:machine/industrial_chunk_loader_side");
this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
} }

View file

@ -8,40 +8,37 @@ import net.minecraft.util.IIcon;
public class BlockComputerCube extends BlockMachineBase { public class BlockComputerCube extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockComputerCube(Material material) public BlockComputerCube(Material material) {
{ super(material);
super(material); setBlockName("techreborn.computercube");
setBlockName("techreborn.computercube"); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/computer_cube");
this.blockIcon = icon.registerIcon("techreborn:machine/computer_cube"); this.iconFront = icon.registerIcon("techreborn:machine/computer_cube");
this.iconFront = icon.registerIcon("techreborn:machine/computer_cube"); this.iconTop = icon.registerIcon("techreborn:machine/computer_cube");
this.iconTop = icon.registerIcon("techreborn:machine/computer_cube"); this.iconBottom = icon.registerIcon("techreborn:machine/computer_cube");
this.iconBottom = icon.registerIcon("techreborn:machine/computer_cube"); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) public IIcon getIcon(int side, int metadata) {
{
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -14,55 +14,50 @@ import techreborn.tiles.TileDigitalChest;
public class BlockDigitalChest extends BlockMachineBase { public class BlockDigitalChest extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockDigitalChest() public BlockDigitalChest() {
{ super(Material.rock);
super(Material.rock); setBlockName("techreborn.digitalChest");
setBlockName("techreborn.digitalChest"); }
}
@Override @Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
{ return new TileDigitalChest();
return new TileDigitalChest(); }
}
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ) EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
{ if (!player.isSneaking())
if (!player.isSneaking()) player.openGui(Core.INSTANCE, GuiHandler.digitalChestID, world, x,
player.openGui(Core.INSTANCE, GuiHandler.digitalChestID, world, x, y, z);
y, z); return true;
return true; }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/qchest_side");
this.blockIcon = icon.registerIcon("techreborn:machine/qchest_side"); this.iconFront = icon.registerIcon("techreborn:machine/quantum_chest");
this.iconFront = icon.registerIcon("techreborn:machine/quantum_chest"); this.iconTop = icon.registerIcon("techreborn:machine/quantum_top");
this.iconTop = icon.registerIcon("techreborn:machine/quantum_top"); this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom"); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) public IIcon getIcon(int side, int metadata) {
{
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -8,40 +8,37 @@ import net.minecraft.util.IIcon;
public class BlockElectricCraftingTable extends BlockMachineBase { public class BlockElectricCraftingTable extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockElectricCraftingTable(Material material) public BlockElectricCraftingTable(Material material) {
{ super(material);
super(material); setBlockName("techreborn.electriccraftingtable");
setBlockName("techreborn.electriccraftingtable"); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side"); this.iconFront = icon.registerIcon("techreborn:machine/electric_crafting_table_front");
this.iconFront = icon.registerIcon("techreborn:machine/electric_crafting_table_front"); this.iconTop = icon.registerIcon("techreborn:machine/electric_crafting_table_top");
this.iconTop = icon.registerIcon("techreborn:machine/electric_crafting_table_top"); this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom"); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) public IIcon getIcon(int side, int metadata) {
{
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -24,7 +24,7 @@ public class BlockFarm extends BlockMachineBase {
@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.isSneaking()){ if (!player.isSneaking()) {
player.openGui(Core.INSTANCE, GuiHandler.farmID, world, x, y, z); player.openGui(Core.INSTANCE, GuiHandler.farmID, world, x, y, z);
return true; return true;
} }
@ -32,5 +32,4 @@ public class BlockFarm extends BlockMachineBase {
} }
} }

View file

@ -8,40 +8,37 @@ import net.minecraft.util.IIcon;
public class BlockFusionCoil extends BlockMachineBase { public class BlockFusionCoil extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockFusionCoil(Material material) public BlockFusionCoil(Material material) {
{ super(material);
super(material); setBlockName("techreborn.fusioncoil");
setBlockName("techreborn.fusioncoil"); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/fusion_coil");
this.blockIcon = icon.registerIcon("techreborn:machine/fusion_coil"); this.iconFront = icon.registerIcon("techreborn:machine/fusion_coil");
this.iconFront = icon.registerIcon("techreborn:machine/fusion_coil"); this.iconTop = icon.registerIcon("techreborn:machine/fusion_coil");
this.iconTop = icon.registerIcon("techreborn:machine/fusion_coil"); this.iconBottom = icon.registerIcon("techreborn:machine/fusion_coil");
this.iconBottom = icon.registerIcon("techreborn:machine/fusion_coil"); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) public IIcon getIcon(int side, int metadata) {
{
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -8,40 +8,37 @@ import net.minecraft.util.IIcon;
public class BlockFusionControlComputer extends BlockMachineBase { public class BlockFusionControlComputer extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockFusionControlComputer(Material material) public BlockFusionControlComputer(Material material) {
{ super(material);
super(material); setBlockName("techreborn.fusioncontrolcomputer");
setBlockName("techreborn.fusioncontrolcomputer"); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/plasma_generator_side_off");
this.blockIcon = icon.registerIcon("techreborn:machine/plasma_generator_side_off"); this.iconFront = icon.registerIcon("techreborn:machine/fusion_control_computer_front");
this.iconFront = icon.registerIcon("techreborn:machine/fusion_control_computer_front"); this.iconTop = icon.registerIcon("techreborn:machine/plasma_generator_side_off");
this.iconTop = icon.registerIcon("techreborn:machine/plasma_generator_side_off"); this.iconBottom = icon.registerIcon("techreborn:machine/plasma_generator_side_off");
this.iconBottom = icon.registerIcon("techreborn:machine/plasma_generator_side_off"); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) public IIcon getIcon(int side, int metadata) {
{
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -6,42 +6,39 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
public class BlockHighlyAdvancedMachine extends BlockMachineBase{ public class BlockHighlyAdvancedMachine extends BlockMachineBase {
@SideOnly(Side.CLIENT)
private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconTop;
public BlockHighlyAdvancedMachine(Material material) @SideOnly(Side.CLIENT)
{ private IIcon iconBottom;
super(material);
setBlockName("techreborn.highlyAdvancedMachine");
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("techreborn:machine/highlyadvancedmachine");
this.iconFront = icon.registerIcon("techreborn:machine/highlyadvancedmachine");
this.iconTop = icon.registerIcon("techreborn:machine/highlyadvancedmachine");
this.iconBottom = icon.registerIcon("techreborn:machine/highlyadvancedmachine");
}
@SideOnly(Side.CLIENT) public BlockHighlyAdvancedMachine(Material material) {
public IIcon getIcon(int side, int metadata) super(material);
{ setBlockName("techreborn.highlyAdvancedMachine");
}
return metadata == 0 && side == 3 ? this.iconFront @Override
: side == 1 ? this.iconTop : @SideOnly(Side.CLIENT)
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop public void registerBlockIcons(IIconRegister icon) {
: (side == metadata ? this.iconFront : this.blockIcon)); this.blockIcon = icon.registerIcon("techreborn:machine/highlyadvancedmachine");
this.iconFront = icon.registerIcon("techreborn:machine/highlyadvancedmachine");
this.iconTop = icon.registerIcon("techreborn:machine/highlyadvancedmachine");
this.iconBottom = icon.registerIcon("techreborn:machine/highlyadvancedmachine");
}
} @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
} }

View file

@ -1,10 +1,6 @@
package techreborn.blocks; package techreborn.blocks;
import net.minecraft.block.Block; import net.minecraft.block.*;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockDynamicLiquid;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.BlockStaticLiquid;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.EnumCreatureType;
@ -22,121 +18,101 @@ import java.util.Random;
public class BlockMachineBase extends BlockContainer { public class BlockMachineBase extends BlockContainer {
public BlockMachineBase(Material material) public BlockMachineBase(Material material) {
{ super(Material.rock);
super(Material.rock); setCreativeTab(TechRebornCreativeTab.instance);
setCreativeTab(TechRebornCreativeTab.instance); setHardness(2f);
setHardness(2f); setStepSound(soundTypeMetal);
setStepSound(soundTypeMetal); }
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
{
return null;
}
public void onBlockAdded(World world, int x, int y, int z)
{
super.onBlockAdded(world, x, y, z);
this.setDefaultDirection(world, x, y, z);
}
private void setDefaultDirection(World world, int x, int y, int z)
{
if (!world.isRemote)
{
Block block1 = world.getBlock(x, y, z - 1);
Block block2 = world.getBlock(x, y, z + 1);
Block block3 = world.getBlock(x - 1, y, z);
Block block4 = world.getBlock(x + 1, y, z);
byte b = 3;
if (block1.func_149730_j() && !block2.func_149730_j())
{
b = 3;
}
if (block2.func_149730_j() && !block1.func_149730_j())
{
b = 2;
}
if (block3.func_149730_j() && !block4.func_149730_j())
{
b = 5;
}
if (block4.func_149730_j() && !block3.func_149730_j())
{
b = 4;
}
world.setBlockMetadataWithNotify(x, y, z, b, 2);
}
}
public void onBlockPlacedBy(World world, int x, int y, int z,
EntityLivingBase player, ItemStack itemstack)
{
int l = MathHelper
.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
if (l == 0)
{
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
if (l == 1)
{
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}
if (l == 2)
{
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if (l == 3)
{
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
super.onBlockPlacedBy(world, x, y, z, player, itemstack);
}
public boolean canCreatureSpawn(EnumCreatureType type, World world, int x,
int y, int z)
{
return false;
}
@Override @Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
{ return null;
}
public void onBlockAdded(World world, int x, int y, int z) {
super.onBlockAdded(world, x, y, z);
this.setDefaultDirection(world, x, y, z);
}
private void setDefaultDirection(World world, int x, int y, int z) {
if (!world.isRemote) {
Block block1 = world.getBlock(x, y, z - 1);
Block block2 = world.getBlock(x, y, z + 1);
Block block3 = world.getBlock(x - 1, y, z);
Block block4 = world.getBlock(x + 1, y, z);
byte b = 3;
if (block1.func_149730_j() && !block2.func_149730_j()) {
b = 3;
}
if (block2.func_149730_j() && !block1.func_149730_j()) {
b = 2;
}
if (block3.func_149730_j() && !block4.func_149730_j()) {
b = 5;
}
if (block4.func_149730_j() && !block3.func_149730_j()) {
b = 4;
}
world.setBlockMetadataWithNotify(x, y, z, b, 2);
}
}
public void onBlockPlacedBy(World world, int x, int y, int z,
EntityLivingBase player, ItemStack itemstack) {
int l = MathHelper
.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
if (l == 0) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
if (l == 1) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}
if (l == 2) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if (l == 3) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
super.onBlockPlacedBy(world, x, y, z, player, itemstack);
}
public boolean canCreatureSpawn(EnumCreatureType type, World world, int x,
int y, int z) {
return false;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
dropInventory(world, x, y, z); dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, meta); super.breakBlock(world, x, y, z, block, meta);
} }
protected void dropInventory(World world, int x, int y, int z) protected void dropInventory(World world, int x, int y, int z) {
{
TileEntity tileEntity = world.getTileEntity(x, y, z); TileEntity tileEntity = world.getTileEntity(x, y, z);
if (!(tileEntity instanceof IInventory)) if (!(tileEntity instanceof IInventory)) {
{
return; return;
} }
IInventory inventory = (IInventory) tileEntity; IInventory inventory = (IInventory) tileEntity;
for (int i = 0; i < inventory.getSizeInventory(); i++) for (int i = 0; i < inventory.getSizeInventory(); i++) {
{
ItemStack itemStack = inventory.getStackInSlot(i); ItemStack itemStack = inventory.getStackInSlot(i);
if (itemStack != null && itemStack.stackSize > 0) if (itemStack != null && itemStack.stackSize > 0) {
{ if (itemStack.getItem() instanceof ItemBlock) {
if(itemStack.getItem() instanceof ItemBlock){ if (((ItemBlock) itemStack.getItem()).field_150939_a instanceof BlockLiquid || ((ItemBlock) itemStack.getItem()).field_150939_a instanceof BlockStaticLiquid || ((ItemBlock) itemStack.getItem()).field_150939_a instanceof BlockDynamicLiquid) {
if(((ItemBlock) itemStack.getItem()).field_150939_a instanceof BlockLiquid || ((ItemBlock) itemStack.getItem()).field_150939_a instanceof BlockStaticLiquid || ((ItemBlock) itemStack.getItem()).field_150939_a instanceof BlockDynamicLiquid){
return; return;
} }
} }
@ -148,8 +124,7 @@ public class BlockMachineBase extends BlockContainer {
EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, itemStack.copy()); EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, itemStack.copy());
if (itemStack.hasTagCompound()) if (itemStack.hasTagCompound()) {
{
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy()); entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
} }

View file

@ -21,77 +21,66 @@ import java.util.Random;
public class BlockMachineCasing extends BlockMultiblockBase { public class BlockMachineCasing extends BlockMultiblockBase {
public static final String[] types = new String[] public static final String[] types = new String[]
{ "standard", "reinforced", "advanced" }; {"standard", "reinforced", "advanced"};
private IIcon[] textures; private IIcon[] textures;
public BlockMachineCasing(Material material) public BlockMachineCasing(Material material) {
{ super(material);
super(material); setCreativeTab(TechRebornCreativeTab.instance);
setCreativeTab(TechRebornCreativeTab.instance); setBlockName("techreborn.machineCasing");
setBlockName("techreborn.machineCasing"); setHardness(2F);
setHardness(2F); }
}
@Override @Override
public Item getItemDropped(int meta, Random random, int fortune) public Item getItemDropped(int meta, Random random, int fortune) {
{ return Item.getItemFromBlock(this);
return Item.getItemFromBlock(this); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
{ for (int meta = 0; meta < types.length; meta++) {
for (int meta = 0; meta < types.length; meta++) list.add(new ItemStack(item, 1, meta));
{ }
list.add(new ItemStack(item, 1, meta)); }
}
}
@Override @Override
public int damageDropped(int metaData) public int damageDropped(int metaData) {
{ return metaData;
return metaData; }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) public void registerBlockIcons(IIconRegister iconRegister) {
{ this.textures = new IIcon[types.length];
this.textures = new IIcon[types.length];
for (int i = 0; i < types.length; i++) for (int i = 0; i < types.length; i++) {
{ textures[i] = iconRegister.registerIcon("techreborn:"
textures[i] = iconRegister.registerIcon("techreborn:" + "machine/casing" + types[i]);
+ "machine/casing" + types[i]); }
} }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metaData) public IIcon getIcon(int side, int metaData) {
{ metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) || ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
{ return textures[metaData];
return textures[metaData]; } else {
} else return textures[metaData];
{ }
return textures[metaData]; }
}
}
@Override @Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
{ return new TileMachineCasing();
return new TileMachineCasing(); }
}
public static int getHeatFromMeta(int meta){ public static int getHeatFromMeta(int meta) {
switch (meta){ switch (meta) {
case 0: case 0:
return 1020; return 1020;
case 1: case 1:

View file

@ -19,53 +19,46 @@ import java.util.List;
public class BlockMachineFrame extends Block { public class BlockMachineFrame extends Block {
public static ItemStack getFrameByName(String name, int count) public static ItemStack getFrameByName(String name, int count) {
{ for (int i = 0; i < types.length; i++) {
for (int i = 0; i < types.length; i++) { if (types[i].equalsIgnoreCase(name)) {
if (types[i].equalsIgnoreCase(name)) { return new ItemStack(ModBlocks.machineframe, count, i);
return new ItemStack(ModBlocks.machineframe, count, i); }
} }
} throw new InvalidParameterException("The part " + name + " could not be found.");
throw new InvalidParameterException("The part " + name + " could not be found."); }
}
public static final String[] types = new String[] public static final String[] types = new String[]
{ "aluminum", "iron", "bronze", "brass", "steel", "titanium" }; {"aluminum", "iron", "bronze", "brass", "steel", "titanium"};
private IIcon[] textures; private IIcon[] textures;
public BlockMachineFrame(Material material) public BlockMachineFrame(Material material) {
{
super(material); super(material);
setBlockName("techreborn.machineFrame"); setBlockName("techreborn.machineFrame");
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
setHardness(1f); setHardness(1f);
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
{ for (int meta = 0; meta < types.length; meta++) {
for (int meta = 0; meta < types.length; meta++)
{
list.add(new ItemStack(item, 1, meta)); list.add(new ItemStack(item, 1, meta));
} }
} }
@Override @Override
public int damageDropped(int metaData) public int damageDropped(int metaData) {
{
return metaData; return metaData;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) public void registerBlockIcons(IIconRegister iconRegister) {
{
this.textures = new IIcon[types.length]; this.textures = new IIcon[types.length];
for (int i = 0; i < types.length; i++) for (int i = 0; i < types.length; i++) {
{
textures[i] = iconRegister.registerIcon("techreborn:" + "machine/" textures[i] = iconRegister.registerIcon("techreborn:" + "machine/"
+ types[i] + "_machine_block"); + types[i] + "_machine_block");
} }
@ -73,16 +66,13 @@ public class BlockMachineFrame extends Block {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metaData) public IIcon getIcon(int side, int metaData) {
{
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1); metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) || ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
{
return textures[metaData]; return textures[metaData];
} else } else {
{
return textures[metaData]; return textures[metaData];
} }
} }

View file

@ -8,48 +8,45 @@ import net.minecraft.util.IIcon;
public class BlockMetalShelf extends BlockMachineBase { public class BlockMetalShelf extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFrontEmpty; private IIcon iconFrontEmpty;
@SideOnly(Side.CLIENT)
private IIcon iconFrontBooks;
@SideOnly(Side.CLIENT)
private IIcon iconFrontCans;
@SideOnly(Side.CLIENT)
private IIcon iconFrontPaper;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconFrontBooks;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconFrontCans;
public BlockMetalShelf(Material material) @SideOnly(Side.CLIENT)
{ private IIcon iconFrontPaper;
super(material);
setBlockName("techreborn.metalshelf");
}
@Override @SideOnly(Side.CLIENT)
@SideOnly(Side.CLIENT) private IIcon iconTop;
public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFrontEmpty = icon.registerIcon("techreborn:machine/metal_shelf_empty");
this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) private IIcon iconBottom;
{
return metadata == 0 && side == 3 ? this.iconFrontEmpty
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFrontEmpty : this.blockIcon));
} public BlockMetalShelf(Material material) {
super(material);
setBlockName("techreborn.metalshelf");
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) {
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFrontEmpty = icon.registerIcon("techreborn:machine/metal_shelf_empty");
this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return metadata == 0 && side == 3 ? this.iconFrontEmpty
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFrontEmpty : this.blockIcon));
}
} }

View file

@ -27,165 +27,140 @@ import java.util.List;
public class BlockOre extends Block { public class BlockOre extends Block {
public static ItemStack getOreByName(String name, int count) public static ItemStack getOreByName(String name, int count) {
{ int index = -1;
int index = -1; for (int i = 0; i < types.length; i++) {
for (int i = 0; i < types.length; i++) { if (types[i].equals(name)) {
if (types[i].equals(name)) { index = i;
index = i; break;
break; }
} }
} return new ItemStack(ModBlocks.ore, count, index);
return new ItemStack(ModBlocks.ore, count, index); }
}
public static ItemStack getOreByName(String name)
{
return getOreByName(name, 1);
}
public static final String[] types = new String[] public static ItemStack getOreByName(String name) {
{ "Galena", "Iridium", "Ruby", "Sapphire", "Bauxite", "Pyrite", "Cinnabar", return getOreByName(name, 1);
"Sphalerite", "Tungston", "Sheldonite", "Peridot", "Sodalite", }
"Tetrahedrite", "Cassiterite", "Lead", "Silver" };
private IIcon[] textures; public static final String[] types = new String[]
{"Galena", "Iridium", "Ruby", "Sapphire", "Bauxite", "Pyrite", "Cinnabar",
"Sphalerite", "Tungston", "Sheldonite", "Peridot", "Sodalite",
"Tetrahedrite", "Cassiterite", "Lead", "Silver"};
public BlockOre(Material material) private IIcon[] textures;
{
super(material);
setBlockName("techreborn.ore");
setCreativeTab(TechRebornCreativeTabMisc.instance);
setHardness(2.0f);
}
@Override public BlockOre(Material material) {
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) super(material);
{ setBlockName("techreborn.ore");
//Ruby setCreativeTab(TechRebornCreativeTabMisc.instance);
if (metadata == 2) setHardness(2.0f);
{ }
OreDrop ruby = new OreDrop(ItemGems.getGemByName("ruby"));
OreDrop redGarnet = new OreDrop(ItemGems.getGemByName("redGarnet"), 0.02);
OreDropSet set = new OreDropSet(ruby, redGarnet);
return set.drop(fortune, world.rand);
}
//Sapphire
if (metadata == 3)
{
OreDrop sapphire = new OreDrop(ItemGems.getGemByName("sapphire"));
OreDrop peridot = new OreDrop(ItemGems.getGemByName("peridot"), 0.03);
OreDropSet set = new OreDropSet(sapphire, peridot);
return set.drop(fortune, world.rand);
}
//Pyrite
if (metadata == 5)
{
OreDrop pyriteDust = new OreDrop(ItemDusts.getDustByName("pyrite"));
OreDropSet set = new OreDropSet(pyriteDust);
return set.drop(fortune, world.rand);
}
//Sodolite
if (metadata == 11)
{
OreDrop sodalite = new OreDrop(ItemDusts.getDustByName("sodalite", 6));
OreDrop aluminum = new OreDrop(ItemDusts.getDustByName("aluminum"), 0.50);
OreDropSet set = new OreDropSet(sodalite, aluminum);
return set.drop(fortune, world.rand);
}
//Cinnabar
if (metadata == 6)
{
OreDrop cinnabar = new OreDrop(ItemDusts.getDustByName("cinnabar"));
OreDrop redstone = new OreDrop(new ItemStack(Items.redstone), 0.25);
OreDropSet set = new OreDropSet(cinnabar, redstone);
return set.drop(fortune, world.rand);
}
//Sphalerite 1, 1/8 yellow garnet
if (metadata == 7)
{
OreDrop sphalerite = new OreDrop(ItemDusts.getDustByName("sphalerite"));
OreDrop yellowGarnet = new OreDrop(ItemGems.getGemByName("yellowGarnet"), 0.125);
OreDropSet set = new OreDropSet(sphalerite, yellowGarnet);
return set.drop(fortune, world.rand);
}
ArrayList<ItemStack> block = new ArrayList<ItemStack>();
block.add(new ItemStack(Item.getItemFromBlock(this), 1, metadata));
return block;
}
@Override @Override
protected boolean canSilkHarvest() public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
{ //Ruby
if (metadata == 2) {
OreDrop ruby = new OreDrop(ItemGems.getGemByName("ruby"));
OreDrop redGarnet = new OreDrop(ItemGems.getGemByName("redGarnet"), 0.02);
OreDropSet set = new OreDropSet(ruby, redGarnet);
return set.drop(fortune, world.rand);
}
//Sapphire
if (metadata == 3) {
OreDrop sapphire = new OreDrop(ItemGems.getGemByName("sapphire"));
OreDrop peridot = new OreDrop(ItemGems.getGemByName("peridot"), 0.03);
OreDropSet set = new OreDropSet(sapphire, peridot);
return set.drop(fortune, world.rand);
}
//Pyrite
if (metadata == 5) {
OreDrop pyriteDust = new OreDrop(ItemDusts.getDustByName("pyrite"));
OreDropSet set = new OreDropSet(pyriteDust);
return set.drop(fortune, world.rand);
}
//Sodolite
if (metadata == 11) {
OreDrop sodalite = new OreDrop(ItemDusts.getDustByName("sodalite", 6));
OreDrop aluminum = new OreDrop(ItemDusts.getDustByName("aluminum"), 0.50);
OreDropSet set = new OreDropSet(sodalite, aluminum);
return set.drop(fortune, world.rand);
}
//Cinnabar
if (metadata == 6) {
OreDrop cinnabar = new OreDrop(ItemDusts.getDustByName("cinnabar"));
OreDrop redstone = new OreDrop(new ItemStack(Items.redstone), 0.25);
OreDropSet set = new OreDropSet(cinnabar, redstone);
return set.drop(fortune, world.rand);
}
//Sphalerite 1, 1/8 yellow garnet
if (metadata == 7) {
OreDrop sphalerite = new OreDrop(ItemDusts.getDustByName("sphalerite"));
OreDrop yellowGarnet = new OreDrop(ItemGems.getGemByName("yellowGarnet"), 0.125);
OreDropSet set = new OreDropSet(sphalerite, yellowGarnet);
return set.drop(fortune, world.rand);
}
ArrayList<ItemStack> block = new ArrayList<ItemStack>();
block.add(new ItemStack(Item.getItemFromBlock(this), 1, metadata));
return block;
}
@Override
protected boolean canSilkHarvest() {
return true; return true;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
{ for (int meta = 0; meta < types.length; meta++) {
for (int meta = 0; meta < types.length; meta++) list.add(new ItemStack(item, 1, meta));
{ }
list.add(new ItemStack(item, 1, meta)); }
}
}
@Override @Override
public int damageDropped(int metaData) public int damageDropped(int metaData) {
{ if (metaData == 2) {
if(metaData == 2 ) return 0;
{ } else if (metaData == 3) {
return 0; return 1;
} } else if (metaData == 5) {
else if(metaData == 3) return 60;
{ }
return 1; return metaData;
} }
else if(metaData == 5)
{
return 60;
}
return metaData;
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) public void registerBlockIcons(IIconRegister iconRegister) {
{ this.textures = new IIcon[types.length];
this.textures = new IIcon[types.length];
for (int i = 0; i < types.length; i++) for (int i = 0; i < types.length; i++) {
{ textures[i] = iconRegister.registerIcon("techreborn:" + "ore/ore"
textures[i] = iconRegister.registerIcon("techreborn:" + "ore/ore" + types[i]);
+ types[i]); }
} }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metaData) public IIcon getIcon(int side, int metaData) {
{ metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) || ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
{ return textures[metaData];
return textures[metaData]; } else {
} return textures[metaData];
else }
{ }
return textures[metaData];
}
}
@Override @Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
return new ItemStack(ModBlocks.ore,1 , world.getBlockMetadata(x, y, z)); return new ItemStack(ModBlocks.ore, 1, world.getBlockMetadata(x, y, z));
} }
} }

View file

@ -20,125 +20,109 @@ import techreborn.tiles.TileQuantumChest;
public class BlockQuantumChest extends BlockContainer { public class BlockQuantumChest extends BlockContainer {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockQuantumChest() public BlockQuantumChest() {
{ super(Material.rock);
super(Material.rock); setBlockName("techreborn.quantumChest");
setBlockName("techreborn.quantumChest"); setCreativeTab(TechRebornCreativeTab.instance);
setCreativeTab(TechRebornCreativeTab.instance); setHardness(2.0F);
setHardness(2.0F); }
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
{
return new TileQuantumChest();
}
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
EntityPlayer player, int side, float hitX, float hitY, float hitZ) return new TileQuantumChest();
{ }
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.quantumChestID, world, x,
y, z);
return true;
}
@Override @Override
@SideOnly(Side.CLIENT) public boolean onBlockActivated(World world, int x, int y, int z,
public void registerBlockIcons(IIconRegister icon) EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
{ if (!player.isSneaking())
this.blockIcon = icon.registerIcon("techreborn:machine/qchest_side"); player.openGui(Core.INSTANCE, GuiHandler.quantumChestID, world, x,
this.iconFront = icon.registerIcon("techreborn:machine/quantum_chest"); y, z);
this.iconTop = icon.registerIcon("techreborn:machine/quantum_top"); return true;
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom"); }
}
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) @SideOnly(Side.CLIENT)
{ public void registerBlockIcons(IIconRegister icon) {
this.blockIcon = icon.registerIcon("techreborn:machine/qchest_side");
this.iconFront = icon.registerIcon("techreborn:machine/quantum_chest");
this.iconTop = icon.registerIcon("techreborn:machine/quantum_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
return metadata == 0 && side == 3 ? this.iconFront @SideOnly(Side.CLIENT)
: side == 1 ? this.iconTop : public IIcon getIcon(int side, int metadata) {
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
} return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
public void onBlockAdded(World world, int x, int y, int z) side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
{ : (side == metadata ? this.iconFront : this.blockIcon));
super.onBlockAdded(world, x, y, z); }
this.setDefaultDirection(world, x, y, z);
} public void onBlockAdded(World world, int x, int y, int z) {
private void setDefaultDirection(World world, int x, int y, int z) super.onBlockAdded(world, x, y, z);
{ this.setDefaultDirection(world, x, y, z);
if (!world.isRemote) }
{
Block block1 = world.getBlock(x, y, z - 1);
Block block2 = world.getBlock(x, y, z + 1);
Block block3 = world.getBlock(x - 1, y, z);
Block block4 = world.getBlock(x + 1, y, z);
byte b = 3; private void setDefaultDirection(World world, int x, int y, int z) {
if (block1.func_149730_j() && !block2.func_149730_j()) if (!world.isRemote) {
{ Block block1 = world.getBlock(x, y, z - 1);
b = 3; Block block2 = world.getBlock(x, y, z + 1);
} Block block3 = world.getBlock(x - 1, y, z);
if (block2.func_149730_j() && !block1.func_149730_j()) Block block4 = world.getBlock(x + 1, y, z);
{
b = 2;
}
if (block3.func_149730_j() && !block4.func_149730_j())
{
b = 5;
}
if (block4.func_149730_j() && !block3.func_149730_j())
{
b = 4;
}
world.setBlockMetadataWithNotify(x, y, z, b, 2); byte b = 3;
} if (block1.func_149730_j() && !block2.func_149730_j()) {
b = 3;
}
if (block2.func_149730_j() && !block1.func_149730_j()) {
b = 2;
}
if (block3.func_149730_j() && !block4.func_149730_j()) {
b = 5;
}
if (block4.func_149730_j() && !block3.func_149730_j()) {
b = 4;
}
} world.setBlockMetadataWithNotify(x, y, z, b, 2);
public void onBlockPlacedBy(World world, int x, int y, int z, }
EntityLivingBase player, ItemStack itemstack)
{
int l = MathHelper }
.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
if (l == 0) public void onBlockPlacedBy(World world, int x, int y, int z,
{ EntityLivingBase player, ItemStack itemstack) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
} int l = MathHelper
if (l == 1) .floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
{
world.setBlockMetadataWithNotify(x, y, z, 5, 2); if (l == 0) {
} world.setBlockMetadataWithNotify(x, y, z, 2, 2);
if (l == 2) }
{ if (l == 1) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2); world.setBlockMetadataWithNotify(x, y, z, 5, 2);
} }
if (l == 3) if (l == 2) {
{ world.setBlockMetadataWithNotify(x, y, z, 3, 2);
world.setBlockMetadataWithNotify(x, y, z, 4, 2); }
} if (l == 3) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
super.onBlockPlacedBy(world, x, y, z, player, itemstack); super.onBlockPlacedBy(world, x, y, z, player, itemstack);
} }
} }

View file

@ -14,50 +14,43 @@ import techreborn.tiles.TileQuantumTank;
public class BlockQuantumTank extends BlockMachineBase { public class BlockQuantumTank extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon top; private IIcon top;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon other; private IIcon other;
public BlockQuantumTank() public BlockQuantumTank() {
{ super(Material.rock);
super(Material.rock); setBlockName("techreborn.quantumTank");
setBlockName("techreborn.quantumTank"); setHardness(2.0F);
setHardness(2.0F); }
}
@Override @Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
{ return new TileQuantumTank();
return new TileQuantumTank(); }
}
@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.isSneaking())
if (!player.isSneaking()) player.openGui(Core.INSTANCE, GuiHandler.quantumTankID, world, x, y, z);
player.openGui(Core.INSTANCE, GuiHandler.quantumTankID, world, x, y, z); return true;
return true; }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ top = icon.registerIcon("techreborn:machine/quantum_top");
top = icon.registerIcon("techreborn:machine/quantum_top"); other = icon.registerIcon("techreborn:machine/ThermalGenerator_other");
other = icon.registerIcon("techreborn:machine/ThermalGenerator_other"); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int currentSide, int meta) public IIcon getIcon(int currentSide, int meta) {
{ if (currentSide == 1) {
if (currentSide == 1) return top;
{ } else {
return top; return other;
} else }
{ }
return other;
}
}
} }

View file

@ -19,85 +19,73 @@ import java.util.Random;
public class BlockStorage extends Block { public class BlockStorage extends Block {
public static ItemStack getStorageBlockByName(String name, int count) public static ItemStack getStorageBlockByName(String name, int count) {
{ for (int i = 0; i < types.length; i++) {
for (int i = 0; i < types.length; i++) { if (types[i].equals(name)) {
if (types[i].equals(name)) { return new ItemStack(ModBlocks.storage, count, i);
return new ItemStack(ModBlocks.storage, count, i); }
} }
} return BlockStorage2.getStorageBlockByName(name, count);
return BlockStorage2.getStorageBlockByName(name, count); }
}
public static ItemStack getStorageBlockByName(String name) public static ItemStack getStorageBlockByName(String name) {
{ return getStorageBlockByName(name, 1);
return getStorageBlockByName(name, 1); }
}
public static final String[] types = new String[] public static final String[] types = new String[]
{ "silver", "aluminum", "titanium", "chrome", "steel", "brass", "lead", {"silver", "aluminum", "titanium", "chrome", "steel", "brass", "lead",
"electrum", "zinc", "platinum", "tungsten", "nickel", "invar", "osmium", "electrum", "zinc", "platinum", "tungsten", "nickel", "invar", "osmium",
"iridium" }; "iridium"};
private IIcon[] textures; private IIcon[] textures;
public BlockStorage(Material material) public BlockStorage(Material material) {
{ super(material);
super(material); setBlockName("techreborn.storage");
setBlockName("techreborn.storage"); setCreativeTab(TechRebornCreativeTabMisc.instance);
setCreativeTab(TechRebornCreativeTabMisc.instance); setHardness(2f);
setHardness(2f); }
}
@Override @Override
public Item getItemDropped(int par1, Random random, int par2) public Item getItemDropped(int par1, Random random, int par2) {
{ return Item.getItemFromBlock(this);
return Item.getItemFromBlock(this); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
{ for (int meta = 0; meta < types.length; meta++) {
for (int meta = 0; meta < types.length; meta++) list.add(new ItemStack(item, 1, meta));
{ }
list.add(new ItemStack(item, 1, meta)); }
}
}
@Override @Override
public int damageDropped(int metaData) public int damageDropped(int metaData) {
{ return metaData;
return metaData; }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) public void registerBlockIcons(IIconRegister iconRegister) {
{ this.textures = new IIcon[types.length];
this.textures = new IIcon[types.length];
for (int i = 0; i < types.length; i++) for (int i = 0; i < types.length; i++) {
{ textures[i] = iconRegister.registerIcon("techreborn:"
textures[i] = iconRegister.registerIcon("techreborn:" + "storage/" + types[i] + "_block");
+ "storage/" + types[i] + "_block"); }
} }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metaData) public IIcon getIcon(int side, int metaData) {
{ metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) || ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
{ return textures[metaData];
return textures[metaData]; } else {
} else return textures[metaData];
{ }
return textures[metaData]; }
}
}
} }

View file

@ -20,24 +20,22 @@ import java.util.Random;
public class BlockStorage2 extends Block { public class BlockStorage2 extends Block {
public static ItemStack getStorageBlockByName(String name, int count) public static ItemStack getStorageBlockByName(String name, int count) {
{ for (int i = 0; i < types.length; i++) {
for (int i = 0; i < types.length; i++) { if (types[i].equals(name)) {
if (types[i].equals(name)) { return new ItemStack(ModBlocks.storage2, count, i);
return new ItemStack(ModBlocks.storage2, count, i); }
} }
} throw new InvalidParameterException("The storage block " + name + " could not be found.");
throw new InvalidParameterException("The storage block " + name + " could not be found."); }
}
public static final String[] types = new String[] public static final String[] types = new String[]
{ "tungstensteel", "lodestone", "tellurium", "iridium_reinforced_tungstensteel", {"tungstensteel", "lodestone", "tellurium", "iridium_reinforced_tungstensteel",
"iridium_reinforced_stone", "ruby", "sapphire", "peridot", "yellow_garnet", "red_garnet" }; "iridium_reinforced_stone", "ruby", "sapphire", "peridot", "yellow_garnet", "red_garnet"};
private IIcon[] textures; private IIcon[] textures;
public BlockStorage2(Material material) public BlockStorage2(Material material) {
{
super(material); super(material);
setBlockName("techreborn.storage2"); setBlockName("techreborn.storage2");
setCreativeTab(TechRebornCreativeTabMisc.instance); setCreativeTab(TechRebornCreativeTabMisc.instance);
@ -45,35 +43,29 @@ public class BlockStorage2 extends Block {
} }
@Override @Override
public Item getItemDropped(int par1, Random random, int par2) public Item getItemDropped(int par1, Random random, int par2) {
{
return Item.getItemFromBlock(this); return Item.getItemFromBlock(this);
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
{ for (int meta = 0; meta < types.length; meta++) {
for (int meta = 0; meta < types.length; meta++)
{
list.add(new ItemStack(item, 1, meta)); list.add(new ItemStack(item, 1, meta));
} }
} }
@Override @Override
public int damageDropped(int metaData) public int damageDropped(int metaData) {
{
return metaData; return metaData;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) public void registerBlockIcons(IIconRegister iconRegister) {
{
this.textures = new IIcon[types.length]; this.textures = new IIcon[types.length];
for (int i = 0; i < types.length; i++) for (int i = 0; i < types.length; i++) {
{
textures[i] = iconRegister.registerIcon("techreborn:" textures[i] = iconRegister.registerIcon("techreborn:"
+ "storage/" + types[i] + "_block"); + "storage/" + types[i] + "_block");
} }
@ -82,16 +74,13 @@ public class BlockStorage2 extends Block {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metaData) public IIcon getIcon(int side, int metaData) {
{
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1); metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) || ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
{
return textures[metaData]; return textures[metaData];
} else } else {
{
return textures[metaData]; return textures[metaData];
} }
} }

View file

@ -8,40 +8,37 @@ import net.minecraft.util.IIcon;
public class BlockSupercondensator extends BlockMachineBase { public class BlockSupercondensator extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockSupercondensator(Material material) public BlockSupercondensator(Material material) {
{ super(material);
super(material); setBlockName("techreborn.supercondensator");
setBlockName("techreborn.supercondensator"); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/supercondensator_side");
this.blockIcon = icon.registerIcon("techreborn:machine/supercondensator_side"); this.iconFront = icon.registerIcon("techreborn:machine/supercondensator_front");
this.iconFront = icon.registerIcon("techreborn:machine/supercondensator_front"); this.iconTop = icon.registerIcon("techreborn:machine/supercondensator_side");
this.iconTop = icon.registerIcon("techreborn:machine/supercondensator_side"); this.iconBottom = icon.registerIcon("techreborn:machine/supercondensator_side");
this.iconBottom = icon.registerIcon("techreborn:machine/supercondensator_side"); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) public IIcon getIcon(int side, int metadata) {
{
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -8,40 +8,37 @@ import net.minecraft.util.IIcon;
public class BlockWoodenshelf extends BlockMachineBase { public class BlockWoodenshelf extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockWoodenshelf(Material material) public BlockWoodenshelf(Material material) {
{ super(material);
super(material); setBlockName("techreborn.woodenshelf");
setBlockName("techreborn.woodenshelf"); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/wood_shelf_side");
this.blockIcon = icon.registerIcon("techreborn:machine/wood_shelf_side"); this.iconFront = icon.registerIcon("techreborn:machine/wood_shelf_empty");
this.iconFront = icon.registerIcon("techreborn:machine/wood_shelf_empty"); this.iconTop = icon.registerIcon("techreborn:machine/wood_shelf_side");
this.iconTop = icon.registerIcon("techreborn:machine/wood_shelf_side"); this.iconBottom = icon.registerIcon("techreborn:machine/wood_shelf_side");
this.iconBottom = icon.registerIcon("techreborn:machine/wood_shelf_side"); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) public IIcon getIcon(int side, int metadata) {
{
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -12,48 +12,43 @@ import net.minecraftforge.fluids.Fluid;
import techreborn.client.TechRebornCreativeTabMisc; import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.lib.ModInfo; import techreborn.lib.ModInfo;
public class BlockFluidBase extends BlockFluidClassic{ public class BlockFluidBase extends BlockFluidClassic {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
protected IIcon stillIcon; protected IIcon stillIcon;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
protected IIcon flowingIcon; protected IIcon flowingIcon;
public BlockFluidBase(Fluid fluid, Material material)
{
super(fluid, material);
setCreativeTab(TechRebornCreativeTabMisc.instance);
}
@Override
public IIcon getIcon(int side, int meta)
{
return (side == 0 || side == 1) ? stillIcon : flowingIcon;
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister register)
{
stillIcon = register.registerIcon(ModInfo.MOD_ID.toLowerCase() + ":" + "fluids/" + getUnlocalizedName().substring(16) + "_flowing");
flowingIcon = register.registerIcon(ModInfo.MOD_ID.toLowerCase() + ":" + "fluids/" + getUnlocalizedName().substring(16) + "_flowing");
this.stack.getFluid().setIcons(stillIcon, flowingIcon);
}
@Override
public boolean canDisplace(IBlockAccess world, int x, int y, int z)
{
if (world.getBlock(x, y, z).getMaterial().isLiquid())
return false;
return super.canDisplace(world, x, y, z);
}
@Override public BlockFluidBase(Fluid fluid, Material material) {
public boolean displaceIfPossible(World world, int x, int y, int z) super(fluid, material);
{ setCreativeTab(TechRebornCreativeTabMisc.instance);
if (world.getBlock(x, y, z).getMaterial().isLiquid()) }
return false;
return super.displaceIfPossible(world, x, y, z); @Override
} public IIcon getIcon(int side, int meta) {
return (side == 0 || side == 1) ? stillIcon : flowingIcon;
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister register) {
stillIcon = register.registerIcon(ModInfo.MOD_ID.toLowerCase() + ":" + "fluids/" + getUnlocalizedName().substring(16) + "_flowing");
flowingIcon = register.registerIcon(ModInfo.MOD_ID.toLowerCase() + ":" + "fluids/" + getUnlocalizedName().substring(16) + "_flowing");
this.stack.getFluid().setIcons(stillIcon, flowingIcon);
}
@Override
public boolean canDisplace(IBlockAccess world, int x, int y, int z) {
if (world.getBlock(x, y, z).getMaterial().isLiquid())
return false;
return super.canDisplace(world, x, y, z);
}
@Override
public boolean displaceIfPossible(World world, int x, int y, int z) {
if (world.getBlock(x, y, z).getMaterial().isLiquid())
return false;
return super.displaceIfPossible(world, x, y, z);
}
} }

View file

@ -3,12 +3,11 @@ package techreborn.blocks.fluid;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
public class BlockFluidTechReborn extends BlockFluidBase{ public class BlockFluidTechReborn extends BlockFluidBase {
public BlockFluidTechReborn(Fluid fluid, Material material, String name) public BlockFluidTechReborn(Fluid fluid, Material material, String name) {
{ super(fluid, material);
super(fluid, material); setBlockName(name);
setBlockName(name); }
}
} }

View file

@ -19,62 +19,56 @@ import java.util.Random;
public class BlockDieselGenerator extends BlockMachineBase { public class BlockDieselGenerator extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockDieselGenerator(Material material) public BlockDieselGenerator(Material material) {
{ super(material);
super(material); setBlockName("techreborn.dieselgenerator");
setBlockName("techreborn.dieselgenerator"); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side"); this.iconFront = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/machine_side"); this.iconTop = icon.registerIcon("techreborn:machine/diesel_generator_top_off");
this.iconTop = icon.registerIcon("techreborn:machine/diesel_generator_top_off"); this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom"); }
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_)
{
return new TileDieselGenerator();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.dieselGeneratorID, world, x, y,
z);
return true;
}
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) public TileEntity createNewTileEntity(World world, int p_149915_2_) {
{ return new TileDieselGenerator();
}
return metadata == 0 && side == 3 ? this.iconFront @Override
: side == 1 ? this.iconTop : public boolean onBlockActivated(World world, int x, int y, int z,
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
: (side == metadata ? this.iconFront : this.blockIcon)); if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.dieselGeneratorID, world, x, y,
z);
return true;
}
} @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
@Override
public Item getItemDropped(int meta, Random random, int fortune) return metadata == 0 && side == 3 ? this.iconFront
{ : side == 1 ? this.iconTop :
return IC2Items.getItem("machine").getItem(); side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
} : (side == metadata ? this.iconFront : this.blockIcon));
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -16,52 +16,47 @@ import java.util.Random;
public class BlockDragonEggSiphoner extends BlockMachineBase { public class BlockDragonEggSiphoner extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockDragonEggSiphoner(Material material) public BlockDragonEggSiphoner(Material material) {
{ super(material);
super(material); setBlockName("techreborn.dragoneggsiphoner");
setBlockName("techreborn.dragoneggsiphoner"); }
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("techreborn:machine/dragon_egg_energy_siphon_side_off");
this.iconFront = icon.registerIcon("techreborn:machine/dragon_egg_energy_siphon_side_off");
this.iconTop = icon.registerIcon("techreborn:machine/dragon_egg_energy_siphon_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_)
{
return new TileDragonEggSiphoner();
}
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) @SideOnly(Side.CLIENT)
{ public void registerBlockIcons(IIconRegister icon) {
this.blockIcon = icon.registerIcon("techreborn:machine/dragon_egg_energy_siphon_side_off");
this.iconFront = icon.registerIcon("techreborn:machine/dragon_egg_energy_siphon_side_off");
this.iconTop = icon.registerIcon("techreborn:machine/dragon_egg_energy_siphon_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
return metadata == 0 && side == 3 ? this.iconFront @Override
: side == 1 ? this.iconTop : public TileEntity createNewTileEntity(World world, int p_149915_2_) {
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop return new TileDragonEggSiphoner();
: (side == metadata ? this.iconFront : this.blockIcon)); }
} @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
@Override
public Item getItemDropped(int meta, Random random, int fortune) return metadata == 0 && side == 3 ? this.iconFront
{ : side == 1 ? this.iconTop :
return IC2Items.getItem("machine").getItem(); side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
} : (side == metadata ? this.iconFront : this.blockIcon));
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -19,62 +19,56 @@ import java.util.Random;
public class BlockGasTurbine extends BlockMachineBase { public class BlockGasTurbine extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockGasTurbine(Material material) public BlockGasTurbine(Material material) {
{ super(material);
super(material); setBlockName("techreborn.gasTurbine");
setBlockName("techreborn.gasTurbine"); }
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_)
{
return new TileGasTurbine();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.gasTurbineID, world, x, y,
z);
return true;
}
@Override @Override
@SideOnly(Side.CLIENT) public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public void registerBlockIcons(IIconRegister icon) return new TileGasTurbine();
{ }
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/machine_side");
this.iconTop = icon.registerIcon("techreborn:machine/gas_generator_top");
this.iconBottom = icon.registerIcon("techreborn:machine/gas_generator_bottom");
}
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) public boolean onBlockActivated(World world, int x, int y, int z,
{ EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.gasTurbineID, world, x, y,
z);
return true;
}
return metadata == 0 && side == 3 ? this.iconFront @Override
: side == 1 ? this.iconTop : @SideOnly(Side.CLIENT)
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop public void registerBlockIcons(IIconRegister icon) {
: (side == metadata ? this.iconFront : this.blockIcon)); this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/machine_side");
this.iconTop = icon.registerIcon("techreborn:machine/gas_generator_top");
this.iconBottom = icon.registerIcon("techreborn:machine/gas_generator_bottom");
}
} @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
@Override
public Item getItemDropped(int meta, Random random, int fortune) return metadata == 0 && side == 3 ? this.iconFront
{ : side == 1 ? this.iconTop :
return IC2Items.getItem("machine").getItem(); side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
} : (side == metadata ? this.iconFront : this.blockIcon));
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -14,54 +14,49 @@ import techreborn.tiles.TileHeatGenerator;
import java.util.Random; import java.util.Random;
public class BlockHeatGenerator extends BlockMachineBase{ public class BlockHeatGenerator extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockHeatGenerator(Material material)
{
super(material);
setBlockName("techreborn.heatgenerator");
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("techreborn:machine/heat_generator_side");
this.iconFront = icon.registerIcon("techreborn:machine/heat_generator_side");
this.iconTop = icon.registerIcon("techreborn:machine/heat_generator_top");
this.iconBottom = icon.registerIcon("techreborn:machine/heat_generator_bottom");
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_)
{
return new TileHeatGenerator();
}
@SideOnly(Side.CLIENT) public BlockHeatGenerator(Material material) {
public IIcon getIcon(int side, int metadata) super(material);
{ setBlockName("techreborn.heatgenerator");
}
return metadata == 0 && side == 3 ? this.iconFront @Override
: side == 1 ? this.iconTop : @SideOnly(Side.CLIENT)
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop public void registerBlockIcons(IIconRegister icon) {
: (side == metadata ? this.iconFront : this.blockIcon)); this.blockIcon = icon.registerIcon("techreborn:machine/heat_generator_side");
this.iconFront = icon.registerIcon("techreborn:machine/heat_generator_side");
this.iconTop = icon.registerIcon("techreborn:machine/heat_generator_top");
this.iconBottom = icon.registerIcon("techreborn:machine/heat_generator_bottom");
}
} @Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
@Override return new TileHeatGenerator();
public Item getItemDropped(int meta, Random random, int fortune) }
{
return IC2Items.getItem("machine").getItem(); @SideOnly(Side.CLIENT)
} public IIcon getIcon(int side, int metadata) {
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -13,46 +13,42 @@ import java.util.Random;
public class BlockLightningRod extends BlockMachineBase { public class BlockLightningRod extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockLightningRod(Material material) public BlockLightningRod(Material material) {
{ super(material);
super(material); setBlockName("techreborn.lightningrod");
setBlockName("techreborn.lightningrod"); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/idsu_front");
this.blockIcon = icon.registerIcon("techreborn:machine/idsu_front"); this.iconFront = icon.registerIcon("techreborn:machine/idsu_front");
this.iconFront = icon.registerIcon("techreborn:machine/idsu_front"); this.iconTop = icon.registerIcon("techreborn:machine/lightning_rod_top");
this.iconTop = icon.registerIcon("techreborn:machine/lightning_rod_top"); this.iconBottom = icon.registerIcon("techreborn:machine/extreme_voltage_machine_side");
this.iconBottom = icon.registerIcon("techreborn:machine/extreme_voltage_machine_side"); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) public IIcon getIcon(int side, int metadata) {
{
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @Override
public Item getItemDropped(int meta, Random random, int fortune) public Item getItemDropped(int meta, Random random, int fortune) {
{ return IC2Items.getItem("machine").getItem();
return IC2Items.getItem("machine").getItem(); }
}
} }

View file

@ -13,46 +13,42 @@ import java.util.Random;
public class BlockMagicEnergyAbsorber extends BlockMachineBase { public class BlockMagicEnergyAbsorber extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockMagicEnergyAbsorber(Material material) public BlockMagicEnergyAbsorber(Material material) {
{ super(material);
super(material); setBlockName("techreborn.magicenergyabsorber");
setBlockName("techreborn.magicenergyabsorber"); }
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("techreborn:machine/magic_energy_absorber_side");
this.iconFront = icon.registerIcon("techreborn:machine/magic_energy_absorber_side");
this.iconTop = icon.registerIcon("techreborn:machine/magic_energy_absorber_top");
this.iconBottom = icon.registerIcon("techreborn:machine/magic_energy_absorber_bottom");
}
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) @SideOnly(Side.CLIENT)
{ public void registerBlockIcons(IIconRegister icon) {
this.blockIcon = icon.registerIcon("techreborn:machine/magic_energy_absorber_side");
this.iconFront = icon.registerIcon("techreborn:machine/magic_energy_absorber_side");
this.iconTop = icon.registerIcon("techreborn:machine/magic_energy_absorber_top");
this.iconBottom = icon.registerIcon("techreborn:machine/magic_energy_absorber_bottom");
}
return metadata == 0 && side == 3 ? this.iconFront @SideOnly(Side.CLIENT)
: side == 1 ? this.iconTop : public IIcon getIcon(int side, int metadata) {
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
} return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
@Override side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
public Item getItemDropped(int meta, Random random, int fortune) : (side == metadata ? this.iconFront : this.blockIcon));
{
return IC2Items.getItem("machine").getItem(); }
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -13,46 +13,42 @@ import java.util.Random;
public class BlockMagicEnergyConverter extends BlockMachineBase { public class BlockMagicEnergyConverter extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockMagicEnergyConverter(Material material) public BlockMagicEnergyConverter(Material material) {
{ super(material);
super(material); setBlockName("techreborn.magicenergyconverter");
setBlockName("techreborn.magicenergyconverter"); }
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("techreborn:machine/magic_energy_converter_side");
this.iconFront = icon.registerIcon("techreborn:machine/magic_energy_converter_front_off");
this.iconTop = icon.registerIcon("techreborn:machine/magic_energy_converter_top");
this.iconBottom = icon.registerIcon("techreborn:machine/magic_energy_converter_bottom");
}
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) @SideOnly(Side.CLIENT)
{ public void registerBlockIcons(IIconRegister icon) {
this.blockIcon = icon.registerIcon("techreborn:machine/magic_energy_converter_side");
this.iconFront = icon.registerIcon("techreborn:machine/magic_energy_converter_front_off");
this.iconTop = icon.registerIcon("techreborn:machine/magic_energy_converter_top");
this.iconBottom = icon.registerIcon("techreborn:machine/magic_energy_converter_bottom");
}
return metadata == 0 && side == 3 ? this.iconFront @SideOnly(Side.CLIENT)
: side == 1 ? this.iconTop : public IIcon getIcon(int side, int metadata) {
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
} return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
@Override side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
public Item getItemDropped(int meta, Random random, int fortune) : (side == metadata ? this.iconFront : this.blockIcon));
{
return IC2Items.getItem("machine").getItem(); }
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -13,46 +13,42 @@ import java.util.Random;
public class BlockPlasmaGenerator extends BlockMachineBase { public class BlockPlasmaGenerator extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockPlasmaGenerator(Material material) public BlockPlasmaGenerator(Material material) {
{ super(material);
super(material); setBlockName("techreborn.plasmagenerator");
setBlockName("techreborn.plasmagenerator"); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/plasma_generator_side_off");
this.blockIcon = icon.registerIcon("techreborn:machine/plasma_generator_side_off"); this.iconFront = icon.registerIcon("techreborn:machine/plasma_generator_front");
this.iconFront = icon.registerIcon("techreborn:machine/plasma_generator_front"); this.iconTop = icon.registerIcon("techreborn:machine/plasma_generator_side_off");
this.iconTop = icon.registerIcon("techreborn:machine/plasma_generator_side_off"); this.iconBottom = icon.registerIcon("techreborn:machine/plasma_generator_side_off");
this.iconBottom = icon.registerIcon("techreborn:machine/plasma_generator_side_off"); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) public IIcon getIcon(int side, int metadata) {
{
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @Override
public Item getItemDropped(int meta, Random random, int fortune) public Item getItemDropped(int meta, Random random, int fortune) {
{ return IC2Items.getItem("machine").getItem();
return IC2Items.getItem("machine").getItem(); }
}
} }

View file

@ -19,62 +19,56 @@ import java.util.Random;
public class BlockSemiFluidGenerator extends BlockMachineBase { public class BlockSemiFluidGenerator extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockSemiFluidGenerator(Material material) public BlockSemiFluidGenerator(Material material) {
{ super(material);
super(material); setBlockName("techreborn.semifluidgenerator");
setBlockName("techreborn.semifluidgenerator"); }
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_)
{
return new TileSemifluidGenerator();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.semifluidGeneratorID, world, x, y,
z);
return true;
}
@Override @Override
@SideOnly(Side.CLIENT) public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public void registerBlockIcons(IIconRegister icon) return new TileSemifluidGenerator();
{ }
this.blockIcon = icon.registerIcon("techreborn:machine/semifluid_generator_side");
this.iconFront = icon.registerIcon("techreborn:machine/semifluid_generator_side");
this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) public boolean onBlockActivated(World world, int x, int y, int z,
{ EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.semifluidGeneratorID, world, x, y,
z);
return true;
}
return metadata == 0 && side == 3 ? this.iconFront @Override
: side == 1 ? this.iconTop : @SideOnly(Side.CLIENT)
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop public void registerBlockIcons(IIconRegister icon) {
: (side == metadata ? this.iconFront : this.blockIcon)); this.blockIcon = icon.registerIcon("techreborn:machine/semifluid_generator_side");
this.iconFront = icon.registerIcon("techreborn:machine/semifluid_generator_side");
this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
} @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
@Override
public Item getItemDropped(int meta, Random random, int fortune) return metadata == 0 && side == 3 ? this.iconFront
{ : side == 1 ? this.iconTop :
return IC2Items.getItem("machine").getItem(); side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
} : (side == metadata ? this.iconFront : this.blockIcon));
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -19,62 +19,56 @@ import java.util.Random;
public class BlockThermalGenerator extends BlockMachineBase { public class BlockThermalGenerator extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockThermalGenerator() public BlockThermalGenerator() {
{ super(Material.rock);
super(Material.rock); setBlockName("techreborn.thermalGenerator");
setBlockName("techreborn.thermalGenerator"); }
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_)
{
return new TileThermalGenerator();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.thermalGeneratorID, world, x, y,
z);
return true;
}
@Override @Override
@SideOnly(Side.CLIENT) public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public void registerBlockIcons(IIconRegister icon) return new TileThermalGenerator();
{ }
this.blockIcon = icon.registerIcon("techreborn:machine/thermal_generator_side_off");
this.iconFront = icon.registerIcon("techreborn:machine/thermal_generator_side_off");
this.iconTop = icon.registerIcon("techreborn:machine/thermal_generator_top_off");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) public boolean onBlockActivated(World world, int x, int y, int z,
{ EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.thermalGeneratorID, world, x, y,
z);
return true;
}
return metadata == 0 && side == 3 ? this.iconFront @Override
: side == 1 ? this.iconTop : @SideOnly(Side.CLIENT)
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop public void registerBlockIcons(IIconRegister icon) {
: (side == metadata ? this.iconFront : this.blockIcon)); this.blockIcon = icon.registerIcon("techreborn:machine/thermal_generator_side_off");
this.iconFront = icon.registerIcon("techreborn:machine/thermal_generator_side_off");
this.iconTop = icon.registerIcon("techreborn:machine/thermal_generator_top_off");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
} @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
@Override
public Item getItemDropped(int meta, Random random, int fortune) return metadata == 0 && side == 3 ? this.iconFront
{ : side == 1 ? this.iconTop :
return IC2Items.getItem("machine").getItem(); side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
} : (side == metadata ? this.iconFront : this.blockIcon));
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -15,59 +15,54 @@ import techreborn.tiles.TileAlloyFurnace;
public class BlockAlloyFurnace extends BlockMachineBase { public class BlockAlloyFurnace extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT)
private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconTop;
public BlockAlloyFurnace(Material material) @SideOnly(Side.CLIENT)
{ private IIcon iconBottom;
super(material);
setBlockName("techreborn.alloyfurnace");
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_)
{
return new TileAlloyFurnace();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.alloyFurnaceID, world, x, y,
z);
return true;
}
@Override public BlockAlloyFurnace(Material material) {
@SideOnly(Side.CLIENT) super(material);
public void registerBlockIcons(IIconRegister icon) setBlockName("techreborn.alloyfurnace");
{ }
this.blockIcon = icon.registerIcon("techreborn:machine/alloy_furnace_side");
this.iconFront = icon.registerIcon("techreborn:machine/alloy_furnace_front_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/alloy_furnace_front_on");
this.iconTop = icon.registerIcon("techreborn:machine/alloy_furnace_top");
this.iconBottom = icon.registerIcon("techreborn:machine/alloy_furnace_bottom");
}
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) public TileEntity createNewTileEntity(World world, int p_149915_2_) {
{ return new TileAlloyFurnace();
return metadata == 0 && side == 3 ? this.iconFront }
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
} @Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.alloyFurnaceID, world, x, y,
z);
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) {
this.blockIcon = icon.registerIcon("techreborn:machine/alloy_furnace_side");
this.iconFront = icon.registerIcon("techreborn:machine/alloy_furnace_front_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/alloy_furnace_front_on");
this.iconTop = icon.registerIcon("techreborn:machine/alloy_furnace_top");
this.iconBottom = icon.registerIcon("techreborn:machine/alloy_furnace_bottom");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
} }

View file

@ -20,77 +20,71 @@ import java.util.Random;
public class BlockAlloySmelter extends BlockMachineBase { public class BlockAlloySmelter extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT)
private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconTop;
public BlockAlloySmelter(Material material) @SideOnly(Side.CLIENT)
{ private IIcon iconBottom;
super(material);
setBlockName("techreborn.alloysmelter");
}
@Override public BlockAlloySmelter(Material material) {
public TileEntity createNewTileEntity(World world, int p_149915_2_) super(material);
{ setBlockName("techreborn.alloysmelter");
return new TileAlloySmelter(); }
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.alloySmelterID, world, x, y,
z);
return true;
}
@Override @Override
@SideOnly(Side.CLIENT) public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public void registerBlockIcons(IIconRegister icon) return new TileAlloySmelter();
{ }
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/electric_alloy_furnace_front_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/electric_alloy_furnace_front_on");
this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
@Override @Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { public boolean onBlockActivated(World world, int x, int y, int z,
int metadata = blockAccess.getBlockMetadata(x, y, z); EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
TileAlloySmelter tileAlloySmelter = (TileAlloySmelter) blockAccess.getTileEntity(x, y, z); if (!player.isSneaking())
if(side == metadata && tileAlloySmelter.crafter.isActive()){ player.openGui(Core.INSTANCE, GuiHandler.alloySmelterID, world, x, y,
return this.iconFrontOn; z);
} return true;
return metadata == 0 && side == 3 ? this.iconFront }
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata)
{
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
} @Override
@SideOnly(Side.CLIENT)
@Override public void registerBlockIcons(IIconRegister icon) {
public Item getItemDropped(int meta, Random random, int fortune) this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
{ this.iconFront = icon.registerIcon("techreborn:machine/electric_alloy_furnace_front_off");
return IC2Items.getItem("machine").getItem(); this.iconFrontOn = icon.registerIcon("techreborn:machine/electric_alloy_furnace_front_on");
} this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
@Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z);
TileAlloySmelter tileAlloySmelter = (TileAlloySmelter) blockAccess.getTileEntity(x, y, z);
if (side == metadata && tileAlloySmelter.crafter.isActive()) {
return this.iconFrontOn;
}
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -20,79 +20,73 @@ import java.util.Random;
public class BlockAssemblingMachine extends BlockMachineBase { public class BlockAssemblingMachine extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT)
private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconFrontOn;
public BlockAssemblingMachine(Material material) @SideOnly(Side.CLIENT)
{ private IIcon iconBottom;
super(material);
setBlockName("techreborn.assemblingmachine");
}
@Override public BlockAssemblingMachine(Material material) {
@SideOnly(Side.CLIENT) super(material);
public void registerBlockIcons(IIconRegister icon) setBlockName("techreborn.assemblingmachine");
{ }
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/assembling_machine_front_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/assembling_machine_front_on");
this.iconTop = icon.registerIcon("techreborn:machine/assembling_machine_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_)
{
return new TileAssemblingMachine();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.assemblingmachineID, world, x, y,
z);
return true;
}
@Override @Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { @SideOnly(Side.CLIENT)
int metadata = blockAccess.getBlockMetadata(x, y, z); public void registerBlockIcons(IIconRegister icon) {
TileAssemblingMachine tileAssemblingMachine = (TileAssemblingMachine) blockAccess.getTileEntity(x, y, z); this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
if(side == metadata && tileAssemblingMachine.crafter.isActive()){ this.iconFront = icon.registerIcon("techreborn:machine/assembling_machine_front_off");
return this.iconFrontOn; this.iconFrontOn = icon.registerIcon("techreborn:machine/assembling_machine_front_on");
} this.iconTop = icon.registerIcon("techreborn:machine/assembling_machine_top");
return metadata == 0 && side == 3 ? this.iconFront this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
: side == 1 ? this.iconTop : }
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
} @Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
@SideOnly(Side.CLIENT) return new TileAssemblingMachine();
public IIcon getIcon(int side, int metadata) }
{
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
} @Override
public boolean onBlockActivated(World world, int x, int y, int z,
@Override EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
public Item getItemDropped(int meta, Random random, int fortune) if (!player.isSneaking())
{ player.openGui(Core.INSTANCE, GuiHandler.assemblingmachineID, world, x, y,
return IC2Items.getItem("machine").getItem(); z);
} return true;
}
@Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z);
TileAssemblingMachine tileAssemblingMachine = (TileAssemblingMachine) blockAccess.getTileEntity(x, y, z);
if (side == metadata && tileAssemblingMachine.crafter.isActive()) {
return this.iconFrontOn;
}
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -19,66 +19,60 @@ import java.util.Random;
public class BlockBlastFurnace extends BlockMachineBase { public class BlockBlastFurnace extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT)
private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconTop;
public BlockBlastFurnace(Material material) @SideOnly(Side.CLIENT)
{ private IIcon iconBottom;
super(material);
setBlockName("techreborn.blastfurnace");
}
@Override public BlockBlastFurnace(Material material) {
public TileEntity createNewTileEntity(World world, int p_149915_2_) super(material);
{ setBlockName("techreborn.blastfurnace");
return new TileBlastFurnace(); }
}
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, public TileEntity createNewTileEntity(World world, int p_149915_2_) {
EntityPlayer player, int side, float hitX, float hitY, float hitZ) return new TileBlastFurnace();
{ }
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.blastFurnaceID, world, x, y,
z);
return true;
}
@Override @Override
@SideOnly(Side.CLIENT) public boolean onBlockActivated(World world, int x, int y, int z,
public void registerBlockIcons(IIconRegister icon) EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
{ if (!player.isSneaking())
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side"); player.openGui(Core.INSTANCE, GuiHandler.blastFurnaceID, world, x, y,
this.iconFront = icon.registerIcon("techreborn:machine/industrial_blast_furnace_front_off"); z);
this.iconFrontOn = icon.registerIcon("techreborn:machine/industrial_blast_furnace_front_on"); return true;
this.iconTop = icon.registerIcon("techreborn:machine/advanced_machine_side"); }
this.iconBottom = icon.registerIcon("techreborn:machine/advanced_machine_side");
}
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) @SideOnly(Side.CLIENT)
{ public void registerBlockIcons(IIconRegister icon) {
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/industrial_blast_furnace_front_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/industrial_blast_furnace_front_on");
this.iconTop = icon.registerIcon("techreborn:machine/advanced_machine_side");
this.iconBottom = icon.registerIcon("techreborn:machine/advanced_machine_side");
}
return metadata == 0 && side == 3 ? this.iconFront @SideOnly(Side.CLIENT)
: side == 1 ? this.iconTop : public IIcon getIcon(int side, int metadata) {
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
} return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
@Override side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
public Item getItemDropped(int meta, Random random, int fortune) : (side == metadata ? this.iconFront : this.blockIcon));
{
return IC2Items.getItem("advancedMachine").getItem(); }
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("advancedMachine").getItem();
}
} }

View file

@ -20,88 +20,82 @@ import java.util.Random;
public class BlockCentrifuge extends BlockMachineBase { public class BlockCentrifuge extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT)
private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconFrontOn;
@SideOnly(Side.CLIENT)
private IIcon iconTopOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconTop;
public BlockCentrifuge() @SideOnly(Side.CLIENT)
{ private IIcon iconTopOn;
super(Material.rock);
setBlockName("techreborn.centrifuge");
}
@Override @SideOnly(Side.CLIENT)
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) private IIcon iconBottom;
{
return new TileCentrifuge();
}
@Override public BlockCentrifuge() {
public boolean onBlockActivated(World world, int x, int y, int z, super(Material.rock);
EntityPlayer player, int side, float hitX, float hitY, float hitZ) setBlockName("techreborn.centrifuge");
{ }
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.centrifugeID, world, x, y,
z);
return true;
}
@Override @Override
@SideOnly(Side.CLIENT) public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
public void registerBlockIcons(IIconRegister icon) return new TileCentrifuge();
{ }
this.iconFront = icon.registerIcon("techreborn:machine/industrial_centrifuge_side_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/industrial_centrifuge_side_on");
this.iconTop = icon.registerIcon("techreborn:machine/industrial_centrifuge_top_off");
this.iconTopOn = icon.registerIcon("techreborn:machine/industrial_centrifuge_top_on");
this.iconBottom = icon.registerIcon("techreborn:machine/industrial_centrifuge_bottom");
}
@Override @Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { public boolean onBlockActivated(World world, int x, int y, int z,
int metadata = blockAccess.getBlockMetadata(x, y, z); EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
TileCentrifuge tileCentrifuge = (TileCentrifuge) blockAccess.getTileEntity(x, y, z); if (!player.isSneaking())
if(side >= 2 && tileCentrifuge.crafter.isActive()){ player.openGui(Core.INSTANCE, GuiHandler.centrifugeID, world, x, y,
return this.iconFrontOn; z);
} return true;
}
if(side == 1 && tileCentrifuge.crafter.isActive()){
return this.iconTopOn; @Override
} @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) {
this.iconFront = icon.registerIcon("techreborn:machine/industrial_centrifuge_side_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/industrial_centrifuge_side_on");
this.iconTop = icon.registerIcon("techreborn:machine/industrial_centrifuge_top_off");
this.iconTopOn = icon.registerIcon("techreborn:machine/industrial_centrifuge_top_on");
this.iconBottom = icon.registerIcon("techreborn:machine/industrial_centrifuge_bottom");
}
@Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z);
TileCentrifuge tileCentrifuge = (TileCentrifuge) blockAccess.getTileEntity(x, y, z);
if (side >= 2 && tileCentrifuge.crafter.isActive()) {
return this.iconFrontOn;
}
if (side == 1 && tileCentrifuge.crafter.isActive()) {
return this.iconTopOn;
}
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.iconFront)); : (side == metadata ? this.iconFront : this.iconFront));
} }
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata)
{
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.iconFront));
} @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
@Override return metadata == 0 && side == 3 ? this.iconFront
public Item getItemDropped(int meta, Random random, int fortune) : side == 1 ? this.iconTop :
{ side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
return IC2Items.getItem("machine").getItem(); : (side == metadata ? this.iconFront : this.iconFront));
}
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -15,58 +15,53 @@ import techreborn.tiles.TileChargeBench;
public class BlockChargeBench extends BlockMachineBase { public class BlockChargeBench extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT)
private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconTop;
public BlockChargeBench(Material material) @SideOnly(Side.CLIENT)
{ private IIcon iconBottom;
super(material);
setBlockName("techreborn.chargebench");
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_)
{
return new TileChargeBench();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.chargeBench, world, x, y,
z);
return true;
}
@Override public BlockChargeBench(Material material) {
@SideOnly(Side.CLIENT) super(material);
public void registerBlockIcons(IIconRegister icon) setBlockName("techreborn.chargebench");
{ }
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/machine_side");
this.iconFrontOn = icon.registerIcon("techreborn:machine/machine_side");
this.iconTop = icon.registerIcon("techreborn:machine/machine_side");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
}
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) public TileEntity createNewTileEntity(World world, int p_149915_2_) {
{ return new TileChargeBench();
return metadata == 0 && side == 3 ? this.iconFront }
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
} @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.chargeBench, world, x, y,
z);
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) {
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/machine_side");
this.iconFrontOn = icon.registerIcon("techreborn:machine/machine_side");
this.iconTop = icon.registerIcon("techreborn:machine/machine_side");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
} }

View file

@ -20,80 +20,74 @@ import java.util.Random;
public class BlockChemicalReactor extends BlockMachineBase { public class BlockChemicalReactor extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT)
private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconTop;
public BlockChemicalReactor(Material material) @SideOnly(Side.CLIENT)
{ private IIcon iconBottom;
super(material);
setBlockName("techreborn.chemicalreactor");
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_)
{
return new TileChemicalReactor();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.chemicalReactorID, world, x, y,
z);
return true;
}
@Override public BlockChemicalReactor(Material material) {
@SideOnly(Side.CLIENT) super(material);
public void registerBlockIcons(IIconRegister icon) setBlockName("techreborn.chemicalreactor");
{ }
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/chemical_reactor_side_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/chemical_reactor_side_on");
this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
@Override @Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { public TileEntity createNewTileEntity(World world, int p_149915_2_) {
int metadata = blockAccess.getBlockMetadata(x, y, z); return new TileChemicalReactor();
TileChemicalReactor tileChemicalReactor = (TileChemicalReactor) blockAccess.getTileEntity(x, y, z); }
if(side == metadata && tileChemicalReactor.crafter.isActive()){
return this.iconFrontOn;
}
return metadata == 0 && side == 3 ? this.iconFront @Override
: side == 1 ? this.iconTop : public boolean onBlockActivated(World world, int x, int y, int z,
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
: (side == metadata ? this.iconFront : this.blockIcon)); if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.chemicalReactorID, world, x, y,
z);
return true;
}
} @Override
@SideOnly(Side.CLIENT)
@SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister icon) {
public IIcon getIcon(int side, int metadata) this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
{ this.iconFront = icon.registerIcon("techreborn:machine/chemical_reactor_side_off");
return metadata == 0 && side == 3 ? this.iconFront this.iconFrontOn = icon.registerIcon("techreborn:machine/chemical_reactor_side_on");
: side == 1 ? this.iconTop : this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
: (side == metadata ? this.iconFront : this.blockIcon)); }
} @Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
@Override int metadata = blockAccess.getBlockMetadata(x, y, z);
public Item getItemDropped(int meta, Random random, int fortune) TileChemicalReactor tileChemicalReactor = (TileChemicalReactor) blockAccess.getTileEntity(x, y, z);
{ if (side == metadata && tileChemicalReactor.crafter.isActive()) {
return IC2Items.getItem("machine").getItem(); return this.iconFrontOn;
} }
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -13,46 +13,42 @@ import java.util.Random;
public class BlockDistillationTower extends BlockMachineBase { public class BlockDistillationTower extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockDistillationTower(Material material) public BlockDistillationTower(Material material) {
{ super(material);
super(material); setBlockName("techreborn.distillationtower");
setBlockName("techreborn.distillationtower"); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side"); this.iconFront = icon.registerIcon("techreborn:machine/distillation_tower_front_off");
this.iconFront = icon.registerIcon("techreborn:machine/distillation_tower_front_off"); this.iconTop = icon.registerIcon("techreborn:machine/advanced_machine_side");
this.iconTop = icon.registerIcon("techreborn:machine/advanced_machine_side"); this.iconBottom = icon.registerIcon("techreborn:machine/advanced_machine_side");
this.iconBottom = icon.registerIcon("techreborn:machine/advanced_machine_side"); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) public IIcon getIcon(int side, int metadata) {
{
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @Override
public Item getItemDropped(int meta, Random random, int fortune) public Item getItemDropped(int meta, Random random, int fortune) {
{ return IC2Items.getItem("machine").getItem();
return IC2Items.getItem("machine").getItem(); }
}
} }

View file

@ -18,91 +18,85 @@ import techreborn.tiles.TileGrinder;
import java.util.Random; import java.util.Random;
public class BlockGrinder extends BlockMachineBase{ public class BlockGrinder extends BlockMachineBase {
@SideOnly(Side.CLIENT)
private IIcon iconFront;
@SideOnly(Side.CLIENT)
private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconFront;
@SideOnly(Side.CLIENT)
private IIcon iconTopOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconFrontOn;
public BlockGrinder(Material material) @SideOnly(Side.CLIENT)
{ private IIcon iconTop;
super(material);
setBlockName("techreborn.grinder");
}
@Override @SideOnly(Side.CLIENT)
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) private IIcon iconTopOn;
{
return new TileGrinder();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.grinderID, world, x, y,
z);
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/industrial_grinder_front_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/industrial_grinder_front_on");
this.iconTop = icon.registerIcon("techreborn:machine/industrial_grinder_top_off");
this.iconTopOn = icon.registerIcon("techreborn:machine/industrial_grinder_top_on");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
@Override @SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { private IIcon iconBottom;
int metadata = blockAccess.getBlockMetadata(x, y, z);
TileGrinder tileGrinder = (TileGrinder) blockAccess.getTileEntity(x, y, z); public BlockGrinder(Material material) {
if(side == metadata && tileGrinder.crafter.isActive()){ super(material);
return this.iconFrontOn; setBlockName("techreborn.grinder");
} }
if(side == 1 && tileGrinder.crafter.isActive()){ @Override
return this.iconTopOn; public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
} return new TileGrinder();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.grinderID, world, x, y,
z);
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) {
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/industrial_grinder_front_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/industrial_grinder_front_on");
this.iconTop = icon.registerIcon("techreborn:machine/industrial_grinder_top_off");
this.iconTopOn = icon.registerIcon("techreborn:machine/industrial_grinder_top_on");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
@Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z);
TileGrinder tileGrinder = (TileGrinder) blockAccess.getTileEntity(x, y, z);
if (side == metadata && tileGrinder.crafter.isActive()) {
return this.iconFrontOn;
}
if (side == 1 && tileGrinder.crafter.isActive()) {
return this.iconTopOn;
}
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata)
{
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
} @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
@Override return metadata == 0 && side == 3 ? this.iconFront
public Item getItemDropped(int meta, Random random, int fortune) : side == 1 ? this.iconTop :
{ side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
return IC2Items.getItem("machine").getItem(); : (side == metadata ? this.iconFront : this.blockIcon));
}
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -18,80 +18,74 @@ import techreborn.tiles.TileImplosionCompressor;
import java.util.Random; import java.util.Random;
public class BlockImplosionCompressor extends BlockMachineBase{ public class BlockImplosionCompressor extends BlockMachineBase {
@SideOnly(Side.CLIENT)
private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFrontOn; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconTop;
public BlockImplosionCompressor(Material material) @SideOnly(Side.CLIENT)
{ private IIcon iconBottom;
super(material);
setBlockName("techreborn.implosioncompressor");
}
@Override public BlockImplosionCompressor(Material material) {
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) super(material);
{ setBlockName("techreborn.implosioncompressor");
return new TileImplosionCompressor(); }
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.compresserID, world, x, y,
z);
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/implosion_compressor_front_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/implosion_compressor_front_on");
this.iconTop = icon.registerIcon("techreborn:machine/advanced_machine_side");
this.iconBottom = icon.registerIcon("techreborn:machine/implosion_compressor_bottom");
}
@Override @Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
int metadata = blockAccess.getBlockMetadata(x, y, z); return new TileImplosionCompressor();
TileImplosionCompressor tileImplosionCompressor = (TileImplosionCompressor) blockAccess.getTileEntity(x, y, z); }
if(side == metadata && tileImplosionCompressor.crafter.isActive()){
return this.iconFrontOn;
}
return metadata == 0 && side == 3 ? this.iconFront @Override
: side == 1 ? this.iconTop : public boolean onBlockActivated(World world, int x, int y, int z,
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
: (side == metadata ? this.iconFront : this.blockIcon)); if (!player.isSneaking())
} player.openGui(Core.INSTANCE, GuiHandler.compresserID, world, x, y,
z);
@SideOnly(Side.CLIENT) return true;
public IIcon getIcon(int side, int metadata) }
{
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
} @Override
@SideOnly(Side.CLIENT)
@Override public void registerBlockIcons(IIconRegister icon) {
public Item getItemDropped(int meta, Random random, int fortune) this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
{ this.iconFront = icon.registerIcon("techreborn:machine/implosion_compressor_front_off");
return IC2Items.getItem("advancedMachine").getItem(); this.iconFrontOn = icon.registerIcon("techreborn:machine/implosion_compressor_front_on");
} this.iconTop = icon.registerIcon("techreborn:machine/advanced_machine_side");
this.iconBottom = icon.registerIcon("techreborn:machine/implosion_compressor_bottom");
}
@Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z);
TileImplosionCompressor tileImplosionCompressor = (TileImplosionCompressor) blockAccess.getTileEntity(x, y, z);
if (side == metadata && tileImplosionCompressor.crafter.isActive()) {
return this.iconFrontOn;
}
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("advancedMachine").getItem();
}
} }

View file

@ -20,82 +20,76 @@ import java.util.Random;
public class BlockIndustrialElectrolyzer extends BlockMachineBase { public class BlockIndustrialElectrolyzer extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT)
private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconTop;
public BlockIndustrialElectrolyzer(Material material) @SideOnly(Side.CLIENT)
{ private IIcon iconBottom;
super(material);
setBlockName("techreborn.industrialelectrolyzer"); public BlockIndustrialElectrolyzer(Material material) {
} super(material);
setBlockName("techreborn.industrialelectrolyzer");
@Override }
public TileEntity createNewTileEntity(World world, int p_149915_2_)
{ @Override
return new TileIndustrialElectrolyzer(); public TileEntity createNewTileEntity(World world, int p_149915_2_) {
} return new TileIndustrialElectrolyzer();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, @Override
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.isSneaking()) if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.industrialElectrolyzerID, world, x, y, player.openGui(Core.INSTANCE, GuiHandler.industrialElectrolyzerID, world, x, y,
z); z);
return true; return true;
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/industrial_electrolyzer_front_off");
this.blockIcon = icon.registerIcon("techreborn:machine/industrial_electrolyzer_front_off"); this.iconFront = icon.registerIcon("techreborn:machine/industrial_electrolyzer_front_off");
this.iconFront = icon.registerIcon("techreborn:machine/industrial_electrolyzer_front_off"); this.iconFrontOn = icon.registerIcon("techreborn:machine/industrial_electrolyzer_front_on");
this.iconFrontOn= icon.registerIcon("techreborn:machine/industrial_electrolyzer_front_on"); this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
this.iconTop = icon.registerIcon("techreborn:machine/machine_top"); this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom"); }
}
@Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z);
TileIndustrialElectrolyzer tileIndustrialElectrolyzer = (TileIndustrialElectrolyzer) blockAccess.getTileEntity(x, y, z);
if(side == metadata && tileIndustrialElectrolyzer.crafter.isActive()){
return this.iconFrontOn;
}
return metadata == 0 && side == 3 ? this.iconFront @Override
: side == 1 ? this.iconTop : public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop int metadata = blockAccess.getBlockMetadata(x, y, z);
: (side == metadata ? this.iconFront : this.blockIcon)); TileIndustrialElectrolyzer tileIndustrialElectrolyzer = (TileIndustrialElectrolyzer) blockAccess.getTileEntity(x, y, z);
if (side == metadata && tileIndustrialElectrolyzer.crafter.isActive()) {
return this.iconFrontOn;
}
} return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
@SideOnly(Side.CLIENT) }
public IIcon getIcon(int side, int metadata)
{
return metadata == 0 && side == 3 ? this.iconFront @SideOnly(Side.CLIENT)
: side == 1 ? this.iconTop : public IIcon getIcon(int side, int metadata) {
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
} return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
@Override side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
public Item getItemDropped(int meta, Random random, int fortune) : (side == metadata ? this.iconFront : this.blockIcon));
{
return IC2Items.getItem("machine").getItem(); }
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -20,81 +20,75 @@ import java.util.Random;
public class BlockIndustrialSawmill extends BlockMachineBase { public class BlockIndustrialSawmill extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT)
private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconTop;
public BlockIndustrialSawmill(Material material) @SideOnly(Side.CLIENT)
{ private IIcon iconBottom;
super(material);
setBlockName("techreborn.industrialsawmill");
}
@Override public BlockIndustrialSawmill(Material material) {
public TileEntity createNewTileEntity(World world, int p_149915_2_) super(material);
{ setBlockName("techreborn.industrialsawmill");
return new TileIndustrialSawmill(); }
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.sawMillID, world, x, y,
z);
return true;
}
@Override @Override
@SideOnly(Side.CLIENT) public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public void registerBlockIcons(IIconRegister icon) return new TileIndustrialSawmill();
{ }
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/industrial_sawmill_front_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/industrial_sawmill_front_on");
this.iconTop = icon.registerIcon("techreborn:machine/advanced_machine_side");
this.iconBottom = icon.registerIcon("techreborn:machine/advanced_machine_side");
}
@Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z);
TileIndustrialSawmill tileIndustrialSawmill = (TileIndustrialSawmill) blockAccess.getTileEntity(x, y, z);
if(side == metadata && tileIndustrialSawmill.crafter.isActive()){
return this.iconFrontOn;
}
return metadata == 0 && side == 3 ? this.iconFront @Override
: side == 1 ? this.iconTop : public boolean onBlockActivated(World world, int x, int y, int z,
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
: (side == metadata ? this.iconFront : this.blockIcon)); if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.sawMillID, world, x, y,
z);
return true;
}
} @Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) {
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/industrial_sawmill_front_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/industrial_sawmill_front_on");
this.iconTop = icon.registerIcon("techreborn:machine/advanced_machine_side");
this.iconBottom = icon.registerIcon("techreborn:machine/advanced_machine_side");
}
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
{ int metadata = blockAccess.getBlockMetadata(x, y, z);
TileIndustrialSawmill tileIndustrialSawmill = (TileIndustrialSawmill) blockAccess.getTileEntity(x, y, z);
if (side == metadata && tileIndustrialSawmill.crafter.isActive()) {
return this.iconFrontOn;
}
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @SideOnly(Side.CLIENT)
public Item getItemDropped(int meta, Random random, int fortune) public IIcon getIcon(int side, int metadata) {
{
return IC2Items.getItem("advancedMachine").getItem(); return metadata == 0 && side == 3 ? this.iconFront
} : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("advancedMachine").getItem();
}
} }

View file

@ -20,79 +20,73 @@ import java.util.Random;
public class BlockLathe extends BlockMachineBase { public class BlockLathe extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT)
private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconTop;
public BlockLathe(Material material) @SideOnly(Side.CLIENT)
{ private IIcon iconBottom;
super(material);
setBlockName("techreborn.lathe");
}
@Override public BlockLathe(Material material) {
@SideOnly(Side.CLIENT) super(material);
public void registerBlockIcons(IIconRegister icon) setBlockName("techreborn.lathe");
{ }
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/lathe_front_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/lathe_front_on");
this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_)
{
return new TileLathe();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.latheID, world, x, y,
z);
return true;
}
@Override @Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { @SideOnly(Side.CLIENT)
int metadata = blockAccess.getBlockMetadata(x, y, z); public void registerBlockIcons(IIconRegister icon) {
TileLathe tileLathe = (TileLathe) blockAccess.getTileEntity(x, y, z); this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
if(side == metadata && tileLathe.crafter.isActive()){ this.iconFront = icon.registerIcon("techreborn:machine/lathe_front_off");
return this.iconFrontOn; this.iconFrontOn = icon.registerIcon("techreborn:machine/lathe_front_on");
} this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
return metadata == 0 && side == 3 ? this.iconFront @Override
: side == 1 ? this.iconTop : public TileEntity createNewTileEntity(World world, int p_149915_2_) {
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop return new TileLathe();
: (side == metadata ? this.iconFront : this.blockIcon)); }
} @Override
public boolean onBlockActivated(World world, int x, int y, int z,
@SideOnly(Side.CLIENT) EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
public IIcon getIcon(int side, int metadata) if (!player.isSneaking())
{ player.openGui(Core.INSTANCE, GuiHandler.latheID, world, x, y,
return metadata == 0 && side == 3 ? this.iconFront z);
: side == 1 ? this.iconTop : return true;
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop }
: (side == metadata ? this.iconFront : this.blockIcon));
} @Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z);
TileLathe tileLathe = (TileLathe) blockAccess.getTileEntity(x, y, z);
if (side == metadata && tileLathe.crafter.isActive()) {
return this.iconFrontOn;
}
@Override return metadata == 0 && side == 3 ? this.iconFront
public Item getItemDropped(int meta, Random random, int fortune) : side == 1 ? this.iconTop :
{ side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
return IC2Items.getItem("machine").getItem(); : (side == metadata ? this.iconFront : this.blockIcon));
}
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -17,68 +17,62 @@ import techreborn.tiles.TileMatterFabricator;
import java.util.Random; import java.util.Random;
public class BlockMatterFabricator extends BlockMachineBase{ public class BlockMatterFabricator extends BlockMachineBase {
@SideOnly(Side.CLIENT)
private IIcon iconFront;
@SideOnly(Side.CLIENT)
private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconFrontOn;
public BlockMatterFabricator(Material material) @SideOnly(Side.CLIENT)
{ private IIcon iconTop;
super(material);
setBlockName("techreborn.matterfabricator");
}
@Override @SideOnly(Side.CLIENT)
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) private IIcon iconBottom;
{
return new TileMatterFabricator();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.matterfabID, world, x, y,
z);
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("techreborn:machine/matterfab_off");
this.iconFront = icon.registerIcon("techreborn:machine/matterfab_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/matterfab_on");
this.iconTop = icon.registerIcon("techreborn:machine/matterfab_off");
this.iconBottom = icon.registerIcon("techreborn:machine/matterfab_off");
}
@SideOnly(Side.CLIENT) public BlockMatterFabricator(Material material) {
public IIcon getIcon(int side, int metadata) super(material);
{ setBlockName("techreborn.matterfabricator");
}
return metadata == 0 && side == 3 ? this.iconFront @Override
: side == 1 ? this.iconTop : public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop return new TileMatterFabricator();
: (side == metadata ? this.iconFront : this.blockIcon)); }
} @Override
public boolean onBlockActivated(World world, int x, int y, int z,
@Override EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
public Item getItemDropped(int meta, Random random, int fortune) if (!player.isSneaking())
{ player.openGui(Core.INSTANCE, GuiHandler.matterfabID, world, x, y,
return IC2Items.getItem("advancedMachine").getItem(); z);
} return true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) {
this.blockIcon = icon.registerIcon("techreborn:machine/matterfab_off");
this.iconFront = icon.registerIcon("techreborn:machine/matterfab_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/matterfab_on");
this.iconTop = icon.registerIcon("techreborn:machine/matterfab_off");
this.iconBottom = icon.registerIcon("techreborn:machine/matterfab_off");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("advancedMachine").getItem();
}
} }

View file

@ -20,79 +20,73 @@ import java.util.Random;
public class BlockPlateCuttingMachine extends BlockMachineBase { public class BlockPlateCuttingMachine extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT)
private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconFrontOn;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconTop;
public BlockPlateCuttingMachine(Material material) @SideOnly(Side.CLIENT)
{ private IIcon iconBottom;
super(material);
setBlockName("techreborn.platecuttingmachine");
}
@Override public BlockPlateCuttingMachine(Material material) {
@SideOnly(Side.CLIENT) super(material);
public void registerBlockIcons(IIconRegister icon) setBlockName("techreborn.platecuttingmachine");
{ }
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.iconFront = icon.registerIcon("techreborn:machine/plate_cutting_machine_front_off");
this.iconFrontOn = icon.registerIcon("techreborn:machine/plate_cutting_machine_front_on");
this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
}
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_)
{
return new TilePlateCuttingMachine();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.platecuttingmachineID, world, x, y,
z);
return true;
}
@Override @Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { @SideOnly(Side.CLIENT)
int metadata = blockAccess.getBlockMetadata(x, y, z); public void registerBlockIcons(IIconRegister icon) {
TilePlateCuttingMachine tilePlateCuttingMachine = (TilePlateCuttingMachine) blockAccess.getTileEntity(x, y, z); this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
if(side == metadata && tilePlateCuttingMachine.crafter.isActive()){ this.iconFront = icon.registerIcon("techreborn:machine/plate_cutting_machine_front_off");
return this.iconFrontOn; this.iconFrontOn = icon.registerIcon("techreborn:machine/plate_cutting_machine_front_on");
} this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
return metadata == 0 && side == 3 ? this.iconFront this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
: side == 1 ? this.iconTop : }
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
} @Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
@SideOnly(Side.CLIENT) return new TilePlateCuttingMachine();
public IIcon getIcon(int side, int metadata) }
{
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
} @Override
public boolean onBlockActivated(World world, int x, int y, int z,
@Override EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
public Item getItemDropped(int meta, Random random, int fortune) if (!player.isSneaking())
{ player.openGui(Core.INSTANCE, GuiHandler.platecuttingmachineID, world, x, y,
return IC2Items.getItem("machine").getItem(); z);
} return true;
}
@Override
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z);
TilePlateCuttingMachine tilePlateCuttingMachine = (TilePlateCuttingMachine) blockAccess.getTileEntity(x, y, z);
if (side == metadata && tilePlateCuttingMachine.crafter.isActive()) {
return this.iconFrontOn;
}
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@Override
public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("machine").getItem();
}
} }

View file

@ -19,61 +19,55 @@ import java.util.Random;
public class BlockRollingMachine extends BlockMachineBase { public class BlockRollingMachine extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockRollingMachine(Material material) public BlockRollingMachine(Material material) {
{ super(material.rock);
super(material.rock); setBlockName("techreborn.rollingmachine");
setBlockName("techreborn.rollingmachine"); }
}
@Override @Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
{ return new TileRollingMachine();
return new TileRollingMachine(); }
}
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ) EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
{ if (!player.isSneaking())
if (!player.isSneaking()) player.openGui(Core.INSTANCE, GuiHandler.rollingMachineID, world,
player.openGui(Core.INSTANCE, GuiHandler.rollingMachineID, world, x, y, z);
x, y, z); return true;
return true; }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side"); this.iconFront = icon.registerIcon("techreborn:machine/rolling_machine_side_off");
this.iconFront = icon.registerIcon("techreborn:machine/rolling_machine_side_off"); this.iconTop = icon.registerIcon("techreborn:machine/machine_top");
this.iconTop = icon.registerIcon("techreborn:machine/machine_top"); this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom"); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) public IIcon getIcon(int side, int metadata) {
{ return metadata == 0 && side == 3 ? this.iconFront
return metadata == 0 && side == 3 ? this.iconFront : side == 1 ? this.iconTop :
: side == 1 ? this.iconTop : side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop : (side == metadata ? this.iconFront : this.blockIcon));
: (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @Override
public Item getItemDropped(int meta, Random random, int fortune) public Item getItemDropped(int meta, Random random, int fortune) {
{ return IC2Items.getItem("machine").getItem();
return IC2Items.getItem("machine").getItem(); }
}
} }

View file

@ -13,46 +13,42 @@ import java.util.Random;
public class BlockVacuumFreezer extends BlockMachineBase { public class BlockVacuumFreezer extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockVacuumFreezer(Material material) public BlockVacuumFreezer(Material material) {
{ super(material);
super(material); setBlockName("techreborn.vacuumfreezer");
setBlockName("techreborn.vacuumfreezer"); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/machine_side");
this.blockIcon = icon.registerIcon("techreborn:machine/machine_side"); this.iconFront = icon.registerIcon("techreborn:machine/vacuum_freezer_front");
this.iconFront = icon.registerIcon("techreborn:machine/vacuum_freezer_front"); this.iconTop = icon.registerIcon("techreborn:machine/vacuum_freezer_top");
this.iconTop = icon.registerIcon("techreborn:machine/vacuum_freezer_top"); this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom"); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) public IIcon getIcon(int side, int metadata) {
{
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @Override
public Item getItemDropped(int meta, Random random, int fortune) public Item getItemDropped(int meta, Random random, int fortune) {
{ return IC2Items.getItem("advancedMachine").getItem();
return IC2Items.getItem("advancedMachine").getItem(); }
}
} }

View file

@ -17,64 +17,60 @@ import techreborn.tiles.TileAesu;
public class BlockAesu extends BlockMachineBase { public class BlockAesu extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockAesu(Material material) public BlockAesu(Material material) {
{ super(material);
super(material); setBlockName("techreborn.aesu");
setBlockName("techreborn.aesu"); }
}
@Override
@Override public TileEntity createNewTileEntity(World world, int p_149915_2_) {
public TileEntity createNewTileEntity(World world, int p_149915_2_) return new TileAesu();
{ }
return new TileAesu();
} @Override
public boolean onBlockActivated(World world, int x, int y, int z,
@Override EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(World world, int x, int y, int z, if (!player.isSneaking())
EntityPlayer player, int side, float hitX, float hitY, float hitZ) player.openGui(Core.INSTANCE, GuiHandler.aesuID, world, x, y,
{ z);
if (!player.isSneaking()) return true;
player.openGui(Core.INSTANCE, GuiHandler.aesuID, world, x, y, }
z);
return true;
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/aesu_side");
this.blockIcon = icon.registerIcon("techreborn:machine/aesu_side"); this.iconFront = icon.registerIcon("techreborn:machine/aesu_front");
this.iconFront = icon.registerIcon("techreborn:machine/aesu_front"); this.iconTop = icon.registerIcon("techreborn:machine/aesu_side");
this.iconTop = icon.registerIcon("techreborn:machine/aesu_side"); this.iconBottom = icon.registerIcon("techreborn:machine/aesu_side");
this.iconBottom = icon.registerIcon("techreborn:machine/aesu_side"); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(int side, int metadata) {
if(side == metadata) if (side == metadata)
return this.iconFront; return this.iconFront;
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) { public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
super.onBlockPlacedBy(world, x, y, z, player, itemstack); super.onBlockPlacedBy(world, x, y, z, player, itemstack);
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TileAesu){ if (tile instanceof TileAesu) {
((TileAesu) tile).setFacing((short) world.getBlockMetadata(x, y, z)); ((TileAesu) tile).setFacing((short) world.getBlockMetadata(x, y, z));
} }
} }
} }

View file

@ -1,13 +1,11 @@
package techreborn.blocks.storage; package techreborn.blocks.storage;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
@ -15,70 +13,64 @@ import net.minecraft.world.World;
import techreborn.Core; import techreborn.Core;
import techreborn.blocks.BlockMachineBase; import techreborn.blocks.BlockMachineBase;
import techreborn.client.GuiHandler; import techreborn.client.GuiHandler;
import techreborn.packets.PacketHandler;
import techreborn.tiles.idsu.IDSUManager;
import techreborn.tiles.idsu.TileIDSU; import techreborn.tiles.idsu.TileIDSU;
public class BlockIDSU extends BlockMachineBase { public class BlockIDSU extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockIDSU(Material material) public BlockIDSU(Material material) {
{ super(material);
super(material); setBlockName("techreborn.idsu");
setBlockName("techreborn.idsu"); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/idsu_side");
this.blockIcon = icon.registerIcon("techreborn:machine/idsu_side"); this.iconFront = icon.registerIcon("techreborn:machine/idsu_front");
this.iconFront = icon.registerIcon("techreborn:machine/idsu_front"); this.iconTop = icon.registerIcon("techreborn:machine/idsu_side");
this.iconTop = icon.registerIcon("techreborn:machine/idsu_side"); this.iconBottom = icon.registerIcon("techreborn:machine/idsu_side");
this.iconBottom = icon.registerIcon("techreborn:machine/idsu_side"); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) public IIcon getIcon(int side, int metadata) {
{ return metadata == 0 && side == 3 ? this.iconFront
return metadata == 0 && side == 3 ? this.iconFront : side == 1 ? this.iconTop :
: side == 1 ? this.iconTop : side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop : (side == metadata ? this.iconFront : this.blockIcon));
: (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileIDSU(5, 2048, 100000000); return new TileIDSU(5, 2048, 100000000);
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ) EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
{ if (!player.isSneaking())
if (!player.isSneaking()) player.openGui(Core.INSTANCE, GuiHandler.idsuID, world, x, y,
player.openGui(Core.INSTANCE, GuiHandler.idsuID, world, x, y, z);
z); return true;
return true; }
}
@Override @Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) { public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
super.onBlockPlacedBy(world, x, y, z, player, itemstack); super.onBlockPlacedBy(world, x, y, z, player, itemstack);
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TileIDSU){ if (tile instanceof TileIDSU) {
((TileIDSU) tile).ownerUdid = player.getUniqueID().toString(); ((TileIDSU) tile).ownerUdid = player.getUniqueID().toString();
System.out.println(((TileIDSU) tile).ownerUdid); System.out.println(((TileIDSU) tile).ownerUdid);
} }
} }
} }

View file

@ -15,51 +15,47 @@ import techreborn.tiles.lesu.TileLesu;
public class BlockLesu extends BlockMachineBase { public class BlockLesu extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockLesu(Material material) public BlockLesu(Material material) {
{ super(material);
super(material); setBlockName("techreborn.lesu");
setBlockName("techreborn.lesu"); }
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("techreborn:machine/lesu_side");
this.iconFront = icon.registerIcon("techreborn:machine/lesu_front");
this.iconTop = icon.registerIcon("techreborn:machine/lesu_side");
this.iconBottom = icon.registerIcon("techreborn:machine/lesu_side");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
if(side == metadata)
return this.iconFront;
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@Override @Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) @SideOnly(Side.CLIENT)
{ public void registerBlockIcons(IIconRegister icon) {
this.blockIcon = icon.registerIcon("techreborn:machine/lesu_side");
this.iconFront = icon.registerIcon("techreborn:machine/lesu_front");
this.iconTop = icon.registerIcon("techreborn:machine/lesu_side");
this.iconBottom = icon.registerIcon("techreborn:machine/lesu_side");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
if (side == metadata)
return this.iconFront;
return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon));
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileLesu(); return new TileLesu();
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, public boolean onBlockActivated(World world, int x, int y, int z,
EntityPlayer player, int side, float hitX, float hitY, float hitZ) EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
{
if (!player.isSneaking()) if (!player.isSneaking())
player.openGui(Core.INSTANCE, GuiHandler.lesuID, world, x, y, player.openGui(Core.INSTANCE, GuiHandler.lesuID, world, x, y,
z); z);

View file

@ -15,63 +15,58 @@ import techreborn.tiles.lesu.TileLesuStorage;
public class BlockLesuStorage extends BlockMachineBase { public class BlockLesuStorage extends BlockMachineBase {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconFront; private IIcon iconFront;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconTop; private IIcon iconTop;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private IIcon iconBottom; private IIcon iconBottom;
public BlockLesuStorage(Material material) public BlockLesuStorage(Material material) {
{ super(material);
super(material); setBlockName("techreborn.lesustorage");
setBlockName("techreborn.lesustorage"); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) public void registerBlockIcons(IIconRegister icon) {
{ this.blockIcon = icon.registerIcon("techreborn:machine/lesu_block");
this.blockIcon = icon.registerIcon("techreborn:machine/lesu_block"); this.iconFront = icon.registerIcon("techreborn:machine/lesu_block");
this.iconFront = icon.registerIcon("techreborn:machine/lesu_block"); this.iconTop = icon.registerIcon("techreborn:machine/lesu_block");
this.iconTop = icon.registerIcon("techreborn:machine/lesu_block"); this.iconBottom = icon.registerIcon("techreborn:machine/lesu_block");
this.iconBottom = icon.registerIcon("techreborn:machine/lesu_block"); }
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) public IIcon getIcon(int side, int metadata) {
{
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) { public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
super.onBlockPlacedBy(world, x, y, z, player, itemstack); super.onBlockPlacedBy(world, x, y, z, player, itemstack);
if(world.getTileEntity(x, y, z) instanceof TileLesuStorage){ if (world.getTileEntity(x, y, z) instanceof TileLesuStorage) {
((TileLesuStorage) world.getTileEntity(x, y, z)).rebuildNetwork(); ((TileLesuStorage) world.getTileEntity(x, y, z)).rebuildNetwork();
} }
} }
@Override @Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) { public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
if(world.getTileEntity(x, y, z) instanceof TileLesuStorage) { if (world.getTileEntity(x, y, z) instanceof TileLesuStorage) {
((TileLesuStorage) world.getTileEntity(x, y, z)).removeFromNetwork(); ((TileLesuStorage) world.getTileEntity(x, y, z)).removeFromNetwork();
} }
super.breakBlock(world, x, y, z, block, meta); super.breakBlock(world, x, y, z, block, meta);
} }
@Override @Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
{
return new TileLesuStorage(); return new TileLesuStorage();
} }

View file

@ -12,261 +12,211 @@ import techreborn.tiles.lesu.TileLesu;
public class GuiHandler implements IGuiHandler { public class GuiHandler implements IGuiHandler {
public static final int thermalGeneratorID = 0; public static final int thermalGeneratorID = 0;
public static final int quantumTankID = 1; public static final int quantumTankID = 1;
public static final int quantumChestID = 2; public static final int quantumChestID = 2;
public static final int centrifugeID = 3; public static final int centrifugeID = 3;
public static final int rollingMachineID = 4; public static final int rollingMachineID = 4;
public static final int blastFurnaceID = 5; public static final int blastFurnaceID = 5;
public static final int alloySmelterID = 6; public static final int alloySmelterID = 6;
public static final int grinderID = 7; public static final int grinderID = 7;
public static final int compresserID = 8; public static final int compresserID = 8;
public static final int matterfabID = 9; public static final int matterfabID = 9;
public static final int pdaID = 10; public static final int pdaID = 10;
public static final int chunkloaderID = 11; public static final int chunkloaderID = 11;
public static final int assemblingmachineID = 12; public static final int assemblingmachineID = 12;
public static final int latheID = 13; public static final int latheID = 13;
public static final int platecuttingmachineID = 14; public static final int platecuttingmachineID = 14;
public static final int dieselGeneratorID = 15; public static final int dieselGeneratorID = 15;
public static final int industrialElectrolyzerID = 16; public static final int industrialElectrolyzerID = 16;
public static final int aesuID =17; public static final int aesuID = 17;
public static final int alloyFurnaceID = 18; public static final int alloyFurnaceID = 18;
public static final int sawMillID = 19; public static final int sawMillID = 19;
public static final int chemicalReactorID = 20; public static final int chemicalReactorID = 20;
public static final int semifluidGeneratorID = 21; public static final int semifluidGeneratorID = 21;
public static final int gasTurbineID = 22; public static final int gasTurbineID = 22;
public static final int digitalChestID = 23; public static final int digitalChestID = 23;
public static final int destructoPackID = 25; public static final int destructoPackID = 25;
public static final int lesuID = 26; public static final int lesuID = 26;
public static final int idsuID = 27; public static final int idsuID = 27;
public static final int chargeBench = 28; public static final int chargeBench = 28;
public static final int farmID = 29; public static final int farmID = 29;
@Override @Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, public Object getServerGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) int x, int y, int z) {
{ if (ID == thermalGeneratorID) {
if (ID == thermalGeneratorID) return new ContainerThermalGenerator(
{ (TileThermalGenerator) world.getTileEntity(x, y, z), player);
return new ContainerThermalGenerator( } else if (ID == semifluidGeneratorID) {
(TileThermalGenerator) world.getTileEntity(x, y, z), player); return new ContainerSemifluidGenerator(
} else if (ID == semifluidGeneratorID) (TileSemifluidGenerator) world.getTileEntity(x, y, z), player);
{ } else if (ID == gasTurbineID) {
return new ContainerSemifluidGenerator( return new ContainerGasTurbine(
(TileSemifluidGenerator) world.getTileEntity(x, y, z), player); (TileGasTurbine) world.getTileEntity(x, y, z), player);
} else if (ID == gasTurbineID) } else if (ID == quantumTankID) {
{ return new ContainerQuantumTank(
return new ContainerGasTurbine( (TileQuantumTank) world.getTileEntity(x, y, z), player);
(TileGasTurbine) world.getTileEntity(x, y, z), player); } else if (ID == digitalChestID) {
} else if (ID == quantumTankID) return new ContainerDigitalChest(
{ (TileDigitalChest) world.getTileEntity(x, y, z), player);
return new ContainerQuantumTank( } else if (ID == quantumChestID) {
(TileQuantumTank) world.getTileEntity(x, y, z), player); return new ContainerQuantumChest(
} else if (ID == digitalChestID) (TileQuantumChest) world.getTileEntity(x, y, z), player);
{ } else if (ID == centrifugeID) {
return new ContainerDigitalChest( return new ContainerCentrifuge(
(TileDigitalChest) world.getTileEntity(x, y, z), player); (TileCentrifuge) world.getTileEntity(x, y, z), player);
} else if (ID == quantumChestID) } else if (ID == rollingMachineID) {
{ return new ContainerRollingMachine(
return new ContainerQuantumChest( (TileRollingMachine) world.getTileEntity(x, y, z), player);
(TileQuantumChest) world.getTileEntity(x, y, z), player); } else if (ID == blastFurnaceID) {
} else if (ID == centrifugeID) return new ContainerBlastFurnace(
{ (TileBlastFurnace) world.getTileEntity(x, y, z), player);
return new ContainerCentrifuge( } else if (ID == alloySmelterID) {
(TileCentrifuge) world.getTileEntity(x, y, z), player); return new ContainerAlloySmelter(
} else if (ID == rollingMachineID) (TileAlloySmelter) world.getTileEntity(x, y, z), player);
{ } else if (ID == grinderID) {
return new ContainerRollingMachine( return new ContainerGrinder(
(TileRollingMachine) world.getTileEntity(x, y, z), player); (TileGrinder) world.getTileEntity(x, y, z), player);
} else if (ID == blastFurnaceID) } else if (ID == compresserID) {
{ return new ContainerImplosionCompressor(
return new ContainerBlastFurnace( (TileImplosionCompressor) world.getTileEntity(x, y, z), player);
(TileBlastFurnace) world.getTileEntity(x, y, z), player); } else if (ID == matterfabID) {
} else if (ID == alloySmelterID) return new ContainerMatterFabricator(
{ (TileMatterFabricator) world.getTileEntity(x, y, z), player);
return new ContainerAlloySmelter( } else if (ID == chunkloaderID) {
(TileAlloySmelter) world.getTileEntity(x, y, z), player); return new ContainerChunkloader(
} else if (ID == grinderID) (TileChunkLoader) world.getTileEntity(x, y, z), player);
{ } else if (ID == assemblingmachineID) {
return new ContainerGrinder( return new ContainerAssemblingMachine(
(TileGrinder) world.getTileEntity(x, y, z), player); (TileAssemblingMachine) world.getTileEntity(x, y, z), player);
} else if (ID == compresserID) } else if (ID == latheID) {
{ return new ContainerLathe(
return new ContainerImplosionCompressor( (TileLathe) world.getTileEntity(x, y, z), player);
(TileImplosionCompressor) world.getTileEntity(x, y, z), player); } else if (ID == platecuttingmachineID) {
} else if (ID == matterfabID) return new ContainerPlateCuttingMachine(
{ (TilePlateCuttingMachine) world.getTileEntity(x, y, z), player);
return new ContainerMatterFabricator( } else if (ID == dieselGeneratorID) {
(TileMatterFabricator) world.getTileEntity(x, y, z), player); return new ContainerDieselGenerator(
} else if (ID == chunkloaderID) (TileDieselGenerator) world.getTileEntity(x, y, z), player);
{ } else if (ID == industrialElectrolyzerID) {
return new ContainerChunkloader( return new ContainerIndustrialElectrolyzer(
(TileChunkLoader) world.getTileEntity(x, y, z), player); (TileIndustrialElectrolyzer) world.getTileEntity(x, y, z), player);
} else if (ID == assemblingmachineID) } else if (ID == aesuID) {
{ return new ContainerAesu(
return new ContainerAssemblingMachine( (TileAesu) world.getTileEntity(x, y, z), player);
(TileAssemblingMachine) world.getTileEntity(x, y, z), player); } else if (ID == alloyFurnaceID) {
} else if (ID == latheID) return new ContainerAlloyFurnace(
{ (TileAlloyFurnace) world.getTileEntity(x, y, z), player);
return new ContainerLathe( } else if (ID == sawMillID) {
(TileLathe) world.getTileEntity(x, y, z), player); return new ContainerIndustrialSawmill(
} else if (ID == platecuttingmachineID) (TileIndustrialSawmill) world.getTileEntity(x, y, z), player);
{ } else if (ID == chemicalReactorID) {
return new ContainerPlateCuttingMachine( return new ContainerChemicalReactor(
(TilePlateCuttingMachine) world.getTileEntity(x, y, z), player); (TileChemicalReactor) world.getTileEntity(x, y, z), player);
} else if (ID == dieselGeneratorID) } else if (ID == pdaID) {
{ return null;
return new ContainerDieselGenerator( } else if (ID == destructoPackID) {
(TileDieselGenerator) world.getTileEntity(x, y, z), player); return new ContainerDestructoPack(player);
} else if (ID == industrialElectrolyzerID) } else if (ID == lesuID) {
{
return new ContainerIndustrialElectrolyzer(
(TileIndustrialElectrolyzer) world.getTileEntity(x, y, z), player);
} else if (ID == aesuID)
{
return new ContainerAesu(
(TileAesu) world.getTileEntity(x, y, z), player);
} else if (ID == alloyFurnaceID)
{
return new ContainerAlloyFurnace(
(TileAlloyFurnace) world.getTileEntity(x, y, z), player);
} else if (ID == sawMillID)
{
return new ContainerIndustrialSawmill(
(TileIndustrialSawmill) world.getTileEntity(x, y, z), player);
} else if (ID == chemicalReactorID)
{
return new ContainerChemicalReactor(
(TileChemicalReactor) world.getTileEntity(x, y, z), player);
} else if (ID == pdaID)
{
return null;
} else if (ID == destructoPackID) {
return new ContainerDestructoPack(player);
} else if (ID == lesuID) {
return new ContainerLesu((TileLesu) world.getTileEntity(x, y, z), player); return new ContainerLesu((TileLesu) world.getTileEntity(x, y, z), player);
} else if (ID == idsuID) { } else if (ID == idsuID) {
return new ContainerIDSU((TileIDSU) world.getTileEntity(x, y, z), player); return new ContainerIDSU((TileIDSU) world.getTileEntity(x, y, z), player);
} else if (ID == chargeBench) { } else if (ID == chargeBench) {
return new ContainerChargeBench((TileChargeBench) world.getTileEntity(x, y, z), player); return new ContainerChargeBench((TileChargeBench) world.getTileEntity(x, y, z), player);
} else if (ID == farmID){ } else if (ID == farmID) {
return new ContainerFarm((TileFarm) world.getTileEntity(x,y,z), player); return new ContainerFarm((TileFarm) world.getTileEntity(x, y, z), player);
} }
return null;
}
@Override return null;
public Object getClientGuiElement(int ID, EntityPlayer player, World world, }
int x, int y, int z)
{ @Override
if (ID == thermalGeneratorID) public Object getClientGuiElement(int ID, EntityPlayer player, World world,
{ int x, int y, int z) {
return new GuiThermalGenerator(player, if (ID == thermalGeneratorID) {
(TileThermalGenerator) world.getTileEntity(x, y, z)); return new GuiThermalGenerator(player,
} else if (ID == semifluidGeneratorID) (TileThermalGenerator) world.getTileEntity(x, y, z));
{ } else if (ID == semifluidGeneratorID) {
return new GuiSemifluidGenerator(player, return new GuiSemifluidGenerator(player,
(TileSemifluidGenerator) world.getTileEntity(x, y, z)); (TileSemifluidGenerator) world.getTileEntity(x, y, z));
} else if (ID == gasTurbineID) } else if (ID == gasTurbineID) {
{ return new GuiGasTurbine(player,
return new GuiGasTurbine(player, (TileGasTurbine) world.getTileEntity(x, y, z));
(TileGasTurbine) world.getTileEntity(x, y, z)); } else if (ID == quantumTankID) {
} else if (ID == quantumTankID) return new GuiQuantumTank(player,
{ (TileQuantumTank) world.getTileEntity(x, y, z));
return new GuiQuantumTank(player, } else if (ID == digitalChestID) {
(TileQuantumTank) world.getTileEntity(x, y, z)); return new GuiDigitalChest(player,
} else if (ID == digitalChestID) (TileDigitalChest) world.getTileEntity(x, y, z));
{ } else if (ID == quantumChestID) {
return new GuiDigitalChest(player, return new GuiQuantumChest(player,
(TileDigitalChest) world.getTileEntity(x, y, z)); (TileQuantumChest) world.getTileEntity(x, y, z));
} else if (ID == quantumChestID) } else if (ID == centrifugeID) {
{ return new GuiCentrifuge(player,
return new GuiQuantumChest(player, (TileCentrifuge) world.getTileEntity(x, y, z));
(TileQuantumChest) world.getTileEntity(x, y, z)); } else if (ID == rollingMachineID) {
} else if (ID == centrifugeID) return new GuiRollingMachine(player,
{ (TileRollingMachine) world.getTileEntity(x, y, z));
return new GuiCentrifuge(player, } else if (ID == blastFurnaceID) {
(TileCentrifuge) world.getTileEntity(x, y, z)); return new GuiBlastFurnace(player,
} else if (ID == rollingMachineID) (TileBlastFurnace) world.getTileEntity(x, y, z));
{ } else if (ID == alloySmelterID) {
return new GuiRollingMachine(player, return new GuiAlloySmelter(player,
(TileRollingMachine) world.getTileEntity(x, y, z)); (TileAlloySmelter) world.getTileEntity(x, y, z));
} else if (ID == blastFurnaceID) } else if (ID == grinderID) {
{ return new GuiGrinder(player,
return new GuiBlastFurnace(player, (TileGrinder) world.getTileEntity(x, y, z));
(TileBlastFurnace) world.getTileEntity(x, y, z)); } else if (ID == compresserID) {
} else if (ID == alloySmelterID) return new GuiImplosionCompressor(player,
{ (TileImplosionCompressor) world.getTileEntity(x, y, z));
return new GuiAlloySmelter(player, } else if (ID == matterfabID) {
(TileAlloySmelter) world.getTileEntity(x, y, z)); return new GuiMatterFabricator(player,
} else if (ID == grinderID) (TileMatterFabricator) world.getTileEntity(x, y, z));
{ } else if (ID == chunkloaderID) {
return new GuiGrinder(player, return new GuiChunkLoader(player,
(TileGrinder) world.getTileEntity(x, y, z)); (TileChunkLoader) world.getTileEntity(x, y, z));
} else if (ID == compresserID) } else if (ID == assemblingmachineID) {
{ return new GuiAssemblingMachine(player,
return new GuiImplosionCompressor(player, (TileAssemblingMachine) world.getTileEntity(x, y, z));
(TileImplosionCompressor) world.getTileEntity(x, y, z)); } else if (ID == latheID) {
} else if (ID == matterfabID) return new GuiLathe(player,
{ (TileLathe) world.getTileEntity(x, y, z));
return new GuiMatterFabricator(player, } else if (ID == platecuttingmachineID) {
(TileMatterFabricator) world.getTileEntity(x, y, z)); return new GuiPlateCuttingMachine(player,
} else if (ID == chunkloaderID) (TilePlateCuttingMachine) world.getTileEntity(x, y, z));
{ } else if (ID == dieselGeneratorID) {
return new GuiChunkLoader(player, return new GuiDieselGenerator(player,
(TileChunkLoader) world.getTileEntity(x, y, z)); (TileDieselGenerator) world.getTileEntity(x, y, z));
} else if (ID == assemblingmachineID) } else if (ID == industrialElectrolyzerID) {
{ return new GuiIndustrialElectrolyzer(player,
return new GuiAssemblingMachine(player, (TileIndustrialElectrolyzer) world.getTileEntity(x, y, z));
(TileAssemblingMachine) world.getTileEntity(x, y, z)); } else if (ID == aesuID) {
} else if (ID == latheID) return new GuiAesu(player,
{ (TileAesu) world.getTileEntity(x, y, z));
return new GuiLathe(player, } else if (ID == alloyFurnaceID) {
(TileLathe) world.getTileEntity(x, y, z)); return new GuiAlloyFurnace(player,
} else if (ID == platecuttingmachineID) (TileAlloyFurnace) world.getTileEntity(x, y, z));
{ } else if (ID == sawMillID) {
return new GuiPlateCuttingMachine(player, return new GuiIndustrialSawmill(player,
(TilePlateCuttingMachine) world.getTileEntity(x, y, z)); (TileIndustrialSawmill) world.getTileEntity(x, y, z));
} else if (ID == dieselGeneratorID) } else if (ID == chemicalReactorID) {
{ return new GuiChemicalReactor(player,
return new GuiDieselGenerator(player, (TileChemicalReactor) world.getTileEntity(x, y, z));
(TileDieselGenerator) world.getTileEntity(x, y, z)); } else if (ID == pdaID) {
} else if (ID == industrialElectrolyzerID) return new GuiPda(player, new ContainerPda(player));
{ } else if (ID == destructoPackID) {
return new GuiIndustrialElectrolyzer(player, return new GuiDestructoPack(new ContainerDestructoPack(player));
(TileIndustrialElectrolyzer) world.getTileEntity(x, y, z)); } else if (ID == lesuID) {
} else if (ID == aesuID) return new GuiLesu(player, (TileLesu) world.getTileEntity(x, y, z));
{
return new GuiAesu(player,
(TileAesu) world.getTileEntity(x, y, z));
} else if (ID == alloyFurnaceID)
{
return new GuiAlloyFurnace(player,
(TileAlloyFurnace) world.getTileEntity(x, y, z));
} else if (ID == sawMillID)
{
return new GuiIndustrialSawmill(player,
(TileIndustrialSawmill) world.getTileEntity(x, y, z));
} else if (ID == chemicalReactorID)
{
return new GuiChemicalReactor(player,
(TileChemicalReactor) world.getTileEntity(x, y, z));
} else if (ID == pdaID)
{
return new GuiPda(player, new ContainerPda(player));
} else if (ID == destructoPackID) {
return new GuiDestructoPack(new ContainerDestructoPack(player));
} else if (ID == lesuID) {
return new GuiLesu(player, (TileLesu)world.getTileEntity(x, y, z));
} else if (ID == idsuID) { } else if (ID == idsuID) {
return new GuiIDSU(player, (TileIDSU)world.getTileEntity(x, y, z)); return new GuiIDSU(player, (TileIDSU) world.getTileEntity(x, y, z));
} else if (ID == chargeBench) { } else if (ID == chargeBench) {
return new GuiChargeBench(player, (TileChargeBench)world.getTileEntity(x, y, z)); return new GuiChargeBench(player, (TileChargeBench) world.getTileEntity(x, y, z));
} else if(ID == farmID){ } else if (ID == farmID) {
return new GuiFarm(new ContainerFarm((TileFarm)world.getTileEntity(x, y, z), player)); return new GuiFarm(new ContainerFarm((TileFarm) world.getTileEntity(x, y, z), player));
} }
return null; return null;
} }
} }

View file

@ -7,20 +7,17 @@ import net.minecraft.util.IIcon;
public class GuiUtil { public class GuiUtil {
public static void drawRepeated(IIcon icon, double x, double y, double width, double height, double z) public static void drawRepeated(IIcon icon, double x, double y, double width, double height, double z) {
{
double iconWidthStep = (icon.getMaxU() - icon.getMinU()) / 16.0D; double iconWidthStep = (icon.getMaxU() - icon.getMinU()) / 16.0D;
double iconHeightStep = (icon.getMaxV() - icon.getMinV()) / 16.0D; double iconHeightStep = (icon.getMaxV() - icon.getMinV()) / 16.0D;
Tessellator tessellator = Tessellator.instance; Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads(); tessellator.startDrawingQuads();
for (double cy = y; cy < y + height; cy += 16.0D) for (double cy = y; cy < y + height; cy += 16.0D) {
{
double quadHeight = Math.min(16.0D, height + y - cy); double quadHeight = Math.min(16.0D, height + y - cy);
double maxY = cy + quadHeight; double maxY = cy + quadHeight;
double maxV = icon.getMinV() + iconHeightStep * quadHeight; double maxV = icon.getMinV() + iconHeightStep * quadHeight;
for (double cx = x; cx < x + width; cx += 16.0D) for (double cx = x; cx < x + width; cx += 16.0D) {
{
double quadWidth = Math.min(16.0D, width + x - cx); double quadWidth = Math.min(16.0D, width + x - cx);
double maxX = cx + quadWidth; double maxX = cx + quadWidth;
double maxU = icon.getMinU() + iconWidthStep * quadWidth; double maxU = icon.getMinU() + iconWidthStep * quadWidth;
@ -34,31 +31,30 @@ public class GuiUtil {
tessellator.draw(); tessellator.draw();
} }
public static void drawTooltipBox(int x, int y, int w, int h) { public static void drawTooltipBox(int x, int y, int w, int h) {
int bg = 0xf0100010; int bg = 0xf0100010;
drawGradientRect(x + 1, y, w - 1, 1, bg, bg); drawGradientRect(x + 1, y, w - 1, 1, bg, bg);
drawGradientRect(x + 1, y + h, w - 1, 1, bg, bg); drawGradientRect(x + 1, y + h, w - 1, 1, bg, bg);
drawGradientRect(x + 1, y + 1, w - 1, h - 1, bg, bg);//center drawGradientRect(x + 1, y + 1, w - 1, h - 1, bg, bg);//center
drawGradientRect(x, y + 1, 1, h - 1, bg, bg); drawGradientRect(x, y + 1, 1, h - 1, bg, bg);
drawGradientRect(x + w, y + 1, 1, h - 1, bg, bg); drawGradientRect(x + w, y + 1, 1, h - 1, bg, bg);
int grad1 = 0x505000ff; int grad1 = 0x505000ff;
int grad2 = 0x5028007F; int grad2 = 0x5028007F;
drawGradientRect(x + 1, y + 2, 1, h - 3, grad1, grad2); drawGradientRect(x + 1, y + 2, 1, h - 3, grad1, grad2);
drawGradientRect(x + w - 1, y + 2, 1, h - 3, grad1, grad2); drawGradientRect(x + w - 1, y + 2, 1, h - 3, grad1, grad2);
drawGradientRect(x + 1, y + 1, w - 1, 1, grad1, grad1); drawGradientRect(x + 1, y + 1, w - 1, 1, grad1, grad1);
drawGradientRect(x + 1, y + h - 1, w - 1, 1, grad2, grad2); drawGradientRect(x + 1, y + h - 1, w - 1, 1, grad2, grad2);
} }
public static void drawGradientRect(int x, int y, int w, int h, int colour1, int colour2) { public static void drawGradientRect(int x, int y, int w, int h, int colour1, int colour2) {
new GuiHook().drawGradientRect(x, y, x + w, y + h, colour1, colour2); new GuiHook().drawGradientRect(x, y, x + w, y + h, colour1, colour2);
} }
public static class GuiHook extends Gui public static class GuiHook extends Gui {
{ @Override
@Override public void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) {
public void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) { super.drawGradientRect(par1, par2, par3, par4, par5, par6);
super.drawGradientRect(par1, par2, par3, par4, par5, par6); }
} }
}
} }

View file

@ -35,10 +35,10 @@ public class IconSupplier {
doubleInsulatedIronCable = reg.registerIcon("ic2" + ":wiring/cable/blockIronCableII"); doubleInsulatedIronCable = reg.registerIcon("ic2" + ":wiring/cable/blockIronCableII");
trippleInsulatedIronCable = reg.registerIcon("ic2" + ":wiring/cable/blockIronCableIII"); trippleInsulatedIronCable = reg.registerIcon("ic2" + ":wiring/cable/blockIronCableIII");
glassFiberCable = reg.registerIcon("ic2" + ":wiring/cable/blockGlassCable"); glassFiberCable = reg.registerIcon("ic2" + ":wiring/cable/blockGlassCable");
tinCable= reg.registerIcon("ic2" + ":wiring/cable/blockTinCable"); tinCable = reg.registerIcon("ic2" + ":wiring/cable/blockTinCable");
detectorCableBlock= reg.registerIcon("ic2" + ":wiring/cable/blockDetectorCable"); detectorCableBlock = reg.registerIcon("ic2" + ":wiring/cable/blockDetectorCable");
splitterCableBlock= reg.registerIcon("ic2" + ":wiring/cable/blockSplitterCable"); splitterCableBlock = reg.registerIcon("ic2" + ":wiring/cable/blockSplitterCable");
insulatedtinCableBlock= reg.registerIcon("ic2" + ":wiring/cable/blockTinCableI"); insulatedtinCableBlock = reg.registerIcon("ic2" + ":wiring/cable/blockTinCableI");
} }
} }
} }

View file

@ -6,36 +6,31 @@ import net.minecraft.item.ItemStack;
public class SlotFake extends Slot { public class SlotFake extends Slot {
public boolean mCanInsertItem; public boolean mCanInsertItem;
public boolean mCanStackItem; public boolean mCanStackItem;
public int mMaxStacksize = 127; public int mMaxStacksize = 127;
public SlotFake(IInventory par1iInventory, int par2, int par3, int par4, public SlotFake(IInventory par1iInventory, int par2, int par3, int par4,
boolean aCanInsertItem, boolean aCanStackItem, int aMaxStacksize) boolean aCanInsertItem, boolean aCanStackItem, int aMaxStacksize) {
{ super(par1iInventory, par2, par3, par4);
super(par1iInventory, par2, par3, par4); this.mCanInsertItem = aCanInsertItem;
this.mCanInsertItem = aCanInsertItem; this.mCanStackItem = aCanStackItem;
this.mCanStackItem = aCanStackItem; this.mMaxStacksize = aMaxStacksize;
this.mMaxStacksize = aMaxStacksize; }
}
public boolean isItemValid(ItemStack par1ItemStack) public boolean isItemValid(ItemStack par1ItemStack) {
{ return this.mCanInsertItem;
return this.mCanInsertItem; }
}
public int getSlotStackLimit() public int getSlotStackLimit() {
{ return this.mMaxStacksize;
return this.mMaxStacksize; }
}
public boolean getHasStack() public boolean getHasStack() {
{ return false;
return false; }
}
public ItemStack decrStackSize(int par1) public ItemStack decrStackSize(int par1) {
{ return !this.mCanStackItem ? null : super.decrStackSize(par1);
return !this.mCanStackItem ? null : super.decrStackSize(par1); }
}
} }

View file

@ -9,29 +9,29 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class SlotFilteredVoid extends Slot { public class SlotFilteredVoid extends Slot {
private List<ItemStack> filter = new ArrayList<ItemStack>();
public SlotFilteredVoid(IInventory par1iInventory, int id, int x, int y)
{
super(par1iInventory, id, x, y);
}
public SlotFilteredVoid(IInventory par1iInventory, int id, int x, int y, ItemStack[] filterList) private List<ItemStack> filter = new ArrayList<ItemStack>();
{
super(par1iInventory, id, x, y); public SlotFilteredVoid(IInventory par1iInventory, int id, int x, int y) {
for (ItemStack itemStack : filterList) super(par1iInventory, id, x, y);
this.filter.add(itemStack); }
}
public SlotFilteredVoid(IInventory par1iInventory, int id, int x, int y, ItemStack[] filterList) {
@Override super(par1iInventory, id, x, y);
public boolean isItemValid(ItemStack stack) { for (ItemStack itemStack : filterList)
for (ItemStack itemStack : filter) this.filter.add(itemStack);
if (itemStack.getItem().equals(stack.getItem()) && itemStack.getItemDamage() == stack.getItemDamage()) }
return false;
@Override
return super.isItemValid(stack); public boolean isItemValid(ItemStack stack) {
} for (ItemStack itemStack : filter)
if (itemStack.getItem().equals(stack.getItem()) && itemStack.getItemDamage() == stack.getItemDamage())
@Override return false;
public void putStack(ItemStack arg0) { }
return super.isItemValid(stack);
}
@Override
public void putStack(ItemStack arg0) {
}
} }

View file

@ -6,18 +6,15 @@ import net.minecraft.item.ItemStack;
public class SlotInput extends Slot { public class SlotInput extends Slot {
public SlotInput(IInventory par1iInventory, int par2, int par3, int par4) public SlotInput(IInventory par1iInventory, int par2, int par3, int par4) {
{ super(par1iInventory, par2, par3, par4);
super(par1iInventory, par2, par3, par4); }
}
public boolean isItemValid(ItemStack par1ItemStack) public boolean isItemValid(ItemStack par1ItemStack) {
{ return false;
return false; }
}
public int getSlotStackLimit() public int getSlotStackLimit() {
{ return 64;
return 64; }
}
} }

View file

@ -6,18 +6,15 @@ import net.minecraft.item.ItemStack;
public class SlotOutput extends Slot { public class SlotOutput extends Slot {
public SlotOutput(IInventory par1iInventory, int par2, int par3, int par4) public SlotOutput(IInventory par1iInventory, int par2, int par3, int par4) {
{ super(par1iInventory, par2, par3, par4);
super(par1iInventory, par2, par3, par4); }
}
public boolean isItemValid(ItemStack par1ItemStack) public boolean isItemValid(ItemStack par1ItemStack) {
{ return false;
return false; }
}
public int getSlotStackLimit() public int getSlotStackLimit() {
{ return 64;
return 64; }
}
} }

View file

@ -6,16 +6,14 @@ import techreborn.init.ModBlocks;
public class TechRebornCreativeTab extends CreativeTabs { public class TechRebornCreativeTab extends CreativeTabs {
public static TechRebornCreativeTab instance = new TechRebornCreativeTab(); public static TechRebornCreativeTab instance = new TechRebornCreativeTab();
public TechRebornCreativeTab() public TechRebornCreativeTab() {
{ super("techreborn");
super("techreborn"); }
}
@Override @Override
public Item getTabIconItem() public Item getTabIconItem() {
{ return Item.getItemFromBlock(ModBlocks.thermalGenerator);
return Item.getItemFromBlock(ModBlocks.thermalGenerator); }
}
} }

View file

@ -6,17 +6,15 @@ import techreborn.init.ModItems;
public class TechRebornCreativeTabMisc extends CreativeTabs { public class TechRebornCreativeTabMisc extends CreativeTabs {
public static TechRebornCreativeTabMisc instance = new TechRebornCreativeTabMisc(); public static TechRebornCreativeTabMisc instance = new TechRebornCreativeTabMisc();
public TechRebornCreativeTabMisc() public TechRebornCreativeTabMisc() {
{ super("techreborn");
super("techreborn"); }
}
@Override @Override
public Item getTabIconItem() public Item getTabIconItem() {
{ return ModItems.cells;
return ModItems.cells; }
}
} }

View file

@ -4,44 +4,43 @@ import cpw.mods.fml.client.GuiModList;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.GuiScreenEvent;
import org.lwjgl.opengl.GL11;
import techreborn.Core; import techreborn.Core;
import java.awt.*; import java.awt.*;
import java.util.ArrayList; import java.util.ArrayList;
public class VersionCheckerClient { public class VersionCheckerClient {
ResourceLocation texture; ResourceLocation texture;
public VersionCheckerClient() { public VersionCheckerClient() {
texture = new ResourceLocation("textures/gui/demo_background.png"); texture = new ResourceLocation("textures/gui/demo_background.png");
} }
@SubscribeEvent @SubscribeEvent
public void drawGui(GuiScreenEvent.DrawScreenEvent event){ public void drawGui(GuiScreenEvent.DrawScreenEvent event) {
if(event.gui instanceof GuiModList){ if (event.gui instanceof GuiModList) {
ArrayList<String> changeLog = Core.INSTANCE.versionChecker.getChangeLogSinceCurrentVersion(); ArrayList<String> changeLog = Core.INSTANCE.versionChecker.getChangeLogSinceCurrentVersion();
String s = ""; String s = "";
if(Core.INSTANCE.versionChecker.isChecking){ if (Core.INSTANCE.versionChecker.isChecking) {
s = "Checking for update..."; s = "Checking for update...";
} else if(Core.INSTANCE.versionChecker.isLatestVersion()){ } else if (Core.INSTANCE.versionChecker.isLatestVersion()) {
s = "You have the latest version of TechReborn"; s = "You have the latest version of TechReborn";
} else{ } else {
s = "There is an update for TechReborn with " + changeLog.size() + " changes."; s = "There is an update for TechReborn with " + changeLog.size() + " changes.";
} }
event.gui.drawString(event.gui.mc.fontRenderer, s, 10, 5, Color.white.getRGB()); event.gui.drawString(event.gui.mc.fontRenderer, s, 10, 5, Color.white.getRGB());
if(!Core.INSTANCE.versionChecker.isLatestVersion()){ if (!Core.INSTANCE.versionChecker.isLatestVersion()) {
if(event.mouseY < 20){ if (event.mouseY < 20) {
GuiUtil.drawTooltipBox(5, 15, 330, changeLog.size() * 10 + 5); GuiUtil.drawTooltipBox(5, 15, 330, changeLog.size() * 10 + 5);
int y = 20; int y = 20;
for(String change : changeLog){ for (String change : changeLog) {
event.gui.drawString(event.gui.mc.fontRenderer, change, 10, y, Color.white.getRGB()); event.gui.drawString(event.gui.mc.fontRenderer, change, 10, y, Color.white.getRGB());
y+= 10; y += 10;
} }
} }
} }
} }
} }
} }

View file

@ -9,83 +9,78 @@ import techreborn.tiles.TileAesu;
public class ContainerAesu extends TechRebornContainer { public class ContainerAesu extends TechRebornContainer {
EntityPlayer player; EntityPlayer player;
TileAesu tile; TileAesu tile;
@Override @Override
public boolean canInteractWith(EntityPlayer player) public boolean canInteractWith(EntityPlayer player) {
{ return true;
return true; }
}
public int euOut; public int euOut;
public int storedEu; public int storedEu;
public int euChange; public int euChange;
public ContainerAesu(TileAesu tileaesu, public ContainerAesu(TileAesu tileaesu,
EntityPlayer player) EntityPlayer player) {
{ tile = tileaesu;
tile = tileaesu; this.player = player;
this.player = player;
// input // input
this.addSlotToContainer(new Slot(tileaesu.inventory, 0, 116, 23)); this.addSlotToContainer(new Slot(tileaesu.inventory, 0, 116, 23));
this.addSlotToContainer(new Slot(tileaesu.inventory, 1, 116, 59)); this.addSlotToContainer(new Slot(tileaesu.inventory, 1, 116, 59));
int i; int i;
for (i = 0; i < 3; ++i) for (i = 0; i < 3; ++i) {
{ for (int j = 0; j < 9; ++j) {
for (int j = 0; j < 9; ++j) this.addSlotToContainer(new Slot(player.inventory, j + i * 9
{ + 9, 7 + j * 16, 84 + i * 18 + 30));
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 }
+ 9, 7 + j * 16, 84 + i * 18 + 30)); }
}
}
for (i = 0; i < 9; ++i) for (i = 0; i < 9; ++i) {
{ this.addSlotToContainer(new Slot(player.inventory, i, 7 + i * 16,
this.addSlotToContainer(new Slot(player.inventory, i, 7 + i * 16, 142 + 30));
142 + 30)); }
} }
}
@Override @Override
public void detectAndSendChanges() { public void detectAndSendChanges() {
super.detectAndSendChanges(); super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); i++) { for (int i = 0; i < this.crafters.size(); i++) {
ICrafting icrafting = (ICrafting)this.crafters.get(i); ICrafting icrafting = (ICrafting) this.crafters.get(i);
if(this.euOut != tile.getMaxOutput()){ if (this.euOut != tile.getMaxOutput()) {
icrafting.sendProgressBarUpdate(this, 0, (int) tile.getMaxOutput()); icrafting.sendProgressBarUpdate(this, 0, (int) tile.getMaxOutput());
} }
if(this.storedEu != tile.getEnergy()){ if (this.storedEu != tile.getEnergy()) {
icrafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy()); icrafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy());
} }
if(this.euChange != tile.getEuChange() && tile.getEuChange() != -1){ if (this.euChange != tile.getEuChange() && tile.getEuChange() != -1) {
icrafting.sendProgressBarUpdate(this, 2, (int) tile.getEuChange()); icrafting.sendProgressBarUpdate(this, 2, (int) tile.getEuChange());
} }
} }
} }
@Override @Override
public void addCraftingToCrafters(ICrafting crafting) { public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting); super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 0, (int) tile.getMaxOutput()); crafting.sendProgressBarUpdate(this, 0, (int) tile.getMaxOutput());
crafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy()); crafting.sendProgressBarUpdate(this, 1, (int) tile.getEnergy());
crafting.sendProgressBarUpdate(this, 2 , (int) tile.getEuChange()); crafting.sendProgressBarUpdate(this, 2, (int) tile.getEuChange());
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public void updateProgressBar(int id, int value) { public void updateProgressBar(int id, int value) {
if(id == 0){ if (id == 0) {
this.euOut = value; this.euOut = value;
} else if(id == 1){ } else if (id == 1) {
this.storedEu = value; this.storedEu = value;
} else if(id == 2){ } else if (id == 2) {
this.euChange = value; this.euChange = value;
} }
} }
} }

View file

@ -7,48 +7,43 @@ import techreborn.tiles.TileAlloyFurnace;
public class ContainerAlloyFurnace extends TechRebornContainer { public class ContainerAlloyFurnace extends TechRebornContainer {
EntityPlayer player; EntityPlayer player;
TileAlloyFurnace tile; TileAlloyFurnace tile;
@Override @Override
public boolean canInteractWith(EntityPlayer player) public boolean canInteractWith(EntityPlayer player) {
{ return true;
return true; }
}
public int tickTime; public int tickTime;
public ContainerAlloyFurnace(TileAlloyFurnace tileAlloyfurnace, public ContainerAlloyFurnace(TileAlloyFurnace tileAlloyfurnace,
EntityPlayer player) EntityPlayer player) {
{ tile = tileAlloyfurnace;
tile = tileAlloyfurnace; this.player = player;
this.player = player;
// input // input
this.addSlotToContainer(new Slot(tileAlloyfurnace.inventory, 0, 47, 17)); this.addSlotToContainer(new Slot(tileAlloyfurnace.inventory, 0, 47, 17));
this.addSlotToContainer(new Slot(tileAlloyfurnace.inventory, 1, 65, 17)); this.addSlotToContainer(new Slot(tileAlloyfurnace.inventory, 1, 65, 17));
// outputs // outputs
this.addSlotToContainer(new SlotOutput(tileAlloyfurnace.inventory, 2, 116, 35)); this.addSlotToContainer(new SlotOutput(tileAlloyfurnace.inventory, 2, 116, 35));
// Fuel // Fuel
this.addSlotToContainer(new Slot(tileAlloyfurnace.inventory, 3, 56, 53)); this.addSlotToContainer(new Slot(tileAlloyfurnace.inventory, 3, 56, 53));
int i; int i;
for (i = 0; i < 3; ++i) for (i = 0; i < 3; ++i) {
{ for (int j = 0; j < 9; ++j) {
for (int j = 0; j < 9; ++j) this.addSlotToContainer(new Slot(player.inventory, j + i * 9
{ + 9, 8 + j * 18, 84 + i * 18));
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 }
+ 9, 8 + j * 18, 84 + i * 18)); }
}
}
for (i = 0; i < 9; ++i) for (i = 0; i < 9; ++i) {
{ this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
142)); }
} }
}
} }

View file

@ -7,55 +7,50 @@ import techreborn.tiles.TileAlloySmelter;
public class ContainerAlloySmelter extends ContainerCrafting { public class ContainerAlloySmelter extends ContainerCrafting {
EntityPlayer player; EntityPlayer player;
TileAlloySmelter tile; TileAlloySmelter tile;
@Override @Override
public boolean canInteractWith(EntityPlayer player) public boolean canInteractWith(EntityPlayer player) {
{ return true;
return true; }
}
public int tickTime; public int tickTime;
public ContainerAlloySmelter(TileAlloySmelter tileAlloysmelter, public ContainerAlloySmelter(TileAlloySmelter tileAlloysmelter,
EntityPlayer player) EntityPlayer player) {
{
super(tileAlloysmelter.crafter); super(tileAlloysmelter.crafter);
tile = tileAlloysmelter; tile = tileAlloysmelter;
this.player = player; this.player = player;
// input // input
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 0, 47, 17)); this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 0, 47, 17));
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 1, 65, 17)); this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 1, 65, 17));
// outputs // outputs
this.addSlotToContainer(new SlotOutput(tileAlloysmelter.inventory, 2, 116, 35)); this.addSlotToContainer(new SlotOutput(tileAlloysmelter.inventory, 2, 116, 35));
// battery // battery
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 3, 56, 53)); this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 3, 56, 53));
// upgrades // upgrades
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 4, 152, 8)); this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 4, 152, 8));
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 5, 152, 26)); this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 5, 152, 26));
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 6, 152, 44)); this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 6, 152, 44));
this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 7, 152, 62)); this.addSlotToContainer(new Slot(tileAlloysmelter.inventory, 7, 152, 62));
int i; int i;
for (i = 0; i < 3; ++i) for (i = 0; i < 3; ++i) {
{ for (int j = 0; j < 9; ++j) {
for (int j = 0; j < 9; ++j) this.addSlotToContainer(new Slot(player.inventory, j + i * 9
{ + 9, 8 + j * 18, 84 + i * 18));
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 }
+ 9, 8 + j * 18, 84 + i * 18)); }
}
}
for (i = 0; i < 9; ++i) for (i = 0; i < 9; ++i) {
{ this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
142)); }
} }
}
} }

Some files were not shown because too many files have changed in this diff Show more