Format
This commit is contained in:
parent
6e0ec1d861
commit
4ac26ac086
137 changed files with 10339 additions and 7322 deletions
|
@ -1,15 +1,7 @@
|
|||
package techreborn;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import erogenousbeef.coreTR.multiblock.MultiblockEventHandler;
|
||||
import erogenousbeef.coreTR.multiblock.MultiblockServerTickHandler;
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import techreborn.achievement.TRAchievements;
|
||||
import techreborn.client.GuiHandler;
|
||||
|
@ -25,59 +17,73 @@ import techreborn.packets.PacketHandler;
|
|||
import techreborn.proxies.CommonProxy;
|
||||
import techreborn.util.LogHelper;
|
||||
import techreborn.world.TROreGen;
|
||||
|
||||
import java.io.File;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import erogenousbeef.coreTR.multiblock.MultiblockEventHandler;
|
||||
import erogenousbeef.coreTR.multiblock.MultiblockServerTickHandler;
|
||||
|
||||
@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 static ConfigTechReborn config;
|
||||
|
||||
public static ConfigTechReborn config;
|
||||
|
||||
@SidedProxy(clientSide = ModInfo.CLIENT_PROXY_CLASS, serverSide = ModInfo.SERVER_PROXY_CLASS)
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@Mod.Instance
|
||||
public static Core INSTANCE;
|
||||
@Mod.Instance
|
||||
public static Core INSTANCE;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preinit(FMLPreInitializationEvent event) {
|
||||
INSTANCE = this;
|
||||
String path = event.getSuggestedConfigurationFile().getAbsolutePath()
|
||||
.replace(ModInfo.MOD_ID, "TechReborn");
|
||||
@Mod.EventHandler
|
||||
public void preinit(FMLPreInitializationEvent event)
|
||||
{
|
||||
INSTANCE = this;
|
||||
String path = event.getSuggestedConfigurationFile().getAbsolutePath()
|
||||
.replace(ModInfo.MOD_ID, "TechReborn");
|
||||
|
||||
config = ConfigTechReborn.initialize(new File(path));
|
||||
LogHelper.info("PreInitialization Compleate");
|
||||
}
|
||||
config = ConfigTechReborn.initialize(new File(path));
|
||||
LogHelper.info("PreInitialization Compleate");
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
//Register ModBlocks
|
||||
ModBlocks.init();
|
||||
//Register ModItems
|
||||
ModItems.init();
|
||||
//Register Multiparts
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
// Register ModBlocks
|
||||
ModBlocks.init();
|
||||
// Register ModItems
|
||||
ModItems.init();
|
||||
// Register Multiparts
|
||||
ModParts.init();
|
||||
// Recipes
|
||||
ModRecipes.init();
|
||||
//Compat
|
||||
CompatManager.init(event);
|
||||
// WorldGen
|
||||
GameRegistry.registerWorldGenerator(new TROreGen(), 0);
|
||||
//Register Gui Handler
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, new GuiHandler());
|
||||
//packets
|
||||
PacketHandler.setChannels(NetworkRegistry.INSTANCE.newChannel(ModInfo.MOD_ID + "_packets", new PacketHandler()));
|
||||
//Achievements
|
||||
TRAchievements.init();
|
||||
//Multiblock events
|
||||
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
|
||||
FMLCommonHandler.instance().bus().register(new MultiblockServerTickHandler());
|
||||
LogHelper.info("Initialization Compleate");
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postinit(FMLPostInitializationEvent event)
|
||||
{
|
||||
RecipeManager.init();
|
||||
}
|
||||
// Recipes
|
||||
ModRecipes.init();
|
||||
// Compat
|
||||
CompatManager.init(event);
|
||||
// WorldGen
|
||||
GameRegistry.registerWorldGenerator(new TROreGen(), 0);
|
||||
// Register Gui Handler
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, new GuiHandler());
|
||||
// packets
|
||||
PacketHandler.setChannels(NetworkRegistry.INSTANCE.newChannel(
|
||||
ModInfo.MOD_ID + "_packets", new PacketHandler()));
|
||||
// Achievements
|
||||
TRAchievements.init();
|
||||
// Multiblock events
|
||||
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
|
||||
FMLCommonHandler.instance().bus()
|
||||
.register(new MultiblockServerTickHandler());
|
||||
|
||||
LogHelper.info("Initialization Compleate");
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postinit(FMLPostInitializationEvent event)
|
||||
{
|
||||
// Has to be done here as buildcraft registers there recipes late
|
||||
RecipeManager.init();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,23 +8,27 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
|
||||
public class AchievementMod extends Achievement{
|
||||
|
||||
public class AchievementMod extends Achievement {
|
||||
|
||||
public static List<Achievement> achievements = new ArrayList();
|
||||
|
||||
public AchievementMod(String name, int x, int y, ItemStack icon, Achievement parent)
|
||||
public AchievementMod(String name, int x, int y, ItemStack icon,
|
||||
Achievement parent)
|
||||
{
|
||||
super("achievement.techreborn:" + name, "TechReborn:" + name, x, y, icon, parent);
|
||||
super("achievement.techreborn:" + name, "TechReborn:" + name, x, y,
|
||||
icon, parent);
|
||||
achievements.add(this);
|
||||
registerStat();
|
||||
}
|
||||
|
||||
public AchievementMod(String name, int x, int y, Item icon, Achievement parent)
|
||||
public AchievementMod(String name, int x, int y, Item icon,
|
||||
Achievement parent)
|
||||
{
|
||||
this(name, x, y, new ItemStack(icon), parent);
|
||||
}
|
||||
|
||||
public AchievementMod(String name, int x, int y, Block icon, Achievement parent)
|
||||
public AchievementMod(String name, int x, int y, Block icon,
|
||||
Achievement parent)
|
||||
{
|
||||
this(name, x, y, new ItemStack(icon), parent);
|
||||
}
|
||||
|
|
|
@ -7,22 +7,30 @@ import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
|
|||
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemPickupEvent;
|
||||
|
||||
public class AchievementTriggerer {
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onItemPickedUp(ItemPickupEvent event) {
|
||||
public void onItemPickedUp(ItemPickupEvent event)
|
||||
{
|
||||
ItemStack stack = event.pickedUp.getEntityItem();
|
||||
if(stack != null && stack.getItem() instanceof IPickupAchievement) {
|
||||
Achievement achievement = ((IPickupAchievement) stack.getItem()).getAchievementOnPickup(stack, event.player, event.pickedUp);
|
||||
if(achievement != null)
|
||||
if (stack != null && stack.getItem() instanceof IPickupAchievement)
|
||||
{
|
||||
Achievement achievement = ((IPickupAchievement) stack.getItem())
|
||||
.getAchievementOnPickup(stack, event.player, event.pickedUp);
|
||||
if (achievement != null)
|
||||
event.player.addStat(achievement, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onItemCrafted(ItemCraftedEvent event) {
|
||||
if(event.crafting != null && event.crafting.getItem() instanceof ICraftAchievement) {
|
||||
Achievement achievement = ((ICraftAchievement) event.crafting.getItem()).getAchievementOnCraft(event.crafting, event.player, event.craftMatrix);
|
||||
if(achievement != null)
|
||||
public void onItemCrafted(ItemCraftedEvent event)
|
||||
{
|
||||
if (event.crafting != null
|
||||
&& event.crafting.getItem() instanceof ICraftAchievement)
|
||||
{
|
||||
Achievement achievement = ((ICraftAchievement) event.crafting
|
||||
.getItem()).getAchievementOnCraft(event.crafting,
|
||||
event.player, event.craftMatrix);
|
||||
if (achievement != null)
|
||||
event.player.addStat(achievement, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.stats.Achievement;
|
||||
|
||||
public interface ICraftAchievement {
|
||||
|
||||
public Achievement getAchievementOnCraft(ItemStack stack, EntityPlayer player, IInventory matrix);
|
||||
|
||||
public Achievement getAchievementOnCraft(ItemStack stack,
|
||||
EntityPlayer player, IInventory matrix);
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.stats.Achievement;
|
||||
|
||||
public interface IPickupAchievement {
|
||||
|
||||
public Achievement getAchievementOnPickup(ItemStack stack, EntityPlayer player, EntityItem item);
|
||||
|
||||
public Achievement getAchievementOnPickup(ItemStack stack,
|
||||
EntityPlayer player, EntityItem item);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,33 +1,39 @@
|
|||
package techreborn.achievement;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.lib.ModInfo;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraftforge.common.AchievementPage;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.lib.ModInfo;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
public class TRAchievements {
|
||||
|
||||
|
||||
public static AchievementPage techrebornPage;
|
||||
public static int pageIndex;
|
||||
|
||||
|
||||
public static Achievement ore_PickUp;
|
||||
public static Achievement thermalgen_Craft;
|
||||
public static Achievement centrifuge_Craft;
|
||||
|
||||
|
||||
public static void init()
|
||||
{
|
||||
ore_PickUp = new AchievementMod("ore_PickUp", 0, 0, new ItemStack(ModBlocks.ore, 1, 0), null);
|
||||
centrifuge_Craft = new AchievementMod("centrifuge_Craft", 1, 1, ModBlocks.centrifuge, ore_PickUp);
|
||||
thermalgen_Craft = new AchievementMod("thermalgen_Craft", 2, 1, ModBlocks.thermalGenerator, ore_PickUp);
|
||||
ore_PickUp = new AchievementMod("ore_PickUp", 0, 0, new ItemStack(
|
||||
ModBlocks.ore, 1, 0), null);
|
||||
centrifuge_Craft = new AchievementMod("centrifuge_Craft", 1, 1,
|
||||
ModBlocks.centrifuge, ore_PickUp);
|
||||
thermalgen_Craft = new AchievementMod("thermalgen_Craft", 2, 1,
|
||||
ModBlocks.thermalGenerator, ore_PickUp);
|
||||
|
||||
pageIndex = AchievementPage.getAchievementPages().size();
|
||||
techrebornPage = new AchievementPage(ModInfo.MOD_NAME, AchievementMod.achievements.toArray(new Achievement[AchievementMod.achievements.size()]));
|
||||
techrebornPage = new AchievementPage(ModInfo.MOD_NAME,
|
||||
AchievementMod.achievements
|
||||
.toArray(new Achievement[AchievementMod.achievements
|
||||
.size()]));
|
||||
AchievementPage.registerAchievementPage(techrebornPage);
|
||||
|
||||
FMLCommonHandler.instance().bus().register(new AchievementTriggerer());
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,72 +4,83 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CentrifugeRecipie {
|
||||
ItemStack inputItem;
|
||||
ItemStack output1, output2, output3, output4;
|
||||
int tickTime;
|
||||
int cells;
|
||||
ItemStack inputItem;
|
||||
ItemStack output1, output2, output3, output4;
|
||||
int tickTime;
|
||||
int cells;
|
||||
|
||||
public CentrifugeRecipie(ItemStack inputItem, ItemStack output1, ItemStack output2, ItemStack output3, ItemStack output4, int tickTime, int cells) {
|
||||
this.inputItem = inputItem;
|
||||
this.output1 = output1;
|
||||
this.output2 = output2;
|
||||
this.output3 = output3;
|
||||
this.output4 = output4;
|
||||
this.tickTime = tickTime;
|
||||
this.cells = cells;
|
||||
}
|
||||
public CentrifugeRecipie(ItemStack inputItem, ItemStack output1,
|
||||
ItemStack output2, ItemStack output3, ItemStack output4,
|
||||
int tickTime, int cells)
|
||||
{
|
||||
this.inputItem = inputItem;
|
||||
this.output1 = output1;
|
||||
this.output2 = output2;
|
||||
this.output3 = output3;
|
||||
this.output4 = output4;
|
||||
this.tickTime = tickTime;
|
||||
this.cells = cells;
|
||||
}
|
||||
|
||||
public CentrifugeRecipie(Item inputItem, int inputAmount, Item output1, Item output2, Item output3, Item output4, int tickTime, int cells) {
|
||||
this.inputItem = new ItemStack(inputItem, inputAmount);
|
||||
if (output1 != null)
|
||||
this.output1 = new ItemStack(output1);
|
||||
if (output2 != null)
|
||||
this.output2 = new ItemStack(output2);
|
||||
if (output3 != null)
|
||||
this.output3 = new ItemStack(output3);
|
||||
if (output4 != null)
|
||||
this.output4 = new ItemStack(output4);
|
||||
this.tickTime = tickTime;
|
||||
this.cells = cells;
|
||||
}
|
||||
public CentrifugeRecipie(Item inputItem, int inputAmount, Item output1,
|
||||
Item output2, Item output3, Item output4, int tickTime, int cells)
|
||||
{
|
||||
this.inputItem = new ItemStack(inputItem, inputAmount);
|
||||
if (output1 != null)
|
||||
this.output1 = new ItemStack(output1);
|
||||
if (output2 != null)
|
||||
this.output2 = new ItemStack(output2);
|
||||
if (output3 != null)
|
||||
this.output3 = new ItemStack(output3);
|
||||
if (output4 != null)
|
||||
this.output4 = new ItemStack(output4);
|
||||
this.tickTime = tickTime;
|
||||
this.cells = cells;
|
||||
}
|
||||
|
||||
public CentrifugeRecipie(CentrifugeRecipie centrifugeRecipie) {
|
||||
this.inputItem = centrifugeRecipie.getInputItem();
|
||||
this.output1 = centrifugeRecipie.getOutput1();
|
||||
this.output2 = centrifugeRecipie.getOutput2();
|
||||
this.output3 = centrifugeRecipie.getOutput3();
|
||||
this.output4 = centrifugeRecipie.getOutput4();
|
||||
this.tickTime = centrifugeRecipie.getTickTime();
|
||||
this.cells = centrifugeRecipie.getCells();
|
||||
}
|
||||
public CentrifugeRecipie(CentrifugeRecipie centrifugeRecipie)
|
||||
{
|
||||
this.inputItem = centrifugeRecipie.getInputItem();
|
||||
this.output1 = centrifugeRecipie.getOutput1();
|
||||
this.output2 = centrifugeRecipie.getOutput2();
|
||||
this.output3 = centrifugeRecipie.getOutput3();
|
||||
this.output4 = centrifugeRecipie.getOutput4();
|
||||
this.tickTime = centrifugeRecipie.getTickTime();
|
||||
this.cells = centrifugeRecipie.getCells();
|
||||
}
|
||||
|
||||
public ItemStack getInputItem() {
|
||||
return inputItem;
|
||||
}
|
||||
public ItemStack getInputItem()
|
||||
{
|
||||
return inputItem;
|
||||
}
|
||||
|
||||
public ItemStack getOutput1() {
|
||||
return output1;
|
||||
}
|
||||
public ItemStack getOutput1()
|
||||
{
|
||||
return output1;
|
||||
}
|
||||
|
||||
public ItemStack getOutput2() {
|
||||
return output2;
|
||||
}
|
||||
public ItemStack getOutput2()
|
||||
{
|
||||
return output2;
|
||||
}
|
||||
|
||||
public ItemStack getOutput3() {
|
||||
return output3;
|
||||
}
|
||||
public ItemStack getOutput3()
|
||||
{
|
||||
return output3;
|
||||
}
|
||||
|
||||
public ItemStack getOutput4() {
|
||||
return output4;
|
||||
}
|
||||
public ItemStack getOutput4()
|
||||
{
|
||||
return output4;
|
||||
}
|
||||
|
||||
public int getTickTime() {
|
||||
return tickTime;
|
||||
}
|
||||
public int getTickTime()
|
||||
{
|
||||
return tickTime;
|
||||
}
|
||||
|
||||
public int getCells() {
|
||||
return cells;
|
||||
}
|
||||
public int getCells()
|
||||
{
|
||||
return cells;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package techreborn.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -9,104 +13,118 @@ import net.minecraft.item.crafting.ShapedRecipes;
|
|||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
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) {
|
||||
String s = "";
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
if(components[i] instanceof String[]) {
|
||||
String as[] = (String[])components[i++];
|
||||
for(int l = 0; l < as.length; l++) {
|
||||
String s2 = as[l];
|
||||
k++;
|
||||
j = s2.length();
|
||||
s = (new StringBuilder()).append(s).append(s2).toString();
|
||||
}
|
||||
} else {
|
||||
while(components[i] instanceof String) {
|
||||
String s1 = (String)components[i++];
|
||||
k++;
|
||||
j = s1.length();
|
||||
s = (new StringBuilder()).append(s).append(s1).toString();
|
||||
}
|
||||
}
|
||||
HashMap hashmap = new HashMap();
|
||||
for(; i < components.length; i += 2) {
|
||||
Character character = (Character)components[i];
|
||||
ItemStack itemstack1 = null;
|
||||
if(components[i + 1] instanceof Item) {
|
||||
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);
|
||||
}
|
||||
public void addRecipe(ItemStack output, Object... components)
|
||||
{
|
||||
String s = "";
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
if (components[i] instanceof String[])
|
||||
{
|
||||
String as[] = (String[]) components[i++];
|
||||
for (int l = 0; l < as.length; l++)
|
||||
{
|
||||
String s2 = as[l];
|
||||
k++;
|
||||
j = s2.length();
|
||||
s = (new StringBuilder()).append(s).append(s2).toString();
|
||||
}
|
||||
} else
|
||||
{
|
||||
while (components[i] instanceof String)
|
||||
{
|
||||
String s1 = (String) components[i++];
|
||||
k++;
|
||||
j = s1.length();
|
||||
s = (new StringBuilder()).append(s).append(s1).toString();
|
||||
}
|
||||
}
|
||||
HashMap hashmap = new HashMap();
|
||||
for (; i < components.length; i += 2)
|
||||
{
|
||||
Character character = (Character) components[i];
|
||||
ItemStack itemstack1 = null;
|
||||
if (components[i + 1] instanceof Item)
|
||||
{
|
||||
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];
|
||||
for(int i1 = 0; i1 < j * k; i1++) {
|
||||
char c = s.charAt(i1);
|
||||
if(hashmap.containsKey(Character.valueOf(c))) {
|
||||
recipeArray[i1] = ((ItemStack)hashmap.get(Character.valueOf(c))).copy();
|
||||
} else {
|
||||
recipeArray[i1] = null;
|
||||
}
|
||||
}
|
||||
ItemStack recipeArray[] = new ItemStack[j * k];
|
||||
for (int i1 = 0; i1 < j * k; i1++)
|
||||
{
|
||||
char c = s.charAt(i1);
|
||||
if (hashmap.containsKey(Character.valueOf(c)))
|
||||
{
|
||||
recipeArray[i1] = ((ItemStack) hashmap
|
||||
.get(Character.valueOf(c))).copy();
|
||||
} 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) {
|
||||
List<ItemStack> ingredients = new ArrayList<ItemStack>();
|
||||
for(int j = 0; j < components.length; j++) {
|
||||
Object obj = components[j];
|
||||
if(obj instanceof ItemStack) {
|
||||
ingredients.add(((ItemStack)obj).copy());
|
||||
continue;
|
||||
}
|
||||
if(obj instanceof Item) {
|
||||
ingredients.add(new ItemStack((Item)obj));
|
||||
continue;
|
||||
}
|
||||
if(obj instanceof Block) {
|
||||
ingredients.add(new ItemStack((Block)obj));
|
||||
} else {
|
||||
throw new RuntimeException("Invalid shapeless recipe!");
|
||||
}
|
||||
}
|
||||
public void addShapelessRecipe(ItemStack output, Object... components)
|
||||
{
|
||||
List<ItemStack> ingredients = new ArrayList<ItemStack>();
|
||||
for (int j = 0; j < components.length; j++)
|
||||
{
|
||||
Object obj = components[j];
|
||||
if (obj instanceof ItemStack)
|
||||
{
|
||||
ingredients.add(((ItemStack) obj).copy());
|
||||
continue;
|
||||
}
|
||||
if (obj instanceof Item)
|
||||
{
|
||||
ingredients.add(new ItemStack((Item) obj));
|
||||
continue;
|
||||
}
|
||||
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)
|
||||
{
|
||||
for (int k = 0; k < recipes.size(); k++)
|
||||
{
|
||||
IRecipe irecipe = (IRecipe) recipes.get(k);
|
||||
if (irecipe.matches(inv, world))
|
||||
{
|
||||
return irecipe.getCraftingResult(inv);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack findMatchingRecipe(InventoryCrafting inv, World world) {
|
||||
for(int k = 0; k < recipes.size(); k++) {
|
||||
IRecipe irecipe = (IRecipe)recipes.get(k);
|
||||
if(irecipe.matches(inv, world)) {
|
||||
return irecipe.getCraftingResult(inv);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public List<IRecipe> getRecipeList() {
|
||||
return recipes;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<IRecipe> getRecipeList()
|
||||
{
|
||||
return recipes;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,45 +1,58 @@
|
|||
package techreborn.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.util.ItemUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public final class TechRebornAPI {
|
||||
|
||||
public static ArrayList<CentrifugeRecipie> centrifugeRecipies = new ArrayList<CentrifugeRecipie>();
|
||||
public static ArrayList<RollingMachineRecipe> rollingmachineRecipes = new ArrayList<RollingMachineRecipe>();
|
||||
public static ArrayList<CentrifugeRecipie> centrifugeRecipies = new ArrayList<CentrifugeRecipie>();
|
||||
public static ArrayList<RollingMachineRecipe> rollingmachineRecipes = new ArrayList<RollingMachineRecipe>();
|
||||
|
||||
public static void registerCentrifugeRecipe(CentrifugeRecipie recipie)
|
||||
{
|
||||
boolean shouldAdd = true;
|
||||
for (CentrifugeRecipie centrifugeRecipie : centrifugeRecipies)
|
||||
{
|
||||
if (ItemUtils.isItemEqual(centrifugeRecipie.getInputItem(),
|
||||
recipie.getInputItem(), false, true))
|
||||
{
|
||||
try
|
||||
{
|
||||
throw new RegisteredItemRecipe(
|
||||
"Item "
|
||||
+ recipie.getInputItem()
|
||||
.getUnlocalizedName()
|
||||
+ " is already being used in a recipe for the Centrifuge");
|
||||
} catch (RegisteredItemRecipe registeredItemRecipe)
|
||||
{
|
||||
registeredItemRecipe.printStackTrace();
|
||||
shouldAdd = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (shouldAdd)
|
||||
centrifugeRecipies.add(recipie);
|
||||
}
|
||||
|
||||
public static void registerCentrifugeRecipe(CentrifugeRecipie recipie) {
|
||||
boolean shouldAdd = true;
|
||||
for (CentrifugeRecipie centrifugeRecipie : centrifugeRecipies) {
|
||||
if (ItemUtils.isItemEqual(centrifugeRecipie.getInputItem(), recipie.getInputItem(), false, true)) {
|
||||
try {
|
||||
throw new RegisteredItemRecipe("Item " + recipie.getInputItem().getUnlocalizedName() + " is already being used in a recipe for the Centrifuge");
|
||||
} catch (RegisteredItemRecipe registeredItemRecipe) {
|
||||
registeredItemRecipe.printStackTrace();
|
||||
shouldAdd = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (shouldAdd)
|
||||
centrifugeRecipies.add(recipie);
|
||||
}
|
||||
public static void addRollingMachinceRecipe(ItemStack output,
|
||||
Object... components)
|
||||
{
|
||||
RollingMachineRecipe.instance.addRecipe(output, components);
|
||||
}
|
||||
|
||||
public static void addRollingMachinceRecipe(ItemStack output, Object... components) {
|
||||
RollingMachineRecipe.instance.addRecipe(output, components);
|
||||
}
|
||||
|
||||
public void addShapelessRollingMachinceRecipe(ItemStack output, Object... components) {
|
||||
RollingMachineRecipe.instance.addShapelessRecipe(output, components);
|
||||
}
|
||||
public void addShapelessRollingMachinceRecipe(ItemStack output,
|
||||
Object... components)
|
||||
{
|
||||
RollingMachineRecipe.instance.addShapelessRecipe(output, components);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class RegisteredItemRecipe extends Exception {
|
||||
public RegisteredItemRecipe(String message) {
|
||||
super(message);
|
||||
}
|
||||
public RegisteredItemRecipe(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
@API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI") package techreborn.api;
|
||||
@API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI")
|
||||
package techreborn.api;
|
||||
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -19,115 +17,146 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileBlastFurnace;
|
||||
import techreborn.tiles.TileMachineCasing;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockBlastFurnace extends BlockContainer {
|
||||
|
||||
public class BlockBlastFurnace extends BlockContainer{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
|
||||
public BlockBlastFurnace(Material material)
|
||||
|
||||
public BlockBlastFurnace(Material material)
|
||||
{
|
||||
super(material);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setBlockName("techreborn.blastfurnace");
|
||||
setHardness(2F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileBlastFurnace();
|
||||
}
|
||||
|
||||
@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())
|
||||
for(ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS){
|
||||
if(world.getTileEntity(x + direction.offsetX, y + direction.offsetY, z + direction.offsetZ) instanceof TileMachineCasing){
|
||||
TileMachineCasing casing = (TileMachineCasing) world.getTileEntity(x + direction.offsetX, y + direction.offsetY, z + direction.offsetZ);
|
||||
if(casing.getMultiblockController() != null && casing.getMultiblockController().isAssembled()){
|
||||
player.openGui(Core.INSTANCE, GuiHandler.blastFurnaceID, 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_blast_furnace_front_off");
|
||||
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.iconTop: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
return new TileBlastFurnace();
|
||||
}
|
||||
|
||||
}
|
||||
@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())
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if (world.getTileEntity(x + direction.offsetX, y
|
||||
+ direction.offsetY, z + direction.offsetZ) instanceof TileMachineCasing)
|
||||
{
|
||||
TileMachineCasing casing = (TileMachineCasing) world
|
||||
.getTileEntity(x + direction.offsetX, y
|
||||
+ direction.offsetY, z + direction.offsetZ);
|
||||
if (casing.getMultiblockController() != null
|
||||
&& casing.getMultiblockController().isAssembled())
|
||||
{
|
||||
player.openGui(Core.INSTANCE,
|
||||
GuiHandler.blastFurnaceID, world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
@Override
|
||||
@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.iconTop = icon.registerIcon("techreborn:machine/machine_side");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||
return metadata == 0 && side == 3 ? this.iconFront
|
||||
: side == 1 ? this.iconTop : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
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;
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
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;
|
||||
}
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
}
|
||||
|
||||
}
|
||||
private void setDefaultDirection(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
||||
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);
|
||||
|
||||
int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
|
||||
byte b = 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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -16,104 +14,131 @@ import net.minecraft.world.World;
|
|||
import techreborn.Core;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.tiles.TileCentrifuge;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCentrifuge extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
|
||||
public BlockCentrifuge() {
|
||||
super(Material.piston);
|
||||
setHardness(2F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileCentrifuge();
|
||||
}
|
||||
public BlockCentrifuge()
|
||||
{
|
||||
super(Material.piston);
|
||||
setHardness(2F);
|
||||
}
|
||||
|
||||
@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.centrifugeID, 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_blast_furnace_front_off");
|
||||
this.iconTop = icon.registerIcon("techreborn:machine/industrial_grinder_top_on");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TileCentrifuge();
|
||||
}
|
||||
|
||||
return metadata == 0 && side == 3 ? this.iconFront : side == 1 ? this.iconTop : (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.centrifugeID, 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_blast_furnace_front_off");
|
||||
this.iconTop = icon
|
||||
.registerIcon("techreborn:machine/industrial_grinder_top_on");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
return metadata == 0 && side == 3 ? this.iconFront
|
||||
: side == 1 ? this.iconTop : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
byte b = 3;
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
||||
byte b = 3;
|
||||
|
||||
int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import erogenousbeef.coreTR.multiblock.BlockMultiblockBase;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
@ -15,67 +15,79 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileMachineCasing;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import erogenousbeef.coreTR.multiblock.BlockMultiblockBase;
|
||||
|
||||
public class BlockMachineCasing extends BlockMultiblockBase {
|
||||
|
||||
public static final String[] types = new String[] {"Standard", "Reinforced", "Advanced"};
|
||||
private IIcon[] textures;
|
||||
|
||||
public BlockMachineCasing(Material material)
|
||||
public static final String[] types = new String[]
|
||||
{ "Standard", "Reinforced", "Advanced" };
|
||||
private IIcon[] textures;
|
||||
|
||||
public BlockMachineCasing(Material material)
|
||||
{
|
||||
super(material);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setBlockName("techreborn.machineCasing");
|
||||
setHardness(2F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random random, int fortune) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random random, int fortune)
|
||||
{
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metaData) {
|
||||
//TODO RubyOre Returns Rubys
|
||||
return metaData;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; meta++)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.textures = new IIcon[types.length];
|
||||
@Override
|
||||
public int damageDropped(int metaData)
|
||||
{
|
||||
// TODO RubyOre Returns Rubys
|
||||
return metaData;
|
||||
}
|
||||
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "machine/casing" + types[i]);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.textures = new IIcon[types.length];
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metaData) {
|
||||
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
textures[i] = iconRegister.registerIcon("techreborn:"
|
||||
+ "machine/casing" + types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|
||||
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
|
||||
return textures[metaData];
|
||||
} else {
|
||||
return textures[metaData];
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metaData)
|
||||
{
|
||||
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileMachineCasing();
|
||||
}
|
||||
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|
||||
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN)
|
||||
{
|
||||
return textures[metaData];
|
||||
} else
|
||||
{
|
||||
return textures[metaData];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TileMachineCasing();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,61 +18,71 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
|
||||
public class BlockOre extends Block {
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{
|
||||
"Galena", "Iridium", "Ruby", "Sapphire", "Bauxite", "Pyrite", "Cinnabar", "Sphalerite",
|
||||
"Tungston", "Sheldonite", "Olivine", "Sodalite", "Copper", "Tin", "Lead", "Silver"
|
||||
};
|
||||
public static final String[] types = new String[]
|
||||
{ "Galena", "Iridium", "Ruby", "Sapphire", "Bauxite", "Pyrite", "Cinnabar",
|
||||
"Sphalerite", "Tungston", "Sheldonite", "Olivine", "Sodalite",
|
||||
"Copper", "Tin", "Lead", "Silver" };
|
||||
|
||||
private IIcon[] textures;
|
||||
private IIcon[] textures;
|
||||
|
||||
public BlockOre(Material material) {
|
||||
super(material);
|
||||
setBlockName("techreborn.ore");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHardness(1f);
|
||||
}
|
||||
public BlockOre(Material material)
|
||||
{
|
||||
super(material);
|
||||
setBlockName("techreborn.ore");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHardness(1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random random, int fortune) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random random, int fortune)
|
||||
{
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; meta++)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metaData) {
|
||||
//TODO RubyOre Returns Rubys
|
||||
return metaData;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int metaData)
|
||||
{
|
||||
// TODO RubyOre Returns Rubys
|
||||
return metaData;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.textures = new IIcon[types.length];
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.textures = new IIcon[types.length];
|
||||
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "ore/ore" + types[i]);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "ore/ore"
|
||||
+ types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metaData) {
|
||||
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metaData)
|
||||
{
|
||||
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
|
||||
|
||||
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|
||||
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
|
||||
return textures[metaData];
|
||||
} else {
|
||||
return textures[metaData];
|
||||
}
|
||||
}
|
||||
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|
||||
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN)
|
||||
{
|
||||
return textures[metaData];
|
||||
} else
|
||||
{
|
||||
return textures[metaData];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -12,47 +10,57 @@ import net.minecraft.world.World;
|
|||
import techreborn.Core;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.tiles.TileQuantumChest;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockQuantumChest extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon top;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon other;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon top;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon other;
|
||||
|
||||
public BlockQuantumChest() {
|
||||
super(Material.piston);
|
||||
setHardness(2f);
|
||||
}
|
||||
public BlockQuantumChest()
|
||||
{
|
||||
super(Material.piston);
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileQuantumChest();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TileQuantumChest();
|
||||
}
|
||||
|
||||
@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.quantumChestID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
@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.quantumChestID, world, x,
|
||||
y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon) {
|
||||
top = icon.registerIcon("techreborn:machine/quantum_top");
|
||||
other = icon.registerIcon("techreborn:machine/quantum_chest");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon)
|
||||
{
|
||||
top = icon.registerIcon("techreborn:machine/quantum_top");
|
||||
other = icon.registerIcon("techreborn:machine/quantum_chest");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int currentSide, int meta) {
|
||||
//TODO chest rotation
|
||||
if (currentSide == 1) {
|
||||
return top;
|
||||
} else {
|
||||
return other;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int currentSide, int meta)
|
||||
{
|
||||
// TODO chest rotation
|
||||
if (currentSide == 1)
|
||||
{
|
||||
return top;
|
||||
} else
|
||||
{
|
||||
return other;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -12,45 +10,56 @@ import net.minecraft.world.World;
|
|||
import techreborn.Core;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.tiles.TileQuantumTank;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockQuantumTank extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon top;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon other;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon top;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon other;
|
||||
|
||||
public BlockQuantumTank() {
|
||||
super(Material.piston);
|
||||
setHardness(2f);
|
||||
}
|
||||
public BlockQuantumTank()
|
||||
{
|
||||
super(Material.piston);
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileQuantumTank();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TileQuantumTank();
|
||||
}
|
||||
|
||||
@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.quantumTankID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
@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.quantumTankID, world, x,
|
||||
y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon) {
|
||||
top = icon.registerIcon("techreborn:machine/quantum_top");
|
||||
other = icon.registerIcon("techreborn:machine/ThermalGenerator_other");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon)
|
||||
{
|
||||
top = icon.registerIcon("techreborn:machine/quantum_top");
|
||||
other = icon.registerIcon("techreborn:machine/ThermalGenerator_other");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int currentSide, int meta) {
|
||||
if (currentSide == 1) {
|
||||
return top;
|
||||
} else {
|
||||
return other;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int currentSide, int meta)
|
||||
{
|
||||
if (currentSide == 1)
|
||||
{
|
||||
return top;
|
||||
} else
|
||||
{
|
||||
return other;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -17,106 +15,132 @@ import techreborn.Core;
|
|||
import techreborn.client.GuiHandler;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileRollingMachine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockRollingMachine extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
|
||||
public BlockRollingMachine(Material material) {
|
||||
super(material.piston);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setBlockName("techreborn.rollingmachine");
|
||||
setHardness(2f);
|
||||
}
|
||||
public BlockRollingMachine(Material material)
|
||||
{
|
||||
super(material.piston);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setBlockName("techreborn.rollingmachine");
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileRollingMachine();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TileRollingMachine();
|
||||
}
|
||||
|
||||
@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.rollingMachineID, 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.iconTop = icon.registerIcon("techreborn:machine/rollingmachine_top");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
@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.rollingMachineID, world,
|
||||
x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
return metadata == 0 && side == 3 ? this.iconFront : side == 1 ? this.iconTop : (side == 0 ? this.iconTop: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
@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.iconTop = icon
|
||||
.registerIcon("techreborn:machine/rollingmachine_top");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
return metadata == 0 && side == 3 ? this.iconFront
|
||||
: side == 1 ? this.iconTop : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||
public void onBlockAdded(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);
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, 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;
|
||||
}
|
||||
private void setDefaultDirection(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
||||
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;
|
||||
}
|
||||
|
||||
int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,60 +18,70 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
|
||||
public class BlockStorage extends Block {
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{
|
||||
"Silver", "Aluminium", "Titanium", "Sapphire", "Ruby", "GreenSapphire", "Chrome", "Electrum", "Tungsten",
|
||||
"Lead", "Zinc", "Brass", "Steel", "Platinum", "Nickel", "Invar",
|
||||
};
|
||||
public static final String[] types = new String[]
|
||||
{ "Silver", "Aluminium", "Titanium", "Sapphire", "Ruby", "GreenSapphire",
|
||||
"Chrome", "Electrum", "Tungsten", "Lead", "Zinc", "Brass", "Steel",
|
||||
"Platinum", "Nickel", "Invar", };
|
||||
|
||||
private IIcon[] textures;
|
||||
private IIcon[] textures;
|
||||
|
||||
public BlockStorage(Material material) {
|
||||
super(material);
|
||||
setBlockName("techreborn.storage");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHardness(2f);
|
||||
}
|
||||
public BlockStorage(Material material)
|
||||
{
|
||||
super(material);
|
||||
setBlockName("techreborn.storage");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random random, int par2) {
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
@Override
|
||||
public Item getItemDropped(int par1, Random random, int par2)
|
||||
{
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; meta++)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metaData) {
|
||||
return metaData;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int metaData)
|
||||
{
|
||||
return metaData;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.textures = new IIcon[types.length];
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.textures = new IIcon[types.length];
|
||||
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "storage/storage" + types[i]);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
textures[i] = iconRegister.registerIcon("techreborn:"
|
||||
+ "storage/storage" + types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metaData) {
|
||||
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metaData)
|
||||
{
|
||||
metaData = MathHelper.clamp_int(metaData, 0, types.length - 1);
|
||||
|
||||
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|
||||
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
|
||||
return textures[metaData];
|
||||
} else {
|
||||
return textures[metaData];
|
||||
}
|
||||
}
|
||||
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|
||||
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN)
|
||||
{
|
||||
return textures[metaData];
|
||||
} else
|
||||
{
|
||||
return textures[metaData];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -18,113 +18,137 @@ import net.minecraft.world.World;
|
|||
import techreborn.Core;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.tiles.TileThermalGenerator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockThermalGenerator extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
|
||||
public BlockThermalGenerator() {
|
||||
super(Material.piston);
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
@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.iconTop = icon.registerIcon("techreborn:machine/ThermalGenerator_top");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
public BlockThermalGenerator()
|
||||
{
|
||||
super(Material.piston);
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
return metadata == 0 && side == 3 ? this.iconFront : side == 1 ? this.iconTop : (side == 0 ? this.iconTop: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
@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.iconTop = icon
|
||||
.registerIcon("techreborn:machine/ThermalGenerator_top");
|
||||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
return metadata == 0 && side == 3 ? this.iconFront
|
||||
: side == 1 ? this.iconTop : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||
public void onBlockAdded(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);
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.setDefaultDirection(world, x, 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;
|
||||
}
|
||||
private void setDefaultDirection(World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
||||
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;
|
||||
}
|
||||
|
||||
int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
|
||||
world.setBlockMetadataWithNotify(x, y, z, b, 2);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileThermalGenerator();
|
||||
}
|
||||
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;
|
||||
|
||||
@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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
//TODO change when added crafting
|
||||
return Item.getItemFromBlock(Blocks.furnace);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, 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
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_,
|
||||
int p_149650_3_)
|
||||
{
|
||||
// TODO change when added crafting
|
||||
return Item.getItemFromBlock(Blocks.furnace);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +1,106 @@
|
|||
package techreborn.client;
|
||||
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.container.*;
|
||||
import techreborn.client.gui.*;
|
||||
import techreborn.client.container.ContainerBlastFurnace;
|
||||
import techreborn.client.container.ContainerCentrifuge;
|
||||
import techreborn.client.container.ContainerQuantumChest;
|
||||
import techreborn.client.container.ContainerQuantumTank;
|
||||
import techreborn.client.container.ContainerRollingMachine;
|
||||
import techreborn.client.container.ContainerThermalGenerator;
|
||||
import techreborn.client.gui.GuiBlastFurnace;
|
||||
import techreborn.client.gui.GuiCentrifuge;
|
||||
import techreborn.client.gui.GuiQuantumChest;
|
||||
import techreborn.client.gui.GuiQuantumTank;
|
||||
import techreborn.client.gui.GuiRollingMachine;
|
||||
import techreborn.client.gui.GuiThermalGenerator;
|
||||
import techreborn.pda.GuiPda;
|
||||
import techreborn.tiles.*;
|
||||
import techreborn.tiles.TileBlastFurnace;
|
||||
import techreborn.tiles.TileCentrifuge;
|
||||
import techreborn.tiles.TileQuantumChest;
|
||||
import techreborn.tiles.TileQuantumTank;
|
||||
import techreborn.tiles.TileRollingMachine;
|
||||
import techreborn.tiles.TileThermalGenerator;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
public class GuiHandler implements IGuiHandler {
|
||||
|
||||
public static final int thermalGeneratorID = 0;
|
||||
public static final int quantumTankID = 1;
|
||||
public static final int quantumChestID = 2;
|
||||
public static final int centrifugeID = 3;
|
||||
public static final int rollingMachineID = 4;
|
||||
public static final int blastFurnaceID = 5;
|
||||
public static final int pdaID = 6;
|
||||
public static final int thermalGeneratorID = 0;
|
||||
public static final int quantumTankID = 1;
|
||||
public static final int quantumChestID = 2;
|
||||
public static final int centrifugeID = 3;
|
||||
public static final int rollingMachineID = 4;
|
||||
public static final int blastFurnaceID = 5;
|
||||
public static final int pdaID = 6;
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
|
||||
int x, int y, int z)
|
||||
{
|
||||
if (ID == thermalGeneratorID)
|
||||
{
|
||||
return new ContainerThermalGenerator(
|
||||
(TileThermalGenerator) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == quantumTankID)
|
||||
{
|
||||
return new ContainerQuantumTank(
|
||||
(TileQuantumTank) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == quantumChestID)
|
||||
{
|
||||
return new ContainerQuantumChest(
|
||||
(TileQuantumChest) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == centrifugeID)
|
||||
{
|
||||
return new ContainerCentrifuge(
|
||||
(TileCentrifuge) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == rollingMachineID)
|
||||
{
|
||||
return new ContainerRollingMachine(
|
||||
(TileRollingMachine) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == blastFurnaceID)
|
||||
{
|
||||
return new ContainerBlastFurnace(
|
||||
(TileBlastFurnace) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == pdaID)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
if (ID == thermalGeneratorID) {
|
||||
return new ContainerThermalGenerator((TileThermalGenerator) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == quantumTankID) {
|
||||
return new ContainerQuantumTank((TileQuantumTank) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == quantumChestID) {
|
||||
return new ContainerQuantumChest((TileQuantumChest) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == centrifugeID) {
|
||||
return new ContainerCentrifuge((TileCentrifuge) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == rollingMachineID) {
|
||||
return new ContainerRollingMachine((TileRollingMachine) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == blastFurnaceID) {
|
||||
return new ContainerBlastFurnace((TileBlastFurnace) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == pdaID) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
if (ID == thermalGeneratorID) {
|
||||
return new GuiThermalGenerator(player, (TileThermalGenerator) world.getTileEntity(x, y, z));
|
||||
} else if (ID == quantumTankID) {
|
||||
return new GuiQuantumTank(player, (TileQuantumTank) world.getTileEntity(x, y, z));
|
||||
} else if (ID == quantumChestID) {
|
||||
return new GuiQuantumChest(player, (TileQuantumChest) world.getTileEntity(x, y, z));
|
||||
} else if (ID == centrifugeID) {
|
||||
return new GuiCentrifuge(player, (TileCentrifuge) world.getTileEntity(x, y, z));
|
||||
} else if (ID == rollingMachineID) {
|
||||
return new GuiRollingMachine(player, (TileRollingMachine) world.getTileEntity(x, y, z));
|
||||
} else if (ID == blastFurnaceID) {
|
||||
return new GuiBlastFurnace(player, (TileBlastFurnace) world.getTileEntity(x, y, z));
|
||||
} else if (ID == pdaID) {
|
||||
return new GuiPda(player);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world,
|
||||
int x, int y, int z)
|
||||
{
|
||||
if (ID == thermalGeneratorID)
|
||||
{
|
||||
return new GuiThermalGenerator(player,
|
||||
(TileThermalGenerator) world.getTileEntity(x, y, z));
|
||||
} else if (ID == quantumTankID)
|
||||
{
|
||||
return new GuiQuantumTank(player,
|
||||
(TileQuantumTank) world.getTileEntity(x, y, z));
|
||||
} else if (ID == quantumChestID)
|
||||
{
|
||||
return new GuiQuantumChest(player,
|
||||
(TileQuantumChest) world.getTileEntity(x, y, z));
|
||||
} else if (ID == centrifugeID)
|
||||
{
|
||||
return new GuiCentrifuge(player,
|
||||
(TileCentrifuge) world.getTileEntity(x, y, z));
|
||||
} else if (ID == rollingMachineID)
|
||||
{
|
||||
return new GuiRollingMachine(player,
|
||||
(TileRollingMachine) world.getTileEntity(x, y, z));
|
||||
} else if (ID == blastFurnaceID)
|
||||
{
|
||||
return new GuiBlastFurnace(player,
|
||||
(TileBlastFurnace) world.getTileEntity(x, y, z));
|
||||
} else if (ID == pdaID)
|
||||
{
|
||||
return new GuiPda(player);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,34 +4,38 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
public class SlotFake extends Slot {
|
||||
|
||||
public boolean mCanInsertItem;
|
||||
public boolean mCanStackItem;
|
||||
public int mMaxStacksize = 127;
|
||||
public boolean mCanInsertItem;
|
||||
public boolean mCanStackItem;
|
||||
public int mMaxStacksize = 127;
|
||||
|
||||
public SlotFake(IInventory par1iInventory, int par2, int par3, int par4,
|
||||
boolean aCanInsertItem, boolean aCanStackItem, int aMaxStacksize)
|
||||
{
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
this.mCanInsertItem = aCanInsertItem;
|
||||
this.mCanStackItem = aCanStackItem;
|
||||
this.mMaxStacksize = aMaxStacksize;
|
||||
}
|
||||
|
||||
public SlotFake(IInventory par1iInventory, int par2, int par3, int par4, boolean aCanInsertItem, boolean aCanStackItem, int aMaxStacksize) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
this.mCanInsertItem = aCanInsertItem;
|
||||
this.mCanStackItem = aCanStackItem;
|
||||
this.mMaxStacksize = aMaxStacksize;
|
||||
}
|
||||
public boolean isItemValid(ItemStack par1ItemStack)
|
||||
{
|
||||
return this.mCanInsertItem;
|
||||
}
|
||||
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
return this.mCanInsertItem;
|
||||
}
|
||||
public int getSlotStackLimit()
|
||||
{
|
||||
return this.mMaxStacksize;
|
||||
}
|
||||
|
||||
public int getSlotStackLimit() {
|
||||
return this.mMaxStacksize;
|
||||
}
|
||||
public boolean getHasStack()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean getHasStack() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack decrStackSize(int par1) {
|
||||
return !this.mCanStackItem ? null : super.decrStackSize(par1);
|
||||
}
|
||||
public ItemStack decrStackSize(int par1)
|
||||
{
|
||||
return !this.mCanStackItem ? null : super.decrStackSize(par1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,15 +6,18 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
public class SlotInput extends Slot {
|
||||
|
||||
public SlotInput(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
public SlotInput(IInventory par1iInventory, int par2, int par3, int par4)
|
||||
{
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
return false;
|
||||
}
|
||||
public boolean isItemValid(ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getSlotStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
public int getSlotStackLimit()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
}
|
|
@ -6,15 +6,18 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
public class SlotOutput extends Slot {
|
||||
|
||||
public SlotOutput(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
public SlotOutput(IInventory par1iInventory, int par2, int par3, int par4)
|
||||
{
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
return false;
|
||||
}
|
||||
public boolean isItemValid(ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getSlotStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
public int getSlotStackLimit()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
}
|
|
@ -6,14 +6,16 @@ import techreborn.init.ModBlocks;
|
|||
|
||||
public class TechRebornCreativeTab extends CreativeTabs {
|
||||
|
||||
public static TechRebornCreativeTab instance = new TechRebornCreativeTab();
|
||||
public static TechRebornCreativeTab instance = new TechRebornCreativeTab();
|
||||
|
||||
public TechRebornCreativeTab() {
|
||||
super("techreborn");
|
||||
}
|
||||
public TechRebornCreativeTab()
|
||||
{
|
||||
super("techreborn");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getTabIconItem() {
|
||||
return Item.getItemFromBlock(ModBlocks.thermalGenerator);
|
||||
}
|
||||
@Override
|
||||
public Item getTabIconItem()
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.thermalGenerator);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,19 +4,19 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.item.Item;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
public class TechRebornCreativeTabMisc extends CreativeTabs{
|
||||
|
||||
public static TechRebornCreativeTabMisc instance = new TechRebornCreativeTabMisc();
|
||||
public class TechRebornCreativeTabMisc extends CreativeTabs {
|
||||
|
||||
public TechRebornCreativeTabMisc()
|
||||
{
|
||||
super("techreborn");
|
||||
}
|
||||
public static TechRebornCreativeTabMisc instance = new TechRebornCreativeTabMisc();
|
||||
|
||||
@Override
|
||||
public Item getTabIconItem()
|
||||
{
|
||||
return ModItems.cells;
|
||||
}
|
||||
public TechRebornCreativeTabMisc()
|
||||
{
|
||||
super("techreborn");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getTabIconItem()
|
||||
{
|
||||
return ModItems.cells;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,48 +1,53 @@
|
|||
package techreborn.client.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.client.SlotOutput;
|
||||
import techreborn.tiles.TileBlastFurnace;
|
||||
import techreborn.tiles.TileCentrifuge;
|
||||
|
||||
public class ContainerBlastFurnace extends TechRebornContainer {
|
||||
|
||||
EntityPlayer player;
|
||||
EntityPlayer player;
|
||||
|
||||
TileBlastFurnace tile;
|
||||
|
||||
TileBlastFurnace tile;
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public int tickTime;
|
||||
public int tickTime;
|
||||
|
||||
public ContainerBlastFurnace(TileBlastFurnace tileblastfurnace, EntityPlayer player) {
|
||||
tile = tileblastfurnace;
|
||||
this.player = player;
|
||||
public ContainerBlastFurnace(TileBlastFurnace tileblastfurnace,
|
||||
EntityPlayer player)
|
||||
{
|
||||
tile = tileblastfurnace;
|
||||
this.player = player;
|
||||
|
||||
//input
|
||||
this.addSlotToContainer(new Slot(tileblastfurnace.inventory, 0, 56, 25));
|
||||
this.addSlotToContainer(new Slot(tileblastfurnace.inventory, 1, 56, 43));
|
||||
//outputs
|
||||
this.addSlotToContainer(new SlotOutput(tileblastfurnace.inventory, 2, 116, 35));
|
||||
// input
|
||||
this.addSlotToContainer(new Slot(tileblastfurnace.inventory, 0, 56, 25));
|
||||
this.addSlotToContainer(new Slot(tileblastfurnace.inventory, 1, 56, 43));
|
||||
// outputs
|
||||
this.addSlotToContainer(new SlotOutput(tileblastfurnace.inventory, 2,
|
||||
116, 35));
|
||||
|
||||
int i;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
|
||||
+ 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 9; ++i)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
|
||||
142));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,61 +8,77 @@ import techreborn.tiles.TileCentrifuge;
|
|||
|
||||
public class ContainerCentrifuge extends TechRebornContainer {
|
||||
|
||||
EntityPlayer player;
|
||||
EntityPlayer player;
|
||||
|
||||
TileCentrifuge tile;
|
||||
TileCentrifuge tile;
|
||||
|
||||
public int tickTime;
|
||||
public int tickTime;
|
||||
|
||||
public ContainerCentrifuge(TileCentrifuge tileCentrifuge, EntityPlayer player) {
|
||||
tile = tileCentrifuge;
|
||||
this.player = player;
|
||||
public ContainerCentrifuge(TileCentrifuge tileCentrifuge,
|
||||
EntityPlayer player)
|
||||
{
|
||||
tile = tileCentrifuge;
|
||||
this.player = player;
|
||||
|
||||
//input
|
||||
this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 0, 80, 35));
|
||||
//cells
|
||||
this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 1, 50, 5));
|
||||
//outputs
|
||||
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 2, 80, 5));
|
||||
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 3, 110, 35));
|
||||
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 4, 80, 65));
|
||||
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 5, 50, 35));
|
||||
// input
|
||||
this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 0, 80, 35));
|
||||
// cells
|
||||
this.addSlotToContainer(new Slot(tileCentrifuge.inventory, 1, 50, 5));
|
||||
// outputs
|
||||
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 2, 80,
|
||||
5));
|
||||
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 3,
|
||||
110, 35));
|
||||
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 4, 80,
|
||||
65));
|
||||
this.addSlotToContainer(new SlotOutput(tileCentrifuge.inventory, 5, 50,
|
||||
35));
|
||||
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
|
||||
+ 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 9; ++i)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
|
||||
142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, tile.tickTime);
|
||||
}
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting)
|
||||
{
|
||||
super.addCraftingToCrafters(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, tile.tickTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks for changes made in the container, sends them to every listener.
|
||||
*/
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); ++i) {
|
||||
ICrafting icrafting = (ICrafting) this.crafters.get(i);
|
||||
if (this.tickTime != this.tile.tickTime) {
|
||||
icrafting.sendProgressBarUpdate(this, 0, this.tile.tickTime);
|
||||
}
|
||||
}
|
||||
this.tickTime = this.tile.tickTime;
|
||||
}
|
||||
/**
|
||||
* Looks for changes made in the container, sends them to every listener.
|
||||
*/
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting) this.crafters.get(i);
|
||||
if (this.tickTime != this.tile.tickTime)
|
||||
{
|
||||
icrafting.sendProgressBarUpdate(this, 0, this.tile.tickTime);
|
||||
}
|
||||
}
|
||||
this.tickTime = this.tile.tickTime;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,34 +7,44 @@ import techreborn.client.SlotOutput;
|
|||
import techreborn.tiles.TileQuantumChest;
|
||||
|
||||
public class ContainerQuantumChest extends TechRebornContainer {
|
||||
public TileQuantumChest tileQuantumChest;
|
||||
public EntityPlayer player;
|
||||
public TileQuantumChest tileQuantumChest;
|
||||
public EntityPlayer player;
|
||||
|
||||
public ContainerQuantumChest(TileQuantumChest tileQuantumChest, EntityPlayer player) {
|
||||
super();
|
||||
this.tileQuantumChest = tileQuantumChest;
|
||||
this.player = player;
|
||||
public ContainerQuantumChest(TileQuantumChest tileQuantumChest,
|
||||
EntityPlayer player)
|
||||
{
|
||||
super();
|
||||
this.tileQuantumChest = tileQuantumChest;
|
||||
this.player = player;
|
||||
|
||||
this.addSlotToContainer(new Slot(tileQuantumChest.inventory, 0, 80, 17));
|
||||
this.addSlotToContainer(new SlotOutput(tileQuantumChest.inventory, 1, 80, 53));
|
||||
this.addSlotToContainer(new SlotFake(tileQuantumChest.inventory, 2, 59, 42, false, false, Integer.MAX_VALUE));
|
||||
this.addSlotToContainer(new Slot(tileQuantumChest.inventory, 0, 80, 17));
|
||||
this.addSlotToContainer(new SlotOutput(tileQuantumChest.inventory, 1,
|
||||
80, 53));
|
||||
this.addSlotToContainer(new SlotFake(tileQuantumChest.inventory, 2, 59,
|
||||
42, false, false, Integer.MAX_VALUE));
|
||||
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
|
||||
+ 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 9; ++i)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
|
||||
142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,33 +7,43 @@ import techreborn.client.SlotOutput;
|
|||
import techreborn.tiles.TileQuantumTank;
|
||||
|
||||
public class ContainerQuantumTank extends TechRebornContainer {
|
||||
public TileQuantumTank tileQuantumTank;
|
||||
public EntityPlayer player;
|
||||
public TileQuantumTank tileQuantumTank;
|
||||
public EntityPlayer player;
|
||||
|
||||
public ContainerQuantumTank(TileQuantumTank tileQuantumTank, EntityPlayer player) {
|
||||
super();
|
||||
this.tileQuantumTank = tileQuantumTank;
|
||||
this.player = player;
|
||||
public ContainerQuantumTank(TileQuantumTank tileQuantumTank,
|
||||
EntityPlayer player)
|
||||
{
|
||||
super();
|
||||
this.tileQuantumTank = tileQuantumTank;
|
||||
this.player = player;
|
||||
|
||||
this.addSlotToContainer(new Slot(tileQuantumTank.inventory, 0, 80, 17));
|
||||
this.addSlotToContainer(new SlotOutput(tileQuantumTank.inventory, 1, 80, 53));
|
||||
this.addSlotToContainer(new SlotFake(tileQuantumTank.inventory, 2, 59, 42, false, false, 1));
|
||||
this.addSlotToContainer(new Slot(tileQuantumTank.inventory, 0, 80, 17));
|
||||
this.addSlotToContainer(new SlotOutput(tileQuantumTank.inventory, 1,
|
||||
80, 53));
|
||||
this.addSlotToContainer(new SlotFake(tileQuantumTank.inventory, 2, 59,
|
||||
42, false, false, 1));
|
||||
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
|
||||
+ 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 9; ++i)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
|
||||
142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,50 +11,63 @@ import techreborn.tiles.TileRollingMachine;
|
|||
|
||||
public class ContainerRollingMachine extends TechRebornContainer {
|
||||
|
||||
EntityPlayer player;
|
||||
TileRollingMachine tile;
|
||||
EntityPlayer player;
|
||||
TileRollingMachine tile;
|
||||
|
||||
public ContainerRollingMachine(TileRollingMachine tileRollingmachine, EntityPlayer player) {
|
||||
tile = tileRollingmachine;
|
||||
this.player = player;
|
||||
public ContainerRollingMachine(TileRollingMachine tileRollingmachine,
|
||||
EntityPlayer player)
|
||||
{
|
||||
tile = tileRollingmachine;
|
||||
this.player = player;
|
||||
|
||||
for (int l = 0; l < 3; l++)
|
||||
{
|
||||
for (int k1 = 0; k1 < 3; k1++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(
|
||||
tileRollingmachine.craftMatrix, k1 + l * 3,
|
||||
30 + k1 * 18, 17 + l * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int l = 0; l < 3; l++) {
|
||||
for (int k1 = 0; k1 < 3; k1++) {
|
||||
this.addSlotToContainer(new Slot(tileRollingmachine.craftMatrix, k1 + l * 3, 30 + k1 * 18, 17 + l * 18));
|
||||
}
|
||||
}
|
||||
// output
|
||||
this.addSlotToContainer(new SlotOutput(tileRollingmachine.inventory, 0,
|
||||
124, 35));
|
||||
|
||||
//output
|
||||
this.addSlotToContainer(new SlotOutput(tileRollingmachine.inventory, 0, 124, 35));
|
||||
// fakeOutput
|
||||
this.addSlotToContainer(new SlotFake(tileRollingmachine.inventory, 1,
|
||||
124, 10, false, false, 1));
|
||||
|
||||
//fakeOutput
|
||||
this.addSlotToContainer(new SlotFake(tileRollingmachine.inventory, 1, 124, 10, false, false, 1));
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
|
||||
+ 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 9; ++i)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
|
||||
142));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onCraftMatrixChanged(IInventory inv) {
|
||||
ItemStack output = RollingMachineRecipe.instance.findMatchingRecipe(tile.craftMatrix, tile.getWorldObj());
|
||||
tile.inventory.setInventorySlotContents(1, output);
|
||||
}
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onCraftMatrixChanged(IInventory inv)
|
||||
{
|
||||
ItemStack output = RollingMachineRecipe.instance.findMatchingRecipe(
|
||||
tile.craftMatrix, tile.getWorldObj());
|
||||
tile.inventory.setInventorySlotContents(1, output);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,33 +7,44 @@ import techreborn.client.SlotOutput;
|
|||
import techreborn.tiles.TileThermalGenerator;
|
||||
|
||||
public class ContainerThermalGenerator extends TechRebornContainer {
|
||||
public TileThermalGenerator tileThermalGenerator;
|
||||
public EntityPlayer player;
|
||||
public TileThermalGenerator tileThermalGenerator;
|
||||
public EntityPlayer player;
|
||||
|
||||
public ContainerThermalGenerator(TileThermalGenerator tileThermalGenerator, EntityPlayer player) {
|
||||
super();
|
||||
this.tileThermalGenerator = tileThermalGenerator;
|
||||
this.player = player;
|
||||
public ContainerThermalGenerator(TileThermalGenerator tileThermalGenerator,
|
||||
EntityPlayer player)
|
||||
{
|
||||
super();
|
||||
this.tileThermalGenerator = tileThermalGenerator;
|
||||
this.player = player;
|
||||
|
||||
this.addSlotToContainer(new Slot(tileThermalGenerator.inventory, 0, 80, 17));
|
||||
this.addSlotToContainer(new SlotOutput(tileThermalGenerator.inventory, 1, 80, 53));
|
||||
this.addSlotToContainer(new SlotFake(tileThermalGenerator.inventory, 2, 59, 42, false, false, 1));
|
||||
this.addSlotToContainer(new Slot(tileThermalGenerator.inventory, 0, 80,
|
||||
17));
|
||||
this.addSlotToContainer(new SlotOutput(tileThermalGenerator.inventory,
|
||||
1, 80, 53));
|
||||
this.addSlotToContainer(new SlotFake(tileThermalGenerator.inventory, 2,
|
||||
59, 42, false, false, 1));
|
||||
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
|
||||
+ 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 9; ++i)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
|
||||
142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,88 +7,112 @@ import net.minecraft.item.ItemStack;
|
|||
import techreborn.client.SlotFake;
|
||||
import techreborn.util.ItemUtils;
|
||||
|
||||
|
||||
public abstract class TechRebornContainer extends Container {
|
||||
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
|
||||
ItemStack originalStack = null;
|
||||
Slot slot = (Slot) inventorySlots.get(slotIndex);
|
||||
int numSlots = inventorySlots.size();
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack stackInSlot = slot.getStack();
|
||||
originalStack = stackInSlot.copy();
|
||||
if (slotIndex >= numSlots - 9 * 4 && tryShiftItem(stackInSlot, numSlots)) {
|
||||
// NOOP
|
||||
} else if (slotIndex >= numSlots - 9 * 4 && slotIndex < numSlots - 9) {
|
||||
if (!shiftItemStack(stackInSlot, numSlots - 9, numSlots))
|
||||
return null;
|
||||
} else if (slotIndex >= numSlots - 9 && slotIndex < numSlots) {
|
||||
if (!shiftItemStack(stackInSlot, numSlots - 9 * 4, numSlots - 9))
|
||||
return null;
|
||||
} else if (!shiftItemStack(stackInSlot, numSlots - 9 * 4, numSlots))
|
||||
return null;
|
||||
slot.onSlotChange(stackInSlot, originalStack);
|
||||
if (stackInSlot.stackSize <= 0)
|
||||
slot.putStack(null);
|
||||
else
|
||||
slot.onSlotChanged();
|
||||
if (stackInSlot.stackSize == originalStack.stackSize)
|
||||
return null;
|
||||
slot.onPickupFromSlot(player, stackInSlot);
|
||||
}
|
||||
return originalStack;
|
||||
}
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex)
|
||||
{
|
||||
ItemStack originalStack = null;
|
||||
Slot slot = (Slot) inventorySlots.get(slotIndex);
|
||||
int numSlots = inventorySlots.size();
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack stackInSlot = slot.getStack();
|
||||
originalStack = stackInSlot.copy();
|
||||
if (slotIndex >= numSlots - 9 * 4
|
||||
&& tryShiftItem(stackInSlot, numSlots))
|
||||
{
|
||||
// NOOP
|
||||
} else if (slotIndex >= numSlots - 9 * 4
|
||||
&& slotIndex < numSlots - 9)
|
||||
{
|
||||
if (!shiftItemStack(stackInSlot, numSlots - 9, numSlots))
|
||||
return null;
|
||||
} else if (slotIndex >= numSlots - 9 && slotIndex < numSlots)
|
||||
{
|
||||
if (!shiftItemStack(stackInSlot, numSlots - 9 * 4, numSlots - 9))
|
||||
return null;
|
||||
} else if (!shiftItemStack(stackInSlot, numSlots - 9 * 4, numSlots))
|
||||
return null;
|
||||
slot.onSlotChange(stackInSlot, originalStack);
|
||||
if (stackInSlot.stackSize <= 0)
|
||||
slot.putStack(null);
|
||||
else
|
||||
slot.onSlotChanged();
|
||||
if (stackInSlot.stackSize == originalStack.stackSize)
|
||||
return null;
|
||||
slot.onPickupFromSlot(player, stackInSlot);
|
||||
}
|
||||
return originalStack;
|
||||
}
|
||||
|
||||
protected boolean shiftItemStack(ItemStack stackToShift, int start, int end) {
|
||||
boolean changed = false;
|
||||
if (stackToShift.isStackable())
|
||||
for (int slotIndex = start; stackToShift.stackSize > 0 && slotIndex < end; slotIndex++) {
|
||||
Slot slot = (Slot) inventorySlots.get(slotIndex);
|
||||
ItemStack stackInSlot = slot.getStack();
|
||||
if (stackInSlot != null && ItemUtils.isItemEqual(stackInSlot, stackToShift, true, true)) {
|
||||
int resultingStackSize = stackInSlot.stackSize + stackToShift.stackSize;
|
||||
int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit());
|
||||
if (resultingStackSize <= max) {
|
||||
stackToShift.stackSize = 0;
|
||||
stackInSlot.stackSize = resultingStackSize;
|
||||
slot.onSlotChanged();
|
||||
changed = true;
|
||||
} else if (stackInSlot.stackSize < max) {
|
||||
stackToShift.stackSize -= max - stackInSlot.stackSize;
|
||||
stackInSlot.stackSize = max;
|
||||
slot.onSlotChanged();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stackToShift.stackSize > 0)
|
||||
for (int slotIndex = start; stackToShift.stackSize > 0 && slotIndex < end; slotIndex++) {
|
||||
Slot slot = (Slot) inventorySlots.get(slotIndex);
|
||||
ItemStack stackInSlot = slot.getStack();
|
||||
if (stackInSlot == null) {
|
||||
int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit());
|
||||
stackInSlot = stackToShift.copy();
|
||||
stackInSlot.stackSize = Math.min(stackToShift.stackSize, max);
|
||||
stackToShift.stackSize -= stackInSlot.stackSize;
|
||||
slot.putStack(stackInSlot);
|
||||
slot.onSlotChanged();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
protected boolean shiftItemStack(ItemStack stackToShift, int start, int end)
|
||||
{
|
||||
boolean changed = false;
|
||||
if (stackToShift.isStackable())
|
||||
for (int slotIndex = start; stackToShift.stackSize > 0
|
||||
&& slotIndex < end; slotIndex++)
|
||||
{
|
||||
Slot slot = (Slot) inventorySlots.get(slotIndex);
|
||||
ItemStack stackInSlot = slot.getStack();
|
||||
if (stackInSlot != null
|
||||
&& ItemUtils.isItemEqual(stackInSlot, stackToShift,
|
||||
true, true))
|
||||
{
|
||||
int resultingStackSize = stackInSlot.stackSize
|
||||
+ stackToShift.stackSize;
|
||||
int max = Math.min(stackToShift.getMaxStackSize(),
|
||||
slot.getSlotStackLimit());
|
||||
if (resultingStackSize <= max)
|
||||
{
|
||||
stackToShift.stackSize = 0;
|
||||
stackInSlot.stackSize = resultingStackSize;
|
||||
slot.onSlotChanged();
|
||||
changed = true;
|
||||
} else if (stackInSlot.stackSize < max)
|
||||
{
|
||||
stackToShift.stackSize -= max - stackInSlot.stackSize;
|
||||
stackInSlot.stackSize = max;
|
||||
slot.onSlotChanged();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stackToShift.stackSize > 0)
|
||||
for (int slotIndex = start; stackToShift.stackSize > 0
|
||||
&& slotIndex < end; slotIndex++)
|
||||
{
|
||||
Slot slot = (Slot) inventorySlots.get(slotIndex);
|
||||
ItemStack stackInSlot = slot.getStack();
|
||||
if (stackInSlot == null)
|
||||
{
|
||||
int max = Math.min(stackToShift.getMaxStackSize(),
|
||||
slot.getSlotStackLimit());
|
||||
stackInSlot = stackToShift.copy();
|
||||
stackInSlot.stackSize = Math.min(stackToShift.stackSize,
|
||||
max);
|
||||
stackToShift.stackSize -= stackInSlot.stackSize;
|
||||
slot.putStack(stackInSlot);
|
||||
slot.onSlotChanged();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
private boolean tryShiftItem(ItemStack stackToShift, int numSlots) {
|
||||
for (int machineIndex = 0; machineIndex < numSlots - 9 * 4; machineIndex++) {
|
||||
Slot slot = (Slot) inventorySlots.get(machineIndex);
|
||||
if (slot instanceof SlotFake) {
|
||||
continue;
|
||||
}
|
||||
if (!slot.isItemValid(stackToShift))
|
||||
continue;
|
||||
if (shiftItemStack(stackToShift, machineIndex, machineIndex + 1))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private boolean tryShiftItem(ItemStack stackToShift, int numSlots)
|
||||
{
|
||||
for (int machineIndex = 0; machineIndex < numSlots - 9 * 4; machineIndex++)
|
||||
{
|
||||
Slot slot = (Slot) inventorySlots.get(machineIndex);
|
||||
if (slot instanceof SlotFake)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!slot.isItemValid(stackToShift))
|
||||
continue;
|
||||
if (shiftItemStack(stackToShift, machineIndex, machineIndex + 1))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,33 +5,40 @@ import net.minecraft.client.resources.I18n;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import techreborn.client.container.ContainerBlastFurnace;
|
||||
import techreborn.client.container.ContainerCentrifuge;
|
||||
import techreborn.tiles.TileBlastFurnace;
|
||||
import techreborn.tiles.TileCentrifuge;
|
||||
|
||||
public class GuiBlastFurnace extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/industrial_blast_furnace.png");
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
"techreborn", "textures/gui/industrial_blast_furnace.png");
|
||||
|
||||
TileBlastFurnace blastfurnace;
|
||||
TileBlastFurnace blastfurnace;
|
||||
|
||||
public GuiBlastFurnace(EntityPlayer player, TileBlastFurnace tileblastfurnace) {
|
||||
super(new ContainerBlastFurnace(tileblastfurnace, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
blastfurnace = tileblastfurnace;
|
||||
}
|
||||
public GuiBlastFurnace(EntityPlayer player,
|
||||
TileBlastFurnace tileblastfurnace)
|
||||
{
|
||||
super(new ContainerBlastFurnace(tileblastfurnace, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
blastfurnace = tileblastfurnace;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
|
||||
int p_146976_2_, int p_146976_3_)
|
||||
{
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
this.fontRendererObj.drawString("Blastfurnace", 60, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
|
||||
int p_146979_2_)
|
||||
{
|
||||
this.fontRendererObj.drawString("Blastfurnace", 60, 6, 4210752);
|
||||
this.fontRendererObj.drawString(
|
||||
I18n.format("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,28 +9,37 @@ import techreborn.tiles.TileCentrifuge;
|
|||
|
||||
public class GuiCentrifuge extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/centrifuge.png");
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
"techreborn", "textures/gui/centrifuge.png");
|
||||
|
||||
TileCentrifuge centrifuge;
|
||||
TileCentrifuge centrifuge;
|
||||
|
||||
public GuiCentrifuge(EntityPlayer player, TileCentrifuge tileCentrifuge) {
|
||||
super(new ContainerCentrifuge(tileCentrifuge, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
centrifuge = tileCentrifuge;
|
||||
}
|
||||
public GuiCentrifuge(EntityPlayer player, TileCentrifuge tileCentrifuge)
|
||||
{
|
||||
super(new ContainerCentrifuge(tileCentrifuge, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
centrifuge = tileCentrifuge;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
|
||||
int p_146976_2_, int p_146976_3_)
|
||||
{
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
this.fontRendererObj.drawString("Centrifuge", 110, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(centrifuge.tickTime + " " + centrifuge.isRunning, 110, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
|
||||
int p_146979_2_)
|
||||
{
|
||||
this.fontRendererObj.drawString("Centrifuge", 110, 6, 4210752);
|
||||
this.fontRendererObj.drawString(
|
||||
I18n.format("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString(centrifuge.tickTime + " "
|
||||
+ centrifuge.isRunning, 110, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -10,31 +9,39 @@ import techreborn.tiles.TileQuantumChest;
|
|||
|
||||
public class GuiQuantumChest extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/ThermalGenerator.png");
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
"techreborn", "textures/gui/ThermalGenerator.png");
|
||||
|
||||
TileQuantumChest tile;
|
||||
TileQuantumChest tile;
|
||||
|
||||
public GuiQuantumChest(EntityPlayer player, TileQuantumChest tile) {
|
||||
super(new ContainerQuantumChest(tile, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
this.tile = tile;
|
||||
}
|
||||
public GuiQuantumChest(EntityPlayer player, TileQuantumChest tile)
|
||||
{
|
||||
super(new ContainerQuantumChest(tile, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
|
||||
int p_146976_2_, int p_146976_3_)
|
||||
{
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
this.fontRendererObj.drawString("Quantum Chest", 8, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString("Amount", 10, 20, 16448255);
|
||||
if (tile.storedItem != null)
|
||||
this.fontRendererObj.drawString(tile.storedItem.stackSize + "", 10, 30, 16448255);
|
||||
}
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
|
||||
int p_146979_2_)
|
||||
{
|
||||
this.fontRendererObj.drawString("Quantum Chest", 8, 6, 4210752);
|
||||
this.fontRendererObj.drawString(
|
||||
I18n.format("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString("Amount", 10, 20, 16448255);
|
||||
if (tile.storedItem != null)
|
||||
this.fontRendererObj.drawString(tile.storedItem.stackSize + "", 10,
|
||||
30, 16448255);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,30 +9,38 @@ import techreborn.tiles.TileQuantumTank;
|
|||
|
||||
public class GuiQuantumTank extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/ThermalGenerator.png");
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
"techreborn", "textures/gui/ThermalGenerator.png");
|
||||
|
||||
TileQuantumTank tile;
|
||||
TileQuantumTank tile;
|
||||
|
||||
public GuiQuantumTank(EntityPlayer player, TileQuantumTank tile) {
|
||||
super(new ContainerQuantumTank(tile, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
this.tile = tile;
|
||||
}
|
||||
public GuiQuantumTank(EntityPlayer player, TileQuantumTank tile)
|
||||
{
|
||||
super(new ContainerQuantumTank(tile, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
|
||||
int p_146976_2_, int p_146976_3_)
|
||||
{
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
this.fontRendererObj.drawString("Quantum Tank", 8, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
|
||||
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10, 30, 16448255);
|
||||
}
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
|
||||
int p_146979_2_)
|
||||
{
|
||||
this.fontRendererObj.drawString("Quantum Tank", 8, 6, 4210752);
|
||||
this.fontRendererObj.drawString(
|
||||
I18n.format("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
|
||||
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10,
|
||||
30, 16448255);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,22 +8,27 @@ import techreborn.tiles.TileRollingMachine;
|
|||
|
||||
public class GuiRollingMachine extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/rollingmachine.png");
|
||||
TileRollingMachine rollingMachine;
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
"techreborn", "textures/gui/rollingmachine.png");
|
||||
TileRollingMachine rollingMachine;
|
||||
|
||||
public GuiRollingMachine(EntityPlayer player, TileRollingMachine tileRollingmachine) {
|
||||
super(new ContainerRollingMachine(tileRollingmachine, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
rollingMachine = tileRollingmachine;
|
||||
}
|
||||
public GuiRollingMachine(EntityPlayer player,
|
||||
TileRollingMachine tileRollingmachine)
|
||||
{
|
||||
super(new ContainerRollingMachine(tileRollingmachine, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
rollingMachine = tileRollingmachine;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
|
||||
int p_146976_2_, int p_146976_3_)
|
||||
{
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,29 +9,38 @@ import techreborn.tiles.TileThermalGenerator;
|
|||
|
||||
public class GuiThermalGenerator extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/ThermalGenerator.png");
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
"techreborn", "textures/gui/ThermalGenerator.png");
|
||||
|
||||
TileThermalGenerator tile;
|
||||
TileThermalGenerator tile;
|
||||
|
||||
public GuiThermalGenerator(EntityPlayer player, TileThermalGenerator tile) {
|
||||
super(new ContainerThermalGenerator(tile, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
this.tile = tile;
|
||||
}
|
||||
public GuiThermalGenerator(EntityPlayer player, TileThermalGenerator tile)
|
||||
{
|
||||
super(new ContainerThermalGenerator(tile, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
|
||||
int p_146976_2_, int p_146976_3_)
|
||||
{
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
this.fontRendererObj.drawString("Thermal Generator", 8, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
|
||||
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10, 30, 16448255);
|
||||
}
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
|
||||
int p_146979_2_)
|
||||
{
|
||||
this.fontRendererObj.drawString("Thermal Generator", 8, 6, 4210752);
|
||||
this.fontRendererObj.drawString(
|
||||
I18n.format("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
|
||||
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10,
|
||||
30, 16448255);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package techreborn.compat;
|
||||
|
||||
import techreborn.compat.waila.CompatModuleWaila;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import techreborn.compat.waila.CompatModuleWaila;
|
||||
|
||||
public class CompatManager {
|
||||
|
||||
public static void init(FMLInitializationEvent event)
|
||||
{
|
||||
if (Loader.isModLoaded("Waila"))
|
||||
{
|
||||
new CompatModuleWaila().init(event);
|
||||
}
|
||||
}
|
||||
public static void init(FMLInitializationEvent event)
|
||||
{
|
||||
if (Loader.isModLoaded("Waila"))
|
||||
{
|
||||
new CompatModuleWaila().init(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,157 +1,206 @@
|
|||
package techreborn.compat.nei;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import ic2.api.item.IC2Items;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import techreborn.api.CentrifugeRecipie;
|
||||
import techreborn.api.TechRebornAPI;
|
||||
import techreborn.client.gui.GuiCentrifuge;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class CentrifugeRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
public class CachedCentrifugeRecipe extends CachedRecipe {
|
||||
public class CachedCentrifugeRecipe extends CachedRecipe {
|
||||
|
||||
private List<PositionedStack> input = new ArrayList<PositionedStack>();
|
||||
private List<PositionedStack> outputs = new ArrayList<PositionedStack>();
|
||||
public Point focus;
|
||||
public CentrifugeRecipie centrifugeRecipie;
|
||||
private List<PositionedStack> input = new ArrayList<PositionedStack>();
|
||||
private List<PositionedStack> outputs = new ArrayList<PositionedStack>();
|
||||
public Point focus;
|
||||
public CentrifugeRecipie centrifugeRecipie;
|
||||
|
||||
public CachedCentrifugeRecipe(CentrifugeRecipie recipie)
|
||||
{
|
||||
this.centrifugeRecipie = recipie;
|
||||
int offset = 4;
|
||||
PositionedStack pStack = new PositionedStack(
|
||||
recipie.getInputItem(), 80 - offset, 35 - offset);
|
||||
pStack.setMaxSize(1);
|
||||
this.input.add(pStack);
|
||||
|
||||
public CachedCentrifugeRecipe(CentrifugeRecipie recipie) {
|
||||
this.centrifugeRecipie = recipie;
|
||||
int offset = 4;
|
||||
PositionedStack pStack = new PositionedStack(recipie.getInputItem(), 80 - offset, 35 - offset);
|
||||
pStack.setMaxSize(1);
|
||||
this.input.add(pStack);
|
||||
if (recipie.getOutput1() != null)
|
||||
{
|
||||
this.outputs.add(new PositionedStack(recipie.getOutput1(),
|
||||
80 - offset, 5 - offset));
|
||||
}
|
||||
if (recipie.getOutput2() != null)
|
||||
{
|
||||
this.outputs.add(new PositionedStack(recipie.getOutput2(),
|
||||
110 - offset, 35 - offset));
|
||||
}
|
||||
if (recipie.getOutput3() != null)
|
||||
{
|
||||
this.outputs.add(new PositionedStack(recipie.getOutput3(),
|
||||
80 - offset, 65 - offset));
|
||||
}
|
||||
if (recipie.getOutput4() != null)
|
||||
{
|
||||
this.outputs.add(new PositionedStack(recipie.getOutput4(),
|
||||
50 - offset, 35 - offset));
|
||||
}
|
||||
|
||||
ItemStack cellStack = IC2Items.getItem("cell");
|
||||
cellStack.stackSize = recipie.getCells();
|
||||
this.outputs.add(new PositionedStack(cellStack, 50 - offset,
|
||||
5 - offset));
|
||||
|
||||
if (recipie.getOutput1() != null) {
|
||||
this.outputs.add(new PositionedStack(recipie.getOutput1(), 80 - offset, 5 - offset));
|
||||
}
|
||||
if (recipie.getOutput2() != null) {
|
||||
this.outputs.add(new PositionedStack(recipie.getOutput2(), 110 - offset, 35 - offset));
|
||||
}
|
||||
if (recipie.getOutput3() != null) {
|
||||
this.outputs.add(new PositionedStack(recipie.getOutput3(), 80 - offset, 65 - offset));
|
||||
}
|
||||
if (recipie.getOutput4() != null) {
|
||||
this.outputs.add(new PositionedStack(recipie.getOutput4(), 50 - offset, 35 - offset));
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack cellStack = IC2Items.getItem("cell");
|
||||
cellStack.stackSize = recipie.getCells();
|
||||
this.outputs.add(new PositionedStack(cellStack, 50 - offset, 5 - offset));
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients(cycleticks / 20, this.input);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks()
|
||||
{
|
||||
return this.outputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return this.getCycledIngredients(cycleticks / 20, this.input);
|
||||
}
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks() {
|
||||
return this.outputs;
|
||||
}
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return "Centrifuge";
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getGuiTexture()
|
||||
{
|
||||
return "techreborn:textures/gui/centrifuge.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return "Centrifuge";
|
||||
}
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GuiCentrifuge.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "techreborn:textures/gui/centrifuge.png";
|
||||
}
|
||||
@Override
|
||||
public void drawBackground(int recipeIndex)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(0, 0, 4, 4, 166, 78);
|
||||
GuiDraw.drawTooltipBox(10, 80, 145, 50);
|
||||
GuiDraw.drawString("Info:", 14, 84, -1);
|
||||
CachedRecipe recipe = arecipes.get(recipeIndex);
|
||||
if (recipe instanceof CachedCentrifugeRecipe)
|
||||
{
|
||||
CachedCentrifugeRecipe centrifugeRecipie = (CachedCentrifugeRecipe) recipe;
|
||||
GuiDraw.drawString(
|
||||
"EU needed: "
|
||||
+ (ConfigTechReborn.CentrifugeInputTick * centrifugeRecipie.centrifugeRecipie
|
||||
.getTickTime()), 14, 94, -1);
|
||||
GuiDraw.drawString("Ticks to smelt: "
|
||||
+ centrifugeRecipie.centrifugeRecipie.getTickTime(), 14,
|
||||
104, -1);
|
||||
GuiDraw.drawString("Time to smelt: "
|
||||
+ centrifugeRecipie.centrifugeRecipie.getTickTime() / 20
|
||||
+ " seconds", 14, 114, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GuiCentrifuge.class;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipeIndex) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(0, 0, 4, 4, 166, 78);
|
||||
GuiDraw.drawTooltipBox(10, 80, 145, 50);
|
||||
GuiDraw.drawString("Info:", 14, 84, -1);
|
||||
CachedRecipe recipe = arecipes.get(recipeIndex);
|
||||
if (recipe instanceof CachedCentrifugeRecipe) {
|
||||
CachedCentrifugeRecipe centrifugeRecipie = (CachedCentrifugeRecipe) recipe;
|
||||
GuiDraw.drawString("EU needed: " + (ConfigTechReborn.CentrifugeInputTick * centrifugeRecipie.centrifugeRecipie.getTickTime()), 14, 94, -1);
|
||||
GuiDraw.drawString("Ticks to smelt: " + centrifugeRecipie.centrifugeRecipie.getTickTime(), 14, 104, -1);
|
||||
GuiDraw.drawString("Time to smelt: " + centrifugeRecipie.centrifugeRecipie.getTickTime() / 20 + " seconds", 14, 114, -1);
|
||||
}
|
||||
@Override
|
||||
public int recipiesPerPage()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(
|
||||
new Rectangle(75, 22, 15, 13), "tr.centrifuge", new Object[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recipiesPerPage() {
|
||||
return 1;
|
||||
}
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if (outputId.equals("tr.centrifuge"))
|
||||
{
|
||||
for (CentrifugeRecipie centrifugeRecipie : TechRebornAPI.centrifugeRecipies)
|
||||
{
|
||||
addCached(centrifugeRecipie);
|
||||
}
|
||||
} else
|
||||
{
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(75, 22, 15, 13), "tr.centrifuge", new Object[0]));
|
||||
}
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
for (CentrifugeRecipie centrifugeRecipie : TechRebornAPI.centrifugeRecipies)
|
||||
{
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(
|
||||
centrifugeRecipie.getOutput1(), result))
|
||||
{
|
||||
addCached(centrifugeRecipie);
|
||||
}
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(
|
||||
centrifugeRecipie.getOutput2(), result))
|
||||
{
|
||||
addCached(centrifugeRecipie);
|
||||
}
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(
|
||||
centrifugeRecipie.getOutput3(), result))
|
||||
{
|
||||
addCached(centrifugeRecipie);
|
||||
}
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(
|
||||
centrifugeRecipie.getOutput4(), result))
|
||||
{
|
||||
addCached(centrifugeRecipie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("tr.centrifuge")) {
|
||||
for (CentrifugeRecipie centrifugeRecipie : TechRebornAPI.centrifugeRecipies) {
|
||||
addCached(centrifugeRecipie);
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
for (CentrifugeRecipie centrifugeRecipie : TechRebornAPI.centrifugeRecipies)
|
||||
{
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(
|
||||
centrifugeRecipie.getInputItem(), ingredient))
|
||||
{
|
||||
addCached(centrifugeRecipie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (CentrifugeRecipie centrifugeRecipie : TechRebornAPI.centrifugeRecipies) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getOutput1(), result)) {
|
||||
addCached(centrifugeRecipie);
|
||||
}
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getOutput2(), result)) {
|
||||
addCached(centrifugeRecipie);
|
||||
}
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getOutput3(), result)) {
|
||||
addCached(centrifugeRecipie);
|
||||
}
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getOutput4(), result)) {
|
||||
addCached(centrifugeRecipie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for (CentrifugeRecipie centrifugeRecipie : TechRebornAPI.centrifugeRecipies) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(centrifugeRecipie.getInputItem(), ingredient)) {
|
||||
addCached(centrifugeRecipie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addCached(CentrifugeRecipie recipie) {
|
||||
this.arecipes.add(new CachedCentrifugeRecipe(recipie));
|
||||
}
|
||||
private void addCached(CentrifugeRecipie recipie)
|
||||
{
|
||||
this.arecipes.add(new CachedCentrifugeRecipe(recipie));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,35 +1,38 @@
|
|||
package techreborn.compat.nei;
|
||||
|
||||
import techreborn.lib.ModInfo;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
public class NEIConfig implements IConfigureNEI {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return ModInfo.MOD_ID;
|
||||
}
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return ModInfo.MOD_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return ModInfo.MOD_VERSION;
|
||||
}
|
||||
@Override
|
||||
public String getVersion()
|
||||
{
|
||||
return ModInfo.MOD_VERSION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadConfig() {
|
||||
CentrifugeRecipeHandler centrifugeRecipeHandler = new CentrifugeRecipeHandler();
|
||||
ShapedRollingMachineHandler shapedRollingMachineHandler = new ShapedRollingMachineHandler();
|
||||
ShapelessRollingMachineHandler shapelessRollingMachineHandler = new ShapelessRollingMachineHandler();
|
||||
@Override
|
||||
public void loadConfig()
|
||||
{
|
||||
CentrifugeRecipeHandler centrifugeRecipeHandler = new CentrifugeRecipeHandler();
|
||||
ShapedRollingMachineHandler shapedRollingMachineHandler = new ShapedRollingMachineHandler();
|
||||
ShapelessRollingMachineHandler shapelessRollingMachineHandler = new ShapelessRollingMachineHandler();
|
||||
|
||||
API.registerRecipeHandler(centrifugeRecipeHandler);
|
||||
API.registerUsageHandler(centrifugeRecipeHandler);
|
||||
API.registerRecipeHandler(centrifugeRecipeHandler);
|
||||
API.registerUsageHandler(centrifugeRecipeHandler);
|
||||
|
||||
API.registerUsageHandler(shapedRollingMachineHandler);
|
||||
API.registerRecipeHandler(shapedRollingMachineHandler);
|
||||
API.registerUsageHandler(shapedRollingMachineHandler);
|
||||
API.registerRecipeHandler(shapedRollingMachineHandler);
|
||||
|
||||
API.registerUsageHandler(shapelessRollingMachineHandler);
|
||||
API.registerRecipeHandler(shapelessRollingMachineHandler);
|
||||
}
|
||||
API.registerUsageHandler(shapelessRollingMachineHandler);
|
||||
API.registerRecipeHandler(shapelessRollingMachineHandler);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
//Copy and pasted from https://github.com/Chicken-Bones/NotEnoughItems/blob/master/src/codechicken/nei/recipe/ShapedRecipeHandler.java
|
||||
package techreborn.compat.nei;
|
||||
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.recipe.ShapedRecipeHandler;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
@ -10,89 +11,110 @@ import net.minecraft.item.crafting.ShapedRecipes;
|
|||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import techreborn.api.RollingMachineRecipe;
|
||||
import techreborn.client.gui.GuiRollingMachine;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.recipe.ShapedRecipeHandler;
|
||||
|
||||
public class ShapedRollingMachineHandler extends ShapedRecipeHandler {
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GuiRollingMachine.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GuiRollingMachine.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
this.transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "rollingcrafting", new Object[0]));
|
||||
}
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
this.transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24,
|
||||
18), "rollingcrafting", new Object[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return "rollingcrafting";
|
||||
}
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return "rollingcrafting";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "rollingcrafting";
|
||||
}
|
||||
@Override
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "rollingcrafting";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("rollingcrafting") && getClass() == ShapedRollingMachineHandler.class) {
|
||||
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance.getRecipeList()) {
|
||||
CachedShapedRecipe recipe = null;
|
||||
if (irecipe instanceof ShapedRecipes)
|
||||
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
|
||||
else if (irecipe instanceof ShapedOreRecipe)
|
||||
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if (outputId.equals("rollingcrafting")
|
||||
&& getClass() == ShapedRollingMachineHandler.class)
|
||||
{
|
||||
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance
|
||||
.getRecipeList())
|
||||
{
|
||||
CachedShapedRecipe recipe = null;
|
||||
if (irecipe instanceof ShapedRecipes)
|
||||
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
|
||||
else if (irecipe instanceof ShapedOreRecipe)
|
||||
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
if (recipe == null)
|
||||
continue;
|
||||
|
||||
recipe.computeVisuals();
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
recipe.computeVisuals();
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
} else
|
||||
{
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance.getRecipeList()) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
|
||||
CachedShapedRecipe recipe = null;
|
||||
if (irecipe instanceof ShapedRecipes)
|
||||
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
|
||||
else if (irecipe instanceof ShapedOreRecipe)
|
||||
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance
|
||||
.getRecipeList())
|
||||
{
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(
|
||||
irecipe.getRecipeOutput(), result))
|
||||
{
|
||||
CachedShapedRecipe recipe = null;
|
||||
if (irecipe instanceof ShapedRecipes)
|
||||
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
|
||||
else if (irecipe instanceof ShapedOreRecipe)
|
||||
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
if (recipe == null)
|
||||
continue;
|
||||
|
||||
recipe.computeVisuals();
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
recipe.computeVisuals();
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance.getRecipeList()) {
|
||||
CachedShapedRecipe recipe = null;
|
||||
if (irecipe instanceof ShapedRecipes)
|
||||
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
|
||||
else if (irecipe instanceof ShapedOreRecipe)
|
||||
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
for (IRecipe irecipe : (List<IRecipe>) RollingMachineRecipe.instance
|
||||
.getRecipeList())
|
||||
{
|
||||
CachedShapedRecipe recipe = null;
|
||||
if (irecipe instanceof ShapedRecipes)
|
||||
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
|
||||
else if (irecipe instanceof ShapedOreRecipe)
|
||||
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
|
||||
|
||||
if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem()))
|
||||
continue;
|
||||
if (recipe == null
|
||||
|| !recipe.contains(recipe.ingredients,
|
||||
ingredient.getItem()))
|
||||
continue;
|
||||
|
||||
recipe.computeVisuals();
|
||||
if (recipe.contains(recipe.ingredients, ingredient)) {
|
||||
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
recipe.computeVisuals();
|
||||
if (recipe.contains(recipe.ingredients, ingredient))
|
||||
{
|
||||
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
//Copy and pasted from https://github.com/Chicken-Bones/NotEnoughItems/blob/master/src/codechicken/nei/recipe/ShapelessRecipeHandler.java
|
||||
package techreborn.compat.nei;
|
||||
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.recipe.ShapelessRecipeHandler;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
@ -10,95 +11,116 @@ import net.minecraft.item.crafting.ShapelessRecipes;
|
|||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import techreborn.api.RollingMachineRecipe;
|
||||
import techreborn.client.gui.GuiRollingMachine;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.recipe.ShapelessRecipeHandler;
|
||||
|
||||
public class ShapelessRollingMachineHandler extends ShapelessRecipeHandler {
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GuiRollingMachine.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GuiRollingMachine.class;
|
||||
}
|
||||
|
||||
public String getRecipeName() {
|
||||
return "Shapeless Rolling Machine";
|
||||
}
|
||||
public String getRecipeName()
|
||||
{
|
||||
return "Shapeless Rolling Machine";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18), "rollingcraftingnoshape"));
|
||||
}
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(84, 23, 24, 18),
|
||||
"rollingcraftingnoshape"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "rollingcraftingnoshape";
|
||||
}
|
||||
@Override
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "rollingcraftingnoshape";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("rollingcraftingnoshape") && getClass() == ShapelessRollingMachineHandler.class) {
|
||||
List<IRecipe> allrecipes = RollingMachineRecipe.instance.getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes) {
|
||||
CachedShapelessRecipe recipe = null;
|
||||
if (irecipe instanceof ShapelessRecipes)
|
||||
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
|
||||
else if (irecipe instanceof ShapelessOreRecipe)
|
||||
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if (outputId.equals("rollingcraftingnoshape")
|
||||
&& getClass() == ShapelessRollingMachineHandler.class)
|
||||
{
|
||||
List<IRecipe> allrecipes = RollingMachineRecipe.instance
|
||||
.getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes)
|
||||
{
|
||||
CachedShapelessRecipe recipe = null;
|
||||
if (irecipe instanceof ShapelessRecipes)
|
||||
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
|
||||
else if (irecipe instanceof ShapelessOreRecipe)
|
||||
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
if (recipe == null)
|
||||
continue;
|
||||
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
} else
|
||||
{
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
List<IRecipe> allrecipes = RollingMachineRecipe.instance.getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
|
||||
CachedShapelessRecipe recipe = null;
|
||||
if (irecipe instanceof ShapelessRecipes)
|
||||
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
|
||||
else if (irecipe instanceof ShapelessOreRecipe)
|
||||
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
List<IRecipe> allrecipes = RollingMachineRecipe.instance
|
||||
.getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes)
|
||||
{
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(
|
||||
irecipe.getRecipeOutput(), result))
|
||||
{
|
||||
CachedShapelessRecipe recipe = null;
|
||||
if (irecipe instanceof ShapelessRecipes)
|
||||
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
|
||||
else if (irecipe instanceof ShapelessOreRecipe)
|
||||
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
if (recipe == null)
|
||||
continue;
|
||||
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
List<IRecipe> allrecipes = RollingMachineRecipe.instance.getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes) {
|
||||
CachedShapelessRecipe recipe = null;
|
||||
if (irecipe instanceof ShapelessRecipes)
|
||||
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
|
||||
else if (irecipe instanceof ShapelessOreRecipe)
|
||||
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
List<IRecipe> allrecipes = RollingMachineRecipe.instance
|
||||
.getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes)
|
||||
{
|
||||
CachedShapelessRecipe recipe = null;
|
||||
if (irecipe instanceof ShapelessRecipes)
|
||||
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
|
||||
else if (irecipe instanceof ShapelessOreRecipe)
|
||||
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
|
||||
|
||||
if (recipe == null)
|
||||
continue;
|
||||
if (recipe == null)
|
||||
continue;
|
||||
|
||||
if (recipe.contains(recipe.ingredients, ingredient)) {
|
||||
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (recipe.contains(recipe.ingredients, ingredient))
|
||||
{
|
||||
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
|
||||
arecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private CachedShapelessRecipe shapelessRecipe(ShapelessRecipes recipe) {
|
||||
if(recipe.recipeItems == null)
|
||||
return null;
|
||||
private CachedShapelessRecipe shapelessRecipe(ShapelessRecipes recipe)
|
||||
{
|
||||
if (recipe.recipeItems == null)
|
||||
return null;
|
||||
|
||||
return new CachedShapelessRecipe(recipe.recipeItems, recipe.getRecipeOutput());
|
||||
}
|
||||
return new CachedShapelessRecipe(recipe.recipeItems,
|
||||
recipe.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package techreborn.compat.recipes;
|
||||
|
||||
import techreborn.compat.waila.CompatModuleWaila;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
|
||||
public class RecipeManager {
|
||||
|
||||
public static void init()
|
||||
|
||||
public static void init()
|
||||
{
|
||||
if (Loader.isModLoaded("BuildCraft|Factory"))
|
||||
{
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
package techreborn.compat.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.BuildCraftFactory;
|
||||
import techreborn.util.RecipeRemover;
|
||||
import buildcraft.BuildCraftFactory;
|
||||
|
||||
public class RecipesBuildcraft {
|
||||
|
||||
|
||||
public static void init()
|
||||
{
|
||||
removeRecipes();
|
||||
addRecipies();
|
||||
}
|
||||
|
||||
|
||||
public static void removeRecipes()
|
||||
{
|
||||
RecipeRemover.removeAnyRecipe(new ItemStack(BuildCraftFactory.quarryBlock));
|
||||
RecipeRemover.removeAnyRecipe(new ItemStack(
|
||||
BuildCraftFactory.quarryBlock));
|
||||
}
|
||||
|
||||
|
||||
public static void addRecipies()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package techreborn.compat.recipes;
|
||||
|
||||
public class RecipesThermalExpansion {
|
||||
//TODO remove basic machine frame recipe
|
||||
//TODO replace iron in recipe to steel
|
||||
// TODO remove basic machine frame recipe
|
||||
// TODO replace iron in recipe to steel
|
||||
|
||||
}
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
package techreborn.compat.waila;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
import techreborn.tiles.TileMachineBase;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
|
||||
public class CompatModuleWaila {
|
||||
|
||||
public void init(FMLInitializationEvent event) {
|
||||
FMLInterModComms.sendMessage("Waila", "register", getClass().getName() + ".callbackRegister");
|
||||
}
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
FMLInterModComms.sendMessage("Waila", "register", getClass().getName()
|
||||
+ ".callbackRegister");
|
||||
}
|
||||
|
||||
public static void callbackRegister(IWailaRegistrar registrar) {
|
||||
registrar.registerBodyProvider(new WailaProviderMachines(), TileMachineBase.class);
|
||||
}
|
||||
public static void callbackRegister(IWailaRegistrar registrar)
|
||||
{
|
||||
registrar.registerBodyProvider(new WailaProviderMachines(),
|
||||
TileMachineBase.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package techreborn.compat.waila;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
@ -10,46 +13,53 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import techreborn.tiles.TileMachineBase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WailaProviderMachines implements IWailaDataProvider {
|
||||
|
||||
private List<String> info = new ArrayList<String>();
|
||||
private List<String> info = new ArrayList<String>();
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack item, List<String> tip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack item, List<String> tip,
|
||||
IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
|
||||
TileMachineBase machine = (TileMachineBase) accessor.getTileEntity();
|
||||
TileMachineBase machine = (TileMachineBase) accessor.getTileEntity();
|
||||
|
||||
machine.addWailaInfo(info);
|
||||
tip.addAll(info);
|
||||
info.clear();
|
||||
machine.addWailaInfo(info);
|
||||
tip.addAll(info);
|
||||
info.clear();
|
||||
|
||||
return tip;
|
||||
}
|
||||
return tip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack item, List<String> tip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack item, List<String> tip,
|
||||
IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
|
||||
return tip;
|
||||
}
|
||||
return tip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack item, List<String> tip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack item, List<String> tip,
|
||||
IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
|
||||
return tip;
|
||||
}
|
||||
return tip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config)
|
||||
{
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World w, int x, int y, int z) {
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te,
|
||||
NBTTagCompound tag, World w, int x, int y, int z)
|
||||
{
|
||||
|
||||
return tag;
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,260 +1,415 @@
|
|||
package techreborn.config;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ConfigTechReborn {
|
||||
private static ConfigTechReborn instance = null;
|
||||
public static String CATEGORY_WORLD = "world";
|
||||
public static String CATEGORY_POWER = "power";
|
||||
public static String CATEGORY_CRAFTING = "crafting";
|
||||
private static ConfigTechReborn instance = null;
|
||||
public static String CATEGORY_WORLD = "world";
|
||||
public static String CATEGORY_POWER = "power";
|
||||
public static String CATEGORY_CRAFTING = "crafting";
|
||||
|
||||
//WORLDGEN
|
||||
public static boolean GalenaOreTrue;
|
||||
public static boolean IridiumOreTrue;
|
||||
public static boolean RubyOreTrue;
|
||||
public static boolean SapphireOreTrue;
|
||||
public static boolean BauxiteOreTrue;
|
||||
public static boolean CopperOreTrue;
|
||||
public static boolean TinOreTrue;
|
||||
public static boolean LeadOreTrue;
|
||||
public static boolean SilverOreTrue;
|
||||
// WORLDGEN
|
||||
public static boolean GalenaOreTrue;
|
||||
public static boolean IridiumOreTrue;
|
||||
public static boolean RubyOreTrue;
|
||||
public static boolean SapphireOreTrue;
|
||||
public static boolean BauxiteOreTrue;
|
||||
public static boolean CopperOreTrue;
|
||||
public static boolean TinOreTrue;
|
||||
public static boolean LeadOreTrue;
|
||||
public static boolean SilverOreTrue;
|
||||
|
||||
public static boolean PyriteOreTrue;
|
||||
public static boolean CinnabarOreTrue;
|
||||
public static boolean SphaleriteOreTrue;
|
||||
public static boolean TungstenOreTrue;
|
||||
public static boolean SheldoniteOreTrue;
|
||||
public static boolean OlivineOreTrue;
|
||||
public static boolean SodaliteOreTrue;
|
||||
public static boolean PyriteOreTrue;
|
||||
public static boolean CinnabarOreTrue;
|
||||
public static boolean SphaleriteOreTrue;
|
||||
public static boolean TungstenOreTrue;
|
||||
public static boolean SheldoniteOreTrue;
|
||||
public static boolean OlivineOreTrue;
|
||||
public static boolean SodaliteOreTrue;
|
||||
|
||||
//Power
|
||||
public static int ThermalGenertaorOutput;
|
||||
public static int CentrifugeInputTick;
|
||||
//Charge
|
||||
public static int AdvancedDrillCharge;
|
||||
public static int LapotronPackCharge;
|
||||
public static int LithiumBatpackCharge;
|
||||
public static int OmniToolCharge;
|
||||
public static int RockCutterCharge;
|
||||
public static int GravityCharge;
|
||||
public static int CentrifugeCharge;
|
||||
public static int ThermalGeneratorCharge;
|
||||
//Tier
|
||||
public static int AdvancedDrillTier;
|
||||
public static int LapotronPackTier;
|
||||
public static int LithiumBatpackTier;
|
||||
public static int OmniToolTier;
|
||||
public static int RockCutterTier;
|
||||
public static int GravityTier;
|
||||
public static int CentrifugeTier;
|
||||
public static int ThermalGeneratorTier;
|
||||
//Crafting
|
||||
public static boolean ExpensiveMacerator;
|
||||
public static boolean ExpensiveDrill;
|
||||
public static boolean ExpensiveDiamondDrill;
|
||||
public static boolean ExpensiveSolar;
|
||||
// Power
|
||||
public static int ThermalGenertaorOutput;
|
||||
public static int CentrifugeInputTick;
|
||||
// Charge
|
||||
public static int AdvancedDrillCharge;
|
||||
public static int LapotronPackCharge;
|
||||
public static int LithiumBatpackCharge;
|
||||
public static int OmniToolCharge;
|
||||
public static int RockCutterCharge;
|
||||
public static int GravityCharge;
|
||||
public static int CentrifugeCharge;
|
||||
public static int ThermalGeneratorCharge;
|
||||
// Tier
|
||||
public static int AdvancedDrillTier;
|
||||
public static int LapotronPackTier;
|
||||
public static int LithiumBatpackTier;
|
||||
public static int OmniToolTier;
|
||||
public static int RockCutterTier;
|
||||
public static int GravityTier;
|
||||
public static int CentrifugeTier;
|
||||
public static int ThermalGeneratorTier;
|
||||
// Crafting
|
||||
public static boolean ExpensiveMacerator;
|
||||
public static boolean ExpensiveDrill;
|
||||
public static boolean ExpensiveDiamondDrill;
|
||||
public static boolean ExpensiveSolar;
|
||||
|
||||
public static Configuration config;
|
||||
|
||||
public static Configuration config;
|
||||
private ConfigTechReborn(File configFile)
|
||||
{
|
||||
config = new Configuration(configFile);
|
||||
config.load();
|
||||
|
||||
private ConfigTechReborn(File configFile) {
|
||||
config = new Configuration(configFile);
|
||||
config.load();
|
||||
ConfigTechReborn.Configs();
|
||||
|
||||
ConfigTechReborn.Configs();
|
||||
config.save();
|
||||
|
||||
config.save();
|
||||
}
|
||||
|
||||
}
|
||||
public static ConfigTechReborn initialize(File configFile)
|
||||
{
|
||||
|
||||
public static ConfigTechReborn initialize(File configFile) {
|
||||
if (instance == null)
|
||||
instance = new ConfigTechReborn(configFile);
|
||||
else
|
||||
throw new IllegalStateException(
|
||||
"Cannot initialize TechReborn Config twice");
|
||||
|
||||
if (instance == null)
|
||||
instance = new ConfigTechReborn(configFile);
|
||||
else
|
||||
throw new IllegalStateException(
|
||||
"Cannot initialize TechReborn Config twice");
|
||||
return instance;
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
public static ConfigTechReborn instance()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
|
||||
public static ConfigTechReborn instance() {
|
||||
if (instance == null) {
|
||||
throw new IllegalStateException(
|
||||
"Instance of TechReborn Config requested before initialization");
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
throw new IllegalStateException(
|
||||
"Instance of TechReborn Config requested before initialization");
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
public static void Configs()
|
||||
{
|
||||
GalenaOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.galenaOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.galenaOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
IridiumOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.iridiumOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.iridiumOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
RubyOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.rubyOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.rubyOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
SapphireOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.sapphireOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.sapphireOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
BauxiteOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.bauxiteOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.bauxiteOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
CopperOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.copperOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.copperOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
TinOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.tinOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.tinOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
LeadOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.leadOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.leadOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
SilverOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.silverOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.silverOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
PyriteOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.pyriteOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.pyriteOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
CinnabarOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.cinnabarOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.cinnabarOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
SphaleriteOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.sphaleriteOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.sphaleriteOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
TungstenOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.tungstonOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.tungstonOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
SheldoniteOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.sheldoniteOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.sheldoniteOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
OlivineOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.olivineOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.olivineOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
SodaliteOreTrue = config
|
||||
.get(CATEGORY_WORLD,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.sodaliteOre"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allow.sodaliteOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
|
||||
public static void Configs() {
|
||||
GalenaOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.galenaOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.galenaOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
IridiumOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.iridiumOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.iridiumOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
RubyOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.rubyOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.rubyOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
SapphireOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.sapphireOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.sapphireOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
BauxiteOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.bauxiteOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.bauxiteOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
CopperOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.copperOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.copperOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
TinOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.tinOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.tinOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
LeadOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.leadOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.leadOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
SilverOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.silverOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.silverOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
PyriteOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.pyriteOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.pyriteOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
CinnabarOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.cinnabarOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.cinnabarOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
SphaleriteOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.sphaleriteOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.sphaleriteOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
TungstenOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.tungstonOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.tungstonOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
SheldoniteOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.sheldoniteOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.sheldoniteOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
OlivineOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.olivineOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.olivineOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
SodaliteOreTrue = config.get(CATEGORY_WORLD,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.sodaliteOre"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allow.sodaliteOre.tooltip"))
|
||||
.getBoolean(true);
|
||||
// Power
|
||||
ThermalGenertaorOutput = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.thermalGeneratorPower"),
|
||||
30,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.thermalGeneratorPower.tooltip"))
|
||||
.getInt();
|
||||
CentrifugeInputTick = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.centrifugePowerUsage"),
|
||||
5,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.centrifugePowerUsage.tooltip"))
|
||||
.getInt();
|
||||
|
||||
//Power
|
||||
ThermalGenertaorOutput = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.thermalGeneratorPower"), 30,
|
||||
StatCollector.translateToLocal("config.techreborn.thermalGeneratorPower.tooltip"))
|
||||
.getInt();
|
||||
CentrifugeInputTick = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.centrifugePowerUsage"), 5,
|
||||
StatCollector.translateToLocal("config.techreborn.centrifugePowerUsage.tooltip"))
|
||||
.getInt();
|
||||
|
||||
//Charge
|
||||
AdvancedDrillCharge = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.advancedDrillMaxCharge"), 60000,
|
||||
StatCollector.translateToLocal("config.techreborn.advancedDrillMaxCharge.tooltip"))
|
||||
.getInt();
|
||||
LapotronPackCharge = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.lapotronPackMaxCharge"), 100000000,
|
||||
StatCollector.translateToLocal("config.techreborn.lapotronPackMaxCharge.tooltop"))
|
||||
.getInt();
|
||||
LithiumBatpackCharge = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.lithiumBatpackMaxCharge"), 4000000,
|
||||
StatCollector.translateToLocal("config.techreborn.lithiumBatpackMaxCharge.tooltip"))
|
||||
.getInt();
|
||||
OmniToolCharge = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.omniToolMaxCharge"), 20000,
|
||||
StatCollector.translateToLocal("config.techreborn.omniToolMaxCharge.tooltip"))
|
||||
.getInt();
|
||||
RockCutterCharge = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.rockCutterMaxCharge"), 10000,
|
||||
StatCollector.translateToLocal("config.techreborn.rockCutterMaxCharge.tooltip"))
|
||||
.getInt();
|
||||
GravityCharge = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.gravityChestplateMaxCharge"), 100000,
|
||||
StatCollector.translateToLocal("config.techreborn.gravityChestplateMaxCharge.tooltip"))
|
||||
.getInt();
|
||||
CentrifugeCharge = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.centrifugeMaxCharge"), 1000000,
|
||||
StatCollector.translateToLocal("config.techreborn.centrifugeMaxCharge.tooltip"))
|
||||
.getInt();
|
||||
ThermalGeneratorCharge = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.thermalGeneratorMaxCharge"), 1000000,
|
||||
StatCollector.translateToLocal("config.techreborn.thermalGeneratorMaxCharge.tooltip"))
|
||||
.getInt();
|
||||
|
||||
//Teir
|
||||
AdvancedDrillTier = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.advancedDrillTier"), 2,
|
||||
StatCollector.translateToLocal("config.techreborn.advancedDrillTier.tooltip"))
|
||||
.getInt();
|
||||
LapotronPackTier = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.lapotronPackTier"), 2,
|
||||
StatCollector.translateToLocal("config.techreborn.lapotronPackTier.tooltip"))
|
||||
.getInt();
|
||||
LithiumBatpackTier = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.lithiumBatpackTier"), 3,
|
||||
StatCollector.translateToLocal("config.techreborn.lithiumBatpackTier.tooltip"))
|
||||
.getInt();
|
||||
OmniToolTier = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.omniToolTier"), 3,
|
||||
StatCollector.translateToLocal("config.techreborn.omniToolTier.tooltip"))
|
||||
.getInt();
|
||||
RockCutterTier = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.rockCutterTier"), 3,
|
||||
StatCollector.translateToLocal("config.techreborn.rockCutterTier.tooltip"))
|
||||
.getInt();
|
||||
GravityTier = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.gravityChestplateTier"), 3,
|
||||
StatCollector.translateToLocal("config.techreborn.gravityChestplateTier.tooltip"))
|
||||
.getInt();
|
||||
CentrifugeTier = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.centrifugeTier"), 1,
|
||||
StatCollector.translateToLocal("config.techreborn.centrifugeTier.tooltip"))
|
||||
.getInt();
|
||||
ThermalGeneratorTier = config.get(CATEGORY_POWER,
|
||||
StatCollector.translateToLocal("config.techreborn.thermalGeneratorTier"), 1,
|
||||
StatCollector.translateToLocal("config.techreborn.thermalGeneratorTier.tooltip"))
|
||||
.getInt();
|
||||
// Charge
|
||||
AdvancedDrillCharge = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.advancedDrillMaxCharge"),
|
||||
60000,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.advancedDrillMaxCharge.tooltip"))
|
||||
.getInt();
|
||||
LapotronPackCharge = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.lapotronPackMaxCharge"),
|
||||
100000000,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.lapotronPackMaxCharge.tooltop"))
|
||||
.getInt();
|
||||
LithiumBatpackCharge = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.lithiumBatpackMaxCharge"),
|
||||
4000000,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.lithiumBatpackMaxCharge.tooltip"))
|
||||
.getInt();
|
||||
OmniToolCharge = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.omniToolMaxCharge"),
|
||||
20000,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.omniToolMaxCharge.tooltip"))
|
||||
.getInt();
|
||||
RockCutterCharge = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.rockCutterMaxCharge"),
|
||||
10000,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.rockCutterMaxCharge.tooltip"))
|
||||
.getInt();
|
||||
GravityCharge = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.gravityChestplateMaxCharge"),
|
||||
100000,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.gravityChestplateMaxCharge.tooltip"))
|
||||
.getInt();
|
||||
CentrifugeCharge = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.centrifugeMaxCharge"),
|
||||
1000000,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.centrifugeMaxCharge.tooltip"))
|
||||
.getInt();
|
||||
ThermalGeneratorCharge = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.thermalGeneratorMaxCharge"),
|
||||
1000000,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.thermalGeneratorMaxCharge.tooltip"))
|
||||
.getInt();
|
||||
|
||||
//Crafting
|
||||
ExpensiveMacerator = config.get(CATEGORY_CRAFTING,
|
||||
StatCollector.translateToLocal("config.techreborn.allowExpensiveMacerator"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allowExpensiveMacerator.tooltip"))
|
||||
.getBoolean(true);
|
||||
ExpensiveDrill = config.get(CATEGORY_CRAFTING,
|
||||
StatCollector.translateToLocal("config.techreborn.allowExpensiveDrill"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allowExpensiveDrill.tooltip"))
|
||||
.getBoolean(true);
|
||||
ExpensiveDiamondDrill = config.get(CATEGORY_CRAFTING,
|
||||
StatCollector.translateToLocal("config.techreborn.allowExpensiveDiamondDrill"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allowExpensiveDiamondDrill.tooltip"))
|
||||
.getBoolean(true);
|
||||
ExpensiveSolar = config.get(CATEGORY_CRAFTING,
|
||||
StatCollector.translateToLocal("config.techreborn.allowExpensiveSolarPanels"), true,
|
||||
StatCollector.translateToLocal("config.techreborn.allowExpensiveSolarPanels.tooltip"))
|
||||
.getBoolean(true);
|
||||
// Teir
|
||||
AdvancedDrillTier = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.advancedDrillTier"),
|
||||
2,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.advancedDrillTier.tooltip"))
|
||||
.getInt();
|
||||
LapotronPackTier = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.lapotronPackTier"),
|
||||
2,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.lapotronPackTier.tooltip"))
|
||||
.getInt();
|
||||
LithiumBatpackTier = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.lithiumBatpackTier"),
|
||||
3,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.lithiumBatpackTier.tooltip"))
|
||||
.getInt();
|
||||
OmniToolTier = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.omniToolTier"),
|
||||
3,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.omniToolTier.tooltip"))
|
||||
.getInt();
|
||||
RockCutterTier = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.rockCutterTier"),
|
||||
3,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.rockCutterTier.tooltip"))
|
||||
.getInt();
|
||||
GravityTier = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.gravityChestplateTier"),
|
||||
3,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.gravityChestplateTier.tooltip"))
|
||||
.getInt();
|
||||
CentrifugeTier = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.centrifugeTier"),
|
||||
1,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.centrifugeTier.tooltip"))
|
||||
.getInt();
|
||||
ThermalGeneratorTier = config
|
||||
.get(CATEGORY_POWER,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.thermalGeneratorTier"),
|
||||
1,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.thermalGeneratorTier.tooltip"))
|
||||
.getInt();
|
||||
|
||||
if (config.hasChanged())
|
||||
config.save();
|
||||
}
|
||||
// Crafting
|
||||
ExpensiveMacerator = config
|
||||
.get(CATEGORY_CRAFTING,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allowExpensiveMacerator"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allowExpensiveMacerator.tooltip"))
|
||||
.getBoolean(true);
|
||||
ExpensiveDrill = config
|
||||
.get(CATEGORY_CRAFTING,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allowExpensiveDrill"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allowExpensiveDrill.tooltip"))
|
||||
.getBoolean(true);
|
||||
ExpensiveDiamondDrill = config
|
||||
.get(CATEGORY_CRAFTING,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allowExpensiveDiamondDrill"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allowExpensiveDiamondDrill.tooltip"))
|
||||
.getBoolean(true);
|
||||
ExpensiveSolar = config
|
||||
.get(CATEGORY_CRAFTING,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allowExpensiveSolarPanels"),
|
||||
true,
|
||||
StatCollector
|
||||
.translateToLocal("config.techreborn.allowExpensiveSolarPanels.tooltip"))
|
||||
.getBoolean(true);
|
||||
|
||||
if (config.hasChanged())
|
||||
config.save();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,121 +1,141 @@
|
|||
package techreborn.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import cpw.mods.fml.client.config.DummyConfigElement;
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
import cpw.mods.fml.client.config.GuiConfigEntries;
|
||||
import cpw.mods.fml.client.config.GuiConfigEntries.CategoryEntry;
|
||||
import cpw.mods.fml.client.config.IConfigElement;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TechRebornConfigGui extends GuiConfig {
|
||||
public TechRebornConfigGui(GuiScreen top) {
|
||||
super(top, getConfigCategories(), "TechReborn", false, false,
|
||||
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config
|
||||
.toString()));
|
||||
}
|
||||
public TechRebornConfigGui(GuiScreen top)
|
||||
{
|
||||
super(top, getConfigCategories(), "TechReborn", false, false, GuiConfig
|
||||
.getAbridgedConfigPath(ConfigTechReborn.config.toString()));
|
||||
}
|
||||
|
||||
private static List<IConfigElement> getConfigCategories() {
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
list.add(new DummyConfigElement.DummyCategoryElement(StatCollector.translateToLocal("config.techreborn.category.general"),
|
||||
"tr.configgui.category.trGeneral", TRGeneral.class));
|
||||
list.add(new DummyConfigElement.DummyCategoryElement(StatCollector.translateToLocal("config.techreborn.category.world"),
|
||||
"tr.configgui.category.trWorld", TRWORLD.class));
|
||||
list.add(new DummyConfigElement.DummyCategoryElement(StatCollector.translateToLocal("config.techreborn.category.power"),
|
||||
"tr.configgui.category.trPower", TRPOWER.class));
|
||||
list.add(new DummyConfigElement.DummyCategoryElement(StatCollector.translateToLocal("config.techreborn.category.crafting"),
|
||||
"tr.configgui.category.trCrafting", TRCRAFTING.class));
|
||||
private static List<IConfigElement> getConfigCategories()
|
||||
{
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
list.add(new DummyConfigElement.DummyCategoryElement(StatCollector
|
||||
.translateToLocal("config.techreborn.category.general"),
|
||||
"tr.configgui.category.trGeneral", TRGeneral.class));
|
||||
list.add(new DummyConfigElement.DummyCategoryElement(StatCollector
|
||||
.translateToLocal("config.techreborn.category.world"),
|
||||
"tr.configgui.category.trWorld", TRWORLD.class));
|
||||
list.add(new DummyConfigElement.DummyCategoryElement(StatCollector
|
||||
.translateToLocal("config.techreborn.category.power"),
|
||||
"tr.configgui.category.trPower", TRPOWER.class));
|
||||
list.add(new DummyConfigElement.DummyCategoryElement(StatCollector
|
||||
.translateToLocal("config.techreborn.category.crafting"),
|
||||
"tr.configgui.category.trCrafting", TRCRAFTING.class));
|
||||
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static class TRGeneral extends CategoryEntry {
|
||||
public static class TRGeneral extends CategoryEntry {
|
||||
|
||||
public TRGeneral(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement) {
|
||||
super(owningScreen, owningEntryList, configElement);
|
||||
}
|
||||
public TRGeneral(GuiConfig owningScreen,
|
||||
GuiConfigEntries owningEntryList, IConfigElement configElement)
|
||||
{
|
||||
super(owningScreen, owningEntryList, configElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen() {
|
||||
return new GuiConfig(this.owningScreen,
|
||||
(new ConfigElement(ConfigTechReborn.config
|
||||
.getCategory(Configuration.CATEGORY_GENERAL)))
|
||||
.getChildElements(), this.owningScreen.modID,
|
||||
Configuration.CATEGORY_GENERAL,
|
||||
this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
|
||||
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
|
||||
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config.toString()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen()
|
||||
{
|
||||
return new GuiConfig(this.owningScreen,
|
||||
(new ConfigElement(ConfigTechReborn.config
|
||||
.getCategory(Configuration.CATEGORY_GENERAL)))
|
||||
.getChildElements(), this.owningScreen.modID,
|
||||
Configuration.CATEGORY_GENERAL,
|
||||
this.configElement.requiresWorldRestart()
|
||||
|| this.owningScreen.allRequireWorldRestart,
|
||||
this.configElement.requiresMcRestart()
|
||||
|| this.owningScreen.allRequireMcRestart,
|
||||
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config
|
||||
.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
// World
|
||||
public static class TRWORLD extends CategoryEntry {
|
||||
public TRWORLD(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement) {
|
||||
super(owningScreen, owningEntryList, configElement);
|
||||
}
|
||||
// World
|
||||
public static class TRWORLD extends CategoryEntry {
|
||||
public TRWORLD(GuiConfig owningScreen,
|
||||
GuiConfigEntries owningEntryList, IConfigElement configElement)
|
||||
{
|
||||
super(owningScreen, owningEntryList, configElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen() {
|
||||
return new GuiConfig(this.owningScreen,
|
||||
(new ConfigElement(ConfigTechReborn.config
|
||||
.getCategory(ConfigTechReborn.CATEGORY_WORLD)))
|
||||
.getChildElements(), this.owningScreen.modID,
|
||||
Configuration.CATEGORY_GENERAL,
|
||||
this.configElement.requiresWorldRestart()
|
||||
|| this.owningScreen.allRequireWorldRestart,
|
||||
this.configElement.requiresMcRestart()
|
||||
|| this.owningScreen.allRequireMcRestart,
|
||||
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config
|
||||
.toString()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen()
|
||||
{
|
||||
return new GuiConfig(this.owningScreen,
|
||||
(new ConfigElement(ConfigTechReborn.config
|
||||
.getCategory(ConfigTechReborn.CATEGORY_WORLD)))
|
||||
.getChildElements(), this.owningScreen.modID,
|
||||
Configuration.CATEGORY_GENERAL,
|
||||
this.configElement.requiresWorldRestart()
|
||||
|| this.owningScreen.allRequireWorldRestart,
|
||||
this.configElement.requiresMcRestart()
|
||||
|| this.owningScreen.allRequireMcRestart,
|
||||
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config
|
||||
.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
// Power
|
||||
public static class TRPOWER extends CategoryEntry {
|
||||
public TRPOWER(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement) {
|
||||
super(owningScreen, owningEntryList, configElement);
|
||||
}
|
||||
// Power
|
||||
public static class TRPOWER extends CategoryEntry {
|
||||
public TRPOWER(GuiConfig owningScreen,
|
||||
GuiConfigEntries owningEntryList, IConfigElement configElement)
|
||||
{
|
||||
super(owningScreen, owningEntryList, configElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen() {
|
||||
return new GuiConfig(this.owningScreen,
|
||||
(new ConfigElement(ConfigTechReborn.config
|
||||
.getCategory(ConfigTechReborn.CATEGORY_POWER)))
|
||||
.getChildElements(), this.owningScreen.modID,
|
||||
Configuration.CATEGORY_GENERAL,
|
||||
this.configElement.requiresWorldRestart()
|
||||
|| this.owningScreen.allRequireWorldRestart,
|
||||
this.configElement.requiresMcRestart()
|
||||
|| this.owningScreen.allRequireMcRestart,
|
||||
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config
|
||||
.toString()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen()
|
||||
{
|
||||
return new GuiConfig(this.owningScreen,
|
||||
(new ConfigElement(ConfigTechReborn.config
|
||||
.getCategory(ConfigTechReborn.CATEGORY_POWER)))
|
||||
.getChildElements(), this.owningScreen.modID,
|
||||
Configuration.CATEGORY_GENERAL,
|
||||
this.configElement.requiresWorldRestart()
|
||||
|| this.owningScreen.allRequireWorldRestart,
|
||||
this.configElement.requiresMcRestart()
|
||||
|| this.owningScreen.allRequireMcRestart,
|
||||
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config
|
||||
.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
// Crafting
|
||||
public static class TRCRAFTING extends CategoryEntry {
|
||||
public TRCRAFTING(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement) {
|
||||
super(owningScreen, owningEntryList, configElement);
|
||||
}
|
||||
// Crafting
|
||||
public static class TRCRAFTING extends CategoryEntry {
|
||||
public TRCRAFTING(GuiConfig owningScreen,
|
||||
GuiConfigEntries owningEntryList, IConfigElement configElement)
|
||||
{
|
||||
super(owningScreen, owningEntryList, configElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen() {
|
||||
return new GuiConfig(this.owningScreen,
|
||||
(new ConfigElement(ConfigTechReborn.config
|
||||
.getCategory(ConfigTechReborn.CATEGORY_CRAFTING)))
|
||||
.getChildElements(), this.owningScreen.modID,
|
||||
Configuration.CATEGORY_GENERAL,
|
||||
this.configElement.requiresWorldRestart()
|
||||
|| this.owningScreen.allRequireWorldRestart,
|
||||
this.configElement.requiresMcRestart()
|
||||
|| this.owningScreen.allRequireMcRestart,
|
||||
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config
|
||||
.toString()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen()
|
||||
{
|
||||
return new GuiConfig(this.owningScreen,
|
||||
(new ConfigElement(ConfigTechReborn.config
|
||||
.getCategory(ConfigTechReborn.CATEGORY_CRAFTING)))
|
||||
.getChildElements(), this.owningScreen.modID,
|
||||
Configuration.CATEGORY_GENERAL,
|
||||
this.configElement.requiresWorldRestart()
|
||||
|| this.owningScreen.allRequireWorldRestart,
|
||||
this.configElement.requiresMcRestart()
|
||||
|| this.owningScreen.allRequireMcRestart,
|
||||
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config
|
||||
.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +1,35 @@
|
|||
package techreborn.config;
|
||||
|
||||
import cpw.mods.fml.client.IModGuiFactory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import cpw.mods.fml.client.IModGuiFactory;
|
||||
|
||||
public class TechRebornGUIFactory implements IModGuiFactory {
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||
return TechRebornConfigGui.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass()
|
||||
{
|
||||
return TechRebornConfigGui.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(
|
||||
RuntimeOptionCategoryElement element) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(
|
||||
RuntimeOptionCategoryElement element)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,104 +1,150 @@
|
|||
package techreborn.init;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import techreborn.blocks.*;
|
||||
import techreborn.blocks.BlockBlastFurnace;
|
||||
import techreborn.blocks.BlockCentrifuge;
|
||||
import techreborn.blocks.BlockMachineCasing;
|
||||
import techreborn.blocks.BlockOre;
|
||||
import techreborn.blocks.BlockQuantumChest;
|
||||
import techreborn.blocks.BlockQuantumTank;
|
||||
import techreborn.blocks.BlockRollingMachine;
|
||||
import techreborn.blocks.BlockStorage;
|
||||
import techreborn.blocks.BlockThermalGenerator;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.itemblocks.ItemBlockMachineCasing;
|
||||
import techreborn.itemblocks.ItemBlockOre;
|
||||
import techreborn.itemblocks.ItemBlockQuantumChest;
|
||||
import techreborn.itemblocks.ItemBlockQuantumTank;
|
||||
import techreborn.itemblocks.ItemBlockStorage;
|
||||
import techreborn.tiles.*;
|
||||
import techreborn.tiles.TileBlastFurnace;
|
||||
import techreborn.tiles.TileCentrifuge;
|
||||
import techreborn.tiles.TileMachineCasing;
|
||||
import techreborn.tiles.TileQuantumChest;
|
||||
import techreborn.tiles.TileQuantumTank;
|
||||
import techreborn.tiles.TileRollingMachine;
|
||||
import techreborn.tiles.TileThermalGenerator;
|
||||
import techreborn.util.LogHelper;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class ModBlocks {
|
||||
|
||||
public static Block thermalGenerator;
|
||||
public static Block quantumTank;
|
||||
public static Block quantumChest;
|
||||
public static Block centrifuge;
|
||||
public static Block RollingMachine;
|
||||
public static Block MachineCasing;
|
||||
public static Block BlastFurnace;
|
||||
public static Block thermalGenerator;
|
||||
public static Block quantumTank;
|
||||
public static Block quantumChest;
|
||||
public static Block centrifuge;
|
||||
public static Block RollingMachine;
|
||||
public static Block MachineCasing;
|
||||
public static Block BlastFurnace;
|
||||
|
||||
public static Block ore;
|
||||
public static Block storage;
|
||||
public static Block ore;
|
||||
public static Block storage;
|
||||
|
||||
public static void init() {
|
||||
thermalGenerator = new BlockThermalGenerator().setBlockName("techreborn.thermalGenerator").setBlockTextureName("techreborn:ThermalGenerator_other").setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(thermalGenerator, "techreborn.thermalGenerator");
|
||||
GameRegistry.registerTileEntity(TileThermalGenerator.class, "TileThermalGenerator");
|
||||
public static void init()
|
||||
{
|
||||
thermalGenerator = new BlockThermalGenerator()
|
||||
.setBlockName("techreborn.thermalGenerator")
|
||||
.setBlockTextureName("techreborn:ThermalGenerator_other")
|
||||
.setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(thermalGenerator,
|
||||
"techreborn.thermalGenerator");
|
||||
GameRegistry.registerTileEntity(TileThermalGenerator.class,
|
||||
"TileThermalGenerator");
|
||||
|
||||
quantumTank = new BlockQuantumTank().setBlockName("techreborn.quantumTank").setBlockTextureName("techreborn:quantumTank").setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(quantumTank, ItemBlockQuantumTank.class, "techreborn.quantumTank");
|
||||
GameRegistry.registerTileEntity(TileQuantumTank.class, "TileQuantumTank");
|
||||
quantumTank = new BlockQuantumTank()
|
||||
.setBlockName("techreborn.quantumTank")
|
||||
.setBlockTextureName("techreborn:quantumTank")
|
||||
.setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(quantumTank, ItemBlockQuantumTank.class,
|
||||
"techreborn.quantumTank");
|
||||
GameRegistry.registerTileEntity(TileQuantumTank.class,
|
||||
"TileQuantumTank");
|
||||
|
||||
quantumChest = new BlockQuantumChest().setBlockName("techreborn.quantumChest").setBlockTextureName("techreborn:quantumChest").setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(quantumChest, ItemBlockQuantumChest.class, "techreborn.quantumChest");
|
||||
GameRegistry.registerTileEntity(TileQuantumChest.class, "TileQuantumChest");
|
||||
quantumChest = new BlockQuantumChest()
|
||||
.setBlockName("techreborn.quantumChest")
|
||||
.setBlockTextureName("techreborn:quantumChest")
|
||||
.setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(quantumChest, ItemBlockQuantumChest.class,
|
||||
"techreborn.quantumChest");
|
||||
GameRegistry.registerTileEntity(TileQuantumChest.class,
|
||||
"TileQuantumChest");
|
||||
|
||||
centrifuge = new BlockCentrifuge().setBlockName("techreborn.centrifuge").setBlockTextureName("techreborn:centrifuge").setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(centrifuge, "techreborn.centrifuge");
|
||||
GameRegistry.registerTileEntity(TileCentrifuge.class, "TileCentrifuge");
|
||||
centrifuge = new BlockCentrifuge()
|
||||
.setBlockName("techreborn.centrifuge")
|
||||
.setBlockTextureName("techreborn:centrifuge")
|
||||
.setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(centrifuge, "techreborn.centrifuge");
|
||||
GameRegistry.registerTileEntity(TileCentrifuge.class, "TileCentrifuge");
|
||||
|
||||
RollingMachine = new BlockRollingMachine(Material.piston);
|
||||
GameRegistry.registerBlock(RollingMachine, "rollingmachine");
|
||||
GameRegistry.registerTileEntity(TileRollingMachine.class, "TileRollingMachine");
|
||||
|
||||
BlastFurnace = new BlockBlastFurnace(Material.piston);
|
||||
GameRegistry.registerBlock(BlastFurnace, "blastFurnace");
|
||||
GameRegistry.registerTileEntity(TileBlastFurnace.class, "TileBlastFurnace");
|
||||
|
||||
MachineCasing = new BlockMachineCasing(Material.piston);
|
||||
GameRegistry.registerBlock(MachineCasing, ItemBlockMachineCasing.class, "machinecasing");
|
||||
GameRegistry.registerTileEntity(TileMachineCasing.class, "TileMachineCasing");
|
||||
RollingMachine = new BlockRollingMachine(Material.piston);
|
||||
GameRegistry.registerBlock(RollingMachine, "rollingmachine");
|
||||
GameRegistry.registerTileEntity(TileRollingMachine.class,
|
||||
"TileRollingMachine");
|
||||
|
||||
ore = new BlockOre(Material.rock);
|
||||
GameRegistry.registerBlock(ore, ItemBlockOre.class, "techreborn.ore");
|
||||
LogHelper.info("TechReborns Blocks Loaded");
|
||||
BlastFurnace = new BlockBlastFurnace(Material.piston);
|
||||
GameRegistry.registerBlock(BlastFurnace, "blastFurnace");
|
||||
GameRegistry.registerTileEntity(TileBlastFurnace.class,
|
||||
"TileBlastFurnace");
|
||||
|
||||
storage = new BlockStorage(Material.rock);
|
||||
GameRegistry.registerBlock(storage, ItemBlockStorage.class, "techreborn.storage");
|
||||
LogHelper.info("TechReborns Blocks Loaded");
|
||||
MachineCasing = new BlockMachineCasing(Material.piston);
|
||||
GameRegistry.registerBlock(MachineCasing, ItemBlockMachineCasing.class,
|
||||
"machinecasing");
|
||||
GameRegistry.registerTileEntity(TileMachineCasing.class,
|
||||
"TileMachineCasing");
|
||||
|
||||
registerOreDict();
|
||||
}
|
||||
ore = new BlockOre(Material.rock);
|
||||
GameRegistry.registerBlock(ore, ItemBlockOre.class, "techreborn.ore");
|
||||
LogHelper.info("TechReborns Blocks Loaded");
|
||||
|
||||
public static void registerOreDict() {
|
||||
OreDictionary.registerOre("oreGalena", new ItemStack(ore, 1, 0));
|
||||
OreDictionary.registerOre("oreIridium", new ItemStack(ore, 1, 1));
|
||||
OreDictionary.registerOre("oreRuby", new ItemStack(ore, 1, 2));
|
||||
OreDictionary.registerOre("oreSapphire", new ItemStack(ore, 1, 3));
|
||||
OreDictionary.registerOre("oreBauxite", new ItemStack(ore, 1, 4));
|
||||
OreDictionary.registerOre("orePyrite", new ItemStack(ore, 1, 5));
|
||||
OreDictionary.registerOre("oreCinnabar", new ItemStack(ore, 1, 6));
|
||||
OreDictionary.registerOre("oreSphalerite", new ItemStack(ore, 1, 7));
|
||||
OreDictionary.registerOre("oreTungston", new ItemStack(ore, 1, 8));
|
||||
OreDictionary.registerOre("oreSheldonite", new ItemStack(ore, 1, 9));
|
||||
OreDictionary.registerOre("oreOlivine", new ItemStack(ore, 1, 10));
|
||||
OreDictionary.registerOre("oreSodalite", new ItemStack(ore, 1, 11));
|
||||
storage = new BlockStorage(Material.rock);
|
||||
GameRegistry.registerBlock(storage, ItemBlockStorage.class,
|
||||
"techreborn.storage");
|
||||
LogHelper.info("TechReborns Blocks Loaded");
|
||||
|
||||
OreDictionary.registerOre("blockSilver", new ItemStack(storage, 1, 0));
|
||||
OreDictionary.registerOre("blockAluminium", new ItemStack(storage, 1, 1));
|
||||
OreDictionary.registerOre("blockTitanium", new ItemStack(storage, 1, 2));
|
||||
OreDictionary.registerOre("blockSapphire", new ItemStack(storage, 1, 3));
|
||||
OreDictionary.registerOre("blockRuby", new ItemStack(storage, 1, 4));
|
||||
OreDictionary.registerOre("blockGreenSapphire", new ItemStack(storage, 1, 5));
|
||||
OreDictionary.registerOre("blockChrome", new ItemStack(storage, 1, 6));
|
||||
OreDictionary.registerOre("blockElectrum", new ItemStack(storage, 1, 7));
|
||||
OreDictionary.registerOre("blockTungsten", new ItemStack(storage, 1, 8));
|
||||
OreDictionary.registerOre("blockLead", new ItemStack(storage, 1, 9));
|
||||
OreDictionary.registerOre("blockZinc", new ItemStack(storage, 1, 10));
|
||||
OreDictionary.registerOre("blockBrass", new ItemStack(storage, 1, 11));
|
||||
OreDictionary.registerOre("blockSteel", new ItemStack(storage, 1, 12));
|
||||
OreDictionary.registerOre("blockPlatinum", new ItemStack(storage, 1, 13));
|
||||
OreDictionary.registerOre("blockNickel", new ItemStack(storage, 1, 14));
|
||||
OreDictionary.registerOre("blockInvar", new ItemStack(storage, 1, 15));
|
||||
registerOreDict();
|
||||
}
|
||||
|
||||
}
|
||||
public static void registerOreDict()
|
||||
{
|
||||
OreDictionary.registerOre("oreGalena", new ItemStack(ore, 1, 0));
|
||||
OreDictionary.registerOre("oreIridium", new ItemStack(ore, 1, 1));
|
||||
OreDictionary.registerOre("oreRuby", new ItemStack(ore, 1, 2));
|
||||
OreDictionary.registerOre("oreSapphire", new ItemStack(ore, 1, 3));
|
||||
OreDictionary.registerOre("oreBauxite", new ItemStack(ore, 1, 4));
|
||||
OreDictionary.registerOre("orePyrite", new ItemStack(ore, 1, 5));
|
||||
OreDictionary.registerOre("oreCinnabar", new ItemStack(ore, 1, 6));
|
||||
OreDictionary.registerOre("oreSphalerite", new ItemStack(ore, 1, 7));
|
||||
OreDictionary.registerOre("oreTungston", new ItemStack(ore, 1, 8));
|
||||
OreDictionary.registerOre("oreSheldonite", new ItemStack(ore, 1, 9));
|
||||
OreDictionary.registerOre("oreOlivine", new ItemStack(ore, 1, 10));
|
||||
OreDictionary.registerOre("oreSodalite", new ItemStack(ore, 1, 11));
|
||||
|
||||
OreDictionary.registerOre("blockSilver", new ItemStack(storage, 1, 0));
|
||||
OreDictionary.registerOre("blockAluminium",
|
||||
new ItemStack(storage, 1, 1));
|
||||
OreDictionary
|
||||
.registerOre("blockTitanium", new ItemStack(storage, 1, 2));
|
||||
OreDictionary
|
||||
.registerOre("blockSapphire", new ItemStack(storage, 1, 3));
|
||||
OreDictionary.registerOre("blockRuby", new ItemStack(storage, 1, 4));
|
||||
OreDictionary.registerOre("blockGreenSapphire", new ItemStack(storage,
|
||||
1, 5));
|
||||
OreDictionary.registerOre("blockChrome", new ItemStack(storage, 1, 6));
|
||||
OreDictionary
|
||||
.registerOre("blockElectrum", new ItemStack(storage, 1, 7));
|
||||
OreDictionary
|
||||
.registerOre("blockTungsten", new ItemStack(storage, 1, 8));
|
||||
OreDictionary.registerOre("blockLead", new ItemStack(storage, 1, 9));
|
||||
OreDictionary.registerOre("blockZinc", new ItemStack(storage, 1, 10));
|
||||
OreDictionary.registerOre("blockBrass", new ItemStack(storage, 1, 11));
|
||||
OreDictionary.registerOre("blockSteel", new ItemStack(storage, 1, 12));
|
||||
OreDictionary.registerOre("blockPlatinum",
|
||||
new ItemStack(storage, 1, 13));
|
||||
OreDictionary.registerOre("blockNickel", new ItemStack(storage, 1, 14));
|
||||
OreDictionary.registerOre("blockInvar", new ItemStack(storage, 1, 15));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package techreborn.init;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||
|
@ -20,147 +19,162 @@ import techreborn.items.tools.ItemOmniTool;
|
|||
import techreborn.items.tools.ItemRockCutter;
|
||||
import techreborn.items.tools.ItemTechPda;
|
||||
import techreborn.util.LogHelper;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class ModItems {
|
||||
|
||||
public static Item dusts;
|
||||
public static Item smallDusts;
|
||||
public static Item ingots;
|
||||
public static Item gems;
|
||||
public static Item parts;
|
||||
public static Item cells;
|
||||
public static Item rockCutter;
|
||||
public static Item lithiumBatpack;
|
||||
public static Item lapotronpack;
|
||||
public static Item gravityChest;
|
||||
public static Item omniTool;
|
||||
public static Item advancedDrill;
|
||||
public static Item manuel;
|
||||
public static Item dusts;
|
||||
public static Item smallDusts;
|
||||
public static Item ingots;
|
||||
public static Item gems;
|
||||
public static Item parts;
|
||||
public static Item cells;
|
||||
public static Item rockCutter;
|
||||
public static Item lithiumBatpack;
|
||||
public static Item lapotronpack;
|
||||
public static Item gravityChest;
|
||||
public static Item omniTool;
|
||||
public static Item advancedDrill;
|
||||
public static Item manuel;
|
||||
|
||||
public static void init() {
|
||||
dusts = new ItemDusts();
|
||||
GameRegistry.registerItem(dusts, "dust");
|
||||
smallDusts = new ItemDustsSmall();
|
||||
GameRegistry.registerItem(smallDusts, "smallDust");
|
||||
ingots = new ItemIngots();
|
||||
GameRegistry.registerItem(ingots, "ingot");
|
||||
gems = new ItemGems();
|
||||
GameRegistry.registerItem(gems, "gem");
|
||||
parts = new ItemParts();
|
||||
GameRegistry.registerItem(parts, "part");
|
||||
cells = new ItemCells();
|
||||
GameRegistry.registerItem(cells, "cell");
|
||||
rockCutter = new ItemRockCutter(ToolMaterial.EMERALD);
|
||||
GameRegistry.registerItem(rockCutter, "rockCutter");
|
||||
lithiumBatpack = new ItemLithiumBatpack(ArmorMaterial.DIAMOND, 7, 1);
|
||||
GameRegistry.registerItem(lithiumBatpack, "lithiumBatpack");
|
||||
lapotronpack = new ItemLapotronPack(ArmorMaterial.DIAMOND, 7, 1);
|
||||
GameRegistry.registerItem(lapotronpack, "lapotronPack");
|
||||
omniTool = new ItemOmniTool(ToolMaterial.EMERALD);
|
||||
GameRegistry.registerItem(omniTool, "omniTool");
|
||||
advancedDrill = new ItemAdvancedDrill();
|
||||
GameRegistry.registerItem(advancedDrill, "advancedDrill");
|
||||
gravityChest = new ItemGravityChest(ArmorMaterial.DIAMOND, 7, 1);
|
||||
GameRegistry.registerItem(gravityChest, "gravitychestplate");
|
||||
manuel = new ItemTechPda();
|
||||
GameRegistry.registerItem(manuel, "techmanuel");
|
||||
public static void init()
|
||||
{
|
||||
dusts = new ItemDusts();
|
||||
GameRegistry.registerItem(dusts, "dust");
|
||||
smallDusts = new ItemDustsSmall();
|
||||
GameRegistry.registerItem(smallDusts, "smallDust");
|
||||
ingots = new ItemIngots();
|
||||
GameRegistry.registerItem(ingots, "ingot");
|
||||
gems = new ItemGems();
|
||||
GameRegistry.registerItem(gems, "gem");
|
||||
parts = new ItemParts();
|
||||
GameRegistry.registerItem(parts, "part");
|
||||
cells = new ItemCells();
|
||||
GameRegistry.registerItem(cells, "cell");
|
||||
rockCutter = new ItemRockCutter(ToolMaterial.EMERALD);
|
||||
GameRegistry.registerItem(rockCutter, "rockCutter");
|
||||
lithiumBatpack = new ItemLithiumBatpack(ArmorMaterial.DIAMOND, 7, 1);
|
||||
GameRegistry.registerItem(lithiumBatpack, "lithiumBatpack");
|
||||
lapotronpack = new ItemLapotronPack(ArmorMaterial.DIAMOND, 7, 1);
|
||||
GameRegistry.registerItem(lapotronpack, "lapotronPack");
|
||||
omniTool = new ItemOmniTool(ToolMaterial.EMERALD);
|
||||
GameRegistry.registerItem(omniTool, "omniTool");
|
||||
advancedDrill = new ItemAdvancedDrill();
|
||||
GameRegistry.registerItem(advancedDrill, "advancedDrill");
|
||||
gravityChest = new ItemGravityChest(ArmorMaterial.DIAMOND, 7, 1);
|
||||
GameRegistry.registerItem(gravityChest, "gravitychestplate");
|
||||
manuel = new ItemTechPda();
|
||||
GameRegistry.registerItem(manuel, "techmanuel");
|
||||
|
||||
LogHelper.info("TechReborns Items Loaded");
|
||||
LogHelper.info("TechReborns Items Loaded");
|
||||
|
||||
registerOreDict();
|
||||
}
|
||||
registerOreDict();
|
||||
}
|
||||
|
||||
public static void registerOreDict() {
|
||||
//Dusts
|
||||
OreDictionary.registerOre("dustAlmandine", new ItemStack(dusts, 1, 0));
|
||||
OreDictionary.registerOre("dustAluminium", new ItemStack(dusts, 1, 1));
|
||||
OreDictionary.registerOre("dustAndradite", new ItemStack(dusts, 1, 2));
|
||||
OreDictionary.registerOre("dustBasalt", new ItemStack(dusts, 1, 4));
|
||||
OreDictionary.registerOre("dustBauxite", new ItemStack(dusts, 1, 5));
|
||||
OreDictionary.registerOre("dustBrass", new ItemStack(dusts, 1, 6));
|
||||
OreDictionary.registerOre("dustBronze", new ItemStack(dusts, 1, 7));
|
||||
OreDictionary.registerOre("dustCalcite", new ItemStack(dusts, 1, 8));
|
||||
OreDictionary.registerOre("dustCharcoal", new ItemStack(dusts, 1, 9));
|
||||
OreDictionary.registerOre("dustChrome", new ItemStack(dusts, 1, 10));
|
||||
OreDictionary.registerOre("dustCinnabar", new ItemStack(dusts, 1, 11));
|
||||
OreDictionary.registerOre("dustClay", new ItemStack(dusts, 1, 12));
|
||||
OreDictionary.registerOre("dustCoal", new ItemStack(dusts, 1, 13));
|
||||
OreDictionary.registerOre("dustCopper", new ItemStack(dusts, 1, 14));
|
||||
OreDictionary.registerOre("dustDiamond", new ItemStack(dusts, 1, 16));
|
||||
OreDictionary.registerOre("dustElectrum", new ItemStack(dusts, 1, 17));
|
||||
OreDictionary.registerOre("dustEmerald", new ItemStack(dusts, 1, 18));
|
||||
OreDictionary.registerOre("dustEnderEye", new ItemStack(dusts, 1, 19));
|
||||
OreDictionary.registerOre("dustEnderPearl", new ItemStack(dusts, 1, 20));
|
||||
OreDictionary.registerOre("dustEndstone", new ItemStack(dusts, 1, 21));
|
||||
OreDictionary.registerOre("dustFlint", new ItemStack(dusts, 1, 22));
|
||||
OreDictionary.registerOre("dustGold", new ItemStack(dusts, 1, 23));
|
||||
OreDictionary.registerOre("dustGreenSapphire", new ItemStack(dusts, 1, 24));
|
||||
OreDictionary.registerOre("dustGrossular", new ItemStack(dusts, 1, 25));
|
||||
OreDictionary.registerOre("dustInvar", new ItemStack(dusts, 1, 26));
|
||||
OreDictionary.registerOre("dustIron", new ItemStack(dusts, 1, 27));
|
||||
OreDictionary.registerOre("dustLazurite", new ItemStack(dusts, 1, 28));
|
||||
OreDictionary.registerOre("dustLead", new ItemStack(dusts, 1, 29));
|
||||
OreDictionary.registerOre("dustMagnesium", new ItemStack(dusts, 1, 30));
|
||||
OreDictionary.registerOre("dustMarble", new ItemStack(dusts, 31));
|
||||
OreDictionary.registerOre("dustNetherrack", new ItemStack(dusts, 32));
|
||||
OreDictionary.registerOre("dustNickel", new ItemStack(dusts, 1, 33));
|
||||
OreDictionary.registerOre("dustObsidian", new ItemStack(dusts, 1, 34));
|
||||
OreDictionary.registerOre("dustOlivine", new ItemStack(dusts, 1, 35));
|
||||
OreDictionary.registerOre("dustPhosphor", new ItemStack(dusts, 1, 36));
|
||||
OreDictionary.registerOre("dustPlatinum", new ItemStack(dusts, 1, 37));
|
||||
OreDictionary.registerOre("dustPyrite", new ItemStack(dusts, 1, 38));
|
||||
OreDictionary.registerOre("dustPyrope", new ItemStack(dusts, 1, 39));
|
||||
OreDictionary.registerOre("dustRedGarnet", new ItemStack(dusts, 1, 40));
|
||||
OreDictionary.registerOre("dustRedrock", new ItemStack(dusts, 1, 41));
|
||||
OreDictionary.registerOre("dustRuby", new ItemStack(dusts, 1, 42));
|
||||
OreDictionary.registerOre("dustSaltpeter", new ItemStack(dusts, 1, 43));
|
||||
OreDictionary.registerOre("dustSapphire", new ItemStack(dusts, 1, 44));
|
||||
OreDictionary.registerOre("dustSilver", new ItemStack(dusts, 1, 45));
|
||||
OreDictionary.registerOre("dustSodalite", new ItemStack(dusts, 1, 46));
|
||||
OreDictionary.registerOre("dustSpessartine", new ItemStack(dusts, 1, 47));
|
||||
OreDictionary.registerOre("dustSphalerite", new ItemStack(dusts, 1, 48));
|
||||
OreDictionary.registerOre("dustSteel", new ItemStack(dusts, 1, 49));
|
||||
OreDictionary.registerOre("dustSulfur", new ItemStack(dusts, 1, 50));
|
||||
OreDictionary.registerOre("dustTin", new ItemStack(dusts, 1, 51));
|
||||
OreDictionary.registerOre("dustTitanium", new ItemStack(dusts, 1, 52));
|
||||
OreDictionary.registerOre("dustTungsten", new ItemStack(dusts, 1, 53));
|
||||
OreDictionary.registerOre("dustUranium", new ItemStack(dusts, 1, 54));
|
||||
OreDictionary.registerOre("dustUvarovite", new ItemStack(dusts, 1, 55));
|
||||
OreDictionary.registerOre("dustYellowGarnet", new ItemStack(dusts, 1, 56));
|
||||
OreDictionary.registerOre("dustZinc", new ItemStack(dusts, 1, 57));
|
||||
OreDictionary.registerOre("ingotCobalt", new ItemStack(dusts, 1, 58));
|
||||
OreDictionary.registerOre("ingotArdite", new ItemStack(ingots, 1, 59));
|
||||
OreDictionary.registerOre("ingotManyullyn", new ItemStack(ingots, 1, 60));
|
||||
OreDictionary.registerOre("ingotAluminumBrass", new ItemStack(ingots, 1, 61));
|
||||
OreDictionary.registerOre("ingotAlumite", new ItemStack(ingots, 1, 62));
|
||||
//Ingots
|
||||
OreDictionary.registerOre("ingotIridium", new ItemStack(ingots, 1, 3));
|
||||
OreDictionary.registerOre("ingotSilver", new ItemStack(ingots, 1, 4));
|
||||
OreDictionary.registerOre("ingotAluminium", new ItemStack(ingots, 1, 5));
|
||||
OreDictionary.registerOre("ingotTitanium", new ItemStack(ingots, 1, 6));
|
||||
OreDictionary.registerOre("ingotChrome", new ItemStack(ingots, 1, 7));
|
||||
OreDictionary.registerOre("ingotElectrum", new ItemStack(ingots, 1, 8));
|
||||
OreDictionary.registerOre("ingotTungsten", new ItemStack(ingots, 1, 9));
|
||||
OreDictionary.registerOre("ingotLead", new ItemStack(ingots, 1, 10));
|
||||
OreDictionary.registerOre("ingotZinc", new ItemStack(ingots, 1, 11));
|
||||
OreDictionary.registerOre("ingotBrass", new ItemStack(ingots, 1, 12));
|
||||
OreDictionary.registerOre("ingotSteel", new ItemStack(ingots, 1, 13));
|
||||
OreDictionary.registerOre("ingotPlatinum", new ItemStack(ingots, 1, 14));
|
||||
OreDictionary.registerOre("ingotNickel", new ItemStack(ingots, 1, 15));
|
||||
OreDictionary.registerOre("ingotInvar", new ItemStack(ingots, 1, 16));
|
||||
OreDictionary.registerOre("ingotCobalt", new ItemStack(ingots, 1, 17));
|
||||
OreDictionary.registerOre("ingotArdite", new ItemStack(ingots, 1, 18));
|
||||
OreDictionary.registerOre("ingotManyullyn", new ItemStack(ingots, 1, 19));
|
||||
OreDictionary.registerOre("ingotAluminumBrass", new ItemStack(ingots, 1, 20));
|
||||
OreDictionary.registerOre("ingotAlumite", new ItemStack(ingots, 1, 21));
|
||||
//Gems
|
||||
OreDictionary.registerOre("gemRuby", new ItemStack(gems, 1, 0));
|
||||
OreDictionary.registerOre("gemSapphire", new ItemStack(gems, 1, 1));
|
||||
OreDictionary.registerOre("gemGreenSapphire", new ItemStack(gems, 1, 2));
|
||||
OreDictionary.registerOre("gemOlivine", new ItemStack(gems, 1, 3));
|
||||
OreDictionary.registerOre("gemRedGarnet", new ItemStack(gems, 1, 4));
|
||||
OreDictionary.registerOre("gemYellowGarnet", new ItemStack(gems, 1, 5));
|
||||
public static void registerOreDict()
|
||||
{
|
||||
// Dusts
|
||||
OreDictionary.registerOre("dustAlmandine", new ItemStack(dusts, 1, 0));
|
||||
OreDictionary.registerOre("dustAluminium", new ItemStack(dusts, 1, 1));
|
||||
OreDictionary.registerOre("dustAndradite", new ItemStack(dusts, 1, 2));
|
||||
OreDictionary.registerOre("dustBasalt", new ItemStack(dusts, 1, 4));
|
||||
OreDictionary.registerOre("dustBauxite", new ItemStack(dusts, 1, 5));
|
||||
OreDictionary.registerOre("dustBrass", new ItemStack(dusts, 1, 6));
|
||||
OreDictionary.registerOre("dustBronze", new ItemStack(dusts, 1, 7));
|
||||
OreDictionary.registerOre("dustCalcite", new ItemStack(dusts, 1, 8));
|
||||
OreDictionary.registerOre("dustCharcoal", new ItemStack(dusts, 1, 9));
|
||||
OreDictionary.registerOre("dustChrome", new ItemStack(dusts, 1, 10));
|
||||
OreDictionary.registerOre("dustCinnabar", new ItemStack(dusts, 1, 11));
|
||||
OreDictionary.registerOre("dustClay", new ItemStack(dusts, 1, 12));
|
||||
OreDictionary.registerOre("dustCoal", new ItemStack(dusts, 1, 13));
|
||||
OreDictionary.registerOre("dustCopper", new ItemStack(dusts, 1, 14));
|
||||
OreDictionary.registerOre("dustDiamond", new ItemStack(dusts, 1, 16));
|
||||
OreDictionary.registerOre("dustElectrum", new ItemStack(dusts, 1, 17));
|
||||
OreDictionary.registerOre("dustEmerald", new ItemStack(dusts, 1, 18));
|
||||
OreDictionary.registerOre("dustEnderEye", new ItemStack(dusts, 1, 19));
|
||||
OreDictionary
|
||||
.registerOre("dustEnderPearl", new ItemStack(dusts, 1, 20));
|
||||
OreDictionary.registerOre("dustEndstone", new ItemStack(dusts, 1, 21));
|
||||
OreDictionary.registerOre("dustFlint", new ItemStack(dusts, 1, 22));
|
||||
OreDictionary.registerOre("dustGold", new ItemStack(dusts, 1, 23));
|
||||
OreDictionary.registerOre("dustGreenSapphire", new ItemStack(dusts, 1,
|
||||
24));
|
||||
OreDictionary.registerOre("dustGrossular", new ItemStack(dusts, 1, 25));
|
||||
OreDictionary.registerOre("dustInvar", new ItemStack(dusts, 1, 26));
|
||||
OreDictionary.registerOre("dustIron", new ItemStack(dusts, 1, 27));
|
||||
OreDictionary.registerOre("dustLazurite", new ItemStack(dusts, 1, 28));
|
||||
OreDictionary.registerOre("dustLead", new ItemStack(dusts, 1, 29));
|
||||
OreDictionary.registerOre("dustMagnesium", new ItemStack(dusts, 1, 30));
|
||||
OreDictionary.registerOre("dustMarble", new ItemStack(dusts, 31));
|
||||
OreDictionary.registerOre("dustNetherrack", new ItemStack(dusts, 32));
|
||||
OreDictionary.registerOre("dustNickel", new ItemStack(dusts, 1, 33));
|
||||
OreDictionary.registerOre("dustObsidian", new ItemStack(dusts, 1, 34));
|
||||
OreDictionary.registerOre("dustOlivine", new ItemStack(dusts, 1, 35));
|
||||
OreDictionary.registerOre("dustPhosphor", new ItemStack(dusts, 1, 36));
|
||||
OreDictionary.registerOre("dustPlatinum", new ItemStack(dusts, 1, 37));
|
||||
OreDictionary.registerOre("dustPyrite", new ItemStack(dusts, 1, 38));
|
||||
OreDictionary.registerOre("dustPyrope", new ItemStack(dusts, 1, 39));
|
||||
OreDictionary.registerOre("dustRedGarnet", new ItemStack(dusts, 1, 40));
|
||||
OreDictionary.registerOre("dustRedrock", new ItemStack(dusts, 1, 41));
|
||||
OreDictionary.registerOre("dustRuby", new ItemStack(dusts, 1, 42));
|
||||
OreDictionary.registerOre("dustSaltpeter", new ItemStack(dusts, 1, 43));
|
||||
OreDictionary.registerOre("dustSapphire", new ItemStack(dusts, 1, 44));
|
||||
OreDictionary.registerOre("dustSilver", new ItemStack(dusts, 1, 45));
|
||||
OreDictionary.registerOre("dustSodalite", new ItemStack(dusts, 1, 46));
|
||||
OreDictionary.registerOre("dustSpessartine",
|
||||
new ItemStack(dusts, 1, 47));
|
||||
OreDictionary
|
||||
.registerOre("dustSphalerite", new ItemStack(dusts, 1, 48));
|
||||
OreDictionary.registerOre("dustSteel", new ItemStack(dusts, 1, 49));
|
||||
OreDictionary.registerOre("dustSulfur", new ItemStack(dusts, 1, 50));
|
||||
OreDictionary.registerOre("dustTin", new ItemStack(dusts, 1, 51));
|
||||
OreDictionary.registerOre("dustTitanium", new ItemStack(dusts, 1, 52));
|
||||
OreDictionary.registerOre("dustTungsten", new ItemStack(dusts, 1, 53));
|
||||
OreDictionary.registerOre("dustUranium", new ItemStack(dusts, 1, 54));
|
||||
OreDictionary.registerOre("dustUvarovite", new ItemStack(dusts, 1, 55));
|
||||
OreDictionary.registerOre("dustYellowGarnet", new ItemStack(dusts, 1,
|
||||
56));
|
||||
OreDictionary.registerOre("dustZinc", new ItemStack(dusts, 1, 57));
|
||||
OreDictionary.registerOre("ingotCobalt", new ItemStack(dusts, 1, 58));
|
||||
OreDictionary.registerOre("ingotArdite", new ItemStack(ingots, 1, 59));
|
||||
OreDictionary.registerOre("ingotManyullyn",
|
||||
new ItemStack(ingots, 1, 60));
|
||||
OreDictionary.registerOre("ingotAluminumBrass", new ItemStack(ingots,
|
||||
1, 61));
|
||||
OreDictionary.registerOre("ingotAlumite", new ItemStack(ingots, 1, 62));
|
||||
// Ingots
|
||||
OreDictionary.registerOre("ingotIridium", new ItemStack(ingots, 1, 3));
|
||||
OreDictionary.registerOre("ingotSilver", new ItemStack(ingots, 1, 4));
|
||||
OreDictionary
|
||||
.registerOre("ingotAluminium", new ItemStack(ingots, 1, 5));
|
||||
OreDictionary.registerOre("ingotTitanium", new ItemStack(ingots, 1, 6));
|
||||
OreDictionary.registerOre("ingotChrome", new ItemStack(ingots, 1, 7));
|
||||
OreDictionary.registerOre("ingotElectrum", new ItemStack(ingots, 1, 8));
|
||||
OreDictionary.registerOre("ingotTungsten", new ItemStack(ingots, 1, 9));
|
||||
OreDictionary.registerOre("ingotLead", new ItemStack(ingots, 1, 10));
|
||||
OreDictionary.registerOre("ingotZinc", new ItemStack(ingots, 1, 11));
|
||||
OreDictionary.registerOre("ingotBrass", new ItemStack(ingots, 1, 12));
|
||||
OreDictionary.registerOre("ingotSteel", new ItemStack(ingots, 1, 13));
|
||||
OreDictionary
|
||||
.registerOre("ingotPlatinum", new ItemStack(ingots, 1, 14));
|
||||
OreDictionary.registerOre("ingotNickel", new ItemStack(ingots, 1, 15));
|
||||
OreDictionary.registerOre("ingotInvar", new ItemStack(ingots, 1, 16));
|
||||
OreDictionary.registerOre("ingotCobalt", new ItemStack(ingots, 1, 17));
|
||||
OreDictionary.registerOre("ingotArdite", new ItemStack(ingots, 1, 18));
|
||||
OreDictionary.registerOre("ingotManyullyn",
|
||||
new ItemStack(ingots, 1, 19));
|
||||
OreDictionary.registerOre("ingotAluminumBrass", new ItemStack(ingots,
|
||||
1, 20));
|
||||
OreDictionary.registerOre("ingotAlumite", new ItemStack(ingots, 1, 21));
|
||||
// Gems
|
||||
OreDictionary.registerOre("gemRuby", new ItemStack(gems, 1, 0));
|
||||
OreDictionary.registerOre("gemSapphire", new ItemStack(gems, 1, 1));
|
||||
OreDictionary
|
||||
.registerOre("gemGreenSapphire", new ItemStack(gems, 1, 2));
|
||||
OreDictionary.registerOre("gemOlivine", new ItemStack(gems, 1, 3));
|
||||
OreDictionary.registerOre("gemRedGarnet", new ItemStack(gems, 1, 4));
|
||||
OreDictionary.registerOre("gemYellowGarnet", new ItemStack(gems, 1, 5));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,10 +6,13 @@ import techreborn.partSystem.parts.CablePart;
|
|||
|
||||
public class ModParts {
|
||||
|
||||
public static void init(){
|
||||
public static void init()
|
||||
{
|
||||
ModPartRegistry.registerPart(new CablePart());
|
||||
ModPartRegistry.addProvider("techreborn.partSystem.QLib.QModPartFactory", "qmunitylib");
|
||||
ModPartRegistry.addProvider("techreborn.partSystem.fmp.FMPFactory", "ForgeMultipart");
|
||||
ModPartRegistry.addProvider(
|
||||
"techreborn.partSystem.QLib.QModPartFactory", "qmunitylib");
|
||||
ModPartRegistry.addProvider("techreborn.partSystem.fmp.FMPFactory",
|
||||
"ForgeMultipart");
|
||||
ModPartRegistry.addProvider(new WorldProvider());
|
||||
ModPartRegistry.addAllPartsToSystems();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package techreborn.init;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import ic2.api.item.IC2Items;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
|
@ -11,233 +10,277 @@ import techreborn.config.ConfigTechReborn;
|
|||
import techreborn.util.CraftingHelper;
|
||||
import techreborn.util.LogHelper;
|
||||
import techreborn.util.RecipeRemover;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class ModRecipes {
|
||||
public static ConfigTechReborn config;
|
||||
public static ConfigTechReborn config;
|
||||
|
||||
public static void init() {
|
||||
removeIc2Recipes();
|
||||
addShaplessRecipes();
|
||||
addShappedRecipes();
|
||||
addSmeltingRecipes();
|
||||
addMachineRecipes();
|
||||
}
|
||||
public static void init()
|
||||
{
|
||||
removeIc2Recipes();
|
||||
addShaplessRecipes();
|
||||
addShappedRecipes();
|
||||
addSmeltingRecipes();
|
||||
addMachineRecipes();
|
||||
}
|
||||
|
||||
public static void removeIc2Recipes() {
|
||||
if (config.ExpensiveMacerator) ;
|
||||
RecipeRemover.removeAnyRecipe(IC2Items.getItem("macerator"));
|
||||
if (config.ExpensiveDrill) ;
|
||||
RecipeRemover.removeAnyRecipe(IC2Items.getItem("miningDrill"));
|
||||
if (config.ExpensiveDiamondDrill) ;
|
||||
RecipeRemover.removeAnyRecipe(IC2Items.getItem("diamondDrill"));
|
||||
if (config.ExpensiveSolar) ;
|
||||
RecipeRemover.removeAnyRecipe(IC2Items.getItem("solarPanel"));
|
||||
public static void removeIc2Recipes()
|
||||
{
|
||||
if (config.ExpensiveMacerator)
|
||||
;
|
||||
RecipeRemover.removeAnyRecipe(IC2Items.getItem("macerator"));
|
||||
if (config.ExpensiveDrill)
|
||||
;
|
||||
RecipeRemover.removeAnyRecipe(IC2Items.getItem("miningDrill"));
|
||||
if (config.ExpensiveDiamondDrill)
|
||||
;
|
||||
RecipeRemover.removeAnyRecipe(IC2Items.getItem("diamondDrill"));
|
||||
if (config.ExpensiveSolar)
|
||||
;
|
||||
RecipeRemover.removeAnyRecipe(IC2Items.getItem("solarPanel"));
|
||||
|
||||
LogHelper.info("IC2 Recipes Removed");
|
||||
}
|
||||
LogHelper.info("IC2 Recipes Removed");
|
||||
}
|
||||
|
||||
public static void addShappedRecipes() {
|
||||
public static void addShappedRecipes()
|
||||
{
|
||||
|
||||
//IC2 Recipes
|
||||
if (config.ExpensiveMacerator) ;
|
||||
CraftingHelper.addShapedOreRecipe(IC2Items.getItem("macerator"),
|
||||
new Object[]{"FDF", "DMD", "FCF",
|
||||
'F', Items.flint,
|
||||
'D', Items.diamond,
|
||||
'M', IC2Items.getItem("machine"),
|
||||
'C', IC2Items.getItem("electronicCircuit")});
|
||||
if (config.ExpensiveDrill) ;
|
||||
CraftingHelper.addShapedOreRecipe(IC2Items.getItem("miningDrill"),
|
||||
new Object[]{" S ", "SCS", "SBS",
|
||||
'S', "ingotSteel",
|
||||
'B', IC2Items.getItem("reBattery"),
|
||||
'C', IC2Items.getItem("electronicCircuit")});
|
||||
if (config.ExpensiveDiamondDrill) ;
|
||||
CraftingHelper.addShapedOreRecipe(IC2Items.getItem("diamondDrill"),
|
||||
new Object[]{" D ", "DBD", "TCT",
|
||||
'D', "gemDiamond",
|
||||
'T', "ingotTitanium",
|
||||
'B', IC2Items.getItem("miningDrill"),
|
||||
'C', IC2Items.getItem("advancedCircuit")});
|
||||
if (config.ExpensiveSolar) ;
|
||||
CraftingHelper.addShapedOreRecipe(IC2Items.getItem("solarPanel"),
|
||||
new Object[]{"PPP", "SZS", "CGC",
|
||||
'P', "paneGlass",
|
||||
'S', new ItemStack(ModItems.parts, 1, 1),
|
||||
'Z', IC2Items.getItem("carbonPlate"),
|
||||
'G', IC2Items.getItem("generator"),
|
||||
'C', IC2Items.getItem("electronicCircuit")});
|
||||
// IC2 Recipes
|
||||
if (config.ExpensiveMacerator)
|
||||
;
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
IC2Items.getItem("macerator"),
|
||||
new Object[]
|
||||
{ "FDF", "DMD", "FCF", 'F', Items.flint, 'D', Items.diamond,
|
||||
'M', IC2Items.getItem("machine"), 'C',
|
||||
IC2Items.getItem("electronicCircuit") });
|
||||
if (config.ExpensiveDrill)
|
||||
;
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
IC2Items.getItem("miningDrill"),
|
||||
new Object[]
|
||||
{ " S ", "SCS", "SBS", 'S', "ingotSteel", 'B',
|
||||
IC2Items.getItem("reBattery"), 'C',
|
||||
IC2Items.getItem("electronicCircuit") });
|
||||
if (config.ExpensiveDiamondDrill)
|
||||
;
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
IC2Items.getItem("diamondDrill"),
|
||||
new Object[]
|
||||
{ " D ", "DBD", "TCT", 'D', "gemDiamond", 'T', "ingotTitanium",
|
||||
'B', IC2Items.getItem("miningDrill"), 'C',
|
||||
IC2Items.getItem("advancedCircuit") });
|
||||
if (config.ExpensiveSolar)
|
||||
;
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
IC2Items.getItem("solarPanel"),
|
||||
new Object[]
|
||||
{ "PPP", "SZS", "CGC", 'P', "paneGlass", 'S',
|
||||
new ItemStack(ModItems.parts, 1, 1), 'Z',
|
||||
IC2Items.getItem("carbonPlate"), 'G',
|
||||
IC2Items.getItem("generator"), 'C',
|
||||
IC2Items.getItem("electronicCircuit") });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.thermalGenerator),
|
||||
new Object[]{"III", "IHI", "CGC",
|
||||
'I', "ingotInvar",
|
||||
'H', IC2Items.getItem("reinforcedGlass"),
|
||||
'C', IC2Items.getItem("electronicCircuit"),
|
||||
'G', IC2Items.getItem("geothermalGenerator")});
|
||||
//TechReborn Recipes
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 4, 6),
|
||||
new Object[]{"EEE", "EAE", "EEE",
|
||||
'E', "gemEmerald",
|
||||
'A', IC2Items.getItem("electronicCircuit")});
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
new ItemStack(ModBlocks.thermalGenerator),
|
||||
new Object[]
|
||||
{ "III", "IHI", "CGC", 'I', "ingotInvar", 'H',
|
||||
IC2Items.getItem("reinforcedGlass"), 'C',
|
||||
IC2Items.getItem("electronicCircuit"), 'G',
|
||||
IC2Items.getItem("geothermalGenerator") });
|
||||
// TechReborn Recipes
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
new ItemStack(ModItems.parts, 4, 6),
|
||||
new Object[]
|
||||
{ "EEE", "EAE", "EEE", 'E', "gemEmerald", 'A',
|
||||
IC2Items.getItem("electronicCircuit") });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 7),
|
||||
new Object[]{"AGA", "RPB", "ASA",
|
||||
'A', "ingotAluminium",
|
||||
'G', "dyeGreen",
|
||||
'R', "dyeRed",
|
||||
'P', "paneGlass",
|
||||
'B', "dyeBlue",
|
||||
'S', Items.glowstone_dust,});
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 7),
|
||||
new Object[]
|
||||
{ "AGA", "RPB", "ASA", 'A', "ingotAluminium", 'G', "dyeGreen",
|
||||
'R', "dyeRed", 'P', "paneGlass", 'B', "dyeBlue", 'S',
|
||||
Items.glowstone_dust, });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 4, 8),
|
||||
new Object[]{"DSD", "S S", "DSD",
|
||||
'D', "dustDiamond",
|
||||
'S', "ingotSteel"});
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 4, 8),
|
||||
new Object[]
|
||||
{ "DSD", "S S", "DSD", 'D', "dustDiamond", 'S', "ingotSteel" });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 16, 13),
|
||||
new Object[]{"CSC", "SCS", "CSC",
|
||||
'S', "ingotSteel",
|
||||
'C', IC2Items.getItem("electronicCircuit")});
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
new ItemStack(ModItems.parts, 16, 13),
|
||||
new Object[]
|
||||
{ "CSC", "SCS", "CSC", 'S', "ingotSteel", 'C',
|
||||
IC2Items.getItem("electronicCircuit") });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 2, 14),
|
||||
new Object[]{"TST", "SBS", "TST",
|
||||
'S', "ingotSteel",
|
||||
'T', "ingotTungsten",
|
||||
'B', "blockSteel"});
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 2, 14),
|
||||
new Object[]
|
||||
{ "TST", "SBS", "TST", 'S', "ingotSteel", 'T', "ingotTungsten",
|
||||
'B', "blockSteel" });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 15),
|
||||
new Object[]{"AAA", "AMA", "AAA",
|
||||
'A', "ingotAluminium",
|
||||
'M', new ItemStack(ModItems.parts, 1, 13)});
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 15),
|
||||
new Object[]
|
||||
{ "AAA", "AMA", "AAA", 'A', "ingotAluminium", 'M',
|
||||
new ItemStack(ModItems.parts, 1, 13) });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 16),
|
||||
new Object[]{"AAA", "AMA", "AAA",
|
||||
'A', "ingotBronze",
|
||||
'M', new ItemStack(ModItems.parts, 1, 13)});
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 16),
|
||||
new Object[]
|
||||
{ "AAA", "AMA", "AAA", 'A', "ingotBronze", 'M',
|
||||
new ItemStack(ModItems.parts, 1, 13) });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 17),
|
||||
new Object[]{"AAA", "AMA", "AAA",
|
||||
'A', "ingotSteel",
|
||||
'M', new ItemStack(ModItems.parts, 1, 13)});
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 17),
|
||||
new Object[]
|
||||
{ "AAA", "AMA", "AAA", 'A', "ingotSteel", 'M',
|
||||
new ItemStack(ModItems.parts, 1, 13) });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 18),
|
||||
new Object[]{"AAA", "AMA", "AAA",
|
||||
'A', "ingotTitanium",
|
||||
'M', new ItemStack(ModItems.parts, 1, 13)});
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 18),
|
||||
new Object[]
|
||||
{ "AAA", "AMA", "AAA", 'A', "ingotTitanium", 'M',
|
||||
new ItemStack(ModItems.parts, 1, 13) });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 19),
|
||||
new Object[]{"AAA", "AMA", "AAA",
|
||||
'A', "ingotBrass",
|
||||
'M', new ItemStack(ModItems.parts, 1, 13)});
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModItems.parts, 1, 19),
|
||||
new Object[]
|
||||
{ "AAA", "AMA", "AAA", 'A', "ingotBrass", 'M',
|
||||
new ItemStack(ModItems.parts, 1, 13) });
|
||||
|
||||
//Storage Blocks
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 0),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "ingotSilver",});
|
||||
// Storage Blocks
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
new ItemStack(ModBlocks.storage, 1, 0), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "ingotSilver", });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 1),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "ingotAluminium",});
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
new ItemStack(ModBlocks.storage, 1, 1), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "ingotAluminium", });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 2),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "ingotTitanium",});
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
new ItemStack(ModBlocks.storage, 1, 2), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "ingotTitanium", });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 3),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "gemSapphire",});
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
new ItemStack(ModBlocks.storage, 1, 3), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "gemSapphire", });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 4),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "gemRuby",});
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
new ItemStack(ModBlocks.storage, 1, 4), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "gemRuby", });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 5),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "gemGreenSapphire",});
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
new ItemStack(ModBlocks.storage, 1, 5), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "gemGreenSapphire", });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 6),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "ingotChrome",});
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
new ItemStack(ModBlocks.storage, 1, 6), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "ingotChrome", });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 7),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "ingotElectrum",});
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
new ItemStack(ModBlocks.storage, 1, 7), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "ingotElectrum", });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 8),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "ingotTungsten",});
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
new ItemStack(ModBlocks.storage, 1, 8), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "ingotTungsten", });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 9),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "ingotLead",});
|
||||
CraftingHelper.addShapedOreRecipe(
|
||||
new ItemStack(ModBlocks.storage, 1, 9), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "ingotLead", });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 10),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "ingotZinc",});
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1,
|
||||
10), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "ingotZinc", });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 11),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "ingotBrass",});
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1,
|
||||
11), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "ingotBrass", });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 12),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "ingotSteel",});
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1,
|
||||
12), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "ingotSteel", });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 13),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "ingotPlatinum",});
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1,
|
||||
13), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "ingotPlatinum", });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 14),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "ingotNickel",});
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1,
|
||||
14), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "ingotNickel", });
|
||||
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1, 15),
|
||||
new Object[]{"AAA", "AAA", "AAA",
|
||||
'A', "ingotInvar",});
|
||||
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.storage, 1,
|
||||
15), new Object[]
|
||||
{ "AAA", "AAA", "AAA", 'A', "ingotInvar", });
|
||||
|
||||
LogHelper.info("Shapped Recipes Added");
|
||||
}
|
||||
LogHelper.info("Shapped Recipes Added");
|
||||
}
|
||||
|
||||
public static void addShaplessRecipes() {
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 4), "blockSilver");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 5), "blockAluminium");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 6), "blockTitanium");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.gems, 9, 1), "blockSapphire");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.gems, 9, 0), "blockRuby");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.gems, 9, 2), "blockGreenSapphire");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 7), "blockChrome");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 8), "blockElectrum");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 9), "blockTungsten");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 10), "blockLead");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 11), "blockZinc");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 12), "blockBrass");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 13), "blockSteel");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 14), "blockPlatinum");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 15), "blockNickel");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9, 16), "blockInvar");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.rockCutter, 1, 27), Items.apple);
|
||||
public static void addShaplessRecipes()
|
||||
{
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9,
|
||||
4), "blockSilver");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9,
|
||||
5), "blockAluminium");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9,
|
||||
6), "blockTitanium");
|
||||
CraftingHelper.addShapelessOreRecipe(
|
||||
new ItemStack(ModItems.gems, 9, 1), "blockSapphire");
|
||||
CraftingHelper.addShapelessOreRecipe(
|
||||
new ItemStack(ModItems.gems, 9, 0), "blockRuby");
|
||||
CraftingHelper.addShapelessOreRecipe(
|
||||
new ItemStack(ModItems.gems, 9, 2), "blockGreenSapphire");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9,
|
||||
7), "blockChrome");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9,
|
||||
8), "blockElectrum");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9,
|
||||
9), "blockTungsten");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9,
|
||||
10), "blockLead");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9,
|
||||
11), "blockZinc");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9,
|
||||
12), "blockBrass");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9,
|
||||
13), "blockSteel");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9,
|
||||
14), "blockPlatinum");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9,
|
||||
15), "blockNickel");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.ingots, 9,
|
||||
16), "blockInvar");
|
||||
CraftingHelper.addShapelessOreRecipe(new ItemStack(ModItems.rockCutter,
|
||||
1, 27), Items.apple);
|
||||
|
||||
LogHelper.info("Shapless Recipes Added");
|
||||
}
|
||||
|
||||
LogHelper.info("Shapless Recipes Added");
|
||||
}
|
||||
public static void addSmeltingRecipes()
|
||||
{
|
||||
GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 27),
|
||||
new ItemStack(Items.iron_ingot), 1F);
|
||||
GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 23),
|
||||
new ItemStack(Items.gold_ingot), 1F);
|
||||
GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 14),
|
||||
IC2Items.getItem("copperIngot"), 1F);
|
||||
GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 51),
|
||||
IC2Items.getItem("tinIngot"), 1F);
|
||||
GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 7),
|
||||
IC2Items.getItem("bronzeIngot"), 1F);
|
||||
GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 29),
|
||||
IC2Items.getItem("leadIngot"), 1F);
|
||||
GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 45),
|
||||
IC2Items.getItem("silverIngot"), 1F);
|
||||
|
||||
public static void addSmeltingRecipes() {
|
||||
GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 27), new ItemStack(Items.iron_ingot), 1F);
|
||||
GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 23), new ItemStack(Items.gold_ingot), 1F);
|
||||
GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 14), IC2Items.getItem("copperIngot"), 1F);
|
||||
GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 51), IC2Items.getItem("tinIngot"), 1F);
|
||||
GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 7), IC2Items.getItem("bronzeIngot"), 1F);
|
||||
GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 29), IC2Items.getItem("leadIngot"), 1F);
|
||||
GameRegistry.addSmelting(new ItemStack(ModItems.dusts, 1, 45), IC2Items.getItem("silverIngot"), 1F);
|
||||
LogHelper.info("Smelting Recipes Added");
|
||||
}
|
||||
|
||||
LogHelper.info("Smelting Recipes Added");
|
||||
}
|
||||
|
||||
public static void addMachineRecipes() {
|
||||
TechRebornAPI.registerCentrifugeRecipe(new CentrifugeRecipie(Items.apple, 4, Items.beef, Items.baked_potato, null, null, 120, 4));
|
||||
TechRebornAPI.registerCentrifugeRecipe(new CentrifugeRecipie(Items.nether_star, 1, Items.diamond, Items.emerald, Items.bed, Items.cake, 500, 8));
|
||||
TechRebornAPI.addRollingMachinceRecipe(new ItemStack(Blocks.furnace, 4), "ccc", "c c", "ccc", 'c', Blocks.cobblestone);
|
||||
LogHelper.info("Machine Recipes Added");
|
||||
}
|
||||
public static void addMachineRecipes()
|
||||
{
|
||||
TechRebornAPI.registerCentrifugeRecipe(new CentrifugeRecipie(
|
||||
Items.apple, 4, Items.beef, Items.baked_potato, null, null,
|
||||
120, 4));
|
||||
TechRebornAPI.registerCentrifugeRecipe(new CentrifugeRecipie(
|
||||
Items.nether_star, 1, Items.diamond, Items.emerald, Items.bed,
|
||||
Items.cake, 500, 8));
|
||||
TechRebornAPI.addRollingMachinceRecipe(
|
||||
new ItemStack(Blocks.furnace, 4), "ccc", "c c", "ccc", 'c',
|
||||
Blocks.cobblestone);
|
||||
LogHelper.info("Machine Recipes Added");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,13 +3,14 @@ package techreborn.itemblocks;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemMultiTexture;
|
||||
import techreborn.blocks.BlockMachineCasing;
|
||||
import techreborn.blocks.BlockOre;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class ItemBlockMachineCasing extends ItemMultiTexture {
|
||||
|
||||
public ItemBlockMachineCasing(Block block) {
|
||||
super(ModBlocks.MachineCasing, ModBlocks.MachineCasing, BlockMachineCasing.types);
|
||||
}
|
||||
public ItemBlockMachineCasing(Block block)
|
||||
{
|
||||
super(ModBlocks.MachineCasing, ModBlocks.MachineCasing,
|
||||
BlockMachineCasing.types);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,20 +12,28 @@ import techreborn.achievement.IPickupAchievement;
|
|||
import techreborn.blocks.BlockOre;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class ItemBlockOre extends ItemMultiTexture implements IPickupAchievement, ICraftAchievement{
|
||||
public class ItemBlockOre extends ItemMultiTexture implements
|
||||
IPickupAchievement, ICraftAchievement {
|
||||
|
||||
public ItemBlockOre(Block block) {
|
||||
super(ModBlocks.ore, ModBlocks.ore, BlockOre.types);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Achievement getAchievementOnCraft(ItemStack stack, EntityPlayer player, IInventory matrix) {
|
||||
return field_150939_a instanceof ICraftAchievement ? ((ICraftAchievement) field_150939_a).getAchievementOnCraft(stack, player, matrix) : null;
|
||||
public ItemBlockOre(Block block)
|
||||
{
|
||||
super(ModBlocks.ore, ModBlocks.ore, BlockOre.types);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Achievement getAchievementOnPickup(ItemStack stack, EntityPlayer player, EntityItem item) {
|
||||
return field_150939_a instanceof IPickupAchievement ? ((IPickupAchievement) field_150939_a).getAchievementOnPickup(stack, player, item) : null;
|
||||
public Achievement getAchievementOnCraft(ItemStack stack,
|
||||
EntityPlayer player, IInventory matrix)
|
||||
{
|
||||
return field_150939_a instanceof ICraftAchievement ? ((ICraftAchievement) field_150939_a)
|
||||
.getAchievementOnCraft(stack, player, matrix) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Achievement getAchievementOnPickup(ItemStack stack,
|
||||
EntityPlayer player, EntityItem item)
|
||||
{
|
||||
return field_150939_a instanceof IPickupAchievement ? ((IPickupAchievement) field_150939_a)
|
||||
.getAchievementOnPickup(stack, player, item) : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package techreborn.itemblocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
|
@ -9,39 +9,53 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.world.World;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.TileQuantumChest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemBlockQuantumChest extends ItemBlock {
|
||||
|
||||
public ItemBlockQuantumChest(Block p_i45328_1_) {
|
||||
super(p_i45328_1_);
|
||||
}
|
||||
public ItemBlockQuantumChest(Block p_i45328_1_)
|
||||
{
|
||||
super(p_i45328_1_);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (stack != null && stack.hasTagCompound()) {
|
||||
if (stack.getTagCompound().getCompoundTag("tileEntity") != null)
|
||||
list.add(stack.getTagCompound().getCompoundTag("tileEntity").getInteger("storedQuantity") + " items");
|
||||
}
|
||||
}
|
||||
@SuppressWarnings(
|
||||
{ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list,
|
||||
boolean par4)
|
||||
{
|
||||
if (stack != null && stack.hasTagCompound())
|
||||
{
|
||||
if (stack.getTagCompound().getCompoundTag("tileEntity") != null)
|
||||
list.add(stack.getTagCompound().getCompoundTag("tileEntity")
|
||||
.getInteger("storedQuantity")
|
||||
+ " items");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
|
||||
if (!world.setBlock(x, y, z, ModBlocks.quantumChest, metadata, 3)) {
|
||||
return false;
|
||||
}
|
||||
if (world.getBlock(x, y, z) == ModBlocks.quantumChest) {
|
||||
world.getBlock(x, y, z).onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
world.getBlock(x, y, z).onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
if (stack != null && stack.hasTagCompound()) {
|
||||
((TileQuantumChest) world.getTileEntity(x, y, z)).readFromNBTWithoutCoords(stack.getTagCompound().getCompoundTag("tileEntity"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player,
|
||||
World world, int x, int y, int z, int side, float hitX, float hitY,
|
||||
float hitZ, int metadata)
|
||||
{
|
||||
if (!world.setBlock(x, y, z, ModBlocks.quantumChest, metadata, 3))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (world.getBlock(x, y, z) == ModBlocks.quantumChest)
|
||||
{
|
||||
world.getBlock(x, y, z).onBlockPlacedBy(world, x, y, z, player,
|
||||
stack);
|
||||
world.getBlock(x, y, z).onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
if (stack != null && stack.hasTagCompound())
|
||||
{
|
||||
((TileQuantumChest) world.getTileEntity(x, y, z))
|
||||
.readFromNBTWithoutCoords(stack.getTagCompound()
|
||||
.getCompoundTag("tileEntity"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,22 +10,32 @@ import techreborn.tiles.TileQuantumTank;
|
|||
|
||||
public class ItemBlockQuantumTank extends ItemBlock {
|
||||
|
||||
public ItemBlockQuantumTank(Block block) {
|
||||
super(block);
|
||||
}
|
||||
public ItemBlockQuantumTank(Block block)
|
||||
{
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
|
||||
if (!world.setBlock(x, y, z, ModBlocks.quantumTank, metadata, 3)) {
|
||||
return false;
|
||||
}
|
||||
if (world.getBlock(x, y, z) == ModBlocks.quantumTank) {
|
||||
world.getBlock(x, y, z).onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
world.getBlock(x, y, z).onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
if (stack != null && stack.hasTagCompound()) {
|
||||
((TileQuantumTank) world.getTileEntity(x, y, z)).readFromNBTWithoutCoords(stack.getTagCompound().getCompoundTag("tileEntity"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player,
|
||||
World world, int x, int y, int z, int side, float hitX, float hitY,
|
||||
float hitZ, int metadata)
|
||||
{
|
||||
if (!world.setBlock(x, y, z, ModBlocks.quantumTank, metadata, 3))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (world.getBlock(x, y, z) == ModBlocks.quantumTank)
|
||||
{
|
||||
world.getBlock(x, y, z).onBlockPlacedBy(world, x, y, z, player,
|
||||
stack);
|
||||
world.getBlock(x, y, z).onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
if (stack != null && stack.hasTagCompound())
|
||||
{
|
||||
((TileQuantumTank) world.getTileEntity(x, y, z))
|
||||
.readFromNBTWithoutCoords(stack.getTagCompound()
|
||||
.getCompoundTag("tileEntity"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,9 @@ import techreborn.init.ModBlocks;
|
|||
|
||||
public class ItemBlockStorage extends ItemMultiTexture {
|
||||
|
||||
public ItemBlockStorage(Block block) {
|
||||
super(ModBlocks.storage, ModBlocks.storage, BlockStorage.types);
|
||||
}
|
||||
public ItemBlockStorage(Block block)
|
||||
{
|
||||
super(ModBlocks.storage, ModBlocks.storage, BlockStorage.types);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,76 +1,85 @@
|
|||
package techreborn.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemCells extends ItemTR {
|
||||
public static final String[] types = new String[]
|
||||
{
|
||||
"Berylium", "biomass", "calciumCarbonate", "calcium", "carbon", "chlorine", "deuterium",
|
||||
"diesel", "ethanol", "glyceryl", "helium3", "helium", "heliumPlasma", "hydrogen", "ice", "lithium",
|
||||
"mercury", "methane", "nitrocarbon", "nitroCoalfuel", "nitroDiesel", "nitrogen", "nitrogenDioxide", "oil",
|
||||
"potassium", "seedOil", "silicon", "sodium", "sodiumPersulfate", "sodiumSulfide", "sulfur", "sulfuricAcid",
|
||||
"wolframium",
|
||||
};
|
||||
public static final String[] types = new String[]
|
||||
{ "Berylium", "biomass", "calciumCarbonate", "calcium", "carbon",
|
||||
"chlorine", "deuterium", "diesel", "ethanol", "glyceryl",
|
||||
"helium3", "helium", "heliumPlasma", "hydrogen", "ice", "lithium",
|
||||
"mercury", "methane", "nitrocarbon", "nitroCoalfuel",
|
||||
"nitroDiesel", "nitrogen", "nitrogenDioxide", "oil", "potassium",
|
||||
"seedOil", "silicon", "sodium", "sodiumPersulfate",
|
||||
"sodiumSulfide", "sulfur", "sulfuricAcid", "wolframium", };
|
||||
|
||||
private IIcon[] textures;
|
||||
private IIcon[] textures;
|
||||
|
||||
public ItemCells() {
|
||||
setUnlocalizedName("techreborn.cell");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
}
|
||||
public ItemCells()
|
||||
{
|
||||
setUnlocalizedName("techreborn.cell");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
// Registers Textures For All Dusts
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
textures = new IIcon[types.length];
|
||||
@Override
|
||||
// Registers Textures For All Dusts
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
textures = new IIcon[types.length];
|
||||
|
||||
for (int i = 0; i < types.length; ++i) {
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "cells/" + types[i] + "Cell");
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < types.length; ++i)
|
||||
{
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "cells/"
|
||||
+ types[i] + "Cell");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
// Adds Texture what match's meta data
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
if (meta < 0 || meta >= textures.length) {
|
||||
meta = 0;
|
||||
}
|
||||
@Override
|
||||
// Adds Texture what match's meta data
|
||||
public IIcon getIconFromDamage(int meta)
|
||||
{
|
||||
if (meta < 0 || meta >= textures.length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return textures[meta];
|
||||
}
|
||||
return textures[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return super.getUnlocalizedName() + "." + types[meta];
|
||||
}
|
||||
return super.getUnlocalizedName() + "." + types[meta];
|
||||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; ++meta) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack itemstack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; ++meta)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack itemstack)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,67 +11,79 @@ import net.minecraft.util.IIcon;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
|
||||
public class ItemDusts extends ItemTR {
|
||||
public static final String[] types = new String[]
|
||||
{
|
||||
"Almandine", "Aluminium", "Andradite", "Ashes", "Basalt", "Bauxite", "Brass", "Bronze",
|
||||
"Calcite", "Charcoal", "Chrome", "Cinnabar", "Clay", "Coal", "Copper", "DarkAshes", "Diamond",
|
||||
"Electrum", "Emerald", "EnderEye", "EnderPearl", "Endstone", "Flint", "Gold", "GreenSapphire", "Grossular",
|
||||
"Invar", "Iron", "Lazurite", "Lead", "Magnesium", "Marble", "Netherrack", "Nickel", "Obsidian",
|
||||
"Olivine", "Phosphor", "Platinum", "Pyrite", "Pyrope", "RedGarnet", "Redrock", "Ruby", "Saltpeter", "Sapphire",
|
||||
"Silver", "Sodalite", "Spessartine", "Sphalerite", "Steel", "Sulfur", "Tin", "Titanium", "Tungsten", "Uranium",
|
||||
"Uvarovite", "YellowGarnet", "Zinc", "Cobalt", "Ardite", "Manyullyn", "AlBrass", "Alumite"
|
||||
};
|
||||
public static final String[] types = new String[]
|
||||
{ "Almandine", "Aluminium", "Andradite", "Ashes", "Basalt", "Bauxite",
|
||||
"Brass", "Bronze", "Calcite", "Charcoal", "Chrome", "Cinnabar",
|
||||
"Clay", "Coal", "Copper", "DarkAshes", "Diamond", "Electrum",
|
||||
"Emerald", "EnderEye", "EnderPearl", "Endstone", "Flint", "Gold",
|
||||
"GreenSapphire", "Grossular", "Invar", "Iron", "Lazurite", "Lead",
|
||||
"Magnesium", "Marble", "Netherrack", "Nickel", "Obsidian",
|
||||
"Olivine", "Phosphor", "Platinum", "Pyrite", "Pyrope", "RedGarnet",
|
||||
"Redrock", "Ruby", "Saltpeter", "Sapphire", "Silver", "Sodalite",
|
||||
"Spessartine", "Sphalerite", "Steel", "Sulfur", "Tin", "Titanium",
|
||||
"Tungsten", "Uranium", "Uvarovite", "YellowGarnet", "Zinc",
|
||||
"Cobalt", "Ardite", "Manyullyn", "AlBrass", "Alumite" };
|
||||
|
||||
private IIcon[] textures;
|
||||
private IIcon[] textures;
|
||||
|
||||
public ItemDusts() {
|
||||
setUnlocalizedName("techreborn.dust");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
}
|
||||
public ItemDusts()
|
||||
{
|
||||
setUnlocalizedName("techreborn.dust");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
// Registers Textures For All Dusts
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
textures = new IIcon[types.length];
|
||||
@Override
|
||||
// Registers Textures For All Dusts
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
textures = new IIcon[types.length];
|
||||
|
||||
for (int i = 0; i < types.length; ++i) {
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "dust/" + types[i] + "Dust");
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < types.length; ++i)
|
||||
{
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "dust/"
|
||||
+ types[i] + "Dust");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
// Adds Texture what match's meta data
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
if (meta < 0 || meta >= textures.length) {
|
||||
meta = 0;
|
||||
}
|
||||
@Override
|
||||
// Adds Texture what match's meta data
|
||||
public IIcon getIconFromDamage(int meta)
|
||||
{
|
||||
if (meta < 0 || meta >= textures.length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return textures[meta];
|
||||
}
|
||||
return textures[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return super.getUnlocalizedName() + "." + types[meta];
|
||||
}
|
||||
return super.getUnlocalizedName() + "." + types[meta];
|
||||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; ++meta) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack itemstack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; ++meta)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack itemstack)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,67 +11,77 @@ import net.minecraft.util.IIcon;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
|
||||
public class ItemDustsSmall extends ItemTR {
|
||||
public static final String[] types = new String[]
|
||||
{
|
||||
"Almandine", "Aluminium", "Andradite", "Basalt", "Bauxite", "Brass", "Bronze",
|
||||
"Calcite", "Charcoal", "Chrome", "Cinnabar", "Clay", "Coal", "Copper", "Diamond",
|
||||
"Electrum", "Emerald", "EnderEye", "EnderPearl", "Endstone", "Gold", "GreenSapphire", "Grossular",
|
||||
"Invar", "Iron", "Lazurite", "Lead", "Magnesium", "Marble", "Netherrack", "Nickel", "Obsidian",
|
||||
"Olivine", "Platinum", "Pyrite", "Pyrope", "RedGarnet", "Ruby", "Saltpeter", "Sapphire",
|
||||
"Silver", "Sodalite", "Steel", "Sulfur", "Tin", "Titanium", "Tungsten",
|
||||
"Zinc",
|
||||
};
|
||||
public static final String[] types = new String[]
|
||||
{ "Almandine", "Aluminium", "Andradite", "Basalt", "Bauxite", "Brass",
|
||||
"Bronze", "Calcite", "Charcoal", "Chrome", "Cinnabar", "Clay",
|
||||
"Coal", "Copper", "Diamond", "Electrum", "Emerald", "EnderEye",
|
||||
"EnderPearl", "Endstone", "Gold", "GreenSapphire", "Grossular",
|
||||
"Invar", "Iron", "Lazurite", "Lead", "Magnesium", "Marble",
|
||||
"Netherrack", "Nickel", "Obsidian", "Olivine", "Platinum",
|
||||
"Pyrite", "Pyrope", "RedGarnet", "Ruby", "Saltpeter", "Sapphire",
|
||||
"Silver", "Sodalite", "Steel", "Sulfur", "Tin", "Titanium",
|
||||
"Tungsten", "Zinc", };
|
||||
|
||||
private IIcon[] textures;
|
||||
private IIcon[] textures;
|
||||
|
||||
public ItemDustsSmall() {
|
||||
setUnlocalizedName("techreborn.dustsmall");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
}
|
||||
public ItemDustsSmall()
|
||||
{
|
||||
setUnlocalizedName("techreborn.dustsmall");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
// Registers Textures For All Dusts
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
textures = new IIcon[types.length];
|
||||
@Override
|
||||
// Registers Textures For All Dusts
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
textures = new IIcon[types.length];
|
||||
|
||||
for (int i = 0; i < types.length; ++i) {
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "smallDust/small" + types[i] + "Dust");
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < types.length; ++i)
|
||||
{
|
||||
textures[i] = iconRegister.registerIcon("techreborn:"
|
||||
+ "smallDust/small" + types[i] + "Dust");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
// Adds Texture what match's meta data
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
if (meta < 0 || meta >= textures.length) {
|
||||
meta = 0;
|
||||
}
|
||||
@Override
|
||||
// Adds Texture what match's meta data
|
||||
public IIcon getIconFromDamage(int meta)
|
||||
{
|
||||
if (meta < 0 || meta >= textures.length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return textures[meta];
|
||||
}
|
||||
return textures[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return super.getUnlocalizedName() + "." + types[meta];
|
||||
}
|
||||
return super.getUnlocalizedName() + "." + types[meta];
|
||||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; ++meta) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack itemstack) {
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; ++meta)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack itemstack)
|
||||
{
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,60 +11,70 @@ import net.minecraft.util.IIcon;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
|
||||
public class ItemGems extends Item {
|
||||
public static final String[] types = new String[]
|
||||
{
|
||||
"Ruby", "Sapphire", "GreenSapphire", "Olivine", "RedGarnet", "YellowGarnet"
|
||||
};
|
||||
public static final String[] types = new String[]
|
||||
{ "Ruby", "Sapphire", "GreenSapphire", "Olivine", "RedGarnet",
|
||||
"YellowGarnet" };
|
||||
|
||||
private IIcon[] textures;
|
||||
private IIcon[] textures;
|
||||
|
||||
public ItemGems() {
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setUnlocalizedName("techreborn.gem");
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
public ItemGems()
|
||||
{
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setUnlocalizedName("techreborn.gem");
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
// Registers Textures For All Dusts
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
textures = new IIcon[types.length];
|
||||
@Override
|
||||
// Registers Textures For All Dusts
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
textures = new IIcon[types.length];
|
||||
|
||||
for (int i = 0; i < types.length; ++i) {
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "gem/" + types[i]);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < types.length; ++i)
|
||||
{
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "gem/"
|
||||
+ types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
// Adds Texture what match's meta data
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
if (meta < 0 || meta >= textures.length) {
|
||||
meta = 0;
|
||||
}
|
||||
@Override
|
||||
// Adds Texture what match's meta data
|
||||
public IIcon getIconFromDamage(int meta)
|
||||
{
|
||||
if (meta < 0 || meta >= textures.length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return textures[meta];
|
||||
}
|
||||
return textures[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return super.getUnlocalizedName() + "." + types[meta];
|
||||
}
|
||||
return super.getUnlocalizedName() + "." + types[meta];
|
||||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; ++meta) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; ++meta)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack itemstack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack itemstack)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,62 +11,72 @@ import net.minecraft.util.IIcon;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
|
||||
public class ItemIngots extends Item {
|
||||
public static final String[] types = new String[]
|
||||
{
|
||||
"IridiumAlloy", "HotTungstenSteel", "TungstenSteel", "Iridium", "Silver", "Aluminium", "Titanium", "Chrome",
|
||||
"Electrum", "Tungsten", "Lead", "Zinc", "Brass", "Steel", "Platinum", "Nickel", "Invar",
|
||||
"Cobalt", "Ardite", "Manyullyn", "AlBrass", "Alumite"
|
||||
};
|
||||
public static final String[] types = new String[]
|
||||
{ "IridiumAlloy", "HotTungstenSteel", "TungstenSteel", "Iridium", "Silver",
|
||||
"Aluminium", "Titanium", "Chrome", "Electrum", "Tungsten", "Lead",
|
||||
"Zinc", "Brass", "Steel", "Platinum", "Nickel", "Invar", "Cobalt",
|
||||
"Ardite", "Manyullyn", "AlBrass", "Alumite" };
|
||||
|
||||
private IIcon[] textures;
|
||||
private IIcon[] textures;
|
||||
|
||||
public ItemIngots() {
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHasSubtypes(true);
|
||||
setUnlocalizedName("techreborn.ingot");
|
||||
}
|
||||
public ItemIngots()
|
||||
{
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHasSubtypes(true);
|
||||
setUnlocalizedName("techreborn.ingot");
|
||||
}
|
||||
|
||||
@Override
|
||||
// Registers Textures For All Dusts
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
textures = new IIcon[types.length];
|
||||
@Override
|
||||
// Registers Textures For All Dusts
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
textures = new IIcon[types.length];
|
||||
|
||||
for (int i = 0; i < types.length; ++i) {
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "ingot/" + types[i] + "Ingot");
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < types.length; ++i)
|
||||
{
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "ingot/"
|
||||
+ types[i] + "Ingot");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
// Adds Texture what match's meta data
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
if (meta < 0 || meta >= textures.length) {
|
||||
meta = 0;
|
||||
}
|
||||
@Override
|
||||
// Adds Texture what match's meta data
|
||||
public IIcon getIconFromDamage(int meta)
|
||||
{
|
||||
if (meta < 0 || meta >= textures.length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return textures[meta];
|
||||
}
|
||||
return textures[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return super.getUnlocalizedName() + "." + types[meta];
|
||||
}
|
||||
return super.getUnlocalizedName() + "." + types[meta];
|
||||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; ++meta) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; ++meta)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack itemstack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack itemstack)
|
||||
{
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,63 +11,75 @@ import net.minecraft.util.IIcon;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
|
||||
public class ItemParts extends Item {
|
||||
public static final String[] types = new String[]
|
||||
{
|
||||
"LazuriteChunk", "SiliconPlate", "MagnaliumPlate", "EnergeyFlowCircuit", "DataControlCircuit", "SuperConductor",
|
||||
"DataStorageCircuit", "ComputerMonitor", "DiamondSawBlade", "DiamondGrinder", "KanthalHeatingCoil",
|
||||
"NichromeHeatingCoil", "CupronickelHeatingCoil", "MachineParts", "WolframiamGrinder",
|
||||
"AluminiumMachineHull", "BronzeMachineHull", "SteelMachineHull", "TitaniumMachineHull", "BrassMachineHull"
|
||||
};
|
||||
public static final String[] types = new String[]
|
||||
{ "LazuriteChunk", "SiliconPlate", "MagnaliumPlate", "EnergeyFlowCircuit",
|
||||
"DataControlCircuit", "SuperConductor", "DataStorageCircuit",
|
||||
"ComputerMonitor", "DiamondSawBlade", "DiamondGrinder",
|
||||
"KanthalHeatingCoil", "NichromeHeatingCoil",
|
||||
"CupronickelHeatingCoil", "MachineParts", "WolframiamGrinder",
|
||||
"AluminiumMachineHull", "BronzeMachineHull", "SteelMachineHull",
|
||||
"TitaniumMachineHull", "BrassMachineHull" };
|
||||
|
||||
private IIcon[] textures;
|
||||
private IIcon[] textures;
|
||||
|
||||
public ItemParts() {
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHasSubtypes(true);
|
||||
setUnlocalizedName("techreborn.part");
|
||||
}
|
||||
public ItemParts()
|
||||
{
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHasSubtypes(true);
|
||||
setUnlocalizedName("techreborn.part");
|
||||
}
|
||||
|
||||
@Override
|
||||
// Registers Textures For All Dusts
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
textures = new IIcon[types.length];
|
||||
@Override
|
||||
// Registers Textures For All Dusts
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
textures = new IIcon[types.length];
|
||||
|
||||
for (int i = 0; i < types.length; ++i) {
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "part/" + types[i]);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < types.length; ++i)
|
||||
{
|
||||
textures[i] = iconRegister.registerIcon("techreborn:" + "part/"
|
||||
+ types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
// Adds Texture what match's meta data
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
if (meta < 0 || meta >= textures.length) {
|
||||
meta = 0;
|
||||
}
|
||||
@Override
|
||||
// Adds Texture what match's meta data
|
||||
public IIcon getIconFromDamage(int meta)
|
||||
{
|
||||
if (meta < 0 || meta >= textures.length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return textures[meta];
|
||||
}
|
||||
return textures[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length)
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return super.getUnlocalizedName() + "." + types[meta];
|
||||
}
|
||||
return super.getUnlocalizedName() + "." + types[meta];
|
||||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; ++meta) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; ++meta)
|
||||
{
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack itemstack) {
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack itemstack)
|
||||
{
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,14 +7,17 @@ import techreborn.lib.ModInfo;
|
|||
|
||||
public class ItemTR extends Item {
|
||||
|
||||
public ItemTR() {
|
||||
setNoRepair();
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
public ItemTR()
|
||||
{
|
||||
setNoRepair();
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
itemIcon = iconRegister.registerIcon(ModInfo.MOD_ID + ":" + getUnlocalizedName().toLowerCase().substring(5));
|
||||
}
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
itemIcon = iconRegister.registerIcon(ModInfo.MOD_ID + ":"
|
||||
+ getUnlocalizedName().toLowerCase().substring(5));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package techreborn.items.armor;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ic2.api.item.ElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -17,137 +18,179 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.ISpecialArmor;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
public class ItemGravityChest extends ItemArmor implements IElectricItem,
|
||||
ISpecialArmor {
|
||||
|
||||
public class ItemGravityChest extends ItemArmor implements IElectricItem, ISpecialArmor {
|
||||
public static int maxCharge = ConfigTechReborn.GravityCharge;
|
||||
public int tier = 3;
|
||||
public int cost = 100;
|
||||
public double transferLimit = 1000;
|
||||
public int energyPerDamage = 100;
|
||||
|
||||
public static int maxCharge = ConfigTechReborn.GravityCharge;
|
||||
public int tier = 3;
|
||||
public int cost = 100;
|
||||
public double transferLimit = 1000;
|
||||
public int energyPerDamage = 100;
|
||||
public ItemGravityChest(ArmorMaterial material, int par3, int par4)
|
||||
{
|
||||
super(material, par3, par4);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setUnlocalizedName("techreborn.gravitychestplate");
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(120);
|
||||
// isDamageable();
|
||||
}
|
||||
|
||||
public ItemGravityChest(ArmorMaterial material, int par3, int par4) {
|
||||
super(material, par3, par4);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setUnlocalizedName("techreborn.gravitychestplate");
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(120);
|
||||
// isDamageable();
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("techreborn:"
|
||||
+ "items/gravitychestplate");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon("techreborn:" + "items/gravitychestplate");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot,
|
||||
String type)
|
||||
{
|
||||
return "techreborn:" + "textures/models/gravitychestplate.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
||||
return "techreborn:" + "textures/models/gravitychestplate.png";
|
||||
}
|
||||
@SuppressWarnings(
|
||||
{ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs,
|
||||
List itemList)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
if (getChargedItem(itemStack) == this)
|
||||
{
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
|
||||
false);
|
||||
itemList.add(charged);
|
||||
}
|
||||
if (getEmptyItem(itemStack) == this)
|
||||
{
|
||||
itemList.add(new ItemStack(this, 1, getMaxDamage()));
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
if (getChargedItem(itemStack) == this) {
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
|
||||
itemList.add(charged);
|
||||
}
|
||||
if (getEmptyItem(itemStack) == this) {
|
||||
itemList.add(new ItemStack(this, 1, getMaxDamage()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack stack)
|
||||
{
|
||||
if (world.isRemote)
|
||||
;
|
||||
if (ElectricItem.manager.canUse(stack, cost))
|
||||
{
|
||||
player.capabilities.allowFlying = true;
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
|
||||
if (world.isRemote) ;
|
||||
if (ElectricItem.manager.canUse(stack, cost)) {
|
||||
player.capabilities.allowFlying = true;
|
||||
if (player.fallDistance > 0.0F)
|
||||
player.fallDistance = 0;
|
||||
|
||||
if (player.fallDistance > 0.0F)
|
||||
player.fallDistance = 0;
|
||||
if (player.capabilities.allowFlying == true & !player.onGround)
|
||||
ElectricItem.manager.discharge(stack, cost, tier, false, true,
|
||||
false);
|
||||
|
||||
if (player.capabilities.allowFlying == true & !player.onGround)
|
||||
ElectricItem.manager.discharge(stack, cost, tier, false, true, false);
|
||||
if (!ElectricItem.manager.canUse(stack, cost))
|
||||
player.capabilities.allowFlying = false;
|
||||
}
|
||||
|
||||
if (!ElectricItem.manager.canUse(stack, cost))
|
||||
player.capabilities.allowFlying = false;
|
||||
}
|
||||
if (player.fallDistance > 0.0F)
|
||||
player.fallDistance = 0;
|
||||
}
|
||||
|
||||
if (player.fallDistance > 0.0F) player.fallDistance = 0;
|
||||
}
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public Item getChargedItem(ItemStack itemStack)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getChargedItem(ItemStack itemStack) {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Item getEmptyItem(ItemStack itemStack)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getEmptyItem(ItemStack itemStack) {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public double getMaxCharge(ItemStack itemStack)
|
||||
{
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxCharge(ItemStack itemStack) {
|
||||
return maxCharge;
|
||||
}
|
||||
@Override
|
||||
public int getTier(ItemStack itemStack)
|
||||
{
|
||||
return tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTier(ItemStack itemStack) {
|
||||
return tier;
|
||||
}
|
||||
@Override
|
||||
public double getTransferLimit(ItemStack itemStack)
|
||||
{
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTransferLimit(ItemStack itemStack) {
|
||||
return transferLimit;
|
||||
}
|
||||
public int getEnergyPerDamage()
|
||||
{
|
||||
return energyPerDamage;
|
||||
}
|
||||
|
||||
public int getEnergyPerDamage() {
|
||||
return energyPerDamage;
|
||||
}
|
||||
@Override
|
||||
public ArmorProperties getProperties(EntityLivingBase player,
|
||||
ItemStack armor, DamageSource source, double damage, int slot)
|
||||
{
|
||||
if (source.isUnblockable())
|
||||
{
|
||||
return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(
|
||||
0, 0.0D, 3);
|
||||
} else
|
||||
{
|
||||
double absorptionRatio = getBaseAbsorptionRatio()
|
||||
* getDamageAbsorptionRatio();
|
||||
int energyPerDamage = getEnergyPerDamage();
|
||||
double damageLimit = energyPerDamage <= 0 ? 0
|
||||
: (25 * ElectricItem.manager.getCharge(armor))
|
||||
/ energyPerDamage;
|
||||
return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(
|
||||
3, absorptionRatio, (int) damageLimit);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
|
||||
if (source.isUnblockable()) {
|
||||
return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(0, 0.0D, 3);
|
||||
} else {
|
||||
double absorptionRatio = getBaseAbsorptionRatio() * getDamageAbsorptionRatio();
|
||||
int energyPerDamage = getEnergyPerDamage();
|
||||
double damageLimit = energyPerDamage <= 0 ? 0 : (25 * ElectricItem.manager.getCharge(armor)) / energyPerDamage;
|
||||
return new net.minecraftforge.common.ISpecialArmor.ArmorProperties(3, absorptionRatio, (int) damageLimit);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot)
|
||||
{
|
||||
if (ElectricItem.manager.getCharge(armor) >= getEnergyPerDamage())
|
||||
{
|
||||
return (int) Math.round(20D * getBaseAbsorptionRatio()
|
||||
* getDamageAbsorptionRatio());
|
||||
} else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
|
||||
if (ElectricItem.manager.getCharge(armor) >= getEnergyPerDamage()) {
|
||||
return (int) Math.round(20D * getBaseAbsorptionRatio() * getDamageAbsorptionRatio());
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void damageArmor(EntityLivingBase entity, ItemStack stack,
|
||||
DamageSource source, int damage, int slot)
|
||||
{
|
||||
ElectricItem.manager.discharge(stack, damage * getEnergyPerDamage(),
|
||||
0x7fffffff, true, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
|
||||
ElectricItem.manager.discharge(stack, damage * getEnergyPerDamage(), 0x7fffffff, true, false, false);
|
||||
}
|
||||
public double getDamageAbsorptionRatio()
|
||||
{
|
||||
return 1.1000000000000001D;
|
||||
}
|
||||
|
||||
public double getDamageAbsorptionRatio() {
|
||||
return 1.1000000000000001D;
|
||||
}
|
||||
|
||||
private double getBaseAbsorptionRatio() {
|
||||
return 0.14999999999999999D;
|
||||
}
|
||||
private double getBaseAbsorptionRatio()
|
||||
{
|
||||
return 0.14999999999999999D;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package techreborn.items.armor;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ic2.api.item.ElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -12,76 +13,93 @@ import net.minecraft.item.ItemArmor;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemLapotronPack extends ItemArmor implements IElectricItem {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.LapotronPackCharge;
|
||||
public static final int tier = ConfigTechReborn.LapotronPackTier;
|
||||
public double transferLimit = 100000;
|
||||
public static final int maxCharge = ConfigTechReborn.LapotronPackCharge;
|
||||
public static final int tier = ConfigTechReborn.LapotronPackTier;
|
||||
public double transferLimit = 100000;
|
||||
|
||||
public ItemLapotronPack(ArmorMaterial armormaterial, int par2, int par3) {
|
||||
super(armormaterial, par2, par3);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setUnlocalizedName("techreborn.lapotronpack");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
public ItemLapotronPack(ArmorMaterial armormaterial, int par2, int par3)
|
||||
{
|
||||
super(armormaterial, par2, par3);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setUnlocalizedName("techreborn.lapotronpack");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/lapotronicEnergyOrb");
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("techreborn:"
|
||||
+ "tool/lapotronicEnergyOrb");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
||||
return "techreborn:" + "textures/models/lapotronpack.png";
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot,
|
||||
String type)
|
||||
{
|
||||
return "techreborn:" + "textures/models/lapotronpack.png";
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
if (getChargedItem(itemStack) == this) {
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
|
||||
itemList.add(charged);
|
||||
}
|
||||
if (getEmptyItem(itemStack) == this) {
|
||||
itemList.add(new ItemStack(this, 1, getMaxDamage()));
|
||||
}
|
||||
}
|
||||
@SuppressWarnings(
|
||||
{ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs,
|
||||
List itemList)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
if (getChargedItem(itemStack) == this)
|
||||
{
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
|
||||
false);
|
||||
itemList.add(charged);
|
||||
}
|
||||
if (getEmptyItem(itemStack) == this)
|
||||
{
|
||||
itemList.add(new ItemStack(this, 1, getMaxDamage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getChargedItem(ItemStack itemStack) {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Item getChargedItem(ItemStack itemStack)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getEmptyItem(ItemStack itemStack) {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Item getEmptyItem(ItemStack itemStack)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxCharge(ItemStack itemStack) {
|
||||
return maxCharge;
|
||||
}
|
||||
@Override
|
||||
public double getMaxCharge(ItemStack itemStack)
|
||||
{
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTier(ItemStack itemStack) {
|
||||
return tier;
|
||||
}
|
||||
@Override
|
||||
public int getTier(ItemStack itemStack)
|
||||
{
|
||||
return tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTransferLimit(ItemStack itemStack) {
|
||||
return transferLimit;
|
||||
}
|
||||
@Override
|
||||
public double getTransferLimit(ItemStack itemStack)
|
||||
{
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package techreborn.items.armor;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ic2.api.item.ElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -12,76 +13,93 @@ import net.minecraft.item.ItemArmor;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemLithiumBatpack extends ItemArmor implements IElectricItem {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.LithiumBatpackCharge;
|
||||
public static final int tier = ConfigTechReborn.LithiumBatpackTier;
|
||||
public double transferLimit = 10000;
|
||||
public static final int maxCharge = ConfigTechReborn.LithiumBatpackCharge;
|
||||
public static final int tier = ConfigTechReborn.LithiumBatpackTier;
|
||||
public double transferLimit = 10000;
|
||||
|
||||
public ItemLithiumBatpack(ArmorMaterial armorMaterial, int par3, int par4) {
|
||||
super(armorMaterial, par3, par4);
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName("techreborn.lithiumbatpack");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
public ItemLithiumBatpack(ArmorMaterial armorMaterial, int par3, int par4)
|
||||
{
|
||||
super(armorMaterial, par3, par4);
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName("techreborn.lithiumbatpack");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/lithiumBatpack");
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("techreborn:"
|
||||
+ "tool/lithiumBatpack");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
||||
return "techreborn:" + "textures/models/lithiumbatpack.png";
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot,
|
||||
String type)
|
||||
{
|
||||
return "techreborn:" + "textures/models/lithiumbatpack.png";
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
if (getChargedItem(itemStack) == this) {
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
|
||||
itemList.add(charged);
|
||||
}
|
||||
if (getEmptyItem(itemStack) == this) {
|
||||
itemList.add(new ItemStack(this, 1, getMaxDamage()));
|
||||
}
|
||||
}
|
||||
@SuppressWarnings(
|
||||
{ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs,
|
||||
List itemList)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
if (getChargedItem(itemStack) == this)
|
||||
{
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
|
||||
false);
|
||||
itemList.add(charged);
|
||||
}
|
||||
if (getEmptyItem(itemStack) == this)
|
||||
{
|
||||
itemList.add(new ItemStack(this, 1, getMaxDamage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getChargedItem(ItemStack itemStack) {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Item getChargedItem(ItemStack itemStack)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getEmptyItem(ItemStack itemStack) {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Item getEmptyItem(ItemStack itemStack)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxCharge(ItemStack itemStack) {
|
||||
return maxCharge;
|
||||
}
|
||||
@Override
|
||||
public double getMaxCharge(ItemStack itemStack)
|
||||
{
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTier(ItemStack itemStack) {
|
||||
return tier;
|
||||
}
|
||||
@Override
|
||||
public int getTier(ItemStack itemStack)
|
||||
{
|
||||
return tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTransferLimit(ItemStack itemStack) {
|
||||
return transferLimit;
|
||||
}
|
||||
@Override
|
||||
public double getTransferLimit(ItemStack itemStack)
|
||||
{
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ic2.api.item.ElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
@ -17,111 +18,142 @@ import net.minecraft.world.World;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.util.TorchHelper;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemAdvancedDrill extends ItemPickaxe implements IElectricItem {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.AdvancedDrillCharge;
|
||||
public int cost = 250;
|
||||
public static final int tier = ConfigTechReborn.AdvancedDrillTier;
|
||||
public double transferLimit = 100;
|
||||
public static final int maxCharge = ConfigTechReborn.AdvancedDrillCharge;
|
||||
public int cost = 250;
|
||||
public static final int tier = ConfigTechReborn.AdvancedDrillTier;
|
||||
public double transferLimit = 100;
|
||||
|
||||
public ItemAdvancedDrill() {
|
||||
super(ToolMaterial.EMERALD);
|
||||
efficiencyOnProperMaterial = 20F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(240);
|
||||
setUnlocalizedName("techreborn.advancedDrill");
|
||||
}
|
||||
public ItemAdvancedDrill()
|
||||
{
|
||||
super(ToolMaterial.EMERALD);
|
||||
efficiencyOnProperMaterial = 20F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(240);
|
||||
setUnlocalizedName("techreborn.advancedDrill");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/advancedDrill");
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("techreborn:"
|
||||
+ "tool/advancedDrill");
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
if (getChargedItem(itemStack) == this) {
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
|
||||
itemList.add(charged);
|
||||
}
|
||||
if (getEmptyItem(itemStack) == this) {
|
||||
itemList.add(new ItemStack(this, 1, getMaxDamage()));
|
||||
}
|
||||
}
|
||||
@SuppressWarnings(
|
||||
{ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs,
|
||||
List itemList)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
if (getChargedItem(itemStack) == this)
|
||||
{
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
|
||||
false);
|
||||
itemList.add(charged);
|
||||
}
|
||||
if (getEmptyItem(itemStack) == this)
|
||||
{
|
||||
itemList.add(new ItemStack(this, 1, getMaxDamage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int par4, int par5, int par6, EntityLivingBase entityLiving) {
|
||||
ElectricItem.manager.use(stack, cost, entityLiving);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block,
|
||||
int par4, int par5, int par6, EntityLivingBase entityLiving)
|
||||
{
|
||||
ElectricItem.manager.use(stack, cost, entityLiving);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
||||
return Items.diamond_pickaxe.canHarvestBlock(block, stack) || Items.diamond_shovel.canHarvestBlock(block, stack);
|
||||
}
|
||||
@Override
|
||||
public boolean canHarvestBlock(Block block, ItemStack stack)
|
||||
{
|
||||
return Items.diamond_pickaxe.canHarvestBlock(block, stack)
|
||||
|| Items.diamond_shovel.canHarvestBlock(block, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, Block block, int meta) {
|
||||
if (!ElectricItem.manager.canUse(stack, cost)) {
|
||||
return 4.0F;
|
||||
}
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, Block block, int meta)
|
||||
{
|
||||
if (!ElectricItem.manager.canUse(stack, cost))
|
||||
{
|
||||
return 4.0F;
|
||||
}
|
||||
|
||||
if (Items.wooden_pickaxe.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_shovel.getDigSpeed(stack, block, meta) > 1.0F) {
|
||||
return efficiencyOnProperMaterial;
|
||||
} else {
|
||||
return super.getDigSpeed(stack, block, meta);
|
||||
}
|
||||
}
|
||||
if (Items.wooden_pickaxe.getDigSpeed(stack, block, meta) > 1.0F
|
||||
|| Items.wooden_shovel.getDigSpeed(stack, block, meta) > 1.0F)
|
||||
{
|
||||
return efficiencyOnProperMaterial;
|
||||
} else
|
||||
{
|
||||
return super.getDigSpeed(stack, block, meta);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack,
|
||||
EntityLivingBase entityliving, EntityLivingBase entityliving1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
|
||||
return TorchHelper.placeTorch(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset);
|
||||
}
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world,
|
||||
int x, int y, int z, int side, float xOffset, float yOffset,
|
||||
float zOffset)
|
||||
{
|
||||
return TorchHelper.placeTorch(stack, player, world, x, y, z, side,
|
||||
xOffset, yOffset, zOffset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxCharge(ItemStack itemStack) {
|
||||
return maxCharge;
|
||||
}
|
||||
@Override
|
||||
public double getMaxCharge(ItemStack itemStack)
|
||||
{
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTier(ItemStack itemStack) {
|
||||
return tier;
|
||||
}
|
||||
@Override
|
||||
public int getTier(ItemStack itemStack)
|
||||
{
|
||||
return tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTransferLimit(ItemStack itemStack) {
|
||||
return transferLimit;
|
||||
}
|
||||
@Override
|
||||
public double getTransferLimit(ItemStack itemStack)
|
||||
{
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getChargedItem(ItemStack itemStack) {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Item getChargedItem(ItemStack itemStack)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getEmptyItem(ItemStack itemStack) {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Item getEmptyItem(ItemStack itemStack)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ic2.api.item.ElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
@ -18,115 +19,155 @@ import net.minecraft.world.World;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.util.TorchHelper;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemOmniTool extends ItemPickaxe implements IElectricItem {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.OmniToolCharge;
|
||||
public static final int tier = ConfigTechReborn.OmniToolTier;
|
||||
public int cost = 100;
|
||||
public int hitCost = 125;
|
||||
public static final int maxCharge = ConfigTechReborn.OmniToolCharge;
|
||||
public static final int tier = ConfigTechReborn.OmniToolTier;
|
||||
public int cost = 100;
|
||||
public int hitCost = 125;
|
||||
|
||||
public ItemOmniTool(ToolMaterial toolMaterial) {
|
||||
super(toolMaterial);
|
||||
efficiencyOnProperMaterial = 13F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(200);
|
||||
setUnlocalizedName("techreborn.omniTool");
|
||||
}
|
||||
public ItemOmniTool(ToolMaterial toolMaterial)
|
||||
{
|
||||
super(toolMaterial);
|
||||
efficiencyOnProperMaterial = 13F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(200);
|
||||
setUnlocalizedName("techreborn.omniTool");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/omnitool");
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("techreborn:"
|
||||
+ "tool/omnitool");
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
if (getChargedItem(itemStack) == this) {
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
|
||||
itemList.add(charged);
|
||||
}
|
||||
if (getEmptyItem(itemStack) == this) {
|
||||
itemList.add(new ItemStack(this, 1, getMaxDamage()));
|
||||
}
|
||||
}
|
||||
@SuppressWarnings(
|
||||
{ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs,
|
||||
List itemList)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
if (getChargedItem(itemStack) == this)
|
||||
{
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
|
||||
false);
|
||||
itemList.add(charged);
|
||||
}
|
||||
if (getEmptyItem(itemStack) == this)
|
||||
{
|
||||
itemList.add(new ItemStack(this, 1, getMaxDamage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int par4, int par5, int par6, EntityLivingBase entityLiving) {
|
||||
ElectricItem.manager.use(stack, cost, entityLiving);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World world, Block block,
|
||||
int par4, int par5, int par6, EntityLivingBase entityLiving)
|
||||
{
|
||||
ElectricItem.manager.use(stack, cost, entityLiving);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
||||
return Items.diamond_axe.canHarvestBlock(block, stack) || Items.diamond_sword.canHarvestBlock(block, stack) || Items.diamond_pickaxe.canHarvestBlock(block, stack) || Items.diamond_shovel.canHarvestBlock(block, stack) || Items.shears.canHarvestBlock(block, stack);
|
||||
}
|
||||
@Override
|
||||
public boolean canHarvestBlock(Block block, ItemStack stack)
|
||||
{
|
||||
return Items.diamond_axe.canHarvestBlock(block, stack)
|
||||
|| Items.diamond_sword.canHarvestBlock(block, stack)
|
||||
|| Items.diamond_pickaxe.canHarvestBlock(block, stack)
|
||||
|| Items.diamond_shovel.canHarvestBlock(block, stack)
|
||||
|| Items.shears.canHarvestBlock(block, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, Block block, int meta) {
|
||||
if (!ElectricItem.manager.canUse(stack, cost)) {
|
||||
return 5.0F;
|
||||
}
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, Block block, int meta)
|
||||
{
|
||||
if (!ElectricItem.manager.canUse(stack, cost))
|
||||
{
|
||||
return 5.0F;
|
||||
}
|
||||
|
||||
if (Items.wooden_axe.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_sword.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_pickaxe.getDigSpeed(stack, block, meta) > 1.0F || Items.wooden_shovel.getDigSpeed(stack, block, meta) > 1.0F || Items.shears.getDigSpeed(stack, block, meta) > 1.0F) {
|
||||
return efficiencyOnProperMaterial;
|
||||
} else {
|
||||
return super.getDigSpeed(stack, block, meta);
|
||||
}
|
||||
}
|
||||
if (Items.wooden_axe.getDigSpeed(stack, block, meta) > 1.0F
|
||||
|| Items.wooden_sword.getDigSpeed(stack, block, meta) > 1.0F
|
||||
|| Items.wooden_pickaxe.getDigSpeed(stack, block, meta) > 1.0F
|
||||
|| Items.wooden_shovel.getDigSpeed(stack, block, meta) > 1.0F
|
||||
|| Items.shears.getDigSpeed(stack, block, meta) > 1.0F)
|
||||
{
|
||||
return efficiencyOnProperMaterial;
|
||||
} else
|
||||
{
|
||||
return super.getDigSpeed(stack, block, meta);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) {
|
||||
if (ElectricItem.manager.use(itemstack, hitCost, attacker)) {
|
||||
entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 8F);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack,
|
||||
EntityLivingBase entityliving, EntityLivingBase attacker)
|
||||
{
|
||||
if (ElectricItem.manager.use(itemstack, hitCost, attacker))
|
||||
{
|
||||
entityliving
|
||||
.attackEntityFrom(DamageSource
|
||||
.causePlayerDamage((EntityPlayer) attacker), 8F);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
|
||||
return TorchHelper.placeTorch(stack, player, world, x, y, z, side, xOffset, yOffset, zOffset);
|
||||
}
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world,
|
||||
int x, int y, int z, int side, float xOffset, float yOffset,
|
||||
float zOffset)
|
||||
{
|
||||
return TorchHelper.placeTorch(stack, player, world, x, y, z, side,
|
||||
xOffset, yOffset, zOffset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getChargedItem(ItemStack itemStack) {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Item getChargedItem(ItemStack itemStack)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getEmptyItem(ItemStack itemStack) {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Item getEmptyItem(ItemStack itemStack)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxCharge(ItemStack itemStack) {
|
||||
return maxCharge;
|
||||
}
|
||||
@Override
|
||||
public double getMaxCharge(ItemStack itemStack)
|
||||
{
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTier(ItemStack itemStack) {
|
||||
return 2;
|
||||
}
|
||||
@Override
|
||||
public int getTier(ItemStack itemStack)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTransferLimit(ItemStack itemStack) {
|
||||
return 200;
|
||||
}
|
||||
@Override
|
||||
public double getTransferLimit(ItemStack itemStack)
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ic2.api.item.ElectricItem;
|
||||
import ic2.api.item.IElectricItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
@ -16,87 +17,105 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.world.World;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemRockCutter extends ItemPickaxe implements IElectricItem {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.RockCutterCharge;
|
||||
public int cost = 500;
|
||||
public static final int tier = ConfigTechReborn.RockCutterTier;
|
||||
public static final int maxCharge = ConfigTechReborn.RockCutterCharge;
|
||||
public int cost = 500;
|
||||
public static final int tier = ConfigTechReborn.RockCutterTier;
|
||||
|
||||
public ItemRockCutter(ToolMaterial toolMaterial) {
|
||||
super(toolMaterial);
|
||||
setUnlocalizedName("techreborn.rockcutter");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(27);
|
||||
efficiencyOnProperMaterial = 16F;
|
||||
}
|
||||
public ItemRockCutter(ToolMaterial toolMaterial)
|
||||
{
|
||||
super(toolMaterial);
|
||||
setUnlocalizedName("techreborn.rockcutter");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(27);
|
||||
efficiencyOnProperMaterial = 16F;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon("techreborn:" + "tool/rockcutter");
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("techreborn:"
|
||||
+ "tool/rockcutter");
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
if (getChargedItem(itemStack) == this) {
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
|
||||
itemList.add(charged);
|
||||
}
|
||||
if (getEmptyItem(itemStack) == this) {
|
||||
itemList.add(new ItemStack(this, 1, getMaxDamage()));
|
||||
}
|
||||
}
|
||||
@SuppressWarnings(
|
||||
{ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs,
|
||||
List itemList)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
if (getChargedItem(itemStack) == this)
|
||||
{
|
||||
ItemStack charged = new ItemStack(this, 1);
|
||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
|
||||
false);
|
||||
itemList.add(charged);
|
||||
}
|
||||
if (getEmptyItem(itemStack) == this)
|
||||
{
|
||||
itemList.add(new ItemStack(this, 1, getMaxDamage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
||||
return Items.diamond_pickaxe.canHarvestBlock(block, stack);
|
||||
}
|
||||
@Override
|
||||
public boolean canHarvestBlock(Block block, ItemStack stack)
|
||||
{
|
||||
return Items.diamond_pickaxe.canHarvestBlock(block, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
par1ItemStack.addEnchantment(Enchantment.silkTouch, 1);
|
||||
}
|
||||
public void onCreated(ItemStack par1ItemStack, World par2World,
|
||||
EntityPlayer par3EntityPlayer)
|
||||
{
|
||||
par1ItemStack.addEnchantment(Enchantment.silkTouch, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public Item getChargedItem(ItemStack itemStack)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getChargedItem(ItemStack itemStack) {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Item getEmptyItem(ItemStack itemStack)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getEmptyItem(ItemStack itemStack) {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public double getMaxCharge(ItemStack itemStack)
|
||||
{
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxCharge(ItemStack itemStack) {
|
||||
return maxCharge;
|
||||
}
|
||||
@Override
|
||||
public int getTier(ItemStack itemStack)
|
||||
{
|
||||
return tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTier(ItemStack itemStack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTransferLimit(ItemStack itemStack) {
|
||||
return 300;
|
||||
}
|
||||
@Override
|
||||
public double getTransferLimit(ItemStack itemStack)
|
||||
{
|
||||
return 300;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,25 +9,27 @@ import techreborn.Core;
|
|||
import techreborn.client.GuiHandler;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
public class ItemTechPda extends Item{
|
||||
|
||||
public class ItemTechPda extends Item {
|
||||
|
||||
public ItemTechPda()
|
||||
{
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setUnlocalizedName("techreborn.pda");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
itemIcon = iconRegister.registerIcon("techreborn:" + "tool/pda");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister)
|
||||
{
|
||||
player.openGui(Core.INSTANCE, GuiHandler.pdaID, world, (int)player.posX, (int)player.posY, (int)player.posY);
|
||||
itemIcon = iconRegister.registerIcon("techreborn:" + "tool/pda");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world,
|
||||
EntityPlayer player)
|
||||
{
|
||||
player.openGui(Core.INSTANCE, GuiHandler.pdaID, world,
|
||||
(int) player.posX, (int) player.posY, (int) player.posY);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,43 +3,47 @@ package techreborn.lib;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class Functions {
|
||||
public static int getIntDirFromDirection(ForgeDirection dir) {
|
||||
switch (dir) {
|
||||
case DOWN:
|
||||
return 0;
|
||||
case EAST:
|
||||
return 5;
|
||||
case NORTH:
|
||||
return 2;
|
||||
case SOUTH:
|
||||
return 3;
|
||||
case UNKNOWN:
|
||||
return 0;
|
||||
case UP:
|
||||
return 1;
|
||||
case WEST:
|
||||
return 4;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
public static int getIntDirFromDirection(ForgeDirection dir)
|
||||
{
|
||||
switch (dir)
|
||||
{
|
||||
case DOWN:
|
||||
return 0;
|
||||
case EAST:
|
||||
return 5;
|
||||
case NORTH:
|
||||
return 2;
|
||||
case SOUTH:
|
||||
return 3;
|
||||
case UNKNOWN:
|
||||
return 0;
|
||||
case UP:
|
||||
return 1;
|
||||
case WEST:
|
||||
return 4;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static ForgeDirection getDirectionFromInt(int dir) {
|
||||
int metaDataToSet = 0;
|
||||
switch (dir) {
|
||||
case 0:
|
||||
metaDataToSet = 2;
|
||||
break;
|
||||
case 1:
|
||||
metaDataToSet = 4;
|
||||
break;
|
||||
case 2:
|
||||
metaDataToSet = 3;
|
||||
break;
|
||||
case 3:
|
||||
metaDataToSet = 5;
|
||||
break;
|
||||
}
|
||||
return ForgeDirection.getOrientation(metaDataToSet);
|
||||
}
|
||||
public static ForgeDirection getDirectionFromInt(int dir)
|
||||
{
|
||||
int metaDataToSet = 0;
|
||||
switch (dir)
|
||||
{
|
||||
case 0:
|
||||
metaDataToSet = 2;
|
||||
break;
|
||||
case 1:
|
||||
metaDataToSet = 4;
|
||||
break;
|
||||
case 2:
|
||||
metaDataToSet = 3;
|
||||
break;
|
||||
case 3:
|
||||
metaDataToSet = 5;
|
||||
break;
|
||||
}
|
||||
return ForgeDirection.getOrientation(metaDataToSet);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,264 +8,290 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class Location {
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
public int depth;
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
public int depth;
|
||||
|
||||
public Location(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
public Location(int x, int y, int z)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public Location(int x, int y, int z, int depth) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.depth = depth;
|
||||
}
|
||||
public Location(int x, int y, int z, int depth)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
public Location(int xCoord, int yCoord, int zCoord, ForgeDirection dir)
|
||||
{
|
||||
this.x = xCoord + dir.offsetX;
|
||||
this.y = yCoord + dir.offsetY;
|
||||
this.z = zCoord + dir.offsetZ;
|
||||
}
|
||||
|
||||
public Location(int xCoord, int yCoord, int zCoord, ForgeDirection dir) {
|
||||
this.x = xCoord + dir.offsetX;
|
||||
this.y = yCoord + dir.offsetY;
|
||||
this.z = zCoord + dir.offsetZ;
|
||||
}
|
||||
public Location(int[] coords)
|
||||
{
|
||||
if (coords.length >= 2)
|
||||
{
|
||||
this.x = coords[0];
|
||||
this.y = coords[1];
|
||||
this.z = coords[2];
|
||||
}
|
||||
}
|
||||
|
||||
public Location(int[] coords) {
|
||||
if (coords.length >= 2) {
|
||||
this.x = coords[0];
|
||||
this.y = coords[1];
|
||||
this.z = coords[2];
|
||||
}
|
||||
}
|
||||
public Location(ChunkPosition pos)
|
||||
{
|
||||
if (pos != null)
|
||||
{
|
||||
this.x = pos.chunkPosX;
|
||||
this.y = pos.chunkPosY;
|
||||
this.z = pos.chunkPosZ;
|
||||
}
|
||||
}
|
||||
|
||||
public Location(ChunkPosition pos) {
|
||||
if (pos != null) {
|
||||
this.x = pos.chunkPosX;
|
||||
this.y = pos.chunkPosY;
|
||||
this.z = pos.chunkPosZ;
|
||||
}
|
||||
}
|
||||
public Location(MovingObjectPosition blockLookedAt)
|
||||
{
|
||||
if (blockLookedAt != null)
|
||||
{
|
||||
this.x = blockLookedAt.blockX;
|
||||
this.y = blockLookedAt.blockY;
|
||||
this.z = blockLookedAt.blockZ;
|
||||
}
|
||||
}
|
||||
|
||||
public Location(MovingObjectPosition blockLookedAt) {
|
||||
if (blockLookedAt != null) {
|
||||
this.x = blockLookedAt.blockX;
|
||||
this.y = blockLookedAt.blockY;
|
||||
this.z = blockLookedAt.blockZ;
|
||||
}
|
||||
}
|
||||
public Location(TileEntity par1)
|
||||
{
|
||||
this.x = par1.xCoord;
|
||||
this.y = par1.yCoord;
|
||||
this.z = par1.zCoord;
|
||||
}
|
||||
|
||||
public Location(TileEntity par1)
|
||||
{
|
||||
this.x = par1.xCoord;
|
||||
this.y = par1.yCoord;
|
||||
this.z = par1.zCoord;
|
||||
}
|
||||
public boolean equals(Location toTest)
|
||||
{
|
||||
if (this.x == toTest.x && this.y == toTest.y && this.z == toTest.z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(Location toTest) {
|
||||
if (this.x == toTest.x && this.y == toTest.y && this.z == toTest.z) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void setLocation(int x, int y, int z)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public void setLocation(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
public int getX()
|
||||
{
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return this.x;
|
||||
}
|
||||
public void setX(int newX)
|
||||
{
|
||||
this.x = newX;
|
||||
}
|
||||
|
||||
public void setX(int newX) {
|
||||
this.x = newX;
|
||||
}
|
||||
public int getY()
|
||||
{
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return this.y;
|
||||
}
|
||||
public void setY(int newY)
|
||||
{
|
||||
this.y = newY;
|
||||
}
|
||||
|
||||
public void setY(int newY) {
|
||||
this.y = newY;
|
||||
}
|
||||
public int getZ()
|
||||
{
|
||||
return this.z;
|
||||
}
|
||||
|
||||
public int getZ() {
|
||||
return this.z;
|
||||
}
|
||||
public void setZ(int newZ)
|
||||
{
|
||||
this.z = newZ;
|
||||
}
|
||||
|
||||
public void setZ(int newZ) {
|
||||
this.z = newZ;
|
||||
}
|
||||
public int[] getLocation()
|
||||
{
|
||||
int[] ret = new int[3];
|
||||
ret[0] = this.x;
|
||||
ret[1] = this.y;
|
||||
ret[2] = this.z;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int[] getLocation() {
|
||||
int[] ret = new int[3];
|
||||
ret[0] = this.x;
|
||||
ret[1] = this.y;
|
||||
ret[2] = this.z;
|
||||
return ret;
|
||||
}
|
||||
public void setLocation(int[] coords)
|
||||
{
|
||||
this.x = coords[0];
|
||||
this.y = coords[1];
|
||||
this.z = coords[2];
|
||||
}
|
||||
|
||||
public void setLocation(int[] coords) {
|
||||
this.x = coords[0];
|
||||
this.y = coords[1];
|
||||
this.z = coords[2];
|
||||
}
|
||||
public int getDifference(Location otherLoc)
|
||||
{
|
||||
return (int) Math.sqrt(Math.pow(this.x - otherLoc.x, 2)
|
||||
+ Math.pow(this.y - otherLoc.y, 2)
|
||||
+ Math.pow(this.z - otherLoc.z, 2));
|
||||
}
|
||||
|
||||
public int getDifference(Location otherLoc) {
|
||||
return (int) Math.sqrt(Math.pow(this.x - otherLoc.x, 2) + Math.pow(this.y - otherLoc.y, 2) + Math.pow(this.z - otherLoc.z, 2));
|
||||
}
|
||||
public String printLocation()
|
||||
{
|
||||
return "X: " + this.x + " Y: " + this.y + " Z: " + this.z;
|
||||
}
|
||||
|
||||
public String printLocation() {
|
||||
return "X: " + this.x + " Y: " + this.y + " Z: " + this.z;
|
||||
}
|
||||
public String printCoords()
|
||||
{
|
||||
return this.x + ", " + this.y + ", " + this.z;
|
||||
}
|
||||
|
||||
public String printCoords() {
|
||||
return this.x + ", " + this.y + ", " + this.z;
|
||||
}
|
||||
public boolean compare(int x, int y, int z)
|
||||
{
|
||||
return (this.x == x && this.y == y && this.z == z);
|
||||
}
|
||||
|
||||
public boolean compare(int x, int y, int z) {
|
||||
return (this.x == x && this.y == y && this.z == z);
|
||||
}
|
||||
public Location getLocation(ForgeDirection dir)
|
||||
{
|
||||
return new Location(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
}
|
||||
|
||||
public Location getLocation(ForgeDirection dir) {
|
||||
return new Location(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
}
|
||||
public Location modifyPositionFromSide(ForgeDirection side, int amount)
|
||||
{
|
||||
switch (side.ordinal())
|
||||
{
|
||||
case 0:
|
||||
this.y -= amount;
|
||||
break;
|
||||
case 1:
|
||||
this.y += amount;
|
||||
break;
|
||||
case 2:
|
||||
this.z -= amount;
|
||||
break;
|
||||
case 3:
|
||||
this.z += amount;
|
||||
break;
|
||||
case 4:
|
||||
this.x -= amount;
|
||||
break;
|
||||
case 5:
|
||||
this.x += amount;
|
||||
break;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Location modifyPositionFromSide(ForgeDirection side, int amount)
|
||||
{
|
||||
switch (side.ordinal())
|
||||
{
|
||||
case 0:
|
||||
this.y -= amount;
|
||||
break;
|
||||
case 1:
|
||||
this.y += amount;
|
||||
break;
|
||||
case 2:
|
||||
this.z -= amount;
|
||||
break;
|
||||
case 3:
|
||||
this.z += amount;
|
||||
break;
|
||||
case 4:
|
||||
this.x -= amount;
|
||||
break;
|
||||
case 5:
|
||||
this.x += amount;
|
||||
break;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public Location modifyPositionFromSide(ForgeDirection side)
|
||||
{
|
||||
return this.modifyPositionFromSide(side, 1);
|
||||
}
|
||||
|
||||
public Location modifyPositionFromSide(ForgeDirection side)
|
||||
{
|
||||
return this.modifyPositionFromSide(side, 1);
|
||||
}
|
||||
/**
|
||||
* This will load the chunk.
|
||||
*/
|
||||
public TileEntity getTileEntity(IBlockAccess world)
|
||||
{
|
||||
return world.getTileEntity(this.x, this.y, this.z);
|
||||
}
|
||||
|
||||
/**
|
||||
* This will load the chunk.
|
||||
*/
|
||||
public TileEntity getTileEntity(IBlockAccess world)
|
||||
{
|
||||
return world.getTileEntity(this.x, this.y, this.z);
|
||||
}
|
||||
public final Location clone()
|
||||
{
|
||||
return new Location(this.x, this.y, this.z);
|
||||
}
|
||||
|
||||
public final Location clone()
|
||||
{
|
||||
return new Location(this.x, this.y, this.z);
|
||||
}
|
||||
/**
|
||||
* No chunk load: returns null if chunk to side is unloaded
|
||||
*/
|
||||
public TileEntity getTileEntityOnSide(World world, ForgeDirection side)
|
||||
{
|
||||
int x = this.x;
|
||||
int y = this.y;
|
||||
int z = this.z;
|
||||
switch (side.ordinal())
|
||||
{
|
||||
case 0:
|
||||
y--;
|
||||
break;
|
||||
case 1:
|
||||
y++;
|
||||
break;
|
||||
case 2:
|
||||
z--;
|
||||
break;
|
||||
case 3:
|
||||
z++;
|
||||
break;
|
||||
case 4:
|
||||
x--;
|
||||
break;
|
||||
case 5:
|
||||
x++;
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
if (world.blockExists(x, y, z))
|
||||
{
|
||||
return world.getTileEntity(x, y, z);
|
||||
} else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* No chunk load: returns null if chunk to side is unloaded
|
||||
*/
|
||||
public TileEntity getTileEntityOnSide(World world, ForgeDirection side)
|
||||
{
|
||||
int x = this.x;
|
||||
int y = this.y;
|
||||
int z = this.z;
|
||||
switch (side.ordinal())
|
||||
{
|
||||
case 0:
|
||||
y--;
|
||||
break;
|
||||
case 1:
|
||||
y++;
|
||||
break;
|
||||
case 2:
|
||||
z--;
|
||||
break;
|
||||
case 3:
|
||||
z++;
|
||||
break;
|
||||
case 4:
|
||||
x--;
|
||||
break;
|
||||
case 5:
|
||||
x++;
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
if (world.blockExists(x, y, z))
|
||||
{
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* No chunk load: returns null if chunk to side is unloaded
|
||||
*/
|
||||
public TileEntity getTileEntityOnSide(World world, int side)
|
||||
{
|
||||
int x = this.x;
|
||||
int y = this.y;
|
||||
int z = this.z;
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
y--;
|
||||
break;
|
||||
case 1:
|
||||
y++;
|
||||
break;
|
||||
case 2:
|
||||
z--;
|
||||
break;
|
||||
case 3:
|
||||
z++;
|
||||
break;
|
||||
case 4:
|
||||
x--;
|
||||
break;
|
||||
case 5:
|
||||
x++;
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
if (world.blockExists(x, y, z))
|
||||
{
|
||||
return world.getTileEntity(x, y, z);
|
||||
} else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* No chunk load: returns null if chunk to side is unloaded
|
||||
*/
|
||||
public TileEntity getTileEntityOnSide(World world, int side)
|
||||
{
|
||||
int x = this.x;
|
||||
int y = this.y;
|
||||
int z = this.z;
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
y--;
|
||||
break;
|
||||
case 1:
|
||||
y++;
|
||||
break;
|
||||
case 2:
|
||||
z--;
|
||||
break;
|
||||
case 3:
|
||||
z++;
|
||||
break;
|
||||
case 4:
|
||||
x--;
|
||||
break;
|
||||
case 5:
|
||||
x++;
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
if (world.blockExists(x, y, z))
|
||||
{
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public int getDepth()
|
||||
{
|
||||
return depth;
|
||||
}
|
||||
|
||||
public int getDepth() {
|
||||
return depth;
|
||||
}
|
||||
|
||||
public int compareTo(Location o) {
|
||||
return ((Integer)depth).compareTo(o.depth);
|
||||
}
|
||||
public int compareTo(Location o)
|
||||
{
|
||||
return ((Integer) depth).compareTo(o.depth);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package techreborn.lib;
|
||||
|
||||
public class ModInfo {
|
||||
public static final String MOD_NAME = "TechReborn";
|
||||
public static final String MOD_ID = "techreborn";
|
||||
public static final String MOD_VERSION = "@MODVERSION@";
|
||||
public static final String MOD_DEPENDENCUIES = "required-after:IC2@:";
|
||||
public static final String SERVER_PROXY_CLASS = "techreborn.proxies.CommonProxy";
|
||||
public static final String CLIENT_PROXY_CLASS = "techreborn.proxies.ClientProxy";
|
||||
public static final String GUI_FACTORY_CLASS = "techreborn.config.TechRebornGUIFactory";
|
||||
public static final String MOD_NAME = "TechReborn";
|
||||
public static final String MOD_ID = "techreborn";
|
||||
public static final String MOD_VERSION = "@MODVERSION@";
|
||||
public static final String MOD_DEPENDENCUIES = "required-after:IC2@:";
|
||||
public static final String SERVER_PROXY_CLASS = "techreborn.proxies.CommonProxy";
|
||||
public static final String CLIENT_PROXY_CLASS = "techreborn.proxies.ClientProxy";
|
||||
public static final String GUI_FACTORY_CLASS = "techreborn.config.TechRebornGUIFactory";
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package techreborn.lib.vecmath;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -12,420 +11,496 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Vecs3d {
|
||||
protected double x, y, z;
|
||||
protected World w = null;
|
||||
protected double x, y, z;
|
||||
protected World w = null;
|
||||
|
||||
public Vecs3d(double x, double y, double z) {
|
||||
public Vecs3d(double x, double y, double z)
|
||||
{
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public Vecs3d(double x, double y, double z, World w) {
|
||||
public Vecs3d(double x, double y, double z, World w)
|
||||
{
|
||||
|
||||
this(x, y, z);
|
||||
this.w = w;
|
||||
}
|
||||
this(x, y, z);
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
public Vecs3d(TileEntity te) {
|
||||
public Vecs3d(TileEntity te)
|
||||
{
|
||||
|
||||
this(te.xCoord, te.yCoord, te.zCoord, te.getWorldObj());
|
||||
}
|
||||
this(te.xCoord, te.yCoord, te.zCoord, te.getWorldObj());
|
||||
}
|
||||
|
||||
public Vecs3d(Vec3 vec) {
|
||||
public Vecs3d(Vec3 vec)
|
||||
{
|
||||
|
||||
this(vec.xCoord, vec.yCoord, vec.zCoord);
|
||||
}
|
||||
this(vec.xCoord, vec.yCoord, vec.zCoord);
|
||||
}
|
||||
|
||||
public Vecs3d(Vec3 vec, World w) {
|
||||
public Vecs3d(Vec3 vec, World w)
|
||||
{
|
||||
|
||||
this(vec.xCoord, vec.yCoord, vec.zCoord);
|
||||
this.w = w;
|
||||
}
|
||||
this(vec.xCoord, vec.yCoord, vec.zCoord);
|
||||
this.w = w;
|
||||
}
|
||||
|
||||
public boolean hasWorld() {
|
||||
public boolean hasWorld()
|
||||
{
|
||||
|
||||
return w != null;
|
||||
}
|
||||
return w != null;
|
||||
}
|
||||
|
||||
public Vecs3d add(double x, double y, double z) {
|
||||
public Vecs3d add(double x, double y, double z)
|
||||
{
|
||||
|
||||
this.x += x;
|
||||
this.y += y;
|
||||
this.z += z;
|
||||
return this;
|
||||
}
|
||||
this.x += x;
|
||||
this.y += y;
|
||||
this.z += z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vecs3d add(ForgeDirection dir) {
|
||||
public Vecs3d add(ForgeDirection dir)
|
||||
{
|
||||
|
||||
return add(dir.offsetX, dir.offsetY, dir.offsetZ);
|
||||
}
|
||||
return add(dir.offsetX, dir.offsetY, dir.offsetZ);
|
||||
}
|
||||
|
||||
public Vecs3d add(Vecs3d vec) {
|
||||
public Vecs3d add(Vecs3d vec)
|
||||
{
|
||||
|
||||
return add(vec.x, vec.y, vec.z);
|
||||
}
|
||||
return add(vec.x, vec.y, vec.z);
|
||||
}
|
||||
|
||||
public Vecs3d sub(double x, double y, double z) {
|
||||
public Vecs3d sub(double x, double y, double z)
|
||||
{
|
||||
|
||||
this.x -= x;
|
||||
this.y -= y;
|
||||
this.z -= z;
|
||||
return this;
|
||||
}
|
||||
this.x -= x;
|
||||
this.y -= y;
|
||||
this.z -= z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vecs3d sub(ForgeDirection dir) {
|
||||
public Vecs3d sub(ForgeDirection dir)
|
||||
{
|
||||
|
||||
return sub(dir.offsetX, dir.offsetY, dir.offsetZ);
|
||||
}
|
||||
return sub(dir.offsetX, dir.offsetY, dir.offsetZ);
|
||||
}
|
||||
|
||||
public Vecs3d sub(Vecs3d vec) {
|
||||
public Vecs3d sub(Vecs3d vec)
|
||||
{
|
||||
|
||||
return sub(vec.x, vec.y, vec.z);
|
||||
}
|
||||
return sub(vec.x, vec.y, vec.z);
|
||||
}
|
||||
|
||||
public Vecs3d mul(double x, double y, double z) {
|
||||
public Vecs3d mul(double x, double y, double z)
|
||||
{
|
||||
|
||||
this.x *= x;
|
||||
this.y *= y;
|
||||
this.z *= z;
|
||||
return this;
|
||||
}
|
||||
this.x *= x;
|
||||
this.y *= y;
|
||||
this.z *= z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vecs3d mul(double multiplier) {
|
||||
public Vecs3d mul(double multiplier)
|
||||
{
|
||||
|
||||
return mul(multiplier, multiplier, multiplier);
|
||||
}
|
||||
return mul(multiplier, multiplier, multiplier);
|
||||
}
|
||||
|
||||
public Vecs3d mul(ForgeDirection direction) {
|
||||
public Vecs3d mul(ForgeDirection direction)
|
||||
{
|
||||
|
||||
return mul(direction.offsetX, direction.offsetY, direction.offsetZ);
|
||||
}
|
||||
return mul(direction.offsetX, direction.offsetY, direction.offsetZ);
|
||||
}
|
||||
|
||||
public Vecs3d multiply(Vecs3d v) {
|
||||
public Vecs3d multiply(Vecs3d v)
|
||||
{
|
||||
|
||||
return mul(v.getX(), v.getY(), v.getZ());
|
||||
}
|
||||
return mul(v.getX(), v.getY(), v.getZ());
|
||||
}
|
||||
|
||||
public Vecs3d div(double x, double y, double z) {
|
||||
public Vecs3d div(double x, double y, double z)
|
||||
{
|
||||
|
||||
this.x /= x;
|
||||
this.y /= y;
|
||||
this.z /= z;
|
||||
return this;
|
||||
}
|
||||
this.x /= x;
|
||||
this.y /= y;
|
||||
this.z /= z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vecs3d div(double multiplier) {
|
||||
public Vecs3d div(double multiplier)
|
||||
{
|
||||
|
||||
return div(multiplier, multiplier, multiplier);
|
||||
}
|
||||
return div(multiplier, multiplier, multiplier);
|
||||
}
|
||||
|
||||
public Vecs3d div(ForgeDirection direction) {
|
||||
public Vecs3d div(ForgeDirection direction)
|
||||
{
|
||||
|
||||
return div(direction.offsetX, direction.offsetY, direction.offsetZ);
|
||||
}
|
||||
return div(direction.offsetX, direction.offsetY, direction.offsetZ);
|
||||
}
|
||||
|
||||
public double length() {
|
||||
public double length()
|
||||
{
|
||||
|
||||
return Math.sqrt(x * x + y * y + z * z);
|
||||
}
|
||||
return Math.sqrt(x * x + y * y + z * z);
|
||||
}
|
||||
|
||||
public Vecs3d normalize() {
|
||||
public Vecs3d normalize()
|
||||
{
|
||||
|
||||
Vecs3d v = clone();
|
||||
Vecs3d v = clone();
|
||||
|
||||
double len = length();
|
||||
double len = length();
|
||||
|
||||
if (len == 0)
|
||||
return v;
|
||||
if (len == 0)
|
||||
return v;
|
||||
|
||||
v.x /= len;
|
||||
v.y /= len;
|
||||
v.z /= len;
|
||||
v.x /= len;
|
||||
v.y /= len;
|
||||
v.z /= len;
|
||||
|
||||
return v;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public Vecs3d abs() {
|
||||
public Vecs3d abs()
|
||||
{
|
||||
|
||||
return new Vecs3d(Math.abs(x), Math.abs(y), Math.abs(z));
|
||||
}
|
||||
return new Vecs3d(Math.abs(x), Math.abs(y), Math.abs(z));
|
||||
}
|
||||
|
||||
public double dot(Vecs3d v) {
|
||||
public double dot(Vecs3d v)
|
||||
{
|
||||
|
||||
return x * v.getX() + y * v.getY() + z * v.getZ();
|
||||
}
|
||||
return x * v.getX() + y * v.getY() + z * v.getZ();
|
||||
}
|
||||
|
||||
public Vecs3d cross(Vecs3d v) {
|
||||
public Vecs3d cross(Vecs3d v)
|
||||
{
|
||||
|
||||
return new Vecs3d(y * v.getZ() - z * v.getY(), x * v.getZ() - z * v.getX(), x * v.getY() - y * v.getX());
|
||||
}
|
||||
return new Vecs3d(y * v.getZ() - z * v.getY(), x * v.getZ() - z
|
||||
* v.getX(), x * v.getY() - y * v.getX());
|
||||
}
|
||||
|
||||
public Vecs3d getRelative(double x, double y, double z) {
|
||||
public Vecs3d getRelative(double x, double y, double z)
|
||||
{
|
||||
|
||||
return clone().add(x, y, z);
|
||||
}
|
||||
return clone().add(x, y, z);
|
||||
}
|
||||
|
||||
public Vecs3d getRelative(ForgeDirection dir) {
|
||||
public Vecs3d getRelative(ForgeDirection dir)
|
||||
{
|
||||
|
||||
return getRelative(dir.offsetX, dir.offsetY, dir.offsetZ);
|
||||
}
|
||||
return getRelative(dir.offsetX, dir.offsetY, dir.offsetZ);
|
||||
}
|
||||
|
||||
public ForgeDirection getDirectionTo(Vecs3d vec) {
|
||||
public ForgeDirection getDirectionTo(Vecs3d vec)
|
||||
{
|
||||
|
||||
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
|
||||
if (getBlockX() + d.offsetX == vec.getBlockX() && getBlockY() + d.offsetY == vec.getBlockY()
|
||||
&& getBlockZ() + d.offsetZ == vec.getBlockZ())
|
||||
return d;
|
||||
return null;
|
||||
}
|
||||
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
|
||||
if (getBlockX() + d.offsetX == vec.getBlockX()
|
||||
&& getBlockY() + d.offsetY == vec.getBlockY()
|
||||
&& getBlockZ() + d.offsetZ == vec.getBlockZ())
|
||||
return d;
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isZero() {
|
||||
public boolean isZero()
|
||||
{
|
||||
|
||||
return x == 0 && y == 0 && z == 0;
|
||||
}
|
||||
return x == 0 && y == 0 && z == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vecs3d clone() {
|
||||
@Override
|
||||
public Vecs3d clone()
|
||||
{
|
||||
|
||||
return new Vecs3d(x, y, z, w);
|
||||
}
|
||||
return new Vecs3d(x, y, z, w);
|
||||
}
|
||||
|
||||
public boolean hasTileEntity() {
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
|
||||
if (hasWorld()) {
|
||||
return w.getTileEntity((int) x, (int) y, (int) z) != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (hasWorld())
|
||||
{
|
||||
return w.getTileEntity((int) x, (int) y, (int) z) != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity() {
|
||||
public TileEntity getTileEntity()
|
||||
{
|
||||
|
||||
if (hasTileEntity()) {
|
||||
return w.getTileEntity((int) x, (int) y, (int) z);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (hasTileEntity())
|
||||
{
|
||||
return w.getTileEntity((int) x, (int) y, (int) z);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isBlock(Block b) {
|
||||
public boolean isBlock(Block b)
|
||||
{
|
||||
|
||||
return isBlock(b, false);
|
||||
}
|
||||
return isBlock(b, false);
|
||||
}
|
||||
|
||||
public boolean isBlock(Block b, boolean checkAir) {
|
||||
public boolean isBlock(Block b, boolean checkAir)
|
||||
{
|
||||
|
||||
if (hasWorld()) {
|
||||
Block bl = w.getBlock((int) x, (int) y, (int) z);
|
||||
if (hasWorld())
|
||||
{
|
||||
Block bl = w.getBlock((int) x, (int) y, (int) z);
|
||||
|
||||
if (b == null && bl == Blocks.air)
|
||||
return true;
|
||||
if (b == null && checkAir && bl.getMaterial() == Material.air)
|
||||
return true;
|
||||
if (b == null && checkAir && bl.isAir(w, (int) x, (int) y, (int) z))
|
||||
return true;
|
||||
if (b == null && bl == Blocks.air)
|
||||
return true;
|
||||
if (b == null && checkAir && bl.getMaterial() == Material.air)
|
||||
return true;
|
||||
if (b == null && checkAir && bl.isAir(w, (int) x, (int) y, (int) z))
|
||||
return true;
|
||||
|
||||
return bl.getClass().isInstance(b);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return bl.getClass().isInstance(b);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getBlockMeta() {
|
||||
public int getBlockMeta()
|
||||
{
|
||||
|
||||
if (hasWorld()) {
|
||||
return w.getBlockMetadata((int) x, (int) y, (int) z);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (hasWorld())
|
||||
{
|
||||
return w.getBlockMetadata((int) x, (int) y, (int) z);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
public Block getBlock()
|
||||
{
|
||||
|
||||
return getBlock(false);
|
||||
}
|
||||
return getBlock(false);
|
||||
}
|
||||
|
||||
public Block getBlock(boolean airIsNull) {
|
||||
public Block getBlock(boolean airIsNull)
|
||||
{
|
||||
|
||||
if (hasWorld()) {
|
||||
if (airIsNull && isBlock(null, true))
|
||||
return null;
|
||||
return w.getBlock((int) x, (int) y, (int) z);
|
||||
if (hasWorld())
|
||||
{
|
||||
if (airIsNull && isBlock(null, true))
|
||||
return null;
|
||||
return w.getBlock((int) x, (int) y, (int) z);
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
public World getWorld()
|
||||
{
|
||||
|
||||
return w;
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
public Vecs3d setWorld(World world) {
|
||||
public Vecs3d setWorld(World world)
|
||||
{
|
||||
|
||||
w = world;
|
||||
w = world;
|
||||
|
||||
return this;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
public double getX()
|
||||
{
|
||||
|
||||
return x;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
public double getY()
|
||||
{
|
||||
|
||||
return y;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
public double getZ()
|
||||
{
|
||||
|
||||
return z;
|
||||
}
|
||||
return z;
|
||||
}
|
||||
|
||||
public int getBlockX() {
|
||||
public int getBlockX()
|
||||
{
|
||||
|
||||
return (int) Math.floor(x);
|
||||
}
|
||||
return (int) Math.floor(x);
|
||||
}
|
||||
|
||||
public int getBlockY() {
|
||||
public int getBlockY()
|
||||
{
|
||||
|
||||
return (int) Math.floor(y);
|
||||
}
|
||||
return (int) Math.floor(y);
|
||||
}
|
||||
|
||||
public int getBlockZ() {
|
||||
public int getBlockZ()
|
||||
{
|
||||
|
||||
return (int) Math.floor(z);
|
||||
}
|
||||
return (int) Math.floor(z);
|
||||
}
|
||||
|
||||
public double distanceTo(Vecs3d vec) {
|
||||
public double distanceTo(Vecs3d vec)
|
||||
{
|
||||
|
||||
return distanceTo(vec.x, vec.y, vec.z);
|
||||
}
|
||||
return distanceTo(vec.x, vec.y, vec.z);
|
||||
}
|
||||
|
||||
public double distanceTo(double x, double y, double z) {
|
||||
public double distanceTo(double x, double y, double z)
|
||||
{
|
||||
|
||||
double dx = x - this.x;
|
||||
double dy = y - this.y;
|
||||
double dz = z - this.z;
|
||||
return dx * dx + dy * dy + dz * dz;
|
||||
}
|
||||
double dx = x - this.x;
|
||||
double dy = y - this.y;
|
||||
double dz = z - this.z;
|
||||
return dx * dx + dy * dy + dz * dz;
|
||||
}
|
||||
|
||||
public void setX(double x) {
|
||||
public void setX(double x)
|
||||
{
|
||||
|
||||
this.x = x;
|
||||
}
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public void setY(double y) {
|
||||
public void setY(double y)
|
||||
{
|
||||
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public void setZ(double z) {
|
||||
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
|
||||
if (obj instanceof Vecs3d) {
|
||||
Vecs3d vec = (Vecs3d) obj;
|
||||
return vec.w == w && vec.x == x && vec.y == y && vec.z == z;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
return new Double(x).hashCode() + new Double(y).hashCode() << 8 + new Double(z).hashCode() << 16;
|
||||
}
|
||||
|
||||
public Vec3 toVec3() {
|
||||
|
||||
return Vec3.createVectorHelper(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
String s = "Vector3{";
|
||||
if (hasWorld())
|
||||
s += "w=" + w.provider.dimensionId + ";";
|
||||
s += "x=" + x + ";y=" + y + ";z=" + z + "}";
|
||||
return s;
|
||||
}
|
||||
|
||||
public ForgeDirection toForgeDirection() {
|
||||
|
||||
if (z == 1)
|
||||
return ForgeDirection.SOUTH;
|
||||
if (z == -1)
|
||||
return ForgeDirection.NORTH;
|
||||
|
||||
if (x == 1)
|
||||
return ForgeDirection.EAST;
|
||||
if (x == -1)
|
||||
return ForgeDirection.WEST;
|
||||
|
||||
if (y == 1)
|
||||
return ForgeDirection.UP;
|
||||
if (y == -1)
|
||||
return ForgeDirection.DOWN;
|
||||
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public static Vecs3d fromString(String s) {
|
||||
|
||||
if (s.startsWith("Vector3{") && s.endsWith("}")) {
|
||||
World w = null;
|
||||
double x = 0, y = 0, z = 0;
|
||||
String s2 = s.substring(s.indexOf("{") + 1, s.lastIndexOf("}"));
|
||||
StringTokenizer st = new StringTokenizer(s2, ";");
|
||||
while (st.hasMoreTokens()) {
|
||||
String t = st.nextToken();
|
||||
|
||||
if (t.toLowerCase().startsWith("w")) {
|
||||
int world = Integer.parseInt(t.split("=")[1]);
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
||||
for (World wo : MinecraftServer.getServer().worldServers) {
|
||||
if (wo.provider.dimensionId == world) {
|
||||
w = wo;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
w = getClientWorld(world);
|
||||
}
|
||||
}
|
||||
|
||||
if (t.toLowerCase().startsWith("x"))
|
||||
x = Double.parseDouble(t.split("=")[1]);
|
||||
if (t.toLowerCase().startsWith("y"))
|
||||
y = Double.parseDouble(t.split("=")[1]);
|
||||
if (t.toLowerCase().startsWith("z"))
|
||||
z = Double.parseDouble(t.split("=")[1]);
|
||||
}
|
||||
|
||||
if (w != null) {
|
||||
return new Vecs3d(x, y, z, w);
|
||||
} else {
|
||||
return new Vecs3d(x, y, z);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static World getClientWorld(int world) {
|
||||
|
||||
if (Minecraft.getMinecraft().theWorld.provider.dimensionId != world)
|
||||
return null;
|
||||
return Minecraft.getMinecraft().theWorld;
|
||||
}
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public void setZ(double z)
|
||||
{
|
||||
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
|
||||
if (obj instanceof Vecs3d)
|
||||
{
|
||||
Vecs3d vec = (Vecs3d) obj;
|
||||
return vec.w == w && vec.x == x && vec.y == y && vec.z == z;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
|
||||
return new Double(x).hashCode() + new Double(y).hashCode() << 8 + new Double(
|
||||
z).hashCode() << 16;
|
||||
}
|
||||
|
||||
public Vec3 toVec3()
|
||||
{
|
||||
|
||||
return Vec3.createVectorHelper(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
||||
String s = "Vector3{";
|
||||
if (hasWorld())
|
||||
s += "w=" + w.provider.dimensionId + ";";
|
||||
s += "x=" + x + ";y=" + y + ";z=" + z + "}";
|
||||
return s;
|
||||
}
|
||||
|
||||
public ForgeDirection toForgeDirection()
|
||||
{
|
||||
|
||||
if (z == 1)
|
||||
return ForgeDirection.SOUTH;
|
||||
if (z == -1)
|
||||
return ForgeDirection.NORTH;
|
||||
|
||||
if (x == 1)
|
||||
return ForgeDirection.EAST;
|
||||
if (x == -1)
|
||||
return ForgeDirection.WEST;
|
||||
|
||||
if (y == 1)
|
||||
return ForgeDirection.UP;
|
||||
if (y == -1)
|
||||
return ForgeDirection.DOWN;
|
||||
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public static Vecs3d fromString(String s)
|
||||
{
|
||||
|
||||
if (s.startsWith("Vector3{") && s.endsWith("}"))
|
||||
{
|
||||
World w = null;
|
||||
double x = 0, y = 0, z = 0;
|
||||
String s2 = s.substring(s.indexOf("{") + 1, s.lastIndexOf("}"));
|
||||
StringTokenizer st = new StringTokenizer(s2, ";");
|
||||
while (st.hasMoreTokens())
|
||||
{
|
||||
String t = st.nextToken();
|
||||
|
||||
if (t.toLowerCase().startsWith("w"))
|
||||
{
|
||||
int world = Integer.parseInt(t.split("=")[1]);
|
||||
if (FMLCommonHandler.instance().getEffectiveSide()
|
||||
.isServer())
|
||||
{
|
||||
for (World wo : MinecraftServer.getServer().worldServers)
|
||||
{
|
||||
if (wo.provider.dimensionId == world)
|
||||
{
|
||||
w = wo;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
w = getClientWorld(world);
|
||||
}
|
||||
}
|
||||
|
||||
if (t.toLowerCase().startsWith("x"))
|
||||
x = Double.parseDouble(t.split("=")[1]);
|
||||
if (t.toLowerCase().startsWith("y"))
|
||||
y = Double.parseDouble(t.split("=")[1]);
|
||||
if (t.toLowerCase().startsWith("z"))
|
||||
z = Double.parseDouble(t.split("=")[1]);
|
||||
}
|
||||
|
||||
if (w != null)
|
||||
{
|
||||
return new Vecs3d(x, y, z, w);
|
||||
} else
|
||||
{
|
||||
return new Vecs3d(x, y, z);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static World getClientWorld(int world)
|
||||
{
|
||||
|
||||
if (Minecraft.getMinecraft().theWorld.provider.dimensionId != world)
|
||||
return null;
|
||||
return Minecraft.getMinecraft().theWorld;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,161 +1,186 @@
|
|||
package techreborn.lib.vecmath;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Vecs3dCube {
|
||||
|
||||
private Vecs3d min, max;
|
||||
private Vecs3d min, max;
|
||||
|
||||
public Vecs3dCube(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
|
||||
public Vecs3dCube(double minX, double minY, double minZ, double maxX,
|
||||
double maxY, double maxZ)
|
||||
{
|
||||
|
||||
this(minX, minY, minZ, maxX, maxY, maxZ, (World) null);
|
||||
}
|
||||
this(minX, minY, minZ, maxX, maxY, maxZ, (World) null);
|
||||
}
|
||||
|
||||
public Vecs3dCube(double minX, double minY, double minZ, double maxX, double maxY, double maxZ, World world) {
|
||||
public Vecs3dCube(double minX, double minY, double minZ, double maxX,
|
||||
double maxY, double maxZ, World world)
|
||||
{
|
||||
|
||||
this(new Vecs3d(minX, minY, minZ, world), new Vecs3d(maxX, maxY, maxZ, world));
|
||||
}
|
||||
this(new Vecs3d(minX, minY, minZ, world), new Vecs3d(maxX, maxY, maxZ,
|
||||
world));
|
||||
}
|
||||
|
||||
public Vecs3dCube(Vecs3d a, Vecs3d b) {
|
||||
public Vecs3dCube(Vecs3d a, Vecs3d b)
|
||||
{
|
||||
|
||||
World w = a.getWorld();
|
||||
if (w == null)
|
||||
w = b.getWorld();
|
||||
World w = a.getWorld();
|
||||
if (w == null)
|
||||
w = b.getWorld();
|
||||
|
||||
min = a;
|
||||
max = b;
|
||||
min = a;
|
||||
max = b;
|
||||
|
||||
fix();
|
||||
}
|
||||
fix();
|
||||
}
|
||||
|
||||
public Vecs3dCube(AxisAlignedBB aabb)
|
||||
{
|
||||
|
||||
public Vecs3dCube(AxisAlignedBB aabb) {
|
||||
this(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ);
|
||||
}
|
||||
|
||||
this(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ);
|
||||
}
|
||||
public Vecs3d getMin()
|
||||
{
|
||||
|
||||
public Vecs3d getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
return min;
|
||||
}
|
||||
public Vecs3d getMax()
|
||||
{
|
||||
|
||||
public Vecs3d getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
public Vecs3d getCenter()
|
||||
{
|
||||
|
||||
public Vecs3d getCenter() {
|
||||
return new Vecs3d((getMinX() + getMaxX()) / 2D,
|
||||
(getMinY() + getMaxY()) / 2D, (getMinZ() + getMaxZ()) / 2D,
|
||||
getMin().getWorld());
|
||||
}
|
||||
|
||||
return new Vecs3d((getMinX() + getMaxX()) / 2D, (getMinY() + getMaxY()) / 2D, (getMinZ() + getMaxZ()) / 2D, getMin().getWorld());
|
||||
}
|
||||
public double getMinX()
|
||||
{
|
||||
|
||||
public double getMinX() {
|
||||
return min.getX();
|
||||
}
|
||||
|
||||
return min.getX();
|
||||
}
|
||||
public double getMinY()
|
||||
{
|
||||
|
||||
public double getMinY() {
|
||||
return min.getY();
|
||||
}
|
||||
|
||||
return min.getY();
|
||||
}
|
||||
public double getMinZ()
|
||||
{
|
||||
|
||||
public double getMinZ() {
|
||||
return min.getZ();
|
||||
}
|
||||
|
||||
return min.getZ();
|
||||
}
|
||||
public double getMaxX()
|
||||
{
|
||||
|
||||
public double getMaxX() {
|
||||
return max.getX();
|
||||
}
|
||||
|
||||
return max.getX();
|
||||
}
|
||||
public double getMaxY()
|
||||
{
|
||||
|
||||
public double getMaxY() {
|
||||
return max.getY();
|
||||
}
|
||||
|
||||
return max.getY();
|
||||
}
|
||||
public double getMaxZ()
|
||||
{
|
||||
|
||||
public double getMaxZ() {
|
||||
return max.getZ();
|
||||
}
|
||||
|
||||
return max.getZ();
|
||||
}
|
||||
public AxisAlignedBB toAABB()
|
||||
{
|
||||
|
||||
public AxisAlignedBB toAABB() {
|
||||
return AxisAlignedBB.getBoundingBox(getMinX(), getMinY(), getMinZ(),
|
||||
getMaxX(), getMaxY(), getMaxZ());
|
||||
}
|
||||
|
||||
return AxisAlignedBB.getBoundingBox(getMinX(), getMinY(), getMinZ(), getMaxX(), getMaxY(), getMaxZ());
|
||||
}
|
||||
@Override
|
||||
public Vecs3dCube clone()
|
||||
{
|
||||
|
||||
@Override
|
||||
public Vecs3dCube clone() {
|
||||
return new Vecs3dCube(min.clone(), max.clone());
|
||||
}
|
||||
|
||||
return new Vecs3dCube(min.clone(), max.clone());
|
||||
}
|
||||
public Vecs3dCube expand(double size)
|
||||
{
|
||||
|
||||
public Vecs3dCube expand(double size) {
|
||||
min.sub(size, size, size);
|
||||
max.add(size, size, size);
|
||||
|
||||
min.sub(size, size, size);
|
||||
max.add(size, size, size);
|
||||
return this;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
public Vecs3dCube fix()
|
||||
{
|
||||
|
||||
public Vecs3dCube fix() {
|
||||
Vecs3d a = min.clone();
|
||||
Vecs3d b = max.clone();
|
||||
|
||||
Vecs3d a = min.clone();
|
||||
Vecs3d b = max.clone();
|
||||
double minX = Math.min(a.getX(), b.getX());
|
||||
double minY = Math.min(a.getY(), b.getY());
|
||||
double minZ = Math.min(a.getZ(), b.getZ());
|
||||
|
||||
double minX = Math.min(a.getX(), b.getX());
|
||||
double minY = Math.min(a.getY(), b.getY());
|
||||
double minZ = Math.min(a.getZ(), b.getZ());
|
||||
double maxX = Math.max(a.getX(), b.getX());
|
||||
double maxY = Math.max(a.getY(), b.getY());
|
||||
double maxZ = Math.max(a.getZ(), b.getZ());
|
||||
|
||||
double maxX = Math.max(a.getX(), b.getX());
|
||||
double maxY = Math.max(a.getY(), b.getY());
|
||||
double maxZ = Math.max(a.getZ(), b.getZ());
|
||||
min = new Vecs3d(minX, minY, minZ, a.w);
|
||||
max = new Vecs3d(maxX, maxY, maxZ, b.w);
|
||||
|
||||
min = new Vecs3d(minX, minY, minZ, a.w);
|
||||
max = new Vecs3d(maxX, maxY, maxZ, b.w);
|
||||
return this;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
public Vecs3dCube add(double x, double y, double z)
|
||||
{
|
||||
|
||||
public Vecs3dCube add(double x, double y, double z) {
|
||||
min.add(x, y, z);
|
||||
max.add(x, y, z);
|
||||
|
||||
min.add(x, y, z);
|
||||
max.add(x, y, z);
|
||||
return this;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
public static final Vecs3dCube merge(List<Vecs3dCube> cubes)
|
||||
{
|
||||
|
||||
public static final Vecs3dCube merge(List<Vecs3dCube> cubes) {
|
||||
double minx = Double.MAX_VALUE;
|
||||
double miny = Double.MAX_VALUE;
|
||||
double minz = Double.MAX_VALUE;
|
||||
double maxx = Double.MIN_VALUE;
|
||||
double maxy = Double.MIN_VALUE;
|
||||
double maxz = Double.MIN_VALUE;
|
||||
|
||||
double minx = Double.MAX_VALUE;
|
||||
double miny = Double.MAX_VALUE;
|
||||
double minz = Double.MAX_VALUE;
|
||||
double maxx = Double.MIN_VALUE;
|
||||
double maxy = Double.MIN_VALUE;
|
||||
double maxz = Double.MIN_VALUE;
|
||||
for (Vecs3dCube c : cubes)
|
||||
{
|
||||
minx = Math.min(minx, c.getMinX());
|
||||
miny = Math.min(miny, c.getMinY());
|
||||
minz = Math.min(minz, c.getMinZ());
|
||||
maxx = Math.max(maxx, c.getMaxX());
|
||||
maxy = Math.max(maxy, c.getMaxY());
|
||||
maxz = Math.max(maxz, c.getMaxZ());
|
||||
}
|
||||
|
||||
for (Vecs3dCube c : cubes) {
|
||||
minx = Math.min(minx, c.getMinX());
|
||||
miny = Math.min(miny, c.getMinY());
|
||||
minz = Math.min(minz, c.getMinZ());
|
||||
maxx = Math.max(maxx, c.getMaxX());
|
||||
maxy = Math.max(maxy, c.getMaxY());
|
||||
maxz = Math.max(maxz, c.getMaxZ());
|
||||
}
|
||||
if (cubes.size() == 0)
|
||||
return new Vecs3dCube(0, 0, 0, 0, 0, 0);
|
||||
|
||||
if (cubes.size() == 0)
|
||||
return new Vecs3dCube(0, 0, 0, 0, 0, 0);
|
||||
return new Vecs3dCube(minx, miny, minz, maxx, maxy, maxz);
|
||||
}
|
||||
|
||||
return new Vecs3dCube(minx, miny, minz, maxx, maxy, maxz);
|
||||
}
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
return min.hashCode() << 8 + max.hashCode();
|
||||
}
|
||||
return min.hashCode() << 8 + max.hashCode();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,136 +1,164 @@
|
|||
package techreborn.multiblocks;
|
||||
|
||||
import erogenousbeef.coreTR.multiblock.IMultiblockPart;
|
||||
import erogenousbeef.coreTR.multiblock.MultiblockControllerBase;
|
||||
import erogenousbeef.coreTR.multiblock.MultiblockValidationException;
|
||||
import erogenousbeef.coreTR.multiblock.rectangular.RectangularMultiblockControllerBase;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.util.LogHelper;
|
||||
import erogenousbeef.coreTR.multiblock.IMultiblockPart;
|
||||
import erogenousbeef.coreTR.multiblock.MultiblockControllerBase;
|
||||
import erogenousbeef.coreTR.multiblock.MultiblockValidationException;
|
||||
import erogenousbeef.coreTR.multiblock.rectangular.RectangularMultiblockControllerBase;
|
||||
|
||||
public class MultiBlockCasing extends RectangularMultiblockControllerBase {
|
||||
|
||||
public MultiBlockCasing(World world) {
|
||||
super(world);
|
||||
}
|
||||
public MultiBlockCasing(World world)
|
||||
{
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedPartWithMultiblockData(IMultiblockPart part, NBTTagCompound data) {
|
||||
@Override
|
||||
public void onAttachedPartWithMultiblockData(IMultiblockPart part,
|
||||
NBTTagCompound data)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBlockAdded(IMultiblockPart newPart) {
|
||||
}
|
||||
@Override
|
||||
protected void onBlockAdded(IMultiblockPart newPart)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBlockRemoved(IMultiblockPart oldPart) {
|
||||
@Override
|
||||
protected void onBlockRemoved(IMultiblockPart oldPart)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMachineAssembled() {
|
||||
LogHelper.warn("New multiblock created!");
|
||||
}
|
||||
@Override
|
||||
protected void onMachineAssembled()
|
||||
{
|
||||
LogHelper.warn("New multiblock created!");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMachineRestored() {
|
||||
@Override
|
||||
protected void onMachineRestored()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMachinePaused() {
|
||||
@Override
|
||||
protected void onMachinePaused()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMachineDisassembled() {
|
||||
@Override
|
||||
protected void onMachineDisassembled()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMinimumNumberOfBlocksForAssembledMachine() {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
protected int getMinimumNumberOfBlocksForAssembledMachine()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMaximumXSize() {
|
||||
return 3;
|
||||
}
|
||||
@Override
|
||||
protected int getMaximumXSize()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMaximumZSize() {
|
||||
return 3;
|
||||
}
|
||||
@Override
|
||||
protected int getMaximumZSize()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMaximumYSize() {
|
||||
return 4;
|
||||
}
|
||||
@Override
|
||||
protected int getMaximumYSize()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMinimumXSize() {
|
||||
return 3;
|
||||
}
|
||||
@Override
|
||||
protected int getMinimumXSize()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMinimumYSize() {
|
||||
return 4;
|
||||
}
|
||||
@Override
|
||||
protected int getMinimumYSize()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMinimumZSize() {
|
||||
return 3;
|
||||
}
|
||||
@Override
|
||||
protected int getMinimumZSize()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAssimilate(MultiblockControllerBase assimilated) {
|
||||
@Override
|
||||
protected void onAssimilate(MultiblockControllerBase assimilated)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAssimilated(MultiblockControllerBase assimilator) {
|
||||
@Override
|
||||
protected void onAssimilated(MultiblockControllerBase assimilator)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean updateServer() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean updateServer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateClient() {
|
||||
@Override
|
||||
protected void updateClient()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound data) {
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound data)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void formatDescriptionPacket(NBTTagCompound data) {
|
||||
@Override
|
||||
public void formatDescriptionPacket(NBTTagCompound data)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeDescriptionPacket(NBTTagCompound data) {
|
||||
@Override
|
||||
public void decodeDescriptionPacket(NBTTagCompound data)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void isBlockGoodForInterior(World world, int x, int y, int z) throws MultiblockValidationException {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if(block.getUnlocalizedName().equals("tile.lava") || block.getUnlocalizedName().equals("tile.air")){
|
||||
} else {
|
||||
super.isBlockGoodForInterior(world, x, y, z);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void isBlockGoodForInterior(World world, int x, int y, int z)
|
||||
throws MultiblockValidationException
|
||||
{
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block.getUnlocalizedName().equals("tile.lava")
|
||||
|| block.getUnlocalizedName().equals("tile.air"))
|
||||
{
|
||||
} else
|
||||
{
|
||||
super.isBlockGoodForInterior(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,71 +1,97 @@
|
|||
package techreborn.packets;
|
||||
|
||||
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
|
||||
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
|
||||
import cpw.mods.fml.common.network.FMLOutboundHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class PacketHandler extends FMLIndexedMessageToMessageCodec<SimplePacket> {
|
||||
private static EnumMap<Side, FMLEmbeddedChannel> channels;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
|
||||
import cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec;
|
||||
import cpw.mods.fml.common.network.FMLOutboundHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public PacketHandler() {
|
||||
public class PacketHandler extends
|
||||
FMLIndexedMessageToMessageCodec<SimplePacket> {
|
||||
private static EnumMap<Side, FMLEmbeddedChannel> channels;
|
||||
|
||||
}
|
||||
public PacketHandler()
|
||||
{
|
||||
|
||||
public static EnumMap<Side, FMLEmbeddedChannel> getChannels() {
|
||||
return channels;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setChannels(EnumMap<Side, FMLEmbeddedChannel> _channels) {
|
||||
channels = _channels;
|
||||
}
|
||||
public static EnumMap<Side, FMLEmbeddedChannel> getChannels()
|
||||
{
|
||||
return channels;
|
||||
}
|
||||
|
||||
public static void sendPacketToServer(SimplePacket packet) {
|
||||
PacketHandler.getChannels().get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.TOSERVER);
|
||||
PacketHandler.getChannels().get(Side.CLIENT).writeOutbound(packet);
|
||||
}
|
||||
public static void setChannels(EnumMap<Side, FMLEmbeddedChannel> _channels)
|
||||
{
|
||||
channels = _channels;
|
||||
}
|
||||
|
||||
public static void sendPacketToPlayer(SimplePacket packet, EntityPlayer player) {
|
||||
PacketHandler.getChannels().get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
|
||||
PacketHandler.getChannels().get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
|
||||
PacketHandler.getChannels().get(Side.SERVER).writeOutbound(packet);
|
||||
}
|
||||
public static void sendPacketToServer(SimplePacket packet)
|
||||
{
|
||||
PacketHandler.getChannels().get(Side.CLIENT)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.TOSERVER);
|
||||
PacketHandler.getChannels().get(Side.CLIENT).writeOutbound(packet);
|
||||
}
|
||||
|
||||
public static void sendPacketToAllPlayers(SimplePacket packet) {
|
||||
PacketHandler.getChannels().get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
|
||||
PacketHandler.getChannels().get(Side.SERVER).writeOutbound(packet);
|
||||
}
|
||||
public static void sendPacketToPlayer(SimplePacket packet,
|
||||
EntityPlayer player)
|
||||
{
|
||||
PacketHandler.getChannels().get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.PLAYER);
|
||||
PacketHandler.getChannels().get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(player);
|
||||
PacketHandler.getChannels().get(Side.SERVER).writeOutbound(packet);
|
||||
}
|
||||
|
||||
public static void sendPacketToAllPlayers(Packet packet, World world) {
|
||||
for (Object player : world.playerEntities) {
|
||||
if (player instanceof EntityPlayerMP)
|
||||
if (player != null)
|
||||
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
public static void sendPacketToAllPlayers(SimplePacket packet)
|
||||
{
|
||||
PacketHandler.getChannels().get(Side.SERVER)
|
||||
.attr(FMLOutboundHandler.FML_MESSAGETARGET)
|
||||
.set(FMLOutboundHandler.OutboundTarget.ALL);
|
||||
PacketHandler.getChannels().get(Side.SERVER).writeOutbound(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeInto(ChannelHandlerContext ctx, SimplePacket msg, ByteBuf target) throws Exception {
|
||||
msg.writePacketData(target);
|
||||
}
|
||||
public static void sendPacketToAllPlayers(Packet packet, World world)
|
||||
{
|
||||
for (Object player : world.playerEntities)
|
||||
{
|
||||
if (player instanceof EntityPlayerMP)
|
||||
if (player != null)
|
||||
((EntityPlayerMP) player).playerNetServerHandler
|
||||
.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf source, SimplePacket msg) {
|
||||
try {
|
||||
msg.readPacketData(source);
|
||||
msg.execute();
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger("Network").warning("Something caused a Protocol Exception!");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void encodeInto(ChannelHandlerContext ctx, SimplePacket msg,
|
||||
ByteBuf target) throws Exception
|
||||
{
|
||||
msg.writePacketData(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf source,
|
||||
SimplePacket msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
msg.readPacketData(source);
|
||||
msg.execute();
|
||||
} catch (IOException e)
|
||||
{
|
||||
Logger.getLogger("Network").warning(
|
||||
"Something caused a Protocol Exception!");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
package techreborn.packets;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -9,110 +11,133 @@ import net.minecraftforge.common.DimensionManager;
|
|||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import java.io.IOException;
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
public abstract class SimplePacket {
|
||||
protected EntityPlayer player;
|
||||
protected byte mode;
|
||||
protected EntityPlayer player;
|
||||
protected byte mode;
|
||||
|
||||
public SimplePacket(EntityPlayer _player) {
|
||||
player = _player;
|
||||
}
|
||||
public SimplePacket(EntityPlayer _player)
|
||||
{
|
||||
player = _player;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public SimplePacket() {
|
||||
player = null;
|
||||
}
|
||||
@SuppressWarnings("unused")
|
||||
public SimplePacket()
|
||||
{
|
||||
player = null;
|
||||
}
|
||||
|
||||
public static String readString(ByteBuf in) throws IOException {
|
||||
byte[] stringBytes = new byte[in.readInt()];
|
||||
in.readBytes(stringBytes);
|
||||
return new String(stringBytes, Charsets.UTF_8);
|
||||
}
|
||||
public static String readString(ByteBuf in) throws IOException
|
||||
{
|
||||
byte[] stringBytes = new byte[in.readInt()];
|
||||
in.readBytes(stringBytes);
|
||||
return new String(stringBytes, Charsets.UTF_8);
|
||||
}
|
||||
|
||||
public static void writeString(String string, ByteBuf out) throws IOException {
|
||||
byte[] stringBytes;
|
||||
stringBytes = string.getBytes(Charsets.UTF_8);
|
||||
out.writeInt(stringBytes.length);
|
||||
out.writeBytes(stringBytes);
|
||||
}
|
||||
public static void writeString(String string, ByteBuf out)
|
||||
throws IOException
|
||||
{
|
||||
byte[] stringBytes;
|
||||
stringBytes = string.getBytes(Charsets.UTF_8);
|
||||
out.writeInt(stringBytes.length);
|
||||
out.writeBytes(stringBytes);
|
||||
}
|
||||
|
||||
public static World readWorld(ByteBuf in) throws IOException {
|
||||
return DimensionManager.getWorld(in.readInt());
|
||||
}
|
||||
public static World readWorld(ByteBuf in) throws IOException
|
||||
{
|
||||
return DimensionManager.getWorld(in.readInt());
|
||||
}
|
||||
|
||||
public static void writeWorld(World world, ByteBuf out) throws IOException {
|
||||
out.writeInt(world.provider.dimensionId);
|
||||
}
|
||||
public static void writeWorld(World world, ByteBuf out) throws IOException
|
||||
{
|
||||
out.writeInt(world.provider.dimensionId);
|
||||
}
|
||||
|
||||
public static EntityPlayer readPlayer(ByteBuf in) throws IOException {
|
||||
if (!in.readBoolean())
|
||||
return null;
|
||||
World playerWorld = readWorld(in);
|
||||
return playerWorld.getPlayerEntityByName(readString(in));
|
||||
}
|
||||
public static EntityPlayer readPlayer(ByteBuf in) throws IOException
|
||||
{
|
||||
if (!in.readBoolean())
|
||||
return null;
|
||||
World playerWorld = readWorld(in);
|
||||
return playerWorld.getPlayerEntityByName(readString(in));
|
||||
}
|
||||
|
||||
public static void writePlayer(EntityPlayer player, ByteBuf out) throws IOException {
|
||||
if (player == null) {
|
||||
out.writeBoolean(false);
|
||||
return;
|
||||
}
|
||||
out.writeBoolean(true);
|
||||
writeWorld(player.worldObj, out);
|
||||
writeString(player.getCommandSenderName(), out);
|
||||
}
|
||||
public static void writePlayer(EntityPlayer player, ByteBuf out)
|
||||
throws IOException
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
out.writeBoolean(false);
|
||||
return;
|
||||
}
|
||||
out.writeBoolean(true);
|
||||
writeWorld(player.worldObj, out);
|
||||
writeString(player.getCommandSenderName(), out);
|
||||
}
|
||||
|
||||
public static TileEntity readTileEntity(ByteBuf in) throws IOException {
|
||||
return readWorld(in).getTileEntity(in.readInt(), in.readInt(), in.readInt());
|
||||
}
|
||||
public static TileEntity readTileEntity(ByteBuf in) throws IOException
|
||||
{
|
||||
return readWorld(in).getTileEntity(in.readInt(), in.readInt(),
|
||||
in.readInt());
|
||||
}
|
||||
|
||||
public static void writeTileEntity(TileEntity tileEntity, ByteBuf out) throws IOException {
|
||||
writeWorld(tileEntity.getWorldObj(), out);
|
||||
out.writeInt(tileEntity.xCoord);
|
||||
out.writeInt(tileEntity.yCoord);
|
||||
out.writeInt(tileEntity.zCoord);
|
||||
}
|
||||
public static void writeTileEntity(TileEntity tileEntity, ByteBuf out)
|
||||
throws IOException
|
||||
{
|
||||
writeWorld(tileEntity.getWorldObj(), out);
|
||||
out.writeInt(tileEntity.xCoord);
|
||||
out.writeInt(tileEntity.yCoord);
|
||||
out.writeInt(tileEntity.zCoord);
|
||||
}
|
||||
|
||||
public static Fluid readFluid(ByteBuf in) throws IOException {
|
||||
return FluidRegistry.getFluid(readString(in));
|
||||
}
|
||||
public static Fluid readFluid(ByteBuf in) throws IOException
|
||||
{
|
||||
return FluidRegistry.getFluid(readString(in));
|
||||
}
|
||||
|
||||
public static void writeFluid(Fluid fluid, ByteBuf out) throws IOException {
|
||||
if (fluid == null) {
|
||||
writeString("", out);
|
||||
return;
|
||||
}
|
||||
writeString(fluid.getName(), out);
|
||||
}
|
||||
public static void writeFluid(Fluid fluid, ByteBuf out) throws IOException
|
||||
{
|
||||
if (fluid == null)
|
||||
{
|
||||
writeString("", out);
|
||||
return;
|
||||
}
|
||||
writeString(fluid.getName(), out);
|
||||
}
|
||||
|
||||
public void writePacketData(ByteBuf out) throws IOException {
|
||||
out.writeByte(mode);
|
||||
writePlayer(player, out);
|
||||
writeData(out);
|
||||
}
|
||||
public void writePacketData(ByteBuf out) throws IOException
|
||||
{
|
||||
out.writeByte(mode);
|
||||
writePlayer(player, out);
|
||||
writeData(out);
|
||||
}
|
||||
|
||||
public abstract void writeData(ByteBuf out) throws IOException;
|
||||
public abstract void writeData(ByteBuf out) throws IOException;
|
||||
|
||||
public void readPacketData(ByteBuf in) throws IOException {
|
||||
mode = in.readByte();
|
||||
player = readPlayer(in);
|
||||
readData(in);
|
||||
}
|
||||
public void readPacketData(ByteBuf in) throws IOException
|
||||
{
|
||||
mode = in.readByte();
|
||||
player = readPlayer(in);
|
||||
readData(in);
|
||||
}
|
||||
|
||||
public abstract void readData(ByteBuf in) throws IOException;
|
||||
public abstract void readData(ByteBuf in) throws IOException;
|
||||
|
||||
public abstract void execute();
|
||||
public abstract void execute();
|
||||
|
||||
public void sendPacketToServer() {
|
||||
PacketHandler.sendPacketToServer(this);
|
||||
}
|
||||
public void sendPacketToServer()
|
||||
{
|
||||
PacketHandler.sendPacketToServer(this);
|
||||
}
|
||||
|
||||
public void sendPacketToPlayer(EntityPlayer player) {
|
||||
PacketHandler.sendPacketToPlayer(this, player);
|
||||
}
|
||||
public void sendPacketToPlayer(EntityPlayer player)
|
||||
{
|
||||
PacketHandler.sendPacketToPlayer(this, player);
|
||||
}
|
||||
|
||||
public void sendPacketToAllPlayers() {
|
||||
PacketHandler.sendPacketToAllPlayers(this);
|
||||
}
|
||||
public void sendPacketToAllPlayers()
|
||||
{
|
||||
PacketHandler.sendPacketToAllPlayers(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package techreborn.partSystem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface ICustomHighlight {
|
||||
|
||||
ArrayList<AxisAlignedBB> getBoxes(World world, int x, int y, int z, EntityPlayer player);
|
||||
ArrayList<AxisAlignedBB> getBoxes(World world, int x, int y, int z,
|
||||
EntityPlayer player);
|
||||
|
||||
}
|
||||
|
|
|
@ -4,29 +4,30 @@
|
|||
|
||||
package techreborn.partSystem;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* This is based of https://github.com/Qmunity/QmunityLib/blob/master/src/main/java/uk/co/qmunity/lib/part/IPart.java
|
||||
* This is based of
|
||||
* https://github.com/Qmunity/QmunityLib/blob/master/src/main/java
|
||||
* /uk/co/qmunity/lib/part/IPart.java
|
||||
* <p/>
|
||||
* You should not be implementing this.
|
||||
*/
|
||||
public interface IModPart {
|
||||
|
||||
/**
|
||||
* Adds all of this part's collision boxes to the list. These boxes can depend on the entity that's colliding with them.
|
||||
* Adds all of this part's collision boxes to the list. These boxes can
|
||||
* depend on the entity that's colliding with them.
|
||||
*/
|
||||
public void addCollisionBoxesToList(List<Vecs3dCube> boxes, Entity entity);
|
||||
|
||||
|
@ -35,7 +36,6 @@ public interface IModPart {
|
|||
*/
|
||||
public List<Vecs3dCube> getSelectionBoxes();
|
||||
|
||||
|
||||
/**
|
||||
* Gets this part's occlusion boxes.
|
||||
*/
|
||||
|
@ -49,10 +49,12 @@ public interface IModPart {
|
|||
|
||||
/**
|
||||
* Renders this part statically. A tessellator has alredy started drawing. <br>
|
||||
* Only called when there's a block/lighting/render update in the chunk this part is in.
|
||||
* Only called when there's a block/lighting/render update in the chunk this
|
||||
* part is in.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderStatic(Vecs3d translation, RenderBlocks renderBlocks, int pass);
|
||||
public boolean renderStatic(Vecs3d translation, RenderBlocks renderBlocks,
|
||||
int pass);
|
||||
|
||||
/**
|
||||
* Writes the part's data to an NBT tag, which is saved with the game data.
|
||||
|
@ -105,7 +107,8 @@ public interface IModPart {
|
|||
public void tick();
|
||||
|
||||
/**
|
||||
* Called when a block or part has been changed. Can be used for cables to check nearby blocks
|
||||
* Called when a block or part has been changed. Can be used for cables to
|
||||
* check nearby blocks
|
||||
*/
|
||||
public void nearByChange();
|
||||
|
||||
|
|
|
@ -11,18 +11,20 @@ import net.minecraft.world.World;
|
|||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
|
||||
|
||||
public interface IPartProvider {
|
||||
|
||||
public String modID();
|
||||
|
||||
public void registerPart();
|
||||
|
||||
public boolean checkOcclusion(World world, Location location, Vecs3dCube cube);
|
||||
public boolean checkOcclusion(World world, Location location,
|
||||
Vecs3dCube cube);
|
||||
|
||||
public boolean hasPart(World world, Location location, String name);
|
||||
|
||||
public boolean placePart(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, ModPart modPart);
|
||||
public boolean placePart(ItemStack item, EntityPlayer player, World world,
|
||||
int x, int y, int z, int side, float hitX, float hitY, float hitZ,
|
||||
ModPart modPart);
|
||||
|
||||
public boolean isTileFromProvider(TileEntity tileEntity);
|
||||
}
|
||||
|
|
|
@ -4,12 +4,10 @@
|
|||
|
||||
package techreborn.partSystem;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.Location;
|
||||
|
||||
|
||||
/**
|
||||
* Extend this class to make your multipart
|
||||
*/
|
||||
|
@ -25,21 +23,21 @@ public abstract class ModPart extends TileEntity implements IModPart {
|
|||
*/
|
||||
public Location location;
|
||||
|
||||
|
||||
/**
|
||||
* This is the world
|
||||
*/
|
||||
@Override
|
||||
public World getWorld() {
|
||||
public World getWorld()
|
||||
{
|
||||
|
||||
return world;
|
||||
}
|
||||
|
||||
/**
|
||||
* This sets the world
|
||||
* Don't use this unless you know what you are doing.
|
||||
* This sets the world Don't use this unless you know what you are doing.
|
||||
*/
|
||||
public void setWorld(World world) {
|
||||
public void setWorld(World world)
|
||||
{
|
||||
this.world = world;
|
||||
setWorldObj(world);
|
||||
}
|
||||
|
@ -48,7 +46,8 @@ public abstract class ModPart extends TileEntity implements IModPart {
|
|||
* Gets the x position in the world
|
||||
*/
|
||||
@Override
|
||||
public int getX() {
|
||||
public int getX()
|
||||
{
|
||||
return location.getX();
|
||||
}
|
||||
|
||||
|
@ -56,7 +55,8 @@ public abstract class ModPart extends TileEntity implements IModPart {
|
|||
* Gets the y position in the world
|
||||
*/
|
||||
@Override
|
||||
public int getY() {
|
||||
public int getY()
|
||||
{
|
||||
return location.getY();
|
||||
}
|
||||
|
||||
|
@ -64,37 +64,39 @@ public abstract class ModPart extends TileEntity implements IModPart {
|
|||
* Gets the z position in the world
|
||||
*/
|
||||
@Override
|
||||
public int getZ() {
|
||||
public int getZ()
|
||||
{
|
||||
return location.getZ();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the location of the part
|
||||
*/
|
||||
public Location getLocation() {
|
||||
public Location getLocation()
|
||||
{
|
||||
return location;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the x position in the world
|
||||
*/
|
||||
public void setLocation(Location location) {
|
||||
public void setLocation(Location location)
|
||||
{
|
||||
this.location = location;
|
||||
this.xCoord = location.getX();
|
||||
this.yCoord = location.getY();
|
||||
this.zCoord = location.getZ();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public World getWorldObj() {
|
||||
public World getWorldObj()
|
||||
{
|
||||
return getWorld();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWorldObj(World p_145834_1_) {
|
||||
public void setWorldObj(World p_145834_1_)
|
||||
{
|
||||
super.setWorldObj(p_145834_1_);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,38 +10,54 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.world.World;
|
||||
import uk.co.qmunity.lib.ref.Names;
|
||||
|
||||
|
||||
public class ModPartItem extends Item {
|
||||
|
||||
ModPart modPart;
|
||||
|
||||
public ModPartItem(ModPart part) {
|
||||
public ModPartItem(ModPart part)
|
||||
{
|
||||
modPart = part;
|
||||
setUnlocalizedName(Names.Unlocalized.Items.MULTIPART);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int face, float x_, float y_, float z_) {
|
||||
if(ModPartRegistry.masterProvider != null){
|
||||
try {
|
||||
if (ModPartRegistry.masterProvider.placePart(item, player, world, x, y, z, face, x_, y_, z_, modPart.getClass().newInstance())) {
|
||||
public boolean onItemUse(ItemStack item, EntityPlayer player, World world,
|
||||
int x, int y, int z, int face, float x_, float y_, float z_)
|
||||
{
|
||||
if (ModPartRegistry.masterProvider != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ModPartRegistry.masterProvider.placePart(item, player,
|
||||
world, x, y, z, face, x_, y_, z_, modPart.getClass()
|
||||
.newInstance()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
} catch (InstantiationException e) {
|
||||
} catch (InstantiationException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}else {
|
||||
for (IPartProvider partProvider : ModPartRegistry.providers) {
|
||||
try {
|
||||
if (partProvider.placePart(item, player, world, x, y, z, face, x_, y_, z_, modPart.getClass().newInstance())) {
|
||||
} else
|
||||
{
|
||||
for (IPartProvider partProvider : ModPartRegistry.providers)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (partProvider.placePart(item, player, world, x, y, z,
|
||||
face, x_, y_, z_, modPart.getClass().newInstance()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
} catch (InstantiationException e) {
|
||||
} catch (InstantiationException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -50,11 +66,13 @@ public class ModPartItem extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
public String getUnlocalizedName(ItemStack stack)
|
||||
{
|
||||
return modPart.getName();
|
||||
}
|
||||
|
||||
public ModPart getModPart() {
|
||||
public ModPart getModPart()
|
||||
{
|
||||
return modPart;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
|
||||
package techreborn.partSystem;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.util.LogHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.util.LogHelper;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class ModPartRegistry {
|
||||
|
||||
public static ArrayList<ModPart> parts = new ArrayList<ModPart>();
|
||||
|
@ -24,55 +24,78 @@ public class ModPartRegistry {
|
|||
|
||||
public static Map<Item, String> itemParts = new HashMap<Item, String>();
|
||||
|
||||
public static void registerPart(ModPart iModPart) {
|
||||
public static void registerPart(ModPart iModPart)
|
||||
{
|
||||
parts.add(iModPart);
|
||||
}
|
||||
|
||||
public static void addAllPartsToSystems() {
|
||||
public static void addAllPartsToSystems()
|
||||
{
|
||||
LogHelper.info("Started to load all parts");
|
||||
|
||||
for (ModPart modPart : ModPartRegistry.parts) {
|
||||
Item part = new ModPartItem(modPart).setUnlocalizedName(modPart.getName()).setCreativeTab(TechRebornCreativeTab.instance).setTextureName(modPart.getItemTextureName());
|
||||
for (ModPart modPart : ModPartRegistry.parts)
|
||||
{
|
||||
Item part = new ModPartItem(modPart)
|
||||
.setUnlocalizedName(modPart.getName())
|
||||
.setCreativeTab(TechRebornCreativeTab.instance)
|
||||
.setTextureName(modPart.getItemTextureName());
|
||||
GameRegistry.registerItem(part, modPart.getName());
|
||||
itemParts.put(part, modPart.getName());
|
||||
}
|
||||
|
||||
for (IPartProvider iPartProvider : providers) {
|
||||
for (IPartProvider iPartProvider : providers)
|
||||
{
|
||||
iPartProvider.registerPart();
|
||||
}
|
||||
}
|
||||
|
||||
public static Item getItem(String string) {
|
||||
for (Map.Entry<Item, String> entry : itemParts.entrySet()) {
|
||||
if (entry.getValue().equals(string)) {
|
||||
public static Item getItem(String string)
|
||||
{
|
||||
for (Map.Entry<Item, String> entry : itemParts.entrySet())
|
||||
{
|
||||
if (entry.getValue().equals(string))
|
||||
{
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void addProvider(String className, String modid) {
|
||||
if (Loader.isModLoaded(modid) || modid.equals("Minecraft")) {
|
||||
try {
|
||||
public static void addProvider(String className, String modid)
|
||||
{
|
||||
if (Loader.isModLoaded(modid) || modid.equals("Minecraft"))
|
||||
{
|
||||
try
|
||||
{
|
||||
IPartProvider iPartProvider = null;
|
||||
iPartProvider = (IPartProvider) Class.forName(className).newInstance();
|
||||
iPartProvider = (IPartProvider) Class.forName(className)
|
||||
.newInstance();
|
||||
providers.add(iPartProvider);
|
||||
} catch (ClassNotFoundException e) {
|
||||
} catch (ClassNotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
LogHelper.error("Failed to load " + className + " to the part system!");
|
||||
} catch (InstantiationException e) {
|
||||
LogHelper.error("Failed to load " + className
|
||||
+ " to the part system!");
|
||||
} catch (InstantiationException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
LogHelper.error("Failed to load " + className + " to the part system!");
|
||||
} catch (IllegalAccessException e) {
|
||||
LogHelper.error("Failed to load " + className
|
||||
+ " to the part system!");
|
||||
} catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
LogHelper.error("Failed to load " + className + " to the part system!");
|
||||
LogHelper.error("Failed to load " + className
|
||||
+ " to the part system!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Only use this one if it is a standalone Provider
|
||||
public static void addProvider(IPartProvider iPartProvider) {
|
||||
if (Loader.isModLoaded(iPartProvider.modID()) || iPartProvider.modID().equals("Minecraft")) {
|
||||
// Only use this one if it is a standalone Provider
|
||||
public static void addProvider(IPartProvider iPartProvider)
|
||||
{
|
||||
if (Loader.isModLoaded(iPartProvider.modID())
|
||||
|| iPartProvider.modID().equals("Minecraft"))
|
||||
{
|
||||
providers.add(iPartProvider);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,73 +4,96 @@
|
|||
|
||||
package techreborn.partSystem;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ModPartUtils {
|
||||
|
||||
|
||||
public static boolean checkOcclusion(World world, Location location, Vecs3dCube cube) {
|
||||
if (world == null) {
|
||||
public static boolean checkOcclusion(World world, Location location,
|
||||
Vecs3dCube cube)
|
||||
{
|
||||
if (world == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
IPartProvider partProvider = getPartProvider(world, location);
|
||||
if (partProvider != null) {
|
||||
if (partProvider != null)
|
||||
{
|
||||
return partProvider.checkOcclusion(world, location, cube);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean checkOcclusion(World world, int x, int y, int z, Vecs3dCube cube) {
|
||||
public static boolean checkOcclusion(World world, int x, int y, int z,
|
||||
Vecs3dCube cube)
|
||||
{
|
||||
return checkOcclusion(world, new Location(x, y, z), cube);
|
||||
}
|
||||
|
||||
public static boolean checkOcclusionInvert(World world, Location location, Vecs3dCube cube) {
|
||||
if (world == null) {
|
||||
public static boolean checkOcclusionInvert(World world, Location location,
|
||||
Vecs3dCube cube)
|
||||
{
|
||||
if (world == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (IPartProvider iPartProvider : ModPartRegistry.providers) {
|
||||
if (!iPartProvider.checkOcclusion(world, location, cube)) {
|
||||
for (IPartProvider iPartProvider : ModPartRegistry.providers)
|
||||
{
|
||||
if (!iPartProvider.checkOcclusion(world, location, cube))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean checkOcclusionInvert(World world, int x, int y, int z, Vecs3dCube cube) {
|
||||
public static boolean checkOcclusionInvert(World world, int x, int y,
|
||||
int z, Vecs3dCube cube)
|
||||
{
|
||||
return checkOcclusionInvert(world, new Location(x, y, z), cube);
|
||||
}
|
||||
|
||||
public static boolean hasPart(World world, Location location, String name) {
|
||||
for (IPartProvider iPartProvider : ModPartRegistry.providers) {
|
||||
if (iPartProvider.hasPart(world, location, name)) {
|
||||
public static boolean hasPart(World world, Location location, String name)
|
||||
{
|
||||
for (IPartProvider iPartProvider : ModPartRegistry.providers)
|
||||
{
|
||||
if (iPartProvider.hasPart(world, location, name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static boolean hasPart(World world, int x, int y, int z, String name) {
|
||||
public static boolean hasPart(World world, int x, int y, int z, String name)
|
||||
{
|
||||
return hasPart(world, new Location(x, y, z), name);
|
||||
}
|
||||
|
||||
public static Item getItemForPart(String string) {
|
||||
for (Map.Entry<Item, String> item : ModPartRegistry.itemParts.entrySet()) {
|
||||
if (item.getValue().equals(string)) {
|
||||
public static Item getItemForPart(String string)
|
||||
{
|
||||
for (Map.Entry<Item, String> item : ModPartRegistry.itemParts
|
||||
.entrySet())
|
||||
{
|
||||
if (item.getValue().equals(string))
|
||||
{
|
||||
return item.getKey();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IPartProvider getPartProvider(World world, Location location) {
|
||||
for (IPartProvider partProvider : ModPartRegistry.providers) {
|
||||
if (partProvider.isTileFromProvider(world.getTileEntity(location.getX(), location.getY(), location.getZ()))) {
|
||||
public static IPartProvider getPartProvider(World world, Location location)
|
||||
{
|
||||
for (IPartProvider partProvider : ModPartRegistry.providers)
|
||||
{
|
||||
if (partProvider.isTileFromProvider(world.getTileEntity(
|
||||
location.getX(), location.getY(), location.getZ())))
|
||||
{
|
||||
return partProvider;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,52 +4,59 @@
|
|||
|
||||
package techreborn.partSystem.QLib;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import uk.co.qmunity.lib.vec.Vec3d;
|
||||
import uk.co.qmunity.lib.vec.Vec3dCube;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by mark on 09/12/14.
|
||||
*/
|
||||
public class ModLib2QLib {
|
||||
|
||||
public static Vec3d convert(Vecs3d input) {
|
||||
public static Vec3d convert(Vecs3d input)
|
||||
{
|
||||
return new Vec3d(input.getX(), input.getY(), input.getZ());
|
||||
}
|
||||
|
||||
public static Vec3dCube convert(Vecs3dCube input) {
|
||||
public static Vec3dCube convert(Vecs3dCube input)
|
||||
{
|
||||
return new Vec3dCube(input.toAABB());
|
||||
}
|
||||
|
||||
|
||||
public static Vecs3d convert(Vec3d input) {
|
||||
public static Vecs3d convert(Vec3d input)
|
||||
{
|
||||
return new Vecs3d(input.getX(), input.getY(), input.getZ());
|
||||
}
|
||||
|
||||
public static Vecs3dCube convert(Vec3dCube input) {
|
||||
public static Vecs3dCube convert(Vec3dCube input)
|
||||
{
|
||||
return new Vecs3dCube(input.toAABB());
|
||||
}
|
||||
|
||||
public static List<Vecs3dCube> convert(List<Vec3dCube> input) {
|
||||
public static List<Vecs3dCube> convert(List<Vec3dCube> input)
|
||||
{
|
||||
List<Vecs3dCube> list = new ArrayList<Vecs3dCube>();
|
||||
for (Vec3dCube cube : input) {
|
||||
for (Vec3dCube cube : input)
|
||||
{
|
||||
list.add(new Vecs3dCube(cube.toAABB()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
//Its got to be called becuase of some weird thing see: https://stackoverflow.com/questions/1998544/method-has-the-same-erasure-as-another-method-in-type
|
||||
public static List<Vec3dCube> convert2(List<Vecs3dCube> input) {
|
||||
// Its got to be called becuase of some weird thing see:
|
||||
// https://stackoverflow.com/questions/1998544/method-has-the-same-erasure-as-another-method-in-type
|
||||
public static List<Vec3dCube> convert2(List<Vecs3dCube> input)
|
||||
{
|
||||
List<Vec3dCube> list = new ArrayList<Vec3dCube>();
|
||||
for (Vecs3dCube cube : input) {
|
||||
for (Vecs3dCube cube : input)
|
||||
{
|
||||
list.add(new Vec3dCube(cube.toAABB()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,14 +4,17 @@
|
|||
|
||||
package techreborn.partSystem.QLib;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.ModPart;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import uk.co.qmunity.lib.client.render.RenderHelper;
|
||||
import uk.co.qmunity.lib.part.IPart;
|
||||
import uk.co.qmunity.lib.part.IPartCollidable;
|
||||
|
@ -27,72 +30,86 @@ import uk.co.qmunity.lib.vec.Vec3d;
|
|||
import uk.co.qmunity.lib.vec.Vec3dCube;
|
||||
import uk.co.qmunity.lib.vec.Vec3i;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class QModPart extends PartBase implements IPartCollidable, IPartSelectable, IPartRenderPlacement, IPartTicking, IPartUpdateListener {
|
||||
public class QModPart extends PartBase implements IPartCollidable,
|
||||
IPartSelectable, IPartRenderPlacement, IPartTicking,
|
||||
IPartUpdateListener {
|
||||
|
||||
ModPart iModPart;
|
||||
|
||||
public QModPart(ModPart iModPart) {
|
||||
public QModPart(ModPart iModPart)
|
||||
{
|
||||
this.iModPart = iModPart;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParent(ITilePartHolder parent) {
|
||||
public void setParent(ITilePartHolder parent)
|
||||
{
|
||||
super.setParent(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
public String getType()
|
||||
{
|
||||
return iModPart.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem() {
|
||||
public ItemStack getItem()
|
||||
{
|
||||
return iModPart.getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(List<Vec3dCube> boxes, Entity entity) {
|
||||
public void addCollisionBoxesToList(List<Vec3dCube> boxes, Entity entity)
|
||||
{
|
||||
List<Vecs3dCube> cubes = new ArrayList<Vecs3dCube>();
|
||||
iModPart.addCollisionBoxesToList(cubes, entity);
|
||||
for (Vecs3dCube cube : cubes) {
|
||||
for (Vecs3dCube cube : cubes)
|
||||
{
|
||||
if (cube != null)
|
||||
boxes.add(ModLib2QLib.convert(cube));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderDynamic(Vec3d translation, double delta, int pass) {
|
||||
public void renderDynamic(Vec3d translation, double delta, int pass)
|
||||
{
|
||||
iModPart.renderDynamic(ModLib2QLib.convert(translation), delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderStatic(Vec3i translation, RenderHelper renderer, RenderBlocks renderBlocks, int pass) {
|
||||
return iModPart.renderStatic(new Vecs3d(translation.getX(), translation.getY(), translation.getZ()),renderBlocks , pass);
|
||||
public boolean renderStatic(Vec3i translation, RenderHelper renderer,
|
||||
RenderBlocks renderBlocks, int pass)
|
||||
{
|
||||
return iModPart.renderStatic(
|
||||
new Vecs3d(translation.getX(), translation.getY(), translation
|
||||
.getZ()), renderBlocks, pass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QMovingObjectPosition rayTrace(Vec3d start, Vec3d end) {
|
||||
public QMovingObjectPosition rayTrace(Vec3d start, Vec3d end)
|
||||
{
|
||||
return RayTracer.instance().rayTraceCubes(this, start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Vec3dCube> getSelectionBoxes() {
|
||||
public List<Vec3dCube> getSelectionBoxes()
|
||||
{
|
||||
return ModLib2QLib.convert2(iModPart.getSelectionBoxes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
public World getWorld()
|
||||
{
|
||||
return getParent().getWorld();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if (iModPart.world == null || iModPart.location == null) {
|
||||
public void update()
|
||||
{
|
||||
if (iModPart.world == null || iModPart.location == null)
|
||||
{
|
||||
iModPart.setWorld(getWorld());
|
||||
iModPart.setLocation(new Location(getX(), getY(), getZ()));
|
||||
}
|
||||
|
@ -100,18 +117,22 @@ public class QModPart extends PartBase implements IPartCollidable, IPartSelectab
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onPartChanged(IPart part) {
|
||||
public void onPartChanged(IPart part)
|
||||
{
|
||||
iModPart.nearByChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange() {
|
||||
public void onNeighborBlockChange()
|
||||
{
|
||||
iModPart.nearByChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborTileChange() {
|
||||
if (iModPart.world == null || iModPart.location == null) {
|
||||
public void onNeighborTileChange()
|
||||
{
|
||||
if (iModPart.world == null || iModPart.location == null)
|
||||
{
|
||||
iModPart.setWorld(getWorld());
|
||||
iModPart.setLocation(new Location(getX(), getY(), getZ()));
|
||||
}
|
||||
|
@ -119,21 +140,26 @@ public class QModPart extends PartBase implements IPartCollidable, IPartSelectab
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAdded() {
|
||||
if(iModPart.location != null){
|
||||
public void onAdded()
|
||||
{
|
||||
if (iModPart.location != null)
|
||||
{
|
||||
iModPart.nearByChange();
|
||||
iModPart.onAdded();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoved() {
|
||||
public void onRemoved()
|
||||
{
|
||||
iModPart.onRemoved();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
if (iModPart.world == null || iModPart.location == null) {
|
||||
public void onLoaded()
|
||||
{
|
||||
if (iModPart.world == null || iModPart.location == null)
|
||||
{
|
||||
iModPart.setWorld(getWorld());
|
||||
iModPart.setLocation(new Location(getX(), getY(), getZ()));
|
||||
}
|
||||
|
@ -141,12 +167,14 @@ public class QModPart extends PartBase implements IPartCollidable, IPartSelectab
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onUnloaded() {
|
||||
public void onUnloaded()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConverted() {
|
||||
public void onConverted()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
package techreborn.partSystem.QLib;
|
||||
|
||||
import techreborn.lib.Location;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -12,6 +13,7 @@ import net.minecraft.util.MovingObjectPosition;
|
|||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.IPartProvider;
|
||||
import techreborn.partSystem.ModPart;
|
||||
|
@ -25,19 +27,22 @@ import uk.co.qmunity.lib.tile.TileMultipart;
|
|||
import uk.co.qmunity.lib.vec.Vec3dCube;
|
||||
import uk.co.qmunity.lib.vec.Vec3i;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class QModPartFactory implements IPartFactory, IPartProvider {
|
||||
@Override
|
||||
public IPart createPart(String type, boolean client) {
|
||||
for (ModPart modPart : ModPartRegistry.parts) {
|
||||
if (modPart.getName().equals(type)) {
|
||||
try {
|
||||
public IPart createPart(String type, boolean client)
|
||||
{
|
||||
for (ModPart modPart : ModPartRegistry.parts)
|
||||
{
|
||||
if (modPart.getName().equals(type))
|
||||
{
|
||||
try
|
||||
{
|
||||
return new QModPart(modPart.getClass().newInstance());
|
||||
} catch (InstantiationException e) {
|
||||
} catch (InstantiationException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -45,58 +50,83 @@ public class QModPartFactory implements IPartFactory, IPartProvider {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean placePart(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int face, float x_, float y_, float z_, ModPart modPart) {
|
||||
IPart part = createPart(item, player, world,
|
||||
new MovingObjectPosition(x, y, z, face, Vec3.createVectorHelper(x + x_, y + y_, z + z_)), modPart);
|
||||
public boolean placePart(ItemStack item, EntityPlayer player, World world,
|
||||
int x, int y, int z, int face, float x_, float y_, float z_,
|
||||
ModPart modPart)
|
||||
{
|
||||
IPart part = createPart(
|
||||
item,
|
||||
player,
|
||||
world,
|
||||
new MovingObjectPosition(x, y, z, face, Vec3
|
||||
.createVectorHelper(x + x_, y + y_, z + z_)), modPart);
|
||||
|
||||
if (part == null)
|
||||
return false;
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(face);
|
||||
return MultipartCompatibility.placePartInWorld(part, world, new Vec3i(x, y, z), dir, player, item);
|
||||
return MultipartCompatibility.placePartInWorld(part, world, new Vec3i(
|
||||
x, y, z), dir, player, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTileFromProvider(TileEntity tileEntity) {
|
||||
public boolean isTileFromProvider(TileEntity tileEntity)
|
||||
{
|
||||
return tileEntity instanceof TileMultipart;
|
||||
}
|
||||
|
||||
public String getCreatedPartType(ItemStack item, EntityPlayer player, World world, MovingObjectPosition mop, ModPart modPart) {
|
||||
public String getCreatedPartType(ItemStack item, EntityPlayer player,
|
||||
World world, MovingObjectPosition mop, ModPart modPart)
|
||||
{
|
||||
return modPart.getName();
|
||||
}
|
||||
|
||||
public IPart createPart(ItemStack item, EntityPlayer player, World world, MovingObjectPosition mop, ModPart modPart) {
|
||||
public IPart createPart(ItemStack item, EntityPlayer player, World world,
|
||||
MovingObjectPosition mop, ModPart modPart)
|
||||
{
|
||||
|
||||
return PartRegistry.createPart(getCreatedPartType(item, player, world, mop, modPart), world.isRemote);
|
||||
return PartRegistry.createPart(
|
||||
getCreatedPartType(item, player, world, mop, modPart),
|
||||
world.isRemote);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modID() {
|
||||
public String modID()
|
||||
{
|
||||
return QLModInfo.MODID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPart() {
|
||||
public void registerPart()
|
||||
{
|
||||
PartRegistry.registerFactory(new QModPartFactory());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkOcclusion(World world, Location location, Vecs3dCube cube) {
|
||||
return MultipartCompatibility.checkOcclusion(world, location.x, location.y, location.z, new Vec3dCube(cube.toAABB()));
|
||||
public boolean checkOcclusion(World world, Location location,
|
||||
Vecs3dCube cube)
|
||||
{
|
||||
return MultipartCompatibility.checkOcclusion(world, location.x,
|
||||
location.y, location.z, new Vec3dCube(cube.toAABB()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPart(World world, Location location, String name) {
|
||||
TileEntity tileEntity = world.getTileEntity(location.getX(), location.getY(), location.getZ());
|
||||
if (tileEntity instanceof TileMultipart) {
|
||||
public boolean hasPart(World world, Location location, String name)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(location.getX(),
|
||||
location.getY(), location.getZ());
|
||||
if (tileEntity instanceof TileMultipart)
|
||||
{
|
||||
TileMultipart mp = (TileMultipart) tileEntity;
|
||||
boolean ret = false;
|
||||
List<IPart> t = mp.getParts();
|
||||
for (IPart p : t) {
|
||||
if (ret == false) {
|
||||
if (p.getType().equals(name)) {
|
||||
for (IPart p : t)
|
||||
{
|
||||
if (ret == false)
|
||||
{
|
||||
if (p.getType().equals(name))
|
||||
{
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
package techreborn.partSystem.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -21,20 +24,18 @@ import techreborn.partSystem.ICustomHighlight;
|
|||
import techreborn.partSystem.IModPart;
|
||||
import techreborn.partSystem.ModPart;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by mark on 10/12/14.
|
||||
*/
|
||||
public class BlockModPart extends BlockContainer implements ICustomHighlight {
|
||||
|
||||
|
||||
public BlockModPart(Material met) {
|
||||
public BlockModPart(Material met)
|
||||
{
|
||||
super(met);
|
||||
}
|
||||
|
||||
public static TileEntityModPart get(IBlockAccess world, int x, int y, int z) {
|
||||
public static TileEntityModPart get(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if (te == null)
|
||||
|
@ -45,13 +46,17 @@ public class BlockModPart extends BlockContainer implements ICustomHighlight {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
public TileEntity createNewTileEntity(World world, int i)
|
||||
{
|
||||
return new TileEntityModPart();
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SuppressWarnings(
|
||||
{ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB bounds, List l, Entity entity) {
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z,
|
||||
AxisAlignedBB bounds, List l, Entity entity)
|
||||
{
|
||||
TileEntityModPart te = get(world, x, y, z);
|
||||
if (te == null)
|
||||
return;
|
||||
|
@ -63,30 +68,36 @@ public class BlockModPart extends BlockContainer implements ICustomHighlight {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
public int getRenderType()
|
||||
{
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
//TODO move to array list
|
||||
public ArrayList<AxisAlignedBB> getBoxes(World world, int x, int y, int z, EntityPlayer player) {
|
||||
// TODO move to array list
|
||||
public ArrayList<AxisAlignedBB> getBoxes(World world, int x, int y, int z,
|
||||
EntityPlayer player)
|
||||
{
|
||||
TileEntityModPart te = get(world, x, y, z);
|
||||
if (te == null)
|
||||
return null;
|
||||
|
||||
List<Vecs3dCube> boxes = new ArrayList<Vecs3dCube>();
|
||||
ArrayList<AxisAlignedBB> list = new ArrayList<AxisAlignedBB>();
|
||||
if (!te.getParts().isEmpty()) {
|
||||
if (!te.getParts().isEmpty())
|
||||
{
|
||||
for (ModPart modPart : te.getParts())
|
||||
boxes.addAll(modPart.getSelectionBoxes());
|
||||
for (int i = 0; i < boxes.size(); i++) {
|
||||
for (int i = 0; i < boxes.size(); i++)
|
||||
{
|
||||
Vecs3dCube cube = boxes.get(i);
|
||||
list.add(cube.toAABB());
|
||||
}
|
||||
|
@ -95,27 +106,40 @@ public class BlockModPart extends BlockContainer implements ICustomHighlight {
|
|||
return list;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
for (ModPart part : get(world, x, y, z).getParts()) {
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z,
|
||||
Block block)
|
||||
{
|
||||
for (ModPart part : get(world, x, y, z).getParts())
|
||||
{
|
||||
part.nearByChange();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace(World wrd, int x, int y, int z, Vec3 origin, Vec3 direction) {
|
||||
public MovingObjectPosition collisionRayTrace(World wrd, int x, int y,
|
||||
int z, Vec3 origin, Vec3 direction)
|
||||
{
|
||||
ArrayList<AxisAlignedBB> aabbs = getBoxes(wrd, x, y, z, null);
|
||||
MovingObjectPosition closest = null;
|
||||
for (AxisAlignedBB aabb : aabbs) {
|
||||
MovingObjectPosition mop = aabb.getOffsetBoundingBox(x, y, z).calculateIntercept(origin, direction);
|
||||
if (mop != null) {
|
||||
if (closest != null && mop.hitVec.distanceTo(origin) < closest.hitVec.distanceTo(origin)) {
|
||||
for (AxisAlignedBB aabb : aabbs)
|
||||
{
|
||||
MovingObjectPosition mop = aabb.getOffsetBoundingBox(x, y, z)
|
||||
.calculateIntercept(origin, direction);
|
||||
if (mop != null)
|
||||
{
|
||||
if (closest != null
|
||||
&& mop.hitVec.distanceTo(origin) < closest.hitVec
|
||||
.distanceTo(origin))
|
||||
{
|
||||
closest = mop;
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
closest = mop;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (closest != null) {
|
||||
if (closest != null)
|
||||
{
|
||||
closest.blockX = x;
|
||||
closest.blockY = y;
|
||||
closest.blockZ = z;
|
||||
|
@ -124,27 +148,36 @@ public class BlockModPart extends BlockContainer implements ICustomHighlight {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
for (ModPart part : get(world, x, y, z).getParts()) {
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
for (ModPart part : get(world, x, y, z).getParts())
|
||||
{
|
||||
part.onAdded();
|
||||
}
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block oldid, int oldmeta) {
|
||||
for (ModPart part : get(world, x, y, z).getParts()) {
|
||||
public void breakBlock(World world, int x, int y, int z, Block oldid,
|
||||
int oldmeta)
|
||||
{
|
||||
for (ModPart part : get(world, x, y, z).getParts())
|
||||
{
|
||||
part.onRemoved();
|
||||
}
|
||||
super.breakBlock(world, x, y, z, oldid, oldmeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z,
|
||||
int metadata, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> l = new ArrayList<ItemStack>();
|
||||
TileEntityModPart te = get(world, x, y, z);
|
||||
if (te != null) {
|
||||
for (IModPart p : te.getParts()) {
|
||||
if (te != null)
|
||||
{
|
||||
for (IModPart p : te.getParts())
|
||||
{
|
||||
ItemStack item = p.getItem();
|
||||
if (item != null)
|
||||
l.add(item);
|
||||
|
|
|
@ -4,22 +4,26 @@
|
|||
|
||||
package techreborn.partSystem.block;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import techreborn.partSystem.ModPart;
|
||||
|
||||
public class RenderModPart extends TileEntitySpecialRenderer {
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float delta) {
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y,
|
||||
double z, float delta)
|
||||
{
|
||||
TileEntityModPart te = (TileEntityModPart) tileEntity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
{
|
||||
for (ModPart modPart : te.getParts()) {
|
||||
for (ModPart modPart : te.getParts())
|
||||
{
|
||||
modPart.renderDynamic(new Vecs3d(0, 0, 0), delta);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
|
||||
package techreborn.partSystem.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
@ -19,89 +24,94 @@ import techreborn.partSystem.ModPart;
|
|||
import techreborn.partSystem.ModPartRegistry;
|
||||
import techreborn.partSystem.parts.NullPart;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class TileEntityModPart extends TileEntity {
|
||||
|
||||
private Map<String, ModPart> parts = new HashMap<String, ModPart>();
|
||||
|
||||
|
||||
public void addCollisionBoxesToList(List<Vecs3dCube> l, AxisAlignedBB bounds, Entity entity) {
|
||||
public void addCollisionBoxesToList(List<Vecs3dCube> l,
|
||||
AxisAlignedBB bounds, Entity entity)
|
||||
{
|
||||
if (getParts().size() == 0)
|
||||
addPart(new NullPart());
|
||||
List<Vecs3dCube> boxes2 = new ArrayList<Vecs3dCube>();
|
||||
for (ModPart mp : getParts()) {
|
||||
for (ModPart mp : getParts())
|
||||
{
|
||||
List<Vecs3dCube> boxes = new ArrayList<Vecs3dCube>();
|
||||
mp.addCollisionBoxesToList(boxes, entity);
|
||||
|
||||
for (int i = 0; i < boxes.size(); i++) {
|
||||
for (int i = 0; i < boxes.size(); i++)
|
||||
{
|
||||
Vecs3dCube cube = boxes.get(i).clone();
|
||||
cube.add(getX(), getY(), getZ());
|
||||
boxes2.add(cube);
|
||||
}
|
||||
}
|
||||
|
||||
for (Vecs3dCube c : boxes2) {
|
||||
//if (c.toAABB().intersectsWith(bounds))
|
||||
for (Vecs3dCube c : boxes2)
|
||||
{
|
||||
// if (c.toAABB().intersectsWith(bounds))
|
||||
l.add(c);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<Vecs3dCube> getOcclusionBoxes() {
|
||||
public List<Vecs3dCube> getOcclusionBoxes()
|
||||
{
|
||||
List<Vecs3dCube> boxes = new ArrayList<Vecs3dCube>();
|
||||
for (ModPart mp : getParts()) {
|
||||
for (ModPart mp : getParts())
|
||||
{
|
||||
boxes.addAll(mp.getOcclusionBoxes());
|
||||
}
|
||||
return boxes;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
public AxisAlignedBB getRenderBoundingBox()
|
||||
{
|
||||
|
||||
return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
|
||||
return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1,
|
||||
yCoord + 1, zCoord + 1);
|
||||
}
|
||||
|
||||
|
||||
public World getWorld() {
|
||||
public World getWorld()
|
||||
{
|
||||
return getWorldObj();
|
||||
}
|
||||
|
||||
|
||||
public int getX() {
|
||||
public int getX()
|
||||
{
|
||||
return xCoord;
|
||||
}
|
||||
|
||||
|
||||
public int getY() {
|
||||
public int getY()
|
||||
{
|
||||
return yCoord;
|
||||
}
|
||||
|
||||
|
||||
public int getZ() {
|
||||
public int getZ()
|
||||
{
|
||||
return zCoord;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (parts.isEmpty()) {
|
||||
public void updateEntity()
|
||||
{
|
||||
if (parts.isEmpty())
|
||||
{
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
for (ModPart mp : getParts()) {
|
||||
if (mp.world != null && mp.location != null) {
|
||||
for (ModPart mp : getParts())
|
||||
{
|
||||
if (mp.world != null && mp.location != null)
|
||||
{
|
||||
mp.tick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
|
||||
super.writeToNBT(tag);
|
||||
|
||||
|
@ -111,23 +121,29 @@ public class TileEntityModPart extends TileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
|
||||
super.readFromNBT(tag);
|
||||
|
||||
NBTTagList l = tag.getTagList("parts", new NBTTagCompound().getId());
|
||||
try {
|
||||
try
|
||||
{
|
||||
readParts(l);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
} catch (InstantiationException e) {
|
||||
} catch (InstantiationException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeParts(NBTTagList l, boolean update) {
|
||||
private void writeParts(NBTTagList l, boolean update)
|
||||
{
|
||||
|
||||
for (ModPart p : getParts()) {
|
||||
for (ModPart p : getParts())
|
||||
{
|
||||
String id = getIdentifier(p);
|
||||
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
@ -142,16 +158,22 @@ public class TileEntityModPart extends TileEntity {
|
|||
}
|
||||
}
|
||||
|
||||
private void readParts(NBTTagList l) throws IllegalAccessException, InstantiationException {
|
||||
private void readParts(NBTTagList l) throws IllegalAccessException,
|
||||
InstantiationException
|
||||
{
|
||||
|
||||
for (int i = 0; i < l.tagCount(); i++) {
|
||||
for (int i = 0; i < l.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound tag = l.getCompoundTagAt(i);
|
||||
|
||||
String id = tag.getString("id");
|
||||
ModPart p = getPart(id);
|
||||
if (p == null) {
|
||||
for (ModPart modPart : ModPartRegistry.parts) {
|
||||
if (modPart.getName().equals(id)) {
|
||||
if (p == null)
|
||||
{
|
||||
for (ModPart modPart : ModPartRegistry.parts)
|
||||
{
|
||||
if (modPart.getName().equals(id))
|
||||
{
|
||||
p = modPart.getClass().newInstance();
|
||||
}
|
||||
}
|
||||
|
@ -165,20 +187,25 @@ public class TileEntityModPart extends TileEntity {
|
|||
}
|
||||
}
|
||||
|
||||
public void addPart(ModPart modPart) {
|
||||
try {
|
||||
public void addPart(ModPart modPart)
|
||||
{
|
||||
try
|
||||
{
|
||||
ModPart newPart = modPart.getClass().newInstance();
|
||||
newPart.setWorld(getWorldObj());
|
||||
newPart.setLocation(new Location(xCoord, yCoord, zCoord));
|
||||
parts.put(newPart.getName(), newPart);
|
||||
} catch (InstantiationException e) {
|
||||
} catch (InstantiationException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private ModPart getPart(String id) {
|
||||
private ModPart getPart(String id)
|
||||
{
|
||||
for (String s : parts.keySet())
|
||||
if (s.equals(id))
|
||||
return parts.get(s);
|
||||
|
@ -186,7 +213,8 @@ public class TileEntityModPart extends TileEntity {
|
|||
return null;
|
||||
}
|
||||
|
||||
private String getIdentifier(ModPart part) {
|
||||
private String getIdentifier(ModPart part)
|
||||
{
|
||||
for (String s : parts.keySet())
|
||||
if (parts.get(s).equals(part))
|
||||
return s;
|
||||
|
@ -194,48 +222,56 @@ public class TileEntityModPart extends TileEntity {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeToNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
|
||||
{
|
||||
readFromNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
|
||||
public List<ModPart> getParts() {
|
||||
public List<ModPart> getParts()
|
||||
{
|
||||
List<ModPart> parts = new ArrayList<ModPart>();
|
||||
for (String s : this.parts.keySet()) {
|
||||
for (String s : this.parts.keySet())
|
||||
{
|
||||
ModPart p = this.parts.get(s);
|
||||
parts.add(p);
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
|
||||
public List<String> getPartsByName() {
|
||||
public List<String> getPartsByName()
|
||||
{
|
||||
List<String> parts = new ArrayList<String>();
|
||||
for (String s : this.parts.keySet()) {
|
||||
for (String s : this.parts.keySet())
|
||||
{
|
||||
parts.add(s);
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
|
||||
public boolean canAddPart(ModPart modpart) {
|
||||
public boolean canAddPart(ModPart modpart)
|
||||
{
|
||||
List<Vecs3dCube> cubes = new ArrayList<Vecs3dCube>();
|
||||
modpart.addCollisionBoxesToList(cubes, null);
|
||||
for (Vecs3dCube c : cubes)
|
||||
if (c != null && !getWorld().checkNoEntityCollision(c.clone().add(getX(), getY(), getZ()).toAABB()))
|
||||
if (c != null
|
||||
&& !getWorld().checkNoEntityCollision(
|
||||
c.clone().add(getX(), getY(), getZ()).toAABB()))
|
||||
return false;
|
||||
|
||||
List<Vecs3dCube> l = getOcclusionBoxes();
|
||||
for (Vecs3dCube b : modpart.getOcclusionBoxes())
|
||||
for (Vecs3dCube c : l)
|
||||
if (c != null && b != null && b.toAABB().intersectsWith(c.toAABB()))
|
||||
if (c != null && b != null
|
||||
&& b.toAABB().intersectsWith(c.toAABB()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4,12 +4,6 @@
|
|||
|
||||
package techreborn.partSystem.block;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.IPartProvider;
|
||||
import techreborn.partSystem.ModPart;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -18,6 +12,12 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.IPartProvider;
|
||||
import techreborn.partSystem.ModPart;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
/**
|
||||
* Created by mark on 10/12/14.
|
||||
|
@ -26,36 +26,49 @@ public class WorldProvider implements IPartProvider {
|
|||
Block blockModPart;
|
||||
|
||||
@Override
|
||||
public String modID() {
|
||||
public String modID()
|
||||
{
|
||||
return "Minecraft";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPart() {
|
||||
//Loads all of the items
|
||||
public void registerPart()
|
||||
{
|
||||
// Loads all of the items
|
||||
|
||||
blockModPart = new BlockModPart(Material.ground).setBlockName("modPartBlock");
|
||||
blockModPart = new BlockModPart(Material.ground)
|
||||
.setBlockName("modPartBlock");
|
||||
GameRegistry.registerBlock(blockModPart, "modPartBlock");
|
||||
|
||||
//registers the tile and renderer
|
||||
GameRegistry.registerTileEntity(TileEntityModPart.class, "TileEntityModPart");
|
||||
// registers the tile and renderer
|
||||
GameRegistry.registerTileEntity(TileEntityModPart.class,
|
||||
"TileEntityModPart");
|
||||
}
|
||||
|
||||
public void clientRegister() {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityModPart.class, new RenderModPart());
|
||||
public void clientRegister()
|
||||
{
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityModPart.class,
|
||||
new RenderModPart());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkOcclusion(World world, Location location, Vecs3dCube cube) {
|
||||
public boolean checkOcclusion(World world, Location location,
|
||||
Vecs3dCube cube)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPart(World world, Location location, String name) {
|
||||
TileEntity tileEntity = world.getTileEntity(location.getX(), location.getY(), location.getZ());
|
||||
if (tileEntity instanceof TileEntityModPart) {
|
||||
for (ModPart part : ((TileEntityModPart) tileEntity).getParts()) {
|
||||
if (part.getName().equals(name)) {
|
||||
public boolean hasPart(World world, Location location, String name)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(location.getX(),
|
||||
location.getY(), location.getZ());
|
||||
if (tileEntity instanceof TileEntityModPart)
|
||||
{
|
||||
for (ModPart part : ((TileEntityModPart) tileEntity).getParts())
|
||||
{
|
||||
if (part.getName().equals(name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -64,27 +77,47 @@ public class WorldProvider implements IPartProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean placePart(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, ModPart modPart) {
|
||||
public boolean placePart(ItemStack item, EntityPlayer player, World world,
|
||||
int x, int y, int z, int side, float hitX, float hitY, float hitZ,
|
||||
ModPart modPart)
|
||||
{
|
||||
ForgeDirection forgeDirection = ForgeDirection.getOrientation(side);
|
||||
if (world.getBlock(x + forgeDirection.offsetX, y + forgeDirection.offsetY, z + forgeDirection.offsetZ) == Blocks.air) {
|
||||
if (world.getBlock(x + forgeDirection.offsetX, y
|
||||
+ forgeDirection.offsetY, z + forgeDirection.offsetZ) == Blocks.air)
|
||||
{
|
||||
TileEntityModPart modPart1;
|
||||
world.setBlock(x + forgeDirection.offsetX, y + forgeDirection.offsetY, z + forgeDirection.offsetZ, blockModPart);
|
||||
modPart1 = (TileEntityModPart) world.getTileEntity(x + forgeDirection.offsetX, y + forgeDirection.offsetY, z + forgeDirection.offsetZ);
|
||||
//if(modPart1.canAddPart(modPart)){
|
||||
modPart1.addPart(modPart);
|
||||
return true;
|
||||
//}
|
||||
world.setBlock(x + forgeDirection.offsetX, y
|
||||
+ forgeDirection.offsetY, z + forgeDirection.offsetZ,
|
||||
blockModPart);
|
||||
modPart1 = (TileEntityModPart) world.getTileEntity(x
|
||||
+ forgeDirection.offsetX, y + forgeDirection.offsetY, z
|
||||
+ forgeDirection.offsetZ);
|
||||
// if(modPart1.canAddPart(modPart)){
|
||||
modPart1.addPart(modPart);
|
||||
return true;
|
||||
// }
|
||||
}
|
||||
//this adds a part to a block
|
||||
if (world.getBlock(x, y, z) == blockModPart) {
|
||||
TileEntityModPart tileEntityModPart = (TileEntityModPart) world.getTileEntity(x + forgeDirection.offsetX, y + forgeDirection.offsetY, z + forgeDirection.offsetZ);
|
||||
if (!tileEntityModPart.getPartsByName().contains(modPart.getName()) && tileEntityModPart.canAddPart(modPart))
|
||||
// this adds a part to a block
|
||||
if (world.getBlock(x, y, z) == blockModPart)
|
||||
{
|
||||
TileEntityModPart tileEntityModPart = (TileEntityModPart) world
|
||||
.getTileEntity(x + forgeDirection.offsetX, y
|
||||
+ forgeDirection.offsetY, z
|
||||
+ forgeDirection.offsetZ);
|
||||
if (!tileEntityModPart.getPartsByName().contains(modPart.getName())
|
||||
&& tileEntityModPart.canAddPart(modPart))
|
||||
tileEntityModPart.addPart(modPart);
|
||||
return true;
|
||||
}
|
||||
if (world.getBlock(x + forgeDirection.offsetX, y + forgeDirection.offsetY, z + forgeDirection.offsetZ) == blockModPart) {
|
||||
TileEntityModPart tileEntityModPart = (TileEntityModPart) world.getTileEntity(x + forgeDirection.offsetX, y + forgeDirection.offsetY, z + forgeDirection.offsetZ);
|
||||
if (!tileEntityModPart.getPartsByName().contains(modPart.getName()) && tileEntityModPart.canAddPart(modPart))
|
||||
if (world.getBlock(x + forgeDirection.offsetX, y
|
||||
+ forgeDirection.offsetY, z + forgeDirection.offsetZ) == blockModPart)
|
||||
{
|
||||
TileEntityModPart tileEntityModPart = (TileEntityModPart) world
|
||||
.getTileEntity(x + forgeDirection.offsetX, y
|
||||
+ forgeDirection.offsetY, z
|
||||
+ forgeDirection.offsetZ);
|
||||
if (!tileEntityModPart.getPartsByName().contains(modPart.getName())
|
||||
&& tileEntityModPart.canAddPart(modPart))
|
||||
tileEntityModPart.addPart(modPart);
|
||||
return true;
|
||||
}
|
||||
|
@ -92,7 +125,8 @@ public class WorldProvider implements IPartProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTileFromProvider(TileEntity tileEntity) {
|
||||
public boolean isTileFromProvider(TileEntity tileEntity)
|
||||
{
|
||||
return tileEntity instanceof TileEntityModPart;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package techreborn.partSystem.client;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
|
@ -13,14 +10,21 @@ import net.minecraft.util.MovingObjectPosition;
|
|||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import techreborn.partSystem.IModPart;
|
||||
import techreborn.partSystem.ModPartItem;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* This is based of https://github.com/Qmunity/QmunityLib/blob/master/src%2Fmain%2Fjava%2Fuk%2Fco%2Fqmunity%2Flib%2Fclient%2Frender%2FRenderPartPlacement.java
|
||||
* This is based of
|
||||
* https://github.com/Qmunity/QmunityLib/blob/master/src%2Fmain%
|
||||
* 2Fjava%2Fuk%2Fco%2Fqmunity%2Flib%2Fclient%2Frender%2FRenderPartPlacement.java
|
||||
* <p/>
|
||||
* You should go check them out!
|
||||
*/
|
||||
|
@ -31,24 +35,30 @@ public class PartPlacementRenderer {
|
|||
private int width = 0, height = 0;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderTick(RenderWorldLastEvent event) {
|
||||
public void onRenderTick(RenderWorldLastEvent event)
|
||||
{
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
ItemStack item = player.getCurrentEquippedItem();
|
||||
if (item == null)
|
||||
return;
|
||||
if (!(item.getItem() instanceof ModPartItem))
|
||||
return;
|
||||
if (Minecraft.getMinecraft().gameSettings.hideGUI && Minecraft.getMinecraft().currentScreen == null)
|
||||
if (Minecraft.getMinecraft().gameSettings.hideGUI
|
||||
&& Minecraft.getMinecraft().currentScreen == null)
|
||||
return;
|
||||
MovingObjectPosition mop = player.rayTrace(player.capabilities.isCreativeMode ? 5 : 4, 0);
|
||||
if (mop == null || mop.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
MovingObjectPosition mop = player.rayTrace(
|
||||
player.capabilities.isCreativeMode ? 5 : 4, 0);
|
||||
if (mop == null
|
||||
|| mop.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
return;
|
||||
IModPart part = ((ModPartItem) item.getItem()).getModPart();
|
||||
if (part == null)
|
||||
return;
|
||||
ForgeDirection faceHit = ForgeDirection.getOrientation(mop.sideHit);
|
||||
Location location = new Location(mop.blockX, mop.blockY, mop.blockZ);
|
||||
if (fb == null || width != Minecraft.getMinecraft().displayWidth || height != Minecraft.getMinecraft().displayHeight) {
|
||||
if (fb == null || width != Minecraft.getMinecraft().displayWidth
|
||||
|| height != Minecraft.getMinecraft().displayHeight)
|
||||
{
|
||||
width = Minecraft.getMinecraft().displayWidth;
|
||||
height = Minecraft.getMinecraft().displayHeight;
|
||||
fb = new Framebuffer(width, height, true);
|
||||
|
@ -61,24 +71,30 @@ public class PartPlacementRenderer {
|
|||
{
|
||||
GL11.glLoadIdentity();
|
||||
fb.bindFramebuffer(true);
|
||||
GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
|
||||
GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT
|
||||
| GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glClearColor(0, 0, 0, 0);
|
||||
net.minecraft.client.renderer.RenderHelper.enableStandardItemLighting();
|
||||
net.minecraft.client.renderer.RenderHelper
|
||||
.enableStandardItemLighting();
|
||||
GL11.glPushMatrix();
|
||||
{
|
||||
Vec3 playerPos = player.getPosition(event.partialTicks);
|
||||
double x = location.getX() - playerPos.xCoord + faceHit.offsetX;
|
||||
double y = location.getY() - playerPos.yCoord + faceHit.offsetY;
|
||||
double z = location.getZ() - playerPos.zCoord + faceHit.offsetZ;
|
||||
double x = location.getX() - playerPos.xCoord
|
||||
+ faceHit.offsetX;
|
||||
double y = location.getY() - playerPos.yCoord
|
||||
+ faceHit.offsetY;
|
||||
double z = location.getZ() - playerPos.zCoord
|
||||
+ faceHit.offsetZ;
|
||||
GL11.glRotated(player.rotationPitch, 1, 0, 0);
|
||||
GL11.glRotated(player.rotationYaw - 180, 0, 1, 0);
|
||||
GL11.glTranslated(x, y, z);
|
||||
part.renderDynamic(new Vecs3d(0, 0, 0), event.partialTicks);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
net.minecraft.client.renderer.RenderHelper
|
||||
.disableStandardItemLighting();
|
||||
fb.unbindFramebuffer();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
|
@ -86,11 +102,14 @@ public class PartPlacementRenderer {
|
|||
GL11.glPushMatrix();
|
||||
{
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
ScaledResolution scaledresolution = new ScaledResolution(mc,
|
||||
mc.displayWidth, mc.displayHeight);
|
||||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glOrtho(0, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0, 0.1, 10000D);
|
||||
GL11.glOrtho(0, scaledresolution.getScaledWidth_double(),
|
||||
scaledresolution.getScaledHeight_double(), 0, 0.1,
|
||||
10000D);
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
|
||||
|
@ -98,7 +117,8 @@ public class PartPlacementRenderer {
|
|||
{
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA,
|
||||
GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int w = scaledresolution.getScaledWidth();
|
||||
int h = scaledresolution.getScaledHeight();
|
||||
|
|
|
@ -4,38 +4,44 @@
|
|||
|
||||
package techreborn.partSystem.fmp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.IPartProvider;
|
||||
import techreborn.partSystem.ModPart;
|
||||
import techreborn.partSystem.ModPartRegistry;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.lib.vec.Cuboid6;
|
||||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.NormallyOccludedPart;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.IPartProvider;
|
||||
import techreborn.partSystem.ModPart;
|
||||
import techreborn.partSystem.ModPartRegistry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Created by mark on 09/12/14.
|
||||
*/
|
||||
public class FMPFactory implements MultiPartRegistry.IPartFactory, IPartProvider {
|
||||
public class FMPFactory implements MultiPartRegistry.IPartFactory,
|
||||
IPartProvider {
|
||||
@Override
|
||||
public TMultiPart createPart(String type, boolean client) {
|
||||
for (ModPart modPart : ModPartRegistry.parts) {
|
||||
if (modPart.getName().equals(type)) {
|
||||
try {
|
||||
public TMultiPart createPart(String type, boolean client)
|
||||
{
|
||||
for (ModPart modPart : ModPartRegistry.parts)
|
||||
{
|
||||
if (modPart.getName().equals(type))
|
||||
{
|
||||
try
|
||||
{
|
||||
return new FMPModPart(modPart.getClass().newInstance());
|
||||
} catch (InstantiationException e) {
|
||||
} catch (InstantiationException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -43,45 +49,65 @@ public class FMPFactory implements MultiPartRegistry.IPartFactory, IPartProvider
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean placePart(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, ModPart modPart) {
|
||||
return new FakeFMPPlacerItem(modPart).onItemUse(item, player, world, x, y, z, side, hitX, hitY, hitZ);
|
||||
public boolean placePart(ItemStack item, EntityPlayer player, World world,
|
||||
int x, int y, int z, int side, float hitX, float hitY, float hitZ,
|
||||
ModPart modPart)
|
||||
{
|
||||
return new FakeFMPPlacerItem(modPart).onItemUse(item, player, world, x,
|
||||
y, z, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTileFromProvider(TileEntity tileEntity) {
|
||||
public boolean isTileFromProvider(TileEntity tileEntity)
|
||||
{
|
||||
return tileEntity instanceof TileMultipart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modID() {
|
||||
public String modID()
|
||||
{
|
||||
return "ForgeMultipart";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPart() {
|
||||
for (ModPart modPart : ModPartRegistry.parts) {
|
||||
MultiPartRegistry.registerParts(new FMPFactory(), new String[]{modPart.getName()});
|
||||
public void registerPart()
|
||||
{
|
||||
for (ModPart modPart : ModPartRegistry.parts)
|
||||
{
|
||||
MultiPartRegistry.registerParts(new FMPFactory(), new String[]
|
||||
{ modPart.getName() });
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkOcclusion(World world, Location location, Vecs3dCube cube) {
|
||||
codechicken.multipart.TileMultipart tmp = codechicken.multipart.TileMultipart.getOrConvertTile(world, new BlockCoord(location.getX(), location.getY(), location.getZ()));
|
||||
public boolean checkOcclusion(World world, Location location,
|
||||
Vecs3dCube cube)
|
||||
{
|
||||
codechicken.multipart.TileMultipart tmp = codechicken.multipart.TileMultipart
|
||||
.getOrConvertTile(world, new BlockCoord(location.getX(),
|
||||
location.getY(), location.getZ()));
|
||||
if (tmp == null)
|
||||
return false;
|
||||
return !tmp.occlusionTest(tmp.partList(), new NormallyOccludedPart(new Cuboid6(cube.toAABB())));
|
||||
return !tmp.occlusionTest(tmp.partList(), new NormallyOccludedPart(
|
||||
new Cuboid6(cube.toAABB())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPart(World world, Location location, String name) {
|
||||
TileEntity tileEntity = world.getTileEntity(location.getX(), location.getY(), location.getZ());
|
||||
if (tileEntity instanceof TileMultipart) {
|
||||
public boolean hasPart(World world, Location location, String name)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(location.getX(),
|
||||
location.getY(), location.getZ());
|
||||
if (tileEntity instanceof TileMultipart)
|
||||
{
|
||||
TileMultipart mp = (TileMultipart) tileEntity;
|
||||
boolean ret = false;
|
||||
List<TMultiPart> t = mp.jPartList();
|
||||
for (TMultiPart p : t) {
|
||||
if (ret == false) {
|
||||
if (p.getType().equals(name)) {
|
||||
for (TMultiPart p : t)
|
||||
{
|
||||
if (ret == false)
|
||||
{
|
||||
if (p.getType().equals(name))
|
||||
{
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,17 @@
|
|||
|
||||
package techreborn.partSystem.fmp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.ModPart;
|
||||
import codechicken.lib.raytracer.IndexedCuboid6;
|
||||
import codechicken.lib.vec.Cuboid6;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
|
@ -15,35 +25,27 @@ import codechicken.multipart.TMultiPart;
|
|||
import codechicken.multipart.TSlottedPart;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.ModPart;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FMPModPart extends TMultiPart implements TSlottedPart, JNormalOcclusion, ISidedHollowConnect {
|
||||
public class FMPModPart extends TMultiPart implements TSlottedPart,
|
||||
JNormalOcclusion, ISidedHollowConnect {
|
||||
|
||||
ModPart iModPart;
|
||||
|
||||
public FMPModPart(ModPart iModPart) {
|
||||
public FMPModPart(ModPart iModPart)
|
||||
{
|
||||
this.iModPart = iModPart;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHollowSize(int i) {
|
||||
public int getHollowSize(int i)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Cuboid6> getOcclusionBoxes() {
|
||||
public Iterable<Cuboid6> getOcclusionBoxes()
|
||||
{
|
||||
List<Cuboid6> cubes = new ArrayList<Cuboid6>();
|
||||
for (Vecs3dCube c : iModPart.getOcclusionBoxes())
|
||||
cubes.add(new Cuboid6(c.toAABB()));
|
||||
|
@ -51,45 +53,53 @@ public class FMPModPart extends TMultiPart implements TSlottedPart, JNormalOcclu
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean occlusionTest(TMultiPart npart) {
|
||||
public boolean occlusionTest(TMultiPart npart)
|
||||
{
|
||||
return NormalOcclusionTest.apply(this, npart);
|
||||
}
|
||||
|
||||
public void addCollisionBoxesToList(List<Vecs3dCube> l, AxisAlignedBB bounds, Entity entity) {
|
||||
public void addCollisionBoxesToList(List<Vecs3dCube> l,
|
||||
AxisAlignedBB bounds, Entity entity)
|
||||
{
|
||||
List<Vecs3dCube> boxes = new ArrayList<Vecs3dCube>();
|
||||
List<Vecs3dCube> boxes_ = new ArrayList<Vecs3dCube>();
|
||||
iModPart.addCollisionBoxesToList(boxes_, entity);
|
||||
for (Vecs3dCube c : boxes_) {
|
||||
for (Vecs3dCube c : boxes_)
|
||||
{
|
||||
Vecs3dCube cube = c.clone();
|
||||
cube.add(getX(), getY(), getZ());
|
||||
boxes.add(cube);
|
||||
}
|
||||
boxes_.clear();
|
||||
|
||||
for (Vecs3dCube c : boxes) {
|
||||
for (Vecs3dCube c : boxes)
|
||||
{
|
||||
if (c.toAABB().intersectsWith(bounds))
|
||||
l.add(c);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Cuboid6> getCollisionBoxes() {
|
||||
public Iterable<Cuboid6> getCollisionBoxes()
|
||||
{
|
||||
List<Cuboid6> cubes = new ArrayList<Cuboid6>();
|
||||
List<Vecs3dCube> boxes = new ArrayList<Vecs3dCube>();
|
||||
iModPart.addCollisionBoxesToList(boxes, null);
|
||||
for (Vecs3dCube c : boxes) {
|
||||
for (Vecs3dCube c : boxes)
|
||||
{
|
||||
if (c != null)
|
||||
cubes.add(new Cuboid6(c.toAABB()));
|
||||
}
|
||||
|
||||
|
||||
return cubes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<IndexedCuboid6> getSubParts() {
|
||||
public Iterable<IndexedCuboid6> getSubParts()
|
||||
{
|
||||
List<IndexedCuboid6> cubes = new ArrayList<IndexedCuboid6>();
|
||||
if (iModPart.getSelectionBoxes() != null) {
|
||||
if (iModPart.getSelectionBoxes() != null)
|
||||
{
|
||||
for (Vecs3dCube c : iModPart.getSelectionBoxes())
|
||||
if (c != null)
|
||||
cubes.add(new IndexedCuboid6(0, new Cuboid6(c.toAABB())));
|
||||
|
@ -103,45 +113,52 @@ public class FMPModPart extends TMultiPart implements TSlottedPart, JNormalOcclu
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderDynamic(Vector3 pos, float frame, int pass) {
|
||||
public void renderDynamic(Vector3 pos, float frame, int pass)
|
||||
{
|
||||
iModPart.renderDynamic(new Vecs3d(pos.x, pos.y, pos.z), frame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
public String getType()
|
||||
{
|
||||
return iModPart.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotMask() {
|
||||
public int getSlotMask()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
public World getWorld()
|
||||
{
|
||||
return world();
|
||||
}
|
||||
|
||||
|
||||
public int getX() {
|
||||
if (iModPart.world == null || iModPart.location == null) {
|
||||
public int getX()
|
||||
{
|
||||
if (iModPart.world == null || iModPart.location == null)
|
||||
{
|
||||
iModPart.setWorld(world());
|
||||
iModPart.setLocation(new Location(x(), y(), z()));
|
||||
}
|
||||
return x();
|
||||
}
|
||||
|
||||
|
||||
public int getY() {
|
||||
if (iModPart.world == null || iModPart.location == null) {
|
||||
public int getY()
|
||||
{
|
||||
if (iModPart.world == null || iModPart.location == null)
|
||||
{
|
||||
iModPart.setWorld(world());
|
||||
iModPart.setLocation(new Location(x(), y(), z()));
|
||||
}
|
||||
return y();
|
||||
}
|
||||
|
||||
|
||||
public int getZ() {
|
||||
if (iModPart.world == null || iModPart.location == null) {
|
||||
public int getZ()
|
||||
{
|
||||
if (iModPart.world == null || iModPart.location == null)
|
||||
{
|
||||
iModPart.setWorld(world());
|
||||
iModPart.setLocation(new Location(x(), y(), z()));
|
||||
}
|
||||
|
@ -149,7 +166,8 @@ public class FMPModPart extends TMultiPart implements TSlottedPart, JNormalOcclu
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAdded() {
|
||||
public void onAdded()
|
||||
{
|
||||
iModPart.setWorld(world());
|
||||
iModPart.setLocation(new Location(x(), y(), z()));
|
||||
iModPart.nearByChange();
|
||||
|
@ -157,34 +175,40 @@ public class FMPModPart extends TMultiPart implements TSlottedPart, JNormalOcclu
|
|||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if(iModPart.location != null){
|
||||
public void update()
|
||||
{
|
||||
if (iModPart.location != null)
|
||||
{
|
||||
iModPart.tick();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged() {
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
super.onNeighborChanged();
|
||||
if (iModPart.world == null || iModPart.location == null) {
|
||||
if (iModPart.world == null || iModPart.location == null)
|
||||
{
|
||||
iModPart.setWorld(world());
|
||||
iModPart.setLocation(new Location(x(), y(), z()));
|
||||
}
|
||||
iModPart.nearByChange();
|
||||
}
|
||||
|
||||
|
||||
public void onRemoved() {
|
||||
public void onRemoved()
|
||||
{
|
||||
iModPart.onRemoved();
|
||||
super.onRemoved();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderStatic(Vector3 pos, int pass) {
|
||||
public boolean renderStatic(Vector3 pos, int pass)
|
||||
{
|
||||
boolean render = false;
|
||||
RenderBlocks renderer = RenderBlocks.getInstance();
|
||||
renderer.blockAccess = getWorld();
|
||||
render = iModPart.renderStatic(new Vecs3d(pos.x, pos.y, pos.z), renderer, pass);
|
||||
render = iModPart.renderStatic(new Vecs3d(pos.x, pos.y, pos.z),
|
||||
renderer, pass);
|
||||
return render;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,28 +4,32 @@
|
|||
|
||||
package techreborn.partSystem.fmp;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.partSystem.ModPart;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import codechicken.multipart.JItemMultiPart;
|
||||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import techreborn.partSystem.ModPart;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* This item is never added into the game, it is only used to add the part to the world.
|
||||
* This item is never added into the game, it is only used to add the part to
|
||||
* the world.
|
||||
*/
|
||||
public class FakeFMPPlacerItem extends JItemMultiPart {
|
||||
ModPart modPart;
|
||||
|
||||
public FakeFMPPlacerItem(ModPart part) {
|
||||
public FakeFMPPlacerItem(ModPart part)
|
||||
{
|
||||
modPart = part;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMultiPart newPart(ItemStack item, EntityPlayer player, World world, BlockCoord pos, int side, Vector3 vhit) {
|
||||
public TMultiPart newPart(ItemStack item, EntityPlayer player, World world,
|
||||
BlockCoord pos, int side, Vector3 vhit)
|
||||
{
|
||||
TMultiPart w = MultiPartRegistry.createPart(modPart.getName(), false);
|
||||
return w;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue