Auto Format code
This commit is contained in:
parent
112b1657cf
commit
796df6c055
503 changed files with 12260 additions and 16291 deletions
|
@ -17,6 +17,7 @@ import net.minecraftforge.fml.common.network.NetworkRegistry;
|
|||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import org.apache.commons.lang3.time.StopWatch;
|
||||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.common.multiblock.MultiblockEventHandler;
|
||||
import reborncore.common.multiblock.MultiblockServerTickHandler;
|
||||
import reborncore.common.packets.AddDiscriminatorEvent;
|
||||
|
@ -24,7 +25,6 @@ import reborncore.common.util.LogHelper;
|
|||
import reborncore.common.util.VersionChecker;
|
||||
import techreborn.achievement.TRAchievements;
|
||||
import techreborn.api.TechRebornAPI;
|
||||
import reborncore.api.recipe.RecipeHandler;
|
||||
import techreborn.api.recipe.recipeConfig.RecipeConfigManager;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.command.TechRebornDevCommand;
|
||||
|
@ -50,158 +50,158 @@ import java.io.File;
|
|||
@Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION, dependencies = ModInfo.MOD_DEPENDENCIES, guiFactory = ModInfo.GUI_FACTORY_CLASS, acceptedMinecraftVersions = "[1.9.4]")
|
||||
public class Core {
|
||||
|
||||
public Core() {
|
||||
//Forge says to call it here, so yeah
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
}
|
||||
public Core() {
|
||||
//Forge says to call it here, so yeah
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
}
|
||||
|
||||
public static ConfigTechReborn config;
|
||||
public static ConfigTechReborn config;
|
||||
|
||||
@SidedProxy(clientSide = ModInfo.CLIENT_PROXY_CLASS, serverSide = ModInfo.SERVER_PROXY_CLASS)
|
||||
public static CommonProxy proxy;
|
||||
@SidedProxy(clientSide = ModInfo.CLIENT_PROXY_CLASS, serverSide = ModInfo.SERVER_PROXY_CLASS)
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@Mod.Instance
|
||||
public static Core INSTANCE;
|
||||
public static LogHelper logHelper = new LogHelper(new ModInfo());
|
||||
public static TechRebornWorldGen worldGen;
|
||||
public static File configDir;
|
||||
public VersionChecker versionChecker;
|
||||
@Mod.Instance
|
||||
public static Core INSTANCE;
|
||||
public static LogHelper logHelper = new LogHelper(new ModInfo());
|
||||
public static TechRebornWorldGen worldGen;
|
||||
public static File configDir;
|
||||
public VersionChecker versionChecker;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preinit(FMLPreInitializationEvent event) throws IllegalAccessException, InstantiationException {
|
||||
event.getModMetadata().version = ModInfo.MOD_VERSION;
|
||||
INSTANCE = this;
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
@Mod.EventHandler
|
||||
public void preinit(FMLPreInitializationEvent event) throws IllegalAccessException, InstantiationException {
|
||||
event.getModMetadata().version = ModInfo.MOD_VERSION;
|
||||
INSTANCE = this;
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
configDir = new File(event.getModConfigurationDirectory(), "techreborn");
|
||||
if (!configDir.exists()) {
|
||||
configDir.mkdir();
|
||||
}
|
||||
config = ConfigTechReborn.initialize(new File(configDir, "main.cfg"));
|
||||
worldGen = new TechRebornWorldGen();
|
||||
worldGen.configFile = (new File(configDir, "ores.json"));
|
||||
worldGen.hConfigFile = (new File(configDir, "ores.hjson"));
|
||||
configDir = new File(event.getModConfigurationDirectory(), "techreborn");
|
||||
if (!configDir.exists()) {
|
||||
configDir.mkdir();
|
||||
}
|
||||
config = ConfigTechReborn.initialize(new File(configDir, "main.cfg"));
|
||||
worldGen = new TechRebornWorldGen();
|
||||
worldGen.configFile = (new File(configDir, "ores.json"));
|
||||
worldGen.hConfigFile = (new File(configDir, "ores.hjson"));
|
||||
|
||||
TechRebornAPI.subItemRetriever = new SubItemRetriever();
|
||||
//Recheck here because things break at times
|
||||
CompatManager.isIC2Loaded = Loader.isModLoaded("IC2");
|
||||
TechRebornAPI.subItemRetriever = new SubItemRetriever();
|
||||
//Recheck here because things break at times
|
||||
CompatManager.isIC2Loaded = Loader.isModLoaded("IC2");
|
||||
|
||||
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
|
||||
compatModule.preInit(event);
|
||||
}
|
||||
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
|
||||
compatModule.preInit(event);
|
||||
}
|
||||
|
||||
// Register ModBlocks
|
||||
ModBlocks.init();
|
||||
// Register Fluids
|
||||
ModFluids.init();
|
||||
// Register ModItems
|
||||
ModItems.init();
|
||||
// Entitys
|
||||
EntityRegistry.registerModEntity(EntityNukePrimed.class, "nuke", 0, INSTANCE, 160, 5, true);
|
||||
// Register ModBlocks
|
||||
ModBlocks.init();
|
||||
// Register Fluids
|
||||
ModFluids.init();
|
||||
// Register ModItems
|
||||
ModItems.init();
|
||||
// Entitys
|
||||
EntityRegistry.registerModEntity(EntityNukePrimed.class, "nuke", 0, INSTANCE, 160, 5, true);
|
||||
|
||||
proxy.preInit(event);
|
||||
proxy.preInit(event);
|
||||
|
||||
RecipeConfigManager.load(event.getModConfigurationDirectory());
|
||||
RecipeConfigManager.load(event.getModConfigurationDirectory());
|
||||
|
||||
versionChecker = new VersionChecker("TechReborn", new ModInfo());
|
||||
versionChecker.checkVersionThreaded();
|
||||
logHelper.info("PreInitialization Complete");
|
||||
}
|
||||
versionChecker = new VersionChecker("TechReborn", new ModInfo());
|
||||
versionChecker.checkVersionThreaded();
|
||||
logHelper.info("PreInitialization Complete");
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) throws IllegalAccessException, InstantiationException {
|
||||
//World gen
|
||||
VeinWorldGenerator.registerTRVeins();
|
||||
if(ConfigTechReborn.veinOres){
|
||||
GameRegistry.registerWorldGenerator(VeinWorldGenerator.INSTANCE, 0);
|
||||
}
|
||||
// Registers Chest Loot
|
||||
ModLoot.init();
|
||||
// Multiparts
|
||||
ModParts.init();
|
||||
// Sounds
|
||||
ModSounds.init();
|
||||
// Compat
|
||||
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
|
||||
compatModule.init(event);
|
||||
}
|
||||
MinecraftForge.EVENT_BUS.register(new StackWIPHandler());
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) throws IllegalAccessException, InstantiationException {
|
||||
//World gen
|
||||
VeinWorldGenerator.registerTRVeins();
|
||||
if (ConfigTechReborn.veinOres) {
|
||||
GameRegistry.registerWorldGenerator(VeinWorldGenerator.INSTANCE, 0);
|
||||
}
|
||||
// Registers Chest Loot
|
||||
ModLoot.init();
|
||||
// Multiparts
|
||||
ModParts.init();
|
||||
// Sounds
|
||||
ModSounds.init();
|
||||
// Compat
|
||||
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
|
||||
compatModule.init(event);
|
||||
}
|
||||
MinecraftForge.EVENT_BUS.register(new StackWIPHandler());
|
||||
|
||||
//Ore Dictionary
|
||||
OreDict.init();
|
||||
//Ore Dictionary
|
||||
OreDict.init();
|
||||
|
||||
// Recipes
|
||||
StopWatch watch = new StopWatch();
|
||||
watch.start();
|
||||
ModRecipes.init();
|
||||
logHelper.all(watch + " : main recipes");
|
||||
watch.stop();
|
||||
// Client only init, needs to be done before parts system
|
||||
proxy.init(event);
|
||||
// WorldGen
|
||||
worldGen.load();
|
||||
if(!ConfigTechReborn.veinOres){
|
||||
GameRegistry.registerWorldGenerator(worldGen, 0);
|
||||
}
|
||||
// Recipes
|
||||
StopWatch watch = new StopWatch();
|
||||
watch.start();
|
||||
ModRecipes.init();
|
||||
logHelper.all(watch + " : main recipes");
|
||||
watch.stop();
|
||||
// Client only init, needs to be done before parts system
|
||||
proxy.init(event);
|
||||
// WorldGen
|
||||
worldGen.load();
|
||||
if (!ConfigTechReborn.veinOres) {
|
||||
GameRegistry.registerWorldGenerator(worldGen, 0);
|
||||
}
|
||||
|
||||
// DungeonLoot.init();
|
||||
// Register Gui Handler
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, new GuiHandler());
|
||||
// DungeonLoot.init();
|
||||
// Register Gui Handler
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, new GuiHandler());
|
||||
|
||||
// Achievements
|
||||
TRAchievements.init();
|
||||
// Multiblock events
|
||||
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
|
||||
// IDSU manager
|
||||
IDSUManager.INSTANCE = new IDSUManager();
|
||||
// Event busses
|
||||
MinecraftForge.EVENT_BUS.register(IDSUManager.INSTANCE);
|
||||
MinecraftForge.EVENT_BUS.register(new MultiblockServerTickHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new TRTickHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new OreUnifier());
|
||||
//MinecraftForge.EVENT_BUS.register(worldGen.retroGen);
|
||||
// Scrapbox
|
||||
if (config.ScrapboxDispenser) {
|
||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(ModItems.scrapBox, new BehaviorDispenseScrapbox());
|
||||
}
|
||||
logHelper.info("Initialization Complete");
|
||||
}
|
||||
// Achievements
|
||||
TRAchievements.init();
|
||||
// Multiblock events
|
||||
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
|
||||
// IDSU manager
|
||||
IDSUManager.INSTANCE = new IDSUManager();
|
||||
// Event busses
|
||||
MinecraftForge.EVENT_BUS.register(IDSUManager.INSTANCE);
|
||||
MinecraftForge.EVENT_BUS.register(new MultiblockServerTickHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new TRTickHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new OreUnifier());
|
||||
//MinecraftForge.EVENT_BUS.register(worldGen.retroGen);
|
||||
// Scrapbox
|
||||
if (config.ScrapboxDispenser) {
|
||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(ModItems.scrapBox, new BehaviorDispenseScrapbox());
|
||||
}
|
||||
logHelper.info("Initialization Complete");
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postinit(FMLPostInitializationEvent event) throws Exception {
|
||||
// Has to be done here as Buildcraft registers their recipes late
|
||||
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
|
||||
compatModule.postInit(event);
|
||||
}
|
||||
proxy.postInit(event);
|
||||
logHelper.info(RecipeHandler.recipeList.size() + " recipes loaded");
|
||||
@Mod.EventHandler
|
||||
public void postinit(FMLPostInitializationEvent event) throws Exception {
|
||||
// Has to be done here as Buildcraft registers their recipes late
|
||||
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
|
||||
compatModule.postInit(event);
|
||||
}
|
||||
proxy.postInit(event);
|
||||
logHelper.info(RecipeHandler.recipeList.size() + " recipes loaded");
|
||||
|
||||
// RecipeHandler.scanForDupeRecipes();
|
||||
// RecipeHandler.scanForDupeRecipes();
|
||||
|
||||
// RecipeConfigManager.save();
|
||||
//recipeCompact.saveMissingItems(configDir);
|
||||
}
|
||||
// RecipeConfigManager.save();
|
||||
//recipeCompact.saveMissingItems(configDir);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
event.registerServerCommand(new TechRebornDevCommand());
|
||||
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
|
||||
compatModule.serverStarting(event);
|
||||
}
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
event.registerServerCommand(new TechRebornDevCommand());
|
||||
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
|
||||
compatModule.serverStarting(event);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent cfgChange) {
|
||||
if (cfgChange.getModID().equals("TechReborn")) {
|
||||
ConfigTechReborn.Configs();
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent cfgChange) {
|
||||
if (cfgChange.getModID().equals("TechReborn")) {
|
||||
ConfigTechReborn.Configs();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void addDiscriminator(AddDiscriminatorEvent event) {
|
||||
event.getPacketHandler().addDiscriminator(event.getPacketHandler().nextDiscriminator, PacketAesu.class);
|
||||
event.getPacketHandler().addDiscriminator(event.getPacketHandler().nextDiscriminator, PacketIdsu.class);
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void addDiscriminator(AddDiscriminatorEvent event) {
|
||||
event.getPacketHandler().addDiscriminator(event.getPacketHandler().nextDiscriminator, PacketAesu.class);
|
||||
event.getPacketHandler().addDiscriminator(event.getPacketHandler().nextDiscriminator, PacketIdsu.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,32 +1,28 @@
|
|||
package techreborn.achievement;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
|
||||
public class AchievementMod extends Achievement
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,29 +8,24 @@ import net.minecraftforge.fml.common.gameevent.PlayerEvent.ItemPickupEvent;
|
|||
import reborncore.common.achievement.ICraftAchievement;
|
||||
import reborncore.common.achievement.IPickupAchievement;
|
||||
|
||||
public class AchievementTriggerer
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (stack != null && stack.getItem() instanceof IPickupAchievement) {
|
||||
Achievement achievement = ((IPickupAchievement) stack.getItem()).getAchievementOnPickup(stack, event.player,
|
||||
event.pickedUp);
|
||||
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)
|
||||
{
|
||||
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);
|
||||
.getAchievementOnCraft(event.crafting, event.player, event.craftMatrix);
|
||||
if (achievement != null)
|
||||
event.player.addStat(achievement, 1);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,7 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
|
|||
import techreborn.init.ModBlocks;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
public class TRAchievements
|
||||
{
|
||||
public class TRAchievements {
|
||||
|
||||
public static AchievementPage techrebornPage;
|
||||
public static int pageIndex;
|
||||
|
@ -17,15 +16,14 @@ public class TRAchievements
|
|||
public static Achievement thermalgen_Craft;
|
||||
public static Achievement centrifuge_Craft;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
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);
|
||||
|
||||
pageIndex = AchievementPage.getAchievementPages().size();
|
||||
techrebornPage = new AchievementPage(ModInfo.MOD_NAME,
|
||||
AchievementMod.achievements.toArray(new Achievement[AchievementMod.achievements.size()]));
|
||||
AchievementMod.achievements.toArray(new Achievement[AchievementMod.achievements.size()]));
|
||||
AchievementPage.registerAchievementPage(techrebornPage);
|
||||
|
||||
FMLCommonHandler.instance().bus().register(new AchievementTriggerer());
|
||||
|
|
|
@ -4,50 +4,50 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
public interface ISubItemRetriever {
|
||||
|
||||
ItemStack getCellByName(String name);
|
||||
ItemStack getCellByName(String name);
|
||||
|
||||
ItemStack getCellByName(String name, int count);
|
||||
ItemStack getCellByName(String name, int count);
|
||||
|
||||
ItemStack getCellByName(String name, int count, boolean lookForIC2);
|
||||
ItemStack getCellByName(String name, int count, boolean lookForIC2);
|
||||
|
||||
ItemStack getDustByName(String name);
|
||||
ItemStack getDustByName(String name);
|
||||
|
||||
ItemStack getDustByName(String name, int count);
|
||||
ItemStack getDustByName(String name, int count);
|
||||
|
||||
ItemStack getSmallDustByName(String name);
|
||||
ItemStack getSmallDustByName(String name);
|
||||
|
||||
ItemStack getSmallDustByName(String name, int count);
|
||||
ItemStack getSmallDustByName(String name, int count);
|
||||
|
||||
ItemStack getGemByName(String name);
|
||||
ItemStack getGemByName(String name);
|
||||
|
||||
ItemStack getGemByName(String name, int count);
|
||||
ItemStack getGemByName(String name, int count);
|
||||
|
||||
ItemStack getIngotByName(String name);
|
||||
ItemStack getIngotByName(String name);
|
||||
|
||||
ItemStack getIngotByName(String name, int count);
|
||||
ItemStack getIngotByName(String name, int count);
|
||||
|
||||
ItemStack getNuggetByName(String name);
|
||||
ItemStack getNuggetByName(String name);
|
||||
|
||||
ItemStack getNuggetByName(String name, int count);
|
||||
ItemStack getNuggetByName(String name, int count);
|
||||
|
||||
ItemStack getPartByName(String name);
|
||||
ItemStack getPartByName(String name);
|
||||
|
||||
ItemStack getPartByName(String name, int count);
|
||||
ItemStack getPartByName(String name, int count);
|
||||
|
||||
ItemStack getPlateByName(String name);
|
||||
ItemStack getPlateByName(String name);
|
||||
|
||||
ItemStack getPlateByName(String name, int count);
|
||||
ItemStack getPlateByName(String name, int count);
|
||||
|
||||
ItemStack getUpgradeByName(String name);
|
||||
ItemStack getUpgradeByName(String name);
|
||||
|
||||
ItemStack getUpgradeByName(String name, int count);
|
||||
ItemStack getUpgradeByName(String name, int count);
|
||||
|
||||
ItemStack getOreByName(String name);
|
||||
ItemStack getOreByName(String name);
|
||||
|
||||
ItemStack getOreByName(String name, int count);
|
||||
ItemStack getOreByName(String name, int count);
|
||||
|
||||
ItemStack getStorageBlockByName(String name);
|
||||
ItemStack getStorageBlockByName(String name);
|
||||
|
||||
ItemStack getStorageBlockByName(String name, int count);
|
||||
ItemStack getStorageBlockByName(String name, int count);
|
||||
|
||||
}
|
||||
|
|
|
@ -6,56 +6,59 @@ import net.minecraft.item.ItemArmor.ArmorMaterial;
|
|||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
|
||||
/**
|
||||
* This contains some static stuff used in recipes and other things
|
||||
*/
|
||||
//TODO move this out of the api, and make it nicer
|
||||
public class Reference {
|
||||
|
||||
private static final Class<?>[] ARMOR_PARAMETERS = { String.class, int.class, int[].class, int.class, SoundEvent.class, float.class };
|
||||
public static ArmorMaterial BRONZE_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "BRONZE", ARMOR_PARAMETERS, "techreborn:bronze", 17, new int[] { 3, 6, 5,
|
||||
2 }, 8, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
|
||||
public static ArmorMaterial RUBY_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "RUBY", ARMOR_PARAMETERS, "techreborn:ruby", 16, new int[] { 2, 7, 5,
|
||||
2 }, 10, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
|
||||
public static ArmorMaterial SAPPHIRE_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "SAPPHIRE", ARMOR_PARAMETERS, "techreborn:sapphire", 19, new int[] { 4, 4, 4,
|
||||
4 }, 8, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
|
||||
public static ArmorMaterial PERIDOT_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "PERIDOT", ARMOR_PARAMETERS, "techreborn:peridot", 17, new int[] { 3, 8, 3,
|
||||
2 }, 16, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
|
||||
|
||||
private static final Class<?>[] ARMOR_PARAMETERS = {String.class, int.class, int[].class, int.class, SoundEvent.class, float.class};
|
||||
public static ArmorMaterial BRONZE_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "BRONZE", ARMOR_PARAMETERS, "techreborn:bronze", 17, new int[]{3, 6, 5, 2}, 8, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
|
||||
public static ArmorMaterial RUBY_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "RUBY", ARMOR_PARAMETERS, "techreborn:ruby", 16, new int[]{2, 7, 5, 2}, 10, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
|
||||
public static ArmorMaterial SAPPHIRE_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "SAPPHIRE", ARMOR_PARAMETERS, "techreborn:sapphire", 19, new int[]{4, 4, 4, 4}, 8, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
|
||||
public static ArmorMaterial PERIDOT_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "PERIDOT", ARMOR_PARAMETERS, "techreborn:peridot", 17, new int[]{3, 8, 3, 2}, 16, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
|
||||
public static ToolMaterial BRONZE = EnumHelper.addToolMaterial("BRONZE", 2, 375, 6.0F, 2.25F, 8);
|
||||
// public static ArmorMaterial BRONZE_ARMOUR = addArmorMaterial("BRONZE", "techreborn:bronze", 17,
|
||||
// new int[]{3, 6, 5, 2}, 8, null/* TODO: SoundEvent */, 0.0F);
|
||||
|
||||
public static ToolMaterial RUBY = EnumHelper.addToolMaterial("RUBY", 2, 320, 6.2F, 2.7F, 10);
|
||||
// public static ArmorMaterial RUBY_ARMOUR = addArmorMaterial("RUBY", "techreborn:ruby", 16,
|
||||
// new int[]{2, 7, 5, 2}, 10, null/* TODO: SoundEvent */, 0.0F);
|
||||
|
||||
public static ToolMaterial BRONZE = EnumHelper.addToolMaterial("BRONZE", 2, 375, 6.0F, 2.25F, 8);
|
||||
// public static ArmorMaterial BRONZE_ARMOUR = addArmorMaterial("BRONZE", "techreborn:bronze", 17,
|
||||
// new int[]{3, 6, 5, 2}, 8, null/* TODO: SoundEvent */, 0.0F);
|
||||
public static ToolMaterial SAPPHIRE = EnumHelper.addToolMaterial("SAPPHIRE", 2, 620, 5.0F, 2F, 8);
|
||||
// public static ArmorMaterial SAPPHIRE_ARMOUR = addArmorMaterial("SAPPHIRE", "techreborn:sapphire",
|
||||
// 19, new int[]{4, 4, 4, 4}, 8, null/* TODO: SoundEvent */, 0.0F);
|
||||
|
||||
public static ToolMaterial RUBY = EnumHelper.addToolMaterial("RUBY", 2, 320, 6.2F, 2.7F, 10);
|
||||
// public static ArmorMaterial RUBY_ARMOUR = addArmorMaterial("RUBY", "techreborn:ruby", 16,
|
||||
// new int[]{2, 7, 5, 2}, 10, null/* TODO: SoundEvent */, 0.0F);
|
||||
public static ToolMaterial PERIDOT = EnumHelper.addToolMaterial("PERIDOT", 2, 400, 7.0F, 2.4F, 16);
|
||||
// public static ArmorMaterial PERIDOT_ARMOUR = addArmorMaterial("PERIDOT", "techreborn:peridot", 17,
|
||||
// new int[]{3, 8, 3, 2}, 16, null/* TODO: SoundEvent */, 0.0F);
|
||||
|
||||
public static ToolMaterial SAPPHIRE = EnumHelper.addToolMaterial("SAPPHIRE", 2, 620, 5.0F, 2F, 8);
|
||||
// public static ArmorMaterial SAPPHIRE_ARMOUR = addArmorMaterial("SAPPHIRE", "techreborn:sapphire",
|
||||
// 19, new int[]{4, 4, 4, 4}, 8, null/* TODO: SoundEvent */, 0.0F);
|
||||
public static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip, float toughness) {
|
||||
return ArmorMaterial.LEATHER;
|
||||
}
|
||||
|
||||
public static ToolMaterial PERIDOT = EnumHelper.addToolMaterial("PERIDOT", 2, 400, 7.0F, 2.4F, 16);
|
||||
// public static ArmorMaterial PERIDOT_ARMOUR = addArmorMaterial("PERIDOT", "techreborn:peridot", 17,
|
||||
// new int[]{3, 8, 3, 2}, 16, null/* TODO: SoundEvent */, 0.0F);
|
||||
|
||||
|
||||
public static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip, float toughness) {
|
||||
return ArmorMaterial.LEATHER;
|
||||
}
|
||||
public static String alloySmelteRecipe = I18n.translateToLocal("techreborn.recipe.alloysmelter");
|
||||
public static String assemblingMachineRecipe = I18n.translateToLocal("techreborn.recipe.assemblingmachine");
|
||||
public static String blastFurnaceRecipe = I18n.translateToLocal("techreborn.recipe.blastfurnace");
|
||||
public static String centrifugeRecipe = I18n.translateToLocal("techreborn.recipe.centrifuge");
|
||||
public static String chemicalReactorRecipe = I18n.translateToLocal("techreborn.recipe.chemicalReactor");
|
||||
public static String industrialGrinderRecipe = I18n.translateToLocal("techreborn.recipe.grinder");
|
||||
public static String implosionCompressorRecipe = I18n.translateToLocal("techreborn.recipe.implosioncompressor");
|
||||
public static String industrialElectrolyzerRecipe = I18n
|
||||
.translateToLocal("techreborn.recipe.industrialelectrolyzer");
|
||||
public static String industrialSawmillRecipe = I18n.translateToLocal("techreborn.recipe.industrialsawmill");
|
||||
public static String latheRecipe = I18n.translateToLocal("techreborn.recipe.lathe");
|
||||
public static String plateCuttingMachineRecipe = I18n.translateToLocal("techreborn.recipe.platecuttingmachine");
|
||||
public static String vacuumFreezerRecipe = I18n.translateToLocal("tile.techreborn.vacuumfreezer.name");
|
||||
public static String grinderRecipe = I18n.translateToLocal("tile.techreborn.grinder.name");
|
||||
public static String extractorRecipe = I18n.translateToLocal("tile.techreborn.extractor.name");
|
||||
public static String compressorRecipe = I18n.translateToLocal("tile.techreborn.compressor.name");
|
||||
public static String recyclerRecipe = I18n.translateToLocal("tile.techreborn.recycler.name");
|
||||
public static String scrapboxRecipe = I18n.translateToLocal("techreborn.recipe.scrapbox");
|
||||
public static String alloySmelteRecipe = I18n.translateToLocal("techreborn.recipe.alloysmelter");
|
||||
public static String assemblingMachineRecipe = I18n.translateToLocal("techreborn.recipe.assemblingmachine");
|
||||
public static String blastFurnaceRecipe = I18n.translateToLocal("techreborn.recipe.blastfurnace");
|
||||
public static String centrifugeRecipe = I18n.translateToLocal("techreborn.recipe.centrifuge");
|
||||
public static String chemicalReactorRecipe = I18n.translateToLocal("techreborn.recipe.chemicalReactor");
|
||||
public static String industrialGrinderRecipe = I18n.translateToLocal("techreborn.recipe.grinder");
|
||||
public static String implosionCompressorRecipe = I18n.translateToLocal("techreborn.recipe.implosioncompressor");
|
||||
public static String industrialElectrolyzerRecipe = I18n
|
||||
.translateToLocal("techreborn.recipe.industrialelectrolyzer");
|
||||
public static String industrialSawmillRecipe = I18n.translateToLocal("techreborn.recipe.industrialsawmill");
|
||||
public static String latheRecipe = I18n.translateToLocal("techreborn.recipe.lathe");
|
||||
public static String plateCuttingMachineRecipe = I18n.translateToLocal("techreborn.recipe.platecuttingmachine");
|
||||
public static String vacuumFreezerRecipe = I18n.translateToLocal("tile.techreborn.vacuumfreezer.name");
|
||||
public static String grinderRecipe = I18n.translateToLocal("tile.techreborn.grinder.name");
|
||||
public static String extractorRecipe = I18n.translateToLocal("tile.techreborn.extractor.name");
|
||||
public static String compressorRecipe = I18n.translateToLocal("tile.techreborn.compressor.name");
|
||||
public static String recyclerRecipe = I18n.translateToLocal("tile.techreborn.recycler.name");
|
||||
public static String scrapboxRecipe = I18n.translateToLocal("techreborn.recipe.scrapbox");
|
||||
}
|
||||
|
|
|
@ -18,110 +18,110 @@ import java.util.List;
|
|||
|
||||
public class RollingMachineRecipe {
|
||||
|
||||
public static final RollingMachineRecipe instance = new RollingMachineRecipe();
|
||||
private final List<IRecipe> recipes = new ArrayList<>();
|
||||
public static final RollingMachineRecipe instance = new RollingMachineRecipe();
|
||||
private final List<IRecipe> recipes = new ArrayList<>();
|
||||
|
||||
public void addShapedOreRecipe(ItemStack outputItemStack, Object... objectInputs) {
|
||||
Validate.notNull(outputItemStack);
|
||||
Validate.notNull(outputItemStack.getItem());
|
||||
if(objectInputs.length == 0){
|
||||
Validate.notNull(null); //Quick way to crash
|
||||
}
|
||||
recipes.add(new ShapedOreRecipe(outputItemStack, objectInputs));
|
||||
}
|
||||
public void addShapedOreRecipe(ItemStack outputItemStack, Object... objectInputs) {
|
||||
Validate.notNull(outputItemStack);
|
||||
Validate.notNull(outputItemStack.getItem());
|
||||
if (objectInputs.length == 0) {
|
||||
Validate.notNull(null); //Quick way to crash
|
||||
}
|
||||
recipes.add(new ShapedOreRecipe(outputItemStack, objectInputs));
|
||||
}
|
||||
|
||||
public void addShapelessOreRecipe(ItemStack outputItemStack, Object... objectInputs) {
|
||||
Validate.notNull(outputItemStack);
|
||||
Validate.notNull(outputItemStack.getItem());
|
||||
if(objectInputs.length == 0){
|
||||
Validate.notNull(null); //Quick way to crash
|
||||
}
|
||||
recipes.add(new ShapelessOreRecipe(outputItemStack, objectInputs));
|
||||
}
|
||||
public void addShapelessOreRecipe(ItemStack outputItemStack, Object... objectInputs) {
|
||||
Validate.notNull(outputItemStack);
|
||||
Validate.notNull(outputItemStack.getItem());
|
||||
if (objectInputs.length == 0) {
|
||||
Validate.notNull(null); //Quick way to crash
|
||||
}
|
||||
recipes.add(new ShapelessOreRecipe(outputItemStack, objectInputs));
|
||||
}
|
||||
|
||||
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(c)) {
|
||||
recipeArray[i1] = ((ItemStack) hashmap.get(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(c)) {
|
||||
recipeArray[i1] = ((ItemStack) hashmap.get(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<>();
|
||||
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<>();
|
||||
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 = 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 = recipes.get(k);
|
||||
if (irecipe.matches(inv, world)) {
|
||||
return irecipe.getCraftingResult(inv);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<IRecipe> getRecipeList() {
|
||||
return recipes;
|
||||
}
|
||||
public List<IRecipe> getRecipeList() {
|
||||
return recipes;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,32 +11,32 @@ import java.util.List;
|
|||
*/
|
||||
public class ScrapboxList {
|
||||
|
||||
/**
|
||||
* This full list of items that is registered with this api
|
||||
*/
|
||||
public static List<ItemStack> stacks = new ArrayList<>();
|
||||
/**
|
||||
* This full list of items that is registered with this api
|
||||
*/
|
||||
public static List<ItemStack> stacks = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Use this to add an item stack to the list
|
||||
*
|
||||
* @param stack the itemstack you want to add
|
||||
*/
|
||||
public static void addItemStackToList(ItemStack stack) {
|
||||
if (!hasItems(stack)) {
|
||||
stacks.add(stack);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Use this to add an item stack to the list
|
||||
*
|
||||
* @param stack the itemstack you want to add
|
||||
*/
|
||||
public static void addItemStackToList(ItemStack stack) {
|
||||
if (!hasItems(stack)) {
|
||||
stacks.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stack the itemstack you want to test
|
||||
* @return if the scrapbox can output this this item
|
||||
*/
|
||||
private static boolean hasItems(ItemStack stack) {
|
||||
for (ItemStack s : stacks) {
|
||||
// TODO why do this!!!!!!!!!
|
||||
if (stack.getDisplayName().equals(s.getDisplayName()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* @param stack the itemstack you want to test
|
||||
* @return if the scrapbox can output this this item
|
||||
*/
|
||||
private static boolean hasItems(ItemStack stack) {
|
||||
for (ItemStack s : stacks) {
|
||||
// TODO why do this!!!!!!!!!
|
||||
if (stack.getDisplayName().equals(s.getDisplayName()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,75 +7,75 @@ import techreborn.api.recipe.IRecipeCompact;
|
|||
|
||||
public final class TechRebornAPI {
|
||||
|
||||
/**
|
||||
* Use this to get the instance of IRecipeCompat
|
||||
*/
|
||||
public static IRecipeCompact recipeCompact;
|
||||
/**
|
||||
* Use this to get the instance of IRecipeCompat
|
||||
*/
|
||||
public static IRecipeCompact recipeCompact;
|
||||
|
||||
public static ISubItemRetriever subItemRetriever;
|
||||
public static ISubItemRetriever subItemRetriever;
|
||||
|
||||
public static void addRollingOreMachinceRecipe(ItemStack output, Object... components) {
|
||||
RollingMachineRecipe.instance.addShapedOreRecipe(output, components);
|
||||
}
|
||||
public static void addRollingOreMachinceRecipe(ItemStack output, Object... components) {
|
||||
RollingMachineRecipe.instance.addShapedOreRecipe(output, components);
|
||||
}
|
||||
|
||||
public static void addShapelessOreRollingMachinceRecipe(ItemStack output, Object... components) {
|
||||
RollingMachineRecipe.instance.addShapelessOreRecipe(output, components);
|
||||
}
|
||||
public static void addShapelessOreRollingMachinceRecipe(ItemStack output, Object... components) {
|
||||
RollingMachineRecipe.instance.addShapelessOreRecipe(output, components);
|
||||
}
|
||||
|
||||
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 static void addShapelessRollingMachinceRecipe(ItemStack output, Object... components) {
|
||||
RollingMachineRecipe.instance.addShapelessRecipe(output, components);
|
||||
}
|
||||
public static void addShapelessRollingMachinceRecipe(ItemStack output, Object... components) {
|
||||
RollingMachineRecipe.instance.addShapelessRecipe(output, components);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to get an item from techrebonrn, @see <a href=
|
||||
* "https://github.com/TechReborn/TechReborn/blob/1.9/src/main/java/techreborn/init/ModItems.java">
|
||||
* ModItems.java</a> for the full list
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static Item getItem(String name) {
|
||||
try {
|
||||
Object e = Class.forName("techreborn.init.ModItems").getField(name).get(null);
|
||||
return e instanceof Item ? (Item) e : null;
|
||||
} catch (NoSuchFieldException e1) {
|
||||
e1.printStackTrace();
|
||||
return null;
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Use this to get an item from techrebonrn, @see <a href=
|
||||
* "https://github.com/TechReborn/TechReborn/blob/1.9/src/main/java/techreborn/init/ModItems.java">
|
||||
* ModItems.java</a> for the full list
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static Item getItem(String name) {
|
||||
try {
|
||||
Object e = Class.forName("techreborn.init.ModItems").getField(name).get(null);
|
||||
return e instanceof Item ? (Item) e : null;
|
||||
} catch (NoSuchFieldException e1) {
|
||||
e1.printStackTrace();
|
||||
return null;
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to get an block from techrebonrn, @see <a href=
|
||||
* "https://github.com/TechReborn/TechReborn/blob/1.9/src/main/java/techreborn/init/ModBlocks.java">
|
||||
* ModBlocks.java</a> for the full list
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static Block getBlock(String name) {
|
||||
try {
|
||||
Object e = Class.forName("techreborn.init.ModBlocks").getField(name).get(null);
|
||||
return e instanceof Block ? (Block) e : null;
|
||||
} catch (NoSuchFieldException e1) {
|
||||
e1.printStackTrace();
|
||||
return null;
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Use this to get an block from techrebonrn, @see <a href=
|
||||
* "https://github.com/TechReborn/TechReborn/blob/1.9/src/main/java/techreborn/init/ModBlocks.java">
|
||||
* ModBlocks.java</a> for the full list
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static Block getBlock(String name) {
|
||||
try {
|
||||
Object e = Class.forName("techreborn.init.ModBlocks").getField(name).get(null);
|
||||
return e instanceof Block ? (Block) e : null;
|
||||
} catch (NoSuchFieldException e1) {
|
||||
e1.printStackTrace();
|
||||
return null;
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
package techreborn.api.gui;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.client.gui.BaseSlot;
|
||||
import techreborn.utils.upgrade.IMachineUpgrade;
|
||||
|
||||
public class SlotUpgrade extends BaseSlot {
|
||||
|
||||
public SlotUpgrade(IInventory inventoryIn, int index, int xPosition, int yPosition) {
|
||||
super(inventoryIn, index, xPosition, yPosition);
|
||||
}
|
||||
public SlotUpgrade(IInventory inventoryIn, int index, int xPosition, int yPosition) {
|
||||
super(inventoryIn, index, xPosition, yPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return stack.getItem() instanceof IMachineUpgrade;
|
||||
}
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return stack.getItem() instanceof IMachineUpgrade;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,82 +4,82 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
public class FusionReactorRecipe {
|
||||
|
||||
/**
|
||||
* This is the item stack that is required in the top slot
|
||||
* <p>
|
||||
* This cannot be null
|
||||
*/
|
||||
ItemStack topInput;
|
||||
/**
|
||||
* This is the item stack that is required in the top slot
|
||||
* <p>
|
||||
* This cannot be null
|
||||
*/
|
||||
ItemStack topInput;
|
||||
|
||||
/**
|
||||
* This is the item stack that is required in the bottom slot
|
||||
* <p>
|
||||
* This can be null
|
||||
*/
|
||||
ItemStack bottomInput;
|
||||
/**
|
||||
* This is the item stack that is required in the bottom slot
|
||||
* <p>
|
||||
* This can be null
|
||||
*/
|
||||
ItemStack bottomInput;
|
||||
|
||||
/**
|
||||
* This is the output stack
|
||||
* <p>
|
||||
* This cannot be null
|
||||
*/
|
||||
ItemStack output;
|
||||
/**
|
||||
* This is the output stack
|
||||
* <p>
|
||||
* This cannot be null
|
||||
*/
|
||||
ItemStack output;
|
||||
|
||||
/**
|
||||
* This is the required eu that has to be in the rector for the reaction to
|
||||
* start
|
||||
*/
|
||||
double startEU;
|
||||
/**
|
||||
* This is the eu that changes every tick, set as a minus number to use
|
||||
* power and a positive number to gen power.
|
||||
*/
|
||||
double euTick;
|
||||
/**
|
||||
* This is the required eu that has to be in the rector for the reaction to
|
||||
* start
|
||||
*/
|
||||
double startEU;
|
||||
/**
|
||||
* This is the eu that changes every tick, set as a minus number to use
|
||||
* power and a positive number to gen power.
|
||||
*/
|
||||
double euTick;
|
||||
|
||||
/**
|
||||
* This is the time in ticks that the reaction takes to complete
|
||||
*/
|
||||
int tickTime;
|
||||
/**
|
||||
* This is the time in ticks that the reaction takes to complete
|
||||
*/
|
||||
int tickTime;
|
||||
|
||||
/**
|
||||
* @param topInput This is the top slot stack
|
||||
* @param bottomInput This is the bottom slot stack
|
||||
* @param output This is the output stack
|
||||
* @param startEU This is the inital EU amount
|
||||
* @param euTick This is the eu that is transfured every tick
|
||||
* @param tickTime This is the time the recipe takes to process
|
||||
*/
|
||||
public FusionReactorRecipe(ItemStack topInput, ItemStack bottomInput, ItemStack output, double startEU,
|
||||
double euTick, int tickTime) {
|
||||
this.topInput = topInput;
|
||||
this.bottomInput = bottomInput;
|
||||
this.output = output;
|
||||
this.startEU = startEU;
|
||||
this.euTick = euTick;
|
||||
this.tickTime = tickTime;
|
||||
}
|
||||
/**
|
||||
* @param topInput This is the top slot stack
|
||||
* @param bottomInput This is the bottom slot stack
|
||||
* @param output This is the output stack
|
||||
* @param startEU This is the inital EU amount
|
||||
* @param euTick This is the eu that is transfured every tick
|
||||
* @param tickTime This is the time the recipe takes to process
|
||||
*/
|
||||
public FusionReactorRecipe(ItemStack topInput, ItemStack bottomInput, ItemStack output, double startEU,
|
||||
double euTick, int tickTime) {
|
||||
this.topInput = topInput;
|
||||
this.bottomInput = bottomInput;
|
||||
this.output = output;
|
||||
this.startEU = startEU;
|
||||
this.euTick = euTick;
|
||||
this.tickTime = tickTime;
|
||||
}
|
||||
|
||||
public ItemStack getTopInput() {
|
||||
return topInput;
|
||||
}
|
||||
public ItemStack getTopInput() {
|
||||
return topInput;
|
||||
}
|
||||
|
||||
public ItemStack getBottomInput() {
|
||||
return bottomInput;
|
||||
}
|
||||
public ItemStack getBottomInput() {
|
||||
return bottomInput;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
public double getStartEU() {
|
||||
return startEU;
|
||||
}
|
||||
public double getStartEU() {
|
||||
return startEU;
|
||||
}
|
||||
|
||||
public double getEuTick() {
|
||||
return euTick;
|
||||
}
|
||||
public double getEuTick() {
|
||||
return euTick;
|
||||
}
|
||||
|
||||
public int getTickTime() {
|
||||
return tickTime;
|
||||
}
|
||||
public int getTickTime() {
|
||||
return tickTime;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,17 +4,17 @@ import java.util.ArrayList;
|
|||
|
||||
public class FusionReactorRecipeHelper {
|
||||
|
||||
/**
|
||||
* This is the list of all the recipes
|
||||
*/
|
||||
public static ArrayList<FusionReactorRecipe> reactorRecipes = new ArrayList<>();
|
||||
/**
|
||||
* This is the list of all the recipes
|
||||
*/
|
||||
public static ArrayList<FusionReactorRecipe> reactorRecipes = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Register your reactor recipe here
|
||||
*
|
||||
* @param reactorRecipe the recipe you want to add
|
||||
*/
|
||||
public static void registerRecipe(FusionReactorRecipe reactorRecipe) {
|
||||
reactorRecipes.add(reactorRecipe);
|
||||
}
|
||||
/**
|
||||
* Register your reactor recipe here
|
||||
*
|
||||
* @param reactorRecipe the recipe you want to add
|
||||
*/
|
||||
public static void registerRecipe(FusionReactorRecipe reactorRecipe) {
|
||||
reactorRecipes.add(reactorRecipe);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,83 +12,83 @@ import java.util.List;
|
|||
*/
|
||||
public abstract class BaseRecipe implements IBaseRecipeType, Cloneable {
|
||||
|
||||
public ArrayList<ItemStack> inputs;
|
||||
public String name;
|
||||
public int tickTime;
|
||||
public int euPerTick;
|
||||
private ArrayList<ItemStack> outputs;
|
||||
public ArrayList<ItemStack> inputs;
|
||||
public String name;
|
||||
public int tickTime;
|
||||
public int euPerTick;
|
||||
private ArrayList<ItemStack> outputs;
|
||||
|
||||
public BaseRecipe(String name, int tickTime, int euPerTick) {
|
||||
inputs = new ArrayList<>();
|
||||
outputs = new ArrayList<>();
|
||||
this.name = name;
|
||||
// This adds all new recipes
|
||||
this.tickTime = tickTime;
|
||||
this.euPerTick = euPerTick;
|
||||
}
|
||||
public BaseRecipe(String name, int tickTime, int euPerTick) {
|
||||
inputs = new ArrayList<>();
|
||||
outputs = new ArrayList<>();
|
||||
this.name = name;
|
||||
// This adds all new recipes
|
||||
this.tickTime = tickTime;
|
||||
this.euPerTick = euPerTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getOutput(int i) {
|
||||
return outputs.get(i).copy();
|
||||
}
|
||||
@Override
|
||||
public ItemStack getOutput(int i) {
|
||||
return outputs.get(i).copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOutputsSize() {
|
||||
return outputs.size();
|
||||
}
|
||||
@Override
|
||||
public int getOutputsSize() {
|
||||
return outputs.size();
|
||||
}
|
||||
|
||||
public void addOutput(ItemStack stack) {
|
||||
outputs.add(stack);
|
||||
}
|
||||
public void addOutput(ItemStack stack) {
|
||||
outputs.add(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getInputs() {
|
||||
return inputs;
|
||||
}
|
||||
@Override
|
||||
public List<ItemStack> getInputs() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return name;
|
||||
}
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int tickTime() {
|
||||
return tickTime;
|
||||
}
|
||||
@Override
|
||||
public int tickTime() {
|
||||
return tickTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int euPerTick() {
|
||||
return euPerTick;
|
||||
}
|
||||
@Override
|
||||
public int euPerTick() {
|
||||
return euPerTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile) {
|
||||
if(tile instanceof ITileRecipeHandler){
|
||||
return ((ITileRecipeHandler) tile).canCraft(tile, this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile) {
|
||||
if (tile instanceof ITileRecipeHandler) {
|
||||
return ((ITileRecipeHandler) tile).canCraft(tile, this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile) {
|
||||
if(tile instanceof ITileRecipeHandler){
|
||||
return ((ITileRecipeHandler) tile).onCraft(tile, this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile) {
|
||||
if (tile instanceof ITileRecipeHandler) {
|
||||
return ((ITileRecipeHandler) tile).onCraft(tile, this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return outputs;
|
||||
}
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return outputs;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,5 +5,5 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
public interface IRecipeCompact {
|
||||
|
||||
ImmutableList<ItemStack> getItems(String name);
|
||||
ImmutableList<ItemStack> getItems(String name);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
* Created by Mark on 03/04/2016.
|
||||
*/
|
||||
public interface ITileRecipeHandler<T extends BaseRecipe> {
|
||||
boolean canCraft(TileEntity tile, T recipe);
|
||||
boolean canCraft(TileEntity tile, T recipe);
|
||||
|
||||
boolean onCraft(TileEntity tile, T recipe);
|
||||
boolean onCraft(TileEntity tile, T recipe);
|
||||
}
|
||||
|
|
|
@ -7,14 +7,14 @@ import techreborn.api.TechRebornAPI;
|
|||
//THIS is only here to trick JEI into showing recipes for the recycler
|
||||
public class RecyclerRecipe extends BaseRecipe {
|
||||
|
||||
public RecyclerRecipe(ItemStack input) {
|
||||
super(Reference.recyclerRecipe, 0, 0);
|
||||
inputs.add(input);
|
||||
addOutput(TechRebornAPI.subItemRetriever.getPartByName("scrap"));
|
||||
}
|
||||
public RecyclerRecipe(ItemStack input) {
|
||||
super(Reference.recyclerRecipe, 0, 0);
|
||||
inputs.add(input);
|
||||
addOutput(TechRebornAPI.subItemRetriever.getPartByName("scrap"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Recycler";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Recycler";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,14 +6,14 @@ import techreborn.api.TechRebornAPI;
|
|||
|
||||
public class ScrapboxRecipe extends BaseRecipe {
|
||||
|
||||
public ScrapboxRecipe(ItemStack output) {
|
||||
super(Reference.scrapboxRecipe, 0, 0);
|
||||
inputs.add(new ItemStack(TechRebornAPI.getItem("scrapBox")));
|
||||
addOutput(output);
|
||||
}
|
||||
public ScrapboxRecipe(ItemStack output) {
|
||||
super(Reference.scrapboxRecipe, 0, 0);
|
||||
inputs.add(new ItemStack(TechRebornAPI.getItem("scrapBox")));
|
||||
addOutput(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Scrapbox";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Scrapbox";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,18 +6,18 @@ import techreborn.api.recipe.BaseRecipe;
|
|||
|
||||
public class AlloySmelterRecipe extends BaseRecipe {
|
||||
|
||||
public AlloySmelterRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick) {
|
||||
super(Reference.alloySmelteRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
}
|
||||
public AlloySmelterRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick) {
|
||||
super(Reference.alloySmelteRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Alloy Smelter";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Alloy Smelter";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,18 +6,18 @@ import techreborn.api.recipe.BaseRecipe;
|
|||
|
||||
public class AssemblingMachineRecipe extends BaseRecipe {
|
||||
|
||||
public AssemblingMachineRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick) {
|
||||
super(Reference.assemblingMachineRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
}
|
||||
public AssemblingMachineRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick) {
|
||||
super(Reference.assemblingMachineRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Assembling Machine";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Assembling Machine";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,25 +6,25 @@ import techreborn.api.recipe.BaseRecipe;
|
|||
|
||||
public class BlastFurnaceRecipe extends BaseRecipe {
|
||||
|
||||
public int neededHeat;
|
||||
public int neededHeat;
|
||||
|
||||
public BlastFurnaceRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, int tickTime,
|
||||
int euPerTick, int neededHeat) {
|
||||
super(Reference.blastFurnaceRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
addOutput(output2);
|
||||
public BlastFurnaceRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, int tickTime,
|
||||
int euPerTick, int neededHeat) {
|
||||
super(Reference.blastFurnaceRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
addOutput(output2);
|
||||
|
||||
this.neededHeat = neededHeat;
|
||||
}
|
||||
this.neededHeat = neededHeat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Blast Furnace";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Blast Furnace";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,38 +6,38 @@ import techreborn.api.recipe.BaseRecipe;
|
|||
|
||||
public class CentrifugeRecipe extends BaseRecipe {
|
||||
|
||||
boolean useOreDic = false;
|
||||
boolean useOreDic = false;
|
||||
|
||||
public CentrifugeRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, ItemStack output3,
|
||||
ItemStack output4, int tickTime, int euPerTick) {
|
||||
super(Reference.centrifugeRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
addOutput(output2);
|
||||
if (output3 != null)
|
||||
addOutput(output3);
|
||||
if (output4 != null)
|
||||
addOutput(output4);
|
||||
}
|
||||
public CentrifugeRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, ItemStack output3,
|
||||
ItemStack output4, int tickTime, int euPerTick) {
|
||||
super(Reference.centrifugeRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
addOutput(output2);
|
||||
if (output3 != null)
|
||||
addOutput(output3);
|
||||
if (output4 != null)
|
||||
addOutput(output4);
|
||||
}
|
||||
|
||||
public CentrifugeRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, ItemStack output3,
|
||||
ItemStack output4, int tickTime, int euPerTick, boolean useOreDic) {
|
||||
this(input1, input2, output1, output2, output3, output4, tickTime, euPerTick);
|
||||
this.useOreDic = useOreDic;
|
||||
}
|
||||
public CentrifugeRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, ItemStack output3,
|
||||
ItemStack output4, int tickTime, int euPerTick, boolean useOreDic) {
|
||||
this(input1, input2, output1, output2, output3, output4, tickTime, euPerTick);
|
||||
this.useOreDic = useOreDic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Centrifuge";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Centrifuge";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return useOreDic;
|
||||
}
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return useOreDic;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,18 +6,18 @@ import techreborn.api.recipe.BaseRecipe;
|
|||
|
||||
public class ChemicalReactorRecipe extends BaseRecipe {
|
||||
|
||||
public ChemicalReactorRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick) {
|
||||
super(Reference.chemicalReactorRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
}
|
||||
public ChemicalReactorRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick) {
|
||||
super(Reference.chemicalReactorRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Chemical Reactor";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Chemical Reactor";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,16 +6,16 @@ import techreborn.api.recipe.BaseRecipe;
|
|||
|
||||
public class CompressorRecipe extends BaseRecipe {
|
||||
|
||||
public CompressorRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
|
||||
super(Reference.compressorRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
}
|
||||
public CompressorRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
|
||||
super(Reference.compressorRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Compressor";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Compressor";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,28 +6,28 @@ import techreborn.api.recipe.BaseRecipe;
|
|||
|
||||
public class ExtractorRecipe extends BaseRecipe {
|
||||
|
||||
boolean useOreDic = true;
|
||||
boolean useOreDic = true;
|
||||
|
||||
public ExtractorRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
|
||||
super(Reference.extractorRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
}
|
||||
public ExtractorRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick, boolean useOreDic) {
|
||||
this(input1, output1, tickTime, euPerTick);
|
||||
this.useOreDic = useOreDic;
|
||||
}
|
||||
public ExtractorRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
|
||||
super(Reference.extractorRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
}
|
||||
|
||||
public ExtractorRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick, boolean useOreDic) {
|
||||
this(input1, output1, tickTime, euPerTick);
|
||||
this.useOreDic = useOreDic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Extractor";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Extractor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return useOreDic;
|
||||
}
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return useOreDic;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,16 +6,16 @@ import techreborn.api.recipe.BaseRecipe;
|
|||
|
||||
public class GrinderRecipe extends BaseRecipe {
|
||||
|
||||
public GrinderRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
|
||||
super(Reference.grinderRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
}
|
||||
public GrinderRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
|
||||
super(Reference.grinderRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Grinder";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Grinder";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,21 +6,21 @@ import techreborn.api.recipe.BaseRecipe;
|
|||
|
||||
public class ImplosionCompressorRecipe extends BaseRecipe {
|
||||
|
||||
public ImplosionCompressorRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2,
|
||||
int tickTime, int euPerTick) {
|
||||
super(Reference.implosionCompressorRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
addOutput(output2);
|
||||
}
|
||||
public ImplosionCompressorRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2,
|
||||
int tickTime, int euPerTick) {
|
||||
super(Reference.implosionCompressorRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
addOutput(output2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Implosion Compressor";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Implosion Compressor";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,32 +6,32 @@ import techreborn.api.recipe.BaseRecipe;
|
|||
|
||||
public class IndustrialElectrolyzerRecipe extends BaseRecipe {
|
||||
|
||||
private boolean useOreDictionary = true;
|
||||
private boolean useOreDictionary = true;
|
||||
|
||||
public IndustrialElectrolyzerRecipe(ItemStack inputCells, ItemStack input2, ItemStack output1, ItemStack output2,
|
||||
ItemStack output3, ItemStack output4, int tickTime, int euPerTick) {
|
||||
super(Reference.industrialElectrolyzerRecipe, tickTime, euPerTick);
|
||||
if (inputCells != null)
|
||||
inputs.add(inputCells);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
addOutput(output2);
|
||||
if (output3 != null)
|
||||
addOutput(output3);
|
||||
if (output4 != null)
|
||||
addOutput(output4);
|
||||
}
|
||||
public IndustrialElectrolyzerRecipe(ItemStack inputCells, ItemStack input2, ItemStack output1, ItemStack output2,
|
||||
ItemStack output3, ItemStack output4, int tickTime, int euPerTick) {
|
||||
super(Reference.industrialElectrolyzerRecipe, tickTime, euPerTick);
|
||||
if (inputCells != null)
|
||||
inputs.add(inputCells);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
addOutput(output2);
|
||||
if (output3 != null)
|
||||
addOutput(output3);
|
||||
if (output4 != null)
|
||||
addOutput(output4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Industrial Electrolyzer";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Industrial Electrolyzer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return useOreDictionary;
|
||||
}
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return useOreDictionary;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,26 +7,26 @@ import techreborn.api.recipe.BaseRecipe;
|
|||
|
||||
public class IndustrialGrinderRecipe extends BaseRecipe {
|
||||
|
||||
public FluidStack fluidStack;
|
||||
public FluidStack fluidStack;
|
||||
|
||||
public IndustrialGrinderRecipe(ItemStack input1, FluidStack fluidStack, ItemStack output1,
|
||||
ItemStack output2, ItemStack output3, ItemStack output4, int tickTime, int euPerTick) {
|
||||
super(Reference.industrialGrinderRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
addOutput(output2);
|
||||
if (output3 != null)
|
||||
addOutput(output3);
|
||||
if (output4 != null)
|
||||
addOutput(output4);
|
||||
this.fluidStack = fluidStack;
|
||||
}
|
||||
public IndustrialGrinderRecipe(ItemStack input1, FluidStack fluidStack, ItemStack output1,
|
||||
ItemStack output2, ItemStack output3, ItemStack output4, int tickTime, int euPerTick) {
|
||||
super(Reference.industrialGrinderRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
addOutput(output2);
|
||||
if (output3 != null)
|
||||
addOutput(output3);
|
||||
if (output4 != null)
|
||||
addOutput(output4);
|
||||
this.fluidStack = fluidStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "IndustrialGrinder";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "IndustrialGrinder";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,50 +7,50 @@ import techreborn.api.recipe.BaseRecipe;
|
|||
|
||||
public class IndustrialSawmillRecipe extends BaseRecipe {
|
||||
|
||||
public FluidStack fluidStack;
|
||||
public FluidStack fluidStack;
|
||||
|
||||
public boolean canUseOreDict = false;
|
||||
public boolean canUseOreDict = false;
|
||||
|
||||
public IndustrialSawmillRecipe(ItemStack input1, ItemStack input2, FluidStack fluidStack, ItemStack output1,
|
||||
ItemStack output2, ItemStack output3, int tickTime, int euPerTick) {
|
||||
super(Reference.industrialSawmillRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
addOutput(output2);
|
||||
if (output3 != null)
|
||||
addOutput(output3);
|
||||
this.fluidStack = fluidStack;
|
||||
}
|
||||
public IndustrialSawmillRecipe(ItemStack input1, ItemStack input2, FluidStack fluidStack, ItemStack output1,
|
||||
ItemStack output2, ItemStack output3, int tickTime, int euPerTick) {
|
||||
super(Reference.industrialSawmillRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
addOutput(output2);
|
||||
if (output3 != null)
|
||||
addOutput(output3);
|
||||
this.fluidStack = fluidStack;
|
||||
}
|
||||
|
||||
public IndustrialSawmillRecipe(ItemStack input1, ItemStack input2, FluidStack fluidStack, ItemStack output1,
|
||||
ItemStack output2, ItemStack output3, int tickTime, int euPerTick, boolean canUseOreDict) {
|
||||
super(Reference.industrialSawmillRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
addOutput(output2);
|
||||
if (output3 != null)
|
||||
addOutput(output3);
|
||||
this.fluidStack = fluidStack;
|
||||
this.canUseOreDict = canUseOreDict;
|
||||
}
|
||||
public IndustrialSawmillRecipe(ItemStack input1, ItemStack input2, FluidStack fluidStack, ItemStack output1,
|
||||
ItemStack output2, ItemStack output3, int tickTime, int euPerTick, boolean canUseOreDict) {
|
||||
super(Reference.industrialSawmillRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
if (output2 != null)
|
||||
addOutput(output2);
|
||||
if (output3 != null)
|
||||
addOutput(output3);
|
||||
this.fluidStack = fluidStack;
|
||||
this.canUseOreDict = canUseOreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Industrial Sawmill";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Industrial Sawmill";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return canUseOreDict;
|
||||
}
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return canUseOreDict;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,16 +6,16 @@ import techreborn.api.recipe.BaseRecipe;
|
|||
|
||||
public class PlateCuttingMachineRecipe extends BaseRecipe {
|
||||
|
||||
public PlateCuttingMachineRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
|
||||
super(Reference.plateCuttingMachineRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
}
|
||||
public PlateCuttingMachineRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
|
||||
super(Reference.plateCuttingMachineRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Plate Cutting Machine";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Plate Cutting Machine";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,16 +6,16 @@ import techreborn.api.recipe.BaseRecipe;
|
|||
|
||||
public class VacuumFreezerRecipe extends BaseRecipe {
|
||||
|
||||
public VacuumFreezerRecipe(ItemStack input, ItemStack output, int tickTime, int euPerTick) {
|
||||
super(Reference.vacuumFreezerRecipe, tickTime, euPerTick);
|
||||
if (input != null)
|
||||
inputs.add(input);
|
||||
if (output != null)
|
||||
addOutput(output);
|
||||
}
|
||||
public VacuumFreezerRecipe(ItemStack input, ItemStack output, int tickTime, int euPerTick) {
|
||||
super(Reference.vacuumFreezerRecipe, tickTime, euPerTick);
|
||||
if (input != null)
|
||||
inputs.add(input);
|
||||
if (output != null)
|
||||
addOutput(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Vacuum Freezer";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Vacuum Freezer";
|
||||
}
|
||||
}
|
|
@ -2,43 +2,43 @@ package techreborn.api.recipe.recipeConfig;
|
|||
|
||||
public class ConfigItem {
|
||||
|
||||
String localName;
|
||||
String localName;
|
||||
|
||||
String itemName;
|
||||
String itemName;
|
||||
|
||||
int meta;
|
||||
int meta;
|
||||
|
||||
int stackSize;
|
||||
int stackSize;
|
||||
|
||||
public String getItemName() {
|
||||
return itemName;
|
||||
}
|
||||
public String getItemName() {
|
||||
return itemName;
|
||||
}
|
||||
|
||||
public void setItemName(String itemName) {
|
||||
this.itemName = itemName;
|
||||
}
|
||||
public void setItemName(String itemName) {
|
||||
this.itemName = itemName;
|
||||
}
|
||||
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
}
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
public void setMeta(int meta) {
|
||||
this.meta = meta;
|
||||
}
|
||||
public void setMeta(int meta) {
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public int getStackSize() {
|
||||
return stackSize;
|
||||
}
|
||||
public int getStackSize() {
|
||||
return stackSize;
|
||||
}
|
||||
|
||||
public void setStackSize(int stackSize) {
|
||||
this.stackSize = stackSize;
|
||||
}
|
||||
public void setStackSize(int stackSize) {
|
||||
this.stackSize = stackSize;
|
||||
}
|
||||
|
||||
public String getLocalName() {
|
||||
return localName;
|
||||
}
|
||||
public String getLocalName() {
|
||||
return localName;
|
||||
}
|
||||
|
||||
public void setLocalName(String localName) {
|
||||
this.localName = localName;
|
||||
}
|
||||
public void setLocalName(String localName) {
|
||||
this.localName = localName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,57 +4,57 @@ import java.util.ArrayList;
|
|||
|
||||
public class RecipeConfig {
|
||||
|
||||
ArrayList<ConfigItem> inputs;
|
||||
ArrayList<ConfigItem> inputs;
|
||||
|
||||
ArrayList<ConfigItem> outputs;
|
||||
ArrayList<ConfigItem> outputs;
|
||||
|
||||
Boolean enabled;
|
||||
Boolean enabled;
|
||||
|
||||
String machine;
|
||||
String machine;
|
||||
|
||||
public ArrayList<ConfigItem> getInputs() {
|
||||
return inputs;
|
||||
}
|
||||
public ArrayList<ConfigItem> getInputs() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
public void setInputs(ArrayList<ConfigItem> inputs) {
|
||||
this.inputs = inputs;
|
||||
}
|
||||
public void setInputs(ArrayList<ConfigItem> inputs) {
|
||||
this.inputs = inputs;
|
||||
}
|
||||
|
||||
public ArrayList<ConfigItem> getOutputs() {
|
||||
return outputs;
|
||||
}
|
||||
public ArrayList<ConfigItem> getOutputs() {
|
||||
return outputs;
|
||||
}
|
||||
|
||||
public void setOutputs(ArrayList<ConfigItem> outputs) {
|
||||
this.outputs = outputs;
|
||||
}
|
||||
public void setOutputs(ArrayList<ConfigItem> outputs) {
|
||||
this.outputs = outputs;
|
||||
}
|
||||
|
||||
public Boolean getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
public Boolean getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(Boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
public void setEnabled(Boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String getMachine() {
|
||||
return machine;
|
||||
}
|
||||
public String getMachine() {
|
||||
return machine;
|
||||
}
|
||||
|
||||
public void setMachine(String machine) {
|
||||
this.machine = machine;
|
||||
}
|
||||
public void setMachine(String machine) {
|
||||
this.machine = machine;
|
||||
}
|
||||
|
||||
public void addInputs(ConfigItem item) {
|
||||
if (inputs == null) {
|
||||
inputs = new ArrayList<>();
|
||||
}
|
||||
inputs.add(item);
|
||||
}
|
||||
public void addInputs(ConfigItem item) {
|
||||
if (inputs == null) {
|
||||
inputs = new ArrayList<>();
|
||||
}
|
||||
inputs.add(item);
|
||||
}
|
||||
|
||||
public void addOutputs(ConfigItem item) {
|
||||
if (outputs == null) {
|
||||
outputs = new ArrayList<>();
|
||||
}
|
||||
outputs.add(item);
|
||||
}
|
||||
public void addOutputs(ConfigItem item) {
|
||||
if (outputs == null) {
|
||||
outputs = new ArrayList<>();
|
||||
}
|
||||
outputs.add(item);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,52 +12,52 @@ import java.util.ArrayList;
|
|||
|
||||
public class RecipeConfigManager {
|
||||
|
||||
public static ArrayList<RecipeConfig> configs = new ArrayList<>();
|
||||
public static ArrayList<RecipeConfig> configs = new ArrayList<>();
|
||||
|
||||
static File configFile = null;
|
||||
static File configFile = null;
|
||||
|
||||
public static void load(File configDir) {
|
||||
if (configFile == null) {
|
||||
configFile = new File(configDir, "techRebornRecipes.json");
|
||||
}
|
||||
}
|
||||
public static void load(File configDir) {
|
||||
if (configFile == null) {
|
||||
configFile = new File(configDir, "techRebornRecipes.json");
|
||||
}
|
||||
}
|
||||
|
||||
public static void save() {
|
||||
if (configFile.exists()) {
|
||||
configFile.delete();
|
||||
}
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
String json = gson.toJson(configs);
|
||||
try {
|
||||
FileWriter writer = new FileWriter(configFile);
|
||||
writer.write(json);
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void save() {
|
||||
if (configFile.exists()) {
|
||||
configFile.delete();
|
||||
}
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
String json = gson.toJson(configs);
|
||||
try {
|
||||
FileWriter writer = new FileWriter(configFile);
|
||||
writer.write(json);
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean canLoadRecipe(IBaseRecipeType recipeType) {
|
||||
RecipeConfig config = new RecipeConfig();
|
||||
for (ItemStack stack : recipeType.getInputs()) {
|
||||
config.addInputs(itemToConfig(stack));
|
||||
}
|
||||
for (ItemStack stack : recipeType.getOutputs()) {
|
||||
config.addOutputs(itemToConfig(stack));
|
||||
}
|
||||
config.enabled = true;
|
||||
config.setMachine(recipeType.getRecipeName());
|
||||
configs.add(config);
|
||||
return config.enabled;
|
||||
}
|
||||
public static boolean canLoadRecipe(IBaseRecipeType recipeType) {
|
||||
RecipeConfig config = new RecipeConfig();
|
||||
for (ItemStack stack : recipeType.getInputs()) {
|
||||
config.addInputs(itemToConfig(stack));
|
||||
}
|
||||
for (ItemStack stack : recipeType.getOutputs()) {
|
||||
config.addOutputs(itemToConfig(stack));
|
||||
}
|
||||
config.enabled = true;
|
||||
config.setMachine(recipeType.getRecipeName());
|
||||
configs.add(config);
|
||||
return config.enabled;
|
||||
}
|
||||
|
||||
public static ConfigItem itemToConfig(ItemStack stack) {
|
||||
ConfigItem newItem = new ConfigItem();
|
||||
newItem.setItemName(stack.getItem().getUnlocalizedName());
|
||||
newItem.setMeta(stack.getItemDamage());
|
||||
newItem.setStackSize(stack.stackSize);
|
||||
newItem.setLocalName(stack.getDisplayName());
|
||||
return newItem;
|
||||
}
|
||||
public static ConfigItem itemToConfig(ItemStack stack) {
|
||||
ConfigItem newItem = new ConfigItem();
|
||||
newItem.setItemName(stack.getItem().getUnlocalizedName());
|
||||
newItem.setMeta(stack.getItemDamage());
|
||||
newItem.setStackSize(stack.stackSize);
|
||||
newItem.setLocalName(stack.getDisplayName());
|
||||
return newItem;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,13 +9,11 @@ import techreborn.Core;
|
|||
import techreborn.client.GuiHandler;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
public class BlockComputerCube extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockComputerCube extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockComputerCube(Material material)
|
||||
{
|
||||
public BlockComputerCube(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.computercube");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -23,34 +21,29 @@ public class BlockComputerCube extends BlockMachineBase implements IAdvancedRota
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.manuelID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "computer_cube";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "computer_cube";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "computer_cube";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "computer_cube";
|
||||
}
|
||||
|
||||
|
|
|
@ -10,54 +10,46 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileDigitalChest;
|
||||
|
||||
public class BlockDigitalChest extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockDigitalChest extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockDigitalChest()
|
||||
{
|
||||
public BlockDigitalChest() {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.digitalChest");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileDigitalChest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.digitalChestID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "quantum_chest";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "qchest_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "quantum_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "machine_bottom";
|
||||
}
|
||||
|
||||
|
|
|
@ -5,39 +5,33 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import reborncore.common.blocks.IAdvancedRotationTexture;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
public class BlockElectricCraftingTable extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockElectricCraftingTable extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockElectricCraftingTable(Material material)
|
||||
{
|
||||
public BlockElectricCraftingTable(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.electriccraftingtable");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "electric_crafting_table_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "electric_crafting_table_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "machine_bottom";
|
||||
}
|
||||
|
||||
|
|
|
@ -6,21 +6,18 @@ import net.minecraft.util.EnumFacing;
|
|||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
public class BlockFusionCoil extends BlockMachineBase
|
||||
{
|
||||
public class BlockFusionCoil extends BlockMachineBase {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockFusionCoil(Material material)
|
||||
{
|
||||
public BlockFusionCoil(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.fusioncoil");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState BlockStateContainer, EnumFacing facing)
|
||||
{
|
||||
public String getTextureNameFromState(IBlockState BlockStateContainer, EnumFacing facing) {
|
||||
return prefix + "fusion_coil";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,13 +14,11 @@ import techreborn.client.TechRebornCreativeTab;
|
|||
import techreborn.tiles.fusionReactor.TileEntityFusionController;
|
||||
import techreborn.utils.damageSources.FusionDamageSource;
|
||||
|
||||
public class BlockFusionControlComputer extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockFusionControlComputer extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockFusionControlComputer(Material material)
|
||||
{
|
||||
public BlockFusionControlComputer(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.fusioncontrolcomputer");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -28,10 +26,9 @@ public class BlockFusionControlComputer extends BlockMachineBase implements IAdv
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
TileEntityFusionController tileEntityFusionController = (TileEntityFusionController) world
|
||||
.getTileEntity(new BlockPos(x, y, z));
|
||||
.getTileEntity(new BlockPos(x, y, z));
|
||||
tileEntityFusionController.checkCoils();
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.fusionID, world, x, y, z);
|
||||
|
@ -39,46 +36,38 @@ public class BlockFusionControlComputer extends BlockMachineBase implements IAdv
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn)
|
||||
{
|
||||
public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) {
|
||||
super.onEntityWalk(worldIn, pos, entityIn);
|
||||
if (worldIn.getTileEntity(pos) instanceof TileEntityFusionController)
|
||||
{
|
||||
if (worldIn.getTileEntity(pos) instanceof TileEntityFusionController) {
|
||||
if (((TileEntityFusionController) worldIn.getTileEntity(pos)).crafingTickTime != 0
|
||||
&& ((TileEntityFusionController) worldIn.getTileEntity(pos)).checkCoils())
|
||||
{
|
||||
&& ((TileEntityFusionController) worldIn.getTileEntity(pos)).checkCoils()) {
|
||||
entityIn.attackEntityFrom(new FusionDamageSource(), 200F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityFusionController();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "fusion_control_computer_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "machine_side";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,11 +5,9 @@ import net.minecraft.block.BlockPlanks;
|
|||
import net.minecraft.block.material.Material;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
|
||||
public class BlockIronFence extends BlockFence
|
||||
{
|
||||
public class BlockIronFence extends BlockFence {
|
||||
|
||||
public BlockIronFence()
|
||||
{
|
||||
public BlockIronFence() {
|
||||
super(Material.IRON, BlockPlanks.EnumType.OAK.getMapColor());
|
||||
setUnlocalizedName("techreborn.ironfence");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -23,9 +20,12 @@ import reborncore.common.multiblock.BlockMultiblockBase;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileMachineCasing;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockMachineCasing extends BlockMultiblockBase implements ITexturedBlock {
|
||||
|
||||
public static final String[] types = new String[]{"standard", "reinforced", "advanced"};
|
||||
public static final String[] types = new String[] { "standard", "reinforced", "advanced" };
|
||||
public static final PropertyInteger METADATA = PropertyInteger.create("type", 0, types.length);
|
||||
|
||||
public BlockMachineCasing(Material material) {
|
||||
|
|
|
@ -19,61 +19,61 @@ import java.security.InvalidParameterException;
|
|||
import java.util.List;
|
||||
|
||||
public class BlockMachineFrame extends BaseBlock implements ITexturedBlock {
|
||||
public static final String[] types = new String[]{"machine", "advancedMachine", "highlyAdvancedMachine"};
|
||||
public static final PropertyInteger METADATA = PropertyInteger.create("type", 0, types.length - 1);
|
||||
public static final String[] types = new String[] { "machine", "advancedMachine", "highlyAdvancedMachine" };
|
||||
public static final PropertyInteger METADATA = PropertyInteger.create("type", 0, types.length - 1);
|
||||
|
||||
public BlockMachineFrame(Material material) {
|
||||
super(material);
|
||||
setUnlocalizedName("techreborn.machineFrame");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setHardness(1f);
|
||||
this.setDefaultState(this.getDefaultState().withProperty(METADATA, 0));
|
||||
}
|
||||
public BlockMachineFrame(Material material) {
|
||||
super(material);
|
||||
setUnlocalizedName("techreborn.machineFrame");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setHardness(1f);
|
||||
this.setDefaultState(this.getDefaultState().withProperty(METADATA, 0));
|
||||
}
|
||||
|
||||
public static ItemStack getFrameByName(String name, int count) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModBlocks.machineframe, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The part " + name + " could not be found.");
|
||||
}
|
||||
public static ItemStack getFrameByName(String name, int count) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModBlocks.machineframe, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The part " + name + " could not be found.");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List<ItemStack> 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<ItemStack> list) {
|
||||
for (int meta = 0; meta < types.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState blockState, EnumFacing facing) {
|
||||
return "techreborn:blocks/machine/machine_blocks/" + types[getMetaFromState(blockState)] + "_machine_block";
|
||||
}
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState blockState, EnumFacing facing) {
|
||||
return "techreborn:blocks/machine/machine_blocks/" + types[getMetaFromState(blockState)] + "_machine_block";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates() {
|
||||
return types.length;
|
||||
}
|
||||
@Override
|
||||
public int amountOfStates() {
|
||||
return types.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(METADATA);
|
||||
}
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(METADATA);
|
||||
}
|
||||
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, METADATA);
|
||||
}
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(METADATA, meta);
|
||||
}
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(METADATA, meta);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,12 +24,10 @@ import techreborn.entitys.EntityNukePrimed;
|
|||
/**
|
||||
* Created by Mark on 13/03/2016.
|
||||
*/
|
||||
public class BlockNuke extends BaseBlock implements ITexturedBlock
|
||||
{
|
||||
public class BlockNuke extends BaseBlock implements ITexturedBlock {
|
||||
public static final PropertyBool OVERLAY = PropertyBool.create("overlay");
|
||||
|
||||
public BlockNuke()
|
||||
{
|
||||
public BlockNuke() {
|
||||
super(Material.TNT);
|
||||
setUnlocalizedName("techreborn.nuke");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
|
@ -37,12 +35,10 @@ public class BlockNuke extends BaseBlock implements ITexturedBlock
|
|||
this.setDefaultState(this.blockState.getBaseState().withProperty(OVERLAY, false));
|
||||
}
|
||||
|
||||
public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter)
|
||||
{
|
||||
if (!worldIn.isRemote)
|
||||
{
|
||||
public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter) {
|
||||
if (!worldIn.isRemote) {
|
||||
EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (double) ((float) pos.getX() + 0.5F),
|
||||
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), igniter);
|
||||
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), igniter);
|
||||
worldIn.spawnEntityInWorld(entitynukeprimed);
|
||||
// worldIn.playSoundAtEntity(entitynukeprimed, "game.tnt.primed",
|
||||
// 1.0F, 1.0F);
|
||||
|
@ -50,37 +46,30 @@ public class BlockNuke extends BaseBlock implements ITexturedBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
|
||||
{
|
||||
if (!worldIn.isRemote)
|
||||
{
|
||||
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) {
|
||||
if (!worldIn.isRemote) {
|
||||
EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (double) ((float) pos.getX() + 0.5F),
|
||||
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy());
|
||||
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy());
|
||||
entitynukeprimed.fuse = worldIn.rand.nextInt(entitynukeprimed.fuse / 4) + entitynukeprimed.fuse / 8;
|
||||
worldIn.spawnEntityInWorld(entitynukeprimed);
|
||||
}
|
||||
}
|
||||
|
||||
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
|
||||
{
|
||||
if (!worldIn.isRemote && entityIn instanceof EntityArrow)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {
|
||||
if (!worldIn.isRemote && entityIn instanceof EntityArrow) {
|
||||
EntityArrow entityarrow = (EntityArrow) entityIn;
|
||||
|
||||
if (entityarrow.isBurning())
|
||||
{
|
||||
if (entityarrow.isBurning()) {
|
||||
this.explode(worldIn, pos, state, entityarrow.shootingEntity instanceof EntityLivingBase
|
||||
? (EntityLivingBase) entityarrow.shootingEntity : null);
|
||||
? (EntityLivingBase) entityarrow.shootingEntity : null);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
|
||||
super.onBlockAdded(worldIn, pos, state);
|
||||
if (worldIn.isBlockPowered(pos))
|
||||
{
|
||||
if (worldIn.isBlockPowered(pos)) {
|
||||
this.explode(worldIn, pos, state, null);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
|
@ -89,10 +78,8 @@ public class BlockNuke extends BaseBlock implements ITexturedBlock
|
|||
/**
|
||||
* Called when a neighboring block changes.
|
||||
*/
|
||||
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
|
||||
{
|
||||
if (worldIn.isBlockPowered(pos))
|
||||
{
|
||||
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) {
|
||||
if (worldIn.isBlockPowered(pos)) {
|
||||
this.explode(worldIn, pos, state, null);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
|
@ -100,39 +87,32 @@ public class BlockNuke extends BaseBlock implements ITexturedBlock
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
|
||||
EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState iBlockState, EnumFacing enumFacing)
|
||||
{
|
||||
if (iBlockState.getValue(OVERLAY))
|
||||
{
|
||||
public String getTextureNameFromState(IBlockState iBlockState, EnumFacing enumFacing) {
|
||||
if (iBlockState.getValue(OVERLAY)) {
|
||||
return "techreborn:blocks/nuke_overlay";
|
||||
}
|
||||
return "techreborn:blocks/nuke";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates()
|
||||
{
|
||||
public int amountOfStates() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(OVERLAY) ? 1 : 0;
|
||||
}
|
||||
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(OVERLAY, (meta & 1) > 0);
|
||||
}
|
||||
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, OVERLAY);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,185 +36,185 @@ import java.util.Random;
|
|||
|
||||
public class BlockOre extends BaseBlock implements ITexturedBlock, IOreNameProvider {
|
||||
|
||||
public static final String[] ores = new String[]{
|
||||
"galena", "iridium", "ruby", "sapphire", "bauxite", "pyrite",
|
||||
"cinnabar", "sphalerite", "tungsten", "sheldonite", "peridot", "sodalite",
|
||||
"lead", "silver"};
|
||||
public static final String[] ores = new String[] {
|
||||
"galena", "iridium", "ruby", "sapphire", "bauxite", "pyrite",
|
||||
"cinnabar", "sphalerite", "tungsten", "sheldonite", "peridot", "sodalite",
|
||||
"lead", "silver" };
|
||||
|
||||
private static final List<String> oreNamesList = Lists.newArrayList(ArrayUtils.arrayToLowercase(ores));
|
||||
private static final List<String> oreNamesList = Lists.newArrayList(ArrayUtils.arrayToLowercase(ores));
|
||||
|
||||
public static final PropertyString VARIANTS = new PropertyString("type", oreNamesList);
|
||||
public static final PropertyString VARIANTS = new PropertyString("type", oreNamesList);
|
||||
|
||||
public BlockOre(Material material) {
|
||||
super(material);
|
||||
setUnlocalizedName("techreborn.ore");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHardness(2.0f);
|
||||
setHarvestLevel("pickaxe", 2);
|
||||
this.setDefaultState(this.getStateFromMeta(0));
|
||||
}
|
||||
public BlockOre(Material material) {
|
||||
super(material);
|
||||
setUnlocalizedName("techreborn.ore");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHardness(2.0f);
|
||||
setHarvestLevel("pickaxe", 2);
|
||||
this.setDefaultState(this.getStateFromMeta(0));
|
||||
}
|
||||
|
||||
public static ItemStack getOreByName(String name, int count) {
|
||||
for (int i = 0; i < ores.length; i++) {
|
||||
if (ores[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModBlocks.ore, count, i);
|
||||
}
|
||||
}
|
||||
return BlockOre2.getOreByName(name, count);
|
||||
}
|
||||
public static ItemStack getOreByName(String name, int count) {
|
||||
for (int i = 0; i < ores.length; i++) {
|
||||
if (ores[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModBlocks.ore, count, i);
|
||||
}
|
||||
}
|
||||
return BlockOre2.getOreByName(name, count);
|
||||
}
|
||||
|
||||
public static ItemStack getOreByName(String name) {
|
||||
return getOreByName(name, 1);
|
||||
}
|
||||
public static ItemStack getOreByName(String name) {
|
||||
return getOreByName(name, 1);
|
||||
}
|
||||
|
||||
public IBlockState getBlockStateFromName(String name) {
|
||||
int index = -1;
|
||||
for (int i = 0; i < ores.length; i++) {
|
||||
if (ores[i].equalsIgnoreCase(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index == -1) {
|
||||
return ModBlocks.ore2.getBlockStateFromName(name);
|
||||
}
|
||||
return getStateFromMeta(index);
|
||||
}
|
||||
public IBlockState getBlockStateFromName(String name) {
|
||||
int index = -1;
|
||||
for (int i = 0; i < ores.length; i++) {
|
||||
if (ores[i].equalsIgnoreCase(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index == -1) {
|
||||
return ModBlocks.ore2.getBlockStateFromName(name);
|
||||
}
|
||||
return getStateFromMeta(index);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
String variant = state.getValue(VARIANTS);
|
||||
int meta = getMetaFromState(state);
|
||||
Random random = new Random();
|
||||
// Ruby
|
||||
if (variant.equalsIgnoreCase("Ruby")) {
|
||||
OreDrop ruby = new OreDrop(ItemGems.getGemByName("ruby"),
|
||||
ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||
OreDrop redGarnet = new OreDrop(ItemGems.getGemByName("redGarnet"), 0.02);
|
||||
OreDropSet set = new OreDropSet(ruby, redGarnet);
|
||||
return set.drop(fortune, random);
|
||||
}
|
||||
@Deprecated
|
||||
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
String variant = state.getValue(VARIANTS);
|
||||
int meta = getMetaFromState(state);
|
||||
Random random = new Random();
|
||||
// Ruby
|
||||
if (variant.equalsIgnoreCase("Ruby")) {
|
||||
OreDrop ruby = new OreDrop(ItemGems.getGemByName("ruby"),
|
||||
ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||
OreDrop redGarnet = new OreDrop(ItemGems.getGemByName("redGarnet"), 0.02);
|
||||
OreDropSet set = new OreDropSet(ruby, redGarnet);
|
||||
return set.drop(fortune, random);
|
||||
}
|
||||
|
||||
// Sapphire
|
||||
if (variant.equalsIgnoreCase("Sapphire")) {
|
||||
OreDrop sapphire = new OreDrop(ItemGems.getGemByName("sapphire"),
|
||||
ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||
OreDrop peridot = new OreDrop(ItemGems.getGemByName("peridot"), 0.03);
|
||||
OreDropSet set = new OreDropSet(sapphire, peridot);
|
||||
return set.drop(fortune, random);
|
||||
}
|
||||
// Sapphire
|
||||
if (variant.equalsIgnoreCase("Sapphire")) {
|
||||
OreDrop sapphire = new OreDrop(ItemGems.getGemByName("sapphire"),
|
||||
ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||
OreDrop peridot = new OreDrop(ItemGems.getGemByName("peridot"), 0.03);
|
||||
OreDropSet set = new OreDropSet(sapphire, peridot);
|
||||
return set.drop(fortune, random);
|
||||
}
|
||||
|
||||
// Pyrite
|
||||
if (variant.equalsIgnoreCase("Pyrite")) {
|
||||
OreDrop pyriteDust = new OreDrop(ItemDusts.getDustByName("pyrite"),
|
||||
ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||
OreDropSet set = new OreDropSet(pyriteDust);
|
||||
return set.drop(fortune, random);
|
||||
}
|
||||
// Pyrite
|
||||
if (variant.equalsIgnoreCase("Pyrite")) {
|
||||
OreDrop pyriteDust = new OreDrop(ItemDusts.getDustByName("pyrite"),
|
||||
ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||
OreDropSet set = new OreDropSet(pyriteDust);
|
||||
return set.drop(fortune, random);
|
||||
}
|
||||
|
||||
// Sodalite
|
||||
if (variant.equalsIgnoreCase("Sodalite")) {
|
||||
OreDrop sodalite = new OreDrop(ItemDusts.getDustByName("sodalite", 6),
|
||||
ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||
OreDrop aluminum = new OreDrop(ItemDusts.getDustByName("aluminum"), 0.50);
|
||||
OreDropSet set = new OreDropSet(sodalite, aluminum);
|
||||
return set.drop(fortune, random);
|
||||
}
|
||||
// Sodalite
|
||||
if (variant.equalsIgnoreCase("Sodalite")) {
|
||||
OreDrop sodalite = new OreDrop(ItemDusts.getDustByName("sodalite", 6),
|
||||
ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||
OreDrop aluminum = new OreDrop(ItemDusts.getDustByName("aluminum"), 0.50);
|
||||
OreDropSet set = new OreDropSet(sodalite, aluminum);
|
||||
return set.drop(fortune, random);
|
||||
}
|
||||
|
||||
// Cinnabar
|
||||
if (variant.equalsIgnoreCase("Cinnabar")) {
|
||||
OreDrop cinnabar = new OreDrop(ItemDusts.getDustByName("cinnabar"),
|
||||
ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||
OreDrop redstone = new OreDrop(new ItemStack(Items.REDSTONE), 0.25);
|
||||
OreDropSet set = new OreDropSet(cinnabar, redstone);
|
||||
return set.drop(fortune, random);
|
||||
}
|
||||
// Cinnabar
|
||||
if (variant.equalsIgnoreCase("Cinnabar")) {
|
||||
OreDrop cinnabar = new OreDrop(ItemDusts.getDustByName("cinnabar"),
|
||||
ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||
OreDrop redstone = new OreDrop(new ItemStack(Items.REDSTONE), 0.25);
|
||||
OreDropSet set = new OreDropSet(cinnabar, redstone);
|
||||
return set.drop(fortune, random);
|
||||
}
|
||||
|
||||
// Sphalerite 1, 1/8 yellow garnet
|
||||
if (variant.equalsIgnoreCase("Sphalerite")) {
|
||||
OreDrop sphalerite = new OreDrop(ItemDusts.getDustByName("sphalerite"),
|
||||
ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||
OreDrop yellowGarnet = new OreDrop(ItemGems.getGemByName("yellowGarnet"), 0.125);
|
||||
OreDropSet set = new OreDropSet(sphalerite, yellowGarnet);
|
||||
return set.drop(fortune, random);
|
||||
}
|
||||
// Sphalerite 1, 1/8 yellow garnet
|
||||
if (variant.equalsIgnoreCase("Sphalerite")) {
|
||||
OreDrop sphalerite = new OreDrop(ItemDusts.getDustByName("sphalerite"),
|
||||
ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||
OreDrop yellowGarnet = new OreDrop(ItemGems.getGemByName("yellowGarnet"), 0.125);
|
||||
OreDropSet set = new OreDropSet(sphalerite, yellowGarnet);
|
||||
return set.drop(fortune, random);
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> block = new ArrayList<>();
|
||||
block.add(new ItemStack(Item.getItemFromBlock(this), 1, meta));
|
||||
return block;
|
||||
}
|
||||
ArrayList<ItemStack> block = new ArrayList<>();
|
||||
block.add(new ItemStack(Item.getItemFromBlock(this), 1, meta));
|
||||
return block;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSilkHarvest() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canSilkHarvest() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < ores.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 < ores.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos,
|
||||
EntityPlayer player) {
|
||||
return new ItemStack(this, 1, getMetaFromState(state));
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos,
|
||||
EntityPlayer player) {
|
||||
return new ItemStack(this, 1, getMetaFromState(state));
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public int damageDropped(IBlockState state)
|
||||
// {
|
||||
// int meta = getMetaFromState(state);
|
||||
// if (meta == 2)
|
||||
// {
|
||||
// return 0;
|
||||
// } else if (meta == 3)
|
||||
// {
|
||||
// return 1;
|
||||
// } else if (meta == 5)
|
||||
// {
|
||||
// return 60;
|
||||
// }
|
||||
// return meta;
|
||||
// }
|
||||
// @Override
|
||||
// public int damageDropped(IBlockState state)
|
||||
// {
|
||||
// int meta = getMetaFromState(state);
|
||||
// if (meta == 2)
|
||||
// {
|
||||
// return 0;
|
||||
// } else if (meta == 3)
|
||||
// {
|
||||
// return 1;
|
||||
// } else if (meta == 5)
|
||||
// {
|
||||
// return 60;
|
||||
// }
|
||||
// return meta;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState BlockStateContainer, EnumFacing facing) {
|
||||
return "techreborn:blocks/ore/ore" + StringUtils.toFirstCapital(ores[getMetaFromState(BlockStateContainer)]);
|
||||
}
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState BlockStateContainer, EnumFacing facing) {
|
||||
return "techreborn:blocks/ore/ore" + StringUtils.toFirstCapital(ores[getMetaFromState(BlockStateContainer)]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates() {
|
||||
return ores.length;
|
||||
}
|
||||
@Override
|
||||
public int amountOfStates() {
|
||||
return ores.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if (meta > ores.length) {
|
||||
meta = 0;
|
||||
}
|
||||
return getBlockState().getBaseState().withProperty(VARIANTS, oreNamesList.get(meta));
|
||||
}
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if (meta > ores.length) {
|
||||
meta = 0;
|
||||
}
|
||||
return getBlockState().getBaseState().withProperty(VARIANTS, oreNamesList.get(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return oreNamesList.indexOf(state.getValue(VARIANTS));
|
||||
}
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return oreNamesList.indexOf(state.getValue(VARIANTS));
|
||||
}
|
||||
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, VARIANTS);
|
||||
}
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, VARIANTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserLoclisedName(IBlockState state) {
|
||||
return StringUtils.toFirstCapital(oreNamesList.get(getMetaFromState(state)));
|
||||
}
|
||||
@Override
|
||||
public String getUserLoclisedName(IBlockState state) {
|
||||
return StringUtils.toFirstCapital(oreNamesList.get(getMetaFromState(state)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedBlock;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
@ -27,15 +23,16 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
|||
import techreborn.init.ModBlocks;
|
||||
import techreborn.world.config.IOreNameProvider;
|
||||
|
||||
public class BlockOre2 extends BaseBlock implements ITexturedBlock, IOreNameProvider
|
||||
{
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
public static final String[] ores = new String[] { "copper", "tin"};
|
||||
public class BlockOre2 extends BaseBlock implements ITexturedBlock, IOreNameProvider {
|
||||
|
||||
public static final String[] ores = new String[] { "copper", "tin" };
|
||||
static List<String> oreNamesList = Lists.newArrayList(ArrayUtils.arrayToLowercase(ores));
|
||||
public PropertyString VARIANTS = new PropertyString("type", oreNamesList);
|
||||
|
||||
public BlockOre2(Material material)
|
||||
{
|
||||
public BlockOre2(Material material) {
|
||||
super(material);
|
||||
setUnlocalizedName("techreborn.ore2");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
|
@ -44,89 +41,76 @@ public class BlockOre2 extends BaseBlock implements ITexturedBlock, IOreNameProv
|
|||
this.setDefaultState(this.getStateFromMeta(0));
|
||||
}
|
||||
|
||||
public static ItemStack getOreByName(String name, int count)
|
||||
{
|
||||
for (int i = 0; i < ores.length; i++)
|
||||
{
|
||||
if (ores[i].equalsIgnoreCase(name))
|
||||
{
|
||||
public static ItemStack getOreByName(String name, int count) {
|
||||
for (int i = 0; i < ores.length; i++) {
|
||||
if (ores[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModBlocks.ore2, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The ore block " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getOreByName(String name)
|
||||
{
|
||||
public static ItemStack getOreByName(String name) {
|
||||
return getOreByName(name, 1);
|
||||
}
|
||||
|
||||
public IBlockState getBlockStateFromName(String name)
|
||||
{
|
||||
public IBlockState getBlockStateFromName(String name) {
|
||||
int index = -1;
|
||||
for (int i = 0; i < ores.length; i++)
|
||||
{
|
||||
if (ores[i].equalsIgnoreCase(name))
|
||||
{
|
||||
for (int i = 0; i < ores.length; i++) {
|
||||
if (ores[i].equalsIgnoreCase(name)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index == -1) {
|
||||
throw new InvalidParameterException("The ore block " + name + " could not be found.");
|
||||
throw new InvalidParameterException("The ore block " + name + " could not be found.");
|
||||
}
|
||||
return getStateFromMeta(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSilkHarvest()
|
||||
{
|
||||
protected boolean canSilkHarvest() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < ores.length; meta++)
|
||||
{
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < ores.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos,
|
||||
EntityPlayer player)
|
||||
{
|
||||
return new ItemStack(this,1, getMetaFromState(state));
|
||||
EntityPlayer player) {
|
||||
return new ItemStack(this, 1, getMetaFromState(state));
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public int damageDropped(IBlockState state)
|
||||
// {
|
||||
// int meta = getMetaFromState(state);
|
||||
// if (meta == 2)
|
||||
// {
|
||||
// return 0;
|
||||
// } else if (meta == 3)
|
||||
// {
|
||||
// return 1;
|
||||
// } else if (meta == 5)
|
||||
// {
|
||||
// return 60;
|
||||
// }
|
||||
// return meta;
|
||||
// }
|
||||
// @Override
|
||||
// public int damageDropped(IBlockState state)
|
||||
// {
|
||||
// int meta = getMetaFromState(state);
|
||||
// if (meta == 2)
|
||||
// {
|
||||
// return 0;
|
||||
// } else if (meta == 3)
|
||||
// {
|
||||
// return 1;
|
||||
// } else if (meta == 5)
|
||||
// {
|
||||
// return 60;
|
||||
// }
|
||||
// return meta;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState BlockStateContainer, EnumFacing facing)
|
||||
{
|
||||
public String getTextureNameFromState(IBlockState BlockStateContainer, EnumFacing facing) {
|
||||
return "techreborn:blocks/ore/ore" + StringUtils.toFirstCapital(ores[getMetaFromState(BlockStateContainer)]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates()
|
||||
{
|
||||
public int amountOfStates() {
|
||||
return ores.length;
|
||||
}
|
||||
|
||||
|
@ -137,7 +121,7 @@ public class BlockOre2 extends BaseBlock implements ITexturedBlock, IOreNameProv
|
|||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if(meta > ores.length){
|
||||
if (meta > ores.length) {
|
||||
meta = 0;
|
||||
}
|
||||
return getBlockState().getBaseState().withProperty(VARIANTS, oreNamesList.get(meta));
|
||||
|
@ -148,15 +132,13 @@ public class BlockOre2 extends BaseBlock implements ITexturedBlock, IOreNameProv
|
|||
return oreNamesList.indexOf(state.getValue(VARIANTS));
|
||||
}
|
||||
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
protected BlockStateContainer createBlockState() {
|
||||
VARIANTS = new PropertyString("type", oreNamesList);
|
||||
return new BlockStateContainer(this, VARIANTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserLoclisedName(IBlockState state)
|
||||
{
|
||||
public String getUserLoclisedName(IBlockState state) {
|
||||
return StringUtils.toFirstCapital(oreNamesList.get(getMetaFromState(state)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package techreborn.blocks;
|
|||
|
||||
import com.google.common.collect.Lists;
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedBlock;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
@ -33,15 +32,13 @@ import techreborn.tiles.TilePlayerDectector;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPlayerDetector extends BlockMachineBase implements ITexturedBlock
|
||||
{
|
||||
public class BlockPlayerDetector extends BlockMachineBase implements ITexturedBlock {
|
||||
|
||||
public static final String[] types = new String[] { "all", "others", "you" };
|
||||
public PropertyString TYPE;
|
||||
static List<String> typeNamesList = Lists.newArrayList(ArrayUtils.arrayToLowercase(types));
|
||||
|
||||
public BlockPlayerDetector()
|
||||
{
|
||||
public BlockPlayerDetector() {
|
||||
super(true);
|
||||
setUnlocalizedName("techreborn.playerDetector");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -50,56 +47,46 @@ public class BlockPlayerDetector extends BlockMachineBase implements ITexturedBl
|
|||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
||||
{
|
||||
public Item getItemDropped(IBlockState state, Random rand, 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++)
|
||||
{
|
||||
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 TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TilePlayerDectector();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower(IBlockState state)
|
||||
{
|
||||
public boolean canProvidePower(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
TileEntity entity = blockAccess.getTileEntity(pos);
|
||||
if (entity instanceof TilePlayerDectector)
|
||||
{
|
||||
if (entity instanceof TilePlayerDectector) {
|
||||
return ((TilePlayerDectector) entity).isProvidingPower() ? 15 : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
TileEntity entity = blockAccess.getTileEntity(pos);
|
||||
if (entity instanceof TilePlayerDectector)
|
||||
{
|
||||
if (entity instanceof TilePlayerDectector) {
|
||||
return ((TilePlayerDectector) entity).isProvidingPower() ? 15 : 0;
|
||||
}
|
||||
return 0;
|
||||
|
@ -107,63 +94,56 @@ public class BlockPlayerDetector extends BlockMachineBase implements ITexturedBl
|
|||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
|
||||
ItemStack stack)
|
||||
{
|
||||
ItemStack stack) {
|
||||
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TilePlayerDectector)
|
||||
{
|
||||
if (tile instanceof TilePlayerDectector) {
|
||||
((TilePlayerDectector) tile).owenerUdid = placer.getUniqueID().toString();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityPlayer,
|
||||
EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
String type = state.getValue(TYPE);
|
||||
String newType = type;
|
||||
String newType = type;
|
||||
TextFormatting color = TextFormatting.GREEN;
|
||||
if(type.equals("all")){
|
||||
if (type.equals("all")) {
|
||||
newType = "others";
|
||||
color = TextFormatting.RED;
|
||||
} else if(type.equals("others")){
|
||||
} else if (type.equals("others")) {
|
||||
newType = "you";
|
||||
color = TextFormatting.BLUE;
|
||||
}else if(type.equals("you")){
|
||||
} else if (type.equals("you")) {
|
||||
newType = "all";
|
||||
}
|
||||
world.setBlockState(pos, state.withProperty(TYPE, newType));
|
||||
if (!world.isRemote) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.playerDetectorID, new TextComponentString(
|
||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.detects") + " " + color
|
||||
+ StringUtils.toFirstCapital(newType)));
|
||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.detects") + " " + color
|
||||
+ StringUtils.toFirstCapital(newType)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState blockState, EnumFacing facing)
|
||||
{
|
||||
public String getTextureNameFromState(IBlockState blockState, EnumFacing facing) {
|
||||
return "techreborn:blocks/machine/greg_machines/player_detector_" + types[getMetaFromState(blockState)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates()
|
||||
{
|
||||
public int amountOfStates() {
|
||||
return types.length;
|
||||
}
|
||||
|
||||
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
protected BlockStateContainer createBlockState() {
|
||||
TYPE = new PropertyString("type", types);
|
||||
return new BlockStateContainer(this, TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if(meta > types.length){
|
||||
if (meta > types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
return getBlockState().getBaseState().withProperty(TYPE, typeNamesList.get(meta));
|
||||
|
|
|
@ -11,15 +11,15 @@ import techreborn.tiles.TilePump;
|
|||
* Created by modmuss50 on 08/05/2016.
|
||||
*/
|
||||
public class BlockPump extends BaseTileBlock {
|
||||
public BlockPump() {
|
||||
super(Material.IRON);
|
||||
setHardness(2f);
|
||||
setUnlocalizedName("techreborn.pump");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
public BlockPump() {
|
||||
super(Material.IRON);
|
||||
setHardness(2f);
|
||||
setUnlocalizedName("techreborn.pump");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TilePump();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TilePump();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,13 +15,11 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileQuantumChest;
|
||||
|
||||
public class BlockQuantumChest extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockQuantumChest extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockQuantumChest()
|
||||
{
|
||||
public BlockQuantumChest() {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.quantumChest");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -29,41 +27,35 @@ public class BlockQuantumChest extends BlockMachineBase implements IAdvancedRota
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileQuantumChest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
|
||||
EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!playerIn.isSneaking())
|
||||
playerIn.openGui(Core.INSTANCE, GuiHandler.quantumChestID, worldIn, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "quantum_chest";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "qchest_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "quantum_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "machine_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,13 +11,11 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileQuantumTank;
|
||||
|
||||
public class BlockQuantumTank extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockQuantumTank extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockQuantumTank()
|
||||
{
|
||||
public BlockQuantumTank() {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.quantumTank");
|
||||
setHardness(2.0F);
|
||||
|
@ -25,47 +23,39 @@ public class BlockQuantumTank extends BlockMachineBase implements IAdvancedRotat
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileQuantumTank();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player))
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
|
||||
return true;
|
||||
}
|
||||
if (!player.isSneaking())
|
||||
{
|
||||
if (!player.isSneaking()) {
|
||||
player.openGui(Core.INSTANCE, GuiHandler.quantumTankID, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return "techreborn:blocks/machine/generators/thermal_generator_side_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return "techreborn:blocks/machine/generators/thermal_generator_side_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "quantum_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return "techreborn:blocks/machine/generators/thermal_generator_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,13 +10,11 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
import reborncore.common.BaseBlock;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
|
||||
public class BlockReinforcedGlass extends BaseBlock implements ITexturedBlock
|
||||
{
|
||||
public class BlockReinforcedGlass extends BaseBlock implements ITexturedBlock {
|
||||
|
||||
private final String prefix = "techreborn:blocks/";
|
||||
|
||||
public BlockReinforcedGlass(Material materialIn)
|
||||
{
|
||||
public BlockReinforcedGlass(Material materialIn) {
|
||||
super(materialIn);
|
||||
setUnlocalizedName("techreborn.reinforcedglass");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
|
@ -24,31 +22,26 @@ public class BlockReinforcedGlass extends BaseBlock implements ITexturedBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
public boolean isFullCube()
|
||||
{
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates()
|
||||
{
|
||||
public int amountOfStates() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState arg0, EnumFacing arg1)
|
||||
{
|
||||
public String getTextureNameFromState(IBlockState arg0, EnumFacing arg1) {
|
||||
return prefix + "reinforcedglass";
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import me.modmuss50.jsonDestroyer.api.IOpaqueBlock;
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedBlock;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -24,124 +20,108 @@ import reborncore.RebornCore;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 20/02/2016.
|
||||
*/
|
||||
public class BlockRubberLeaves extends BlockLeaves implements ITexturedBlock, IOpaqueBlock
|
||||
{
|
||||
public class BlockRubberLeaves extends BlockLeaves implements ITexturedBlock, IOpaqueBlock {
|
||||
|
||||
public BlockRubberLeaves()
|
||||
{
|
||||
public BlockRubberLeaves() {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.rubberleaves");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
this.setDefaultState(this.getDefaultState().withProperty(CHECK_DECAY, true)
|
||||
.withProperty(DECAYABLE, true));
|
||||
Blocks.FIRE.setFireInfo(this, 30, 60);
|
||||
.withProperty(DECAYABLE, true));
|
||||
Blocks.FIRE.setFireInfo(this, 30, 60);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPlanks.EnumType getWoodType(int meta)
|
||||
{
|
||||
public BlockPlanks.EnumType getWoodType(int meta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
|
||||
{
|
||||
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) {
|
||||
List<ItemStack> list = new java.util.ArrayList<>();
|
||||
list.add(new ItemStack(this, 1, 0));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isFullCube()
|
||||
{
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(IBlockState state)
|
||||
{
|
||||
protected ItemStack createStackedBlock(IBlockState state) {
|
||||
IBlockState newState = state.withProperty(CHECK_DECAY, false).withProperty(DECAYABLE,
|
||||
false);
|
||||
false);
|
||||
|
||||
return super.createStackedBlock(newState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState IBlockState, EnumFacing enumFacing)
|
||||
{
|
||||
public String getTextureNameFromState(IBlockState IBlockState, EnumFacing enumFacing) {
|
||||
return "techreborn:blocks/rubber_leaves";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates()
|
||||
{
|
||||
public int amountOfStates() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, new IProperty[] { CHECK_DECAY, DECAYABLE });
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(DECAYABLE, (meta & 1) == 0)
|
||||
.withProperty(CHECK_DECAY, (meta & 2) > 0);
|
||||
.withProperty(CHECK_DECAY, (meta & 2) > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int meta = 0;
|
||||
if (!(Boolean) state.getValue(DECAYABLE))
|
||||
{
|
||||
if (!(Boolean) state.getValue(DECAYABLE)) {
|
||||
meta |= 1;
|
||||
}
|
||||
if ((Boolean) state.getValue(CHECK_DECAY))
|
||||
{
|
||||
if ((Boolean) state.getValue(CHECK_DECAY)) {
|
||||
meta |= 2;
|
||||
}
|
||||
return meta;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockColor()
|
||||
{
|
||||
public int getBlockColor() {
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(IBlockState state)
|
||||
{
|
||||
public int getRenderColor(IBlockState state) {
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
|
||||
{
|
||||
public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) {
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
||||
{
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||
return Item.getItemFromBlock(ModBlocks.rubberSapling);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
|
@ -28,41 +24,40 @@ import techreborn.init.ModSounds;
|
|||
import techreborn.items.ItemParts;
|
||||
import techreborn.items.tools.ItemTreeTap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 19/02/2016.
|
||||
*/
|
||||
public class BlockRubberLog extends Block implements ITexturedBlock
|
||||
{
|
||||
public class BlockRubberLog extends Block implements ITexturedBlock {
|
||||
|
||||
public static PropertyDirection SAP_SIDE = PropertyDirection.create("sapside", EnumFacing.Plane.HORIZONTAL);
|
||||
public static PropertyBool HAS_SAP = PropertyBool.create("hassap");
|
||||
|
||||
public BlockRubberLog()
|
||||
{
|
||||
public BlockRubberLog() {
|
||||
super(Material.WOOD);
|
||||
setUnlocalizedName("techreborn.rubberlog");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
this.setHardness(2.0F);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
this.setDefaultState(
|
||||
this.getDefaultState().withProperty(SAP_SIDE, EnumFacing.NORTH).withProperty(HAS_SAP, false));
|
||||
this.getDefaultState().withProperty(SAP_SIDE, EnumFacing.NORTH).withProperty(HAS_SAP, false));
|
||||
this.setTickRandomly(true);
|
||||
this.setSoundType(SoundType.WOOD);
|
||||
Blocks.FIRE.setFireInfo(this, 5, 5);
|
||||
Blocks.FIRE.setFireInfo(this, 5, 5);
|
||||
}
|
||||
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, SAP_SIDE, HAS_SAP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
boolean hasSap = false;
|
||||
int tempMeta = meta;
|
||||
if (meta > 3)
|
||||
{
|
||||
if (meta > 3) {
|
||||
hasSap = true;
|
||||
tempMeta -= 3;
|
||||
}
|
||||
|
@ -71,12 +66,10 @@ public class BlockRubberLog extends Block implements ITexturedBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int tempMeta = 0;
|
||||
EnumFacing facing = state.getValue(SAP_SIDE);
|
||||
switch (facing)
|
||||
{
|
||||
switch (facing) {
|
||||
case SOUTH:
|
||||
tempMeta = 0;
|
||||
break;
|
||||
|
@ -89,24 +82,19 @@ public class BlockRubberLog extends Block implements ITexturedBlock
|
|||
case EAST:
|
||||
tempMeta = 3;
|
||||
}
|
||||
if (state.getValue(HAS_SAP))
|
||||
{
|
||||
if (state.getValue(HAS_SAP)) {
|
||||
tempMeta += 4;
|
||||
}
|
||||
return tempMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState IBlockState, EnumFacing enumFacing)
|
||||
{
|
||||
if (enumFacing == EnumFacing.DOWN || enumFacing == EnumFacing.UP)
|
||||
{
|
||||
public String getTextureNameFromState(IBlockState IBlockState, EnumFacing enumFacing) {
|
||||
if (enumFacing == EnumFacing.DOWN || enumFacing == EnumFacing.UP) {
|
||||
return "techreborn:blocks/rubber_log_top";
|
||||
}
|
||||
if (IBlockState.getValue(HAS_SAP))
|
||||
{
|
||||
if (IBlockState.getValue(SAP_SIDE) == enumFacing)
|
||||
{
|
||||
if (IBlockState.getValue(HAS_SAP)) {
|
||||
if (IBlockState.getValue(SAP_SIDE) == enumFacing) {
|
||||
return "techreborn:blocks/rubber_log_sap";
|
||||
}
|
||||
}
|
||||
|
@ -114,34 +102,27 @@ public class BlockRubberLog extends Block implements ITexturedBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates()
|
||||
{
|
||||
public int amountOfStates() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainLeaves(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean canSustainLeaves(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
|
||||
int i = 4;
|
||||
int j = i + 1;
|
||||
if (worldIn.isAreaLoaded(pos.add(-j, -j, -j), pos.add(j, j, j)))
|
||||
{
|
||||
for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-i, -i, -i), pos.add(i, i, i)))
|
||||
{
|
||||
if (worldIn.isAreaLoaded(pos.add(-j, -j, -j), pos.add(j, j, j))) {
|
||||
for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-i, -i, -i), pos.add(i, i, i))) {
|
||||
IBlockState state1 = worldIn.getBlockState(blockpos);
|
||||
if (state1.getBlock().isLeaves(state1, worldIn, blockpos))
|
||||
{
|
||||
if (state1.getBlock().isLeaves(state1, worldIn, blockpos)) {
|
||||
state1.getBlock().beginLeavesDecay(state1, worldIn, blockpos);
|
||||
}
|
||||
}
|
||||
|
@ -149,17 +130,13 @@ public class BlockRubberLog extends Block implements ITexturedBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
|
||||
{
|
||||
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
|
||||
super.updateTick(worldIn, pos, state, rand);
|
||||
if (!state.getValue(HAS_SAP))
|
||||
{
|
||||
if (rand.nextInt(50) == 0)
|
||||
{
|
||||
if (!state.getValue(HAS_SAP)) {
|
||||
if (rand.nextInt(50) == 0) {
|
||||
EnumFacing facing = EnumFacing.getHorizontal(rand.nextInt(4));
|
||||
if (worldIn.getBlockState(pos.down()).getBlock() == this
|
||||
&& worldIn.getBlockState(pos.up()).getBlock() == this)
|
||||
{
|
||||
&& worldIn.getBlockState(pos.up()).getBlock() == this) {
|
||||
worldIn.setBlockState(pos, state.withProperty(HAS_SAP, true).withProperty(SAP_SIDE, facing));
|
||||
}
|
||||
}
|
||||
|
@ -168,26 +145,22 @@ public class BlockRubberLog extends Block implements ITexturedBlock
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
|
||||
EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
|
||||
if (playerIn.getHeldItem(EnumHand.MAIN_HAND) != null
|
||||
&& playerIn.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof ItemTreeTap)
|
||||
if (state.getValue(HAS_SAP))
|
||||
{
|
||||
if (state.getValue(SAP_SIDE) == side)
|
||||
{
|
||||
&& playerIn.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof ItemTreeTap)
|
||||
if (state.getValue(HAS_SAP)) {
|
||||
if (state.getValue(SAP_SIDE) == side) {
|
||||
worldIn.setBlockState(pos,
|
||||
state.withProperty(HAS_SAP, false).withProperty(SAP_SIDE, EnumFacing.getHorizontal(0)));
|
||||
state.withProperty(HAS_SAP, false).withProperty(SAP_SIDE, EnumFacing.getHorizontal(0)));
|
||||
worldIn.playSound(null, pos.getX(), pos.getY(),
|
||||
pos.getZ(), ModSounds.extract,
|
||||
SoundCategory.BLOCKS, 0.6F, 1F);
|
||||
if (!worldIn.isRemote)
|
||||
{
|
||||
pos.getZ(), ModSounds.extract,
|
||||
SoundCategory.BLOCKS, 0.6F, 1F);
|
||||
if (!worldIn.isRemote) {
|
||||
Random rand = new Random();
|
||||
BlockPos itemPos = pos.offset(side);
|
||||
EntityItem item = new EntityItem(worldIn, itemPos.getX(), itemPos.getY(), itemPos.getZ(),
|
||||
ItemParts.getPartByName("rubberSap").copy());
|
||||
ItemParts.getPartByName("rubberSap").copy());
|
||||
float factor = 0.05F;
|
||||
playerIn.getHeldItem(EnumHand.MAIN_HAND).damageItem(1, playerIn);
|
||||
item.motionX = rand.nextGaussian() * factor;
|
||||
|
@ -202,20 +175,16 @@ public class BlockRubberLog extends Block implements ITexturedBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
public int damageDropped(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
drops.add(new ItemStack(this));
|
||||
if (state.getValue(HAS_SAP))
|
||||
{
|
||||
if (new Random().nextInt(4) == 0)
|
||||
{
|
||||
if (state.getValue(HAS_SAP)) {
|
||||
if (new Random().nextInt(4) == 0) {
|
||||
drops.add(ItemParts.getPartByName("rubberSap"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,29 +13,25 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
|||
/**
|
||||
* Created by modmuss50 on 20/02/2016.
|
||||
*/
|
||||
public class BlockRubberPlank extends Block implements ITexturedBlock
|
||||
{
|
||||
public class BlockRubberPlank extends Block implements ITexturedBlock {
|
||||
|
||||
public BlockRubberPlank()
|
||||
{
|
||||
public BlockRubberPlank() {
|
||||
super(Material.WOOD);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
setUnlocalizedName("techreborn.rubberplank");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
this.setHardness(2.0F);
|
||||
this.setSoundType(SoundType.WOOD);
|
||||
Blocks.FIRE.setFireInfo(this, 5, 20);
|
||||
Blocks.FIRE.setFireInfo(this, 5, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState state, EnumFacing side)
|
||||
{
|
||||
public String getTextureNameFromState(IBlockState state, EnumFacing side) {
|
||||
return "techreborn:blocks/rubber_planks";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates()
|
||||
{
|
||||
public int amountOfStates() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockSapling;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -14,14 +11,15 @@ import net.minecraft.world.World;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.world.RubberTreeGenerator;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 20/02/2016.
|
||||
*/
|
||||
public class BlockRubberSapling extends BlockSapling
|
||||
{
|
||||
public class BlockRubberSapling extends BlockSapling {
|
||||
|
||||
public BlockRubberSapling()
|
||||
{
|
||||
public BlockRubberSapling() {
|
||||
setUnlocalizedName("techreborn.rubbersapling");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
this.setDefaultState(this.getDefaultState().withProperty(STAGE, 0));
|
||||
|
@ -29,23 +27,19 @@ public class BlockRubberSapling extends BlockSapling
|
|||
}
|
||||
|
||||
@Override
|
||||
public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand)
|
||||
{
|
||||
if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos))
|
||||
{
|
||||
public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand) {
|
||||
if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) {
|
||||
return;
|
||||
}
|
||||
worldIn.setBlockToAir(pos);
|
||||
if (!new RubberTreeGenerator(false).generate(worldIn, rand, pos))
|
||||
{
|
||||
if (!new RubberTreeGenerator(false).generate(worldIn, rand, pos)) {
|
||||
worldIn.setBlockState(pos, state); // Re-add the sapling if the tree
|
||||
// failed to grow
|
||||
// failed to grow
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list)
|
||||
{
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) {
|
||||
list.add(new ItemStack(itemIn, 1, 0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,15 +18,13 @@ import techreborn.init.ModBlocks;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockStorage extends BaseBlock implements ITexturedBlock
|
||||
{
|
||||
public class BlockStorage extends BaseBlock implements ITexturedBlock {
|
||||
|
||||
public static final String[] types = new String[] { "silver", "aluminum", "titanium", "chrome", "steel", "brass",
|
||||
"lead", "electrum", "zinc", "platinum", "tungsten", "nickel", "invar", "iridium" };
|
||||
"lead", "electrum", "zinc", "platinum", "tungsten", "nickel", "invar", "iridium" };
|
||||
public PropertyInteger METADATA;
|
||||
|
||||
public BlockStorage(Material material)
|
||||
{
|
||||
public BlockStorage(Material material) {
|
||||
super(material);
|
||||
setUnlocalizedName("techreborn.storage");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
|
@ -34,74 +32,61 @@ public class BlockStorage extends BaseBlock implements ITexturedBlock
|
|||
this.setDefaultState(this.getDefaultState().withProperty(METADATA, 0));
|
||||
}
|
||||
|
||||
public static ItemStack getStorageBlockByName(String name, int count)
|
||||
{
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
if (types[i].equals(name))
|
||||
{
|
||||
public static ItemStack getStorageBlockByName(String name, int count) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
return new ItemStack(ModBlocks.storage, count, i);
|
||||
}
|
||||
}
|
||||
return BlockStorage2.getStorageBlockByName(name, count);
|
||||
}
|
||||
|
||||
public static ItemStack getStorageBlockByName(String name)
|
||||
{
|
||||
public static ItemStack getStorageBlockByName(String name) {
|
||||
return getStorageBlockByName(name, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
||||
{
|
||||
public Item getItemDropped(IBlockState state, Random rand, 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++)
|
||||
{
|
||||
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(IBlockState state)
|
||||
{
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState BlockStateContainer, EnumFacing facing)
|
||||
{
|
||||
public String getTextureNameFromState(IBlockState BlockStateContainer, EnumFacing facing) {
|
||||
return "techreborn:blocks/storage/" + types[getMetaFromState(BlockStateContainer)] + "_block";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates()
|
||||
{
|
||||
public int amountOfStates() {
|
||||
return types.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
if(meta > types.length){
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if (meta > types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
return this.getDefaultState().withProperty(METADATA, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(METADATA);
|
||||
}
|
||||
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
protected BlockStateContainer createBlockState() {
|
||||
|
||||
METADATA = PropertyInteger.create("type", 0, types.length - 1);
|
||||
return new BlockStateContainer(this, METADATA);
|
||||
|
|
|
@ -19,16 +19,14 @@ import java.security.InvalidParameterException;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockStorage2 extends BaseBlock implements ITexturedBlock
|
||||
{
|
||||
public class BlockStorage2 extends BaseBlock implements ITexturedBlock {
|
||||
|
||||
public static final String[] types = new String[] { "tungstensteel",
|
||||
"iridium_reinforced_tungstensteel", "iridium_reinforced_stone", "ruby", "sapphire", "peridot",
|
||||
"yellowGarnet", "redGarnet", "copper", "tin", "refinedIron" };
|
||||
"iridium_reinforced_tungstensteel", "iridium_reinforced_stone", "ruby", "sapphire", "peridot",
|
||||
"yellowGarnet", "redGarnet", "copper", "tin", "refinedIron" };
|
||||
public PropertyInteger METADATA;
|
||||
|
||||
public BlockStorage2(Material material)
|
||||
{
|
||||
public BlockStorage2(Material material) {
|
||||
super(material);
|
||||
setUnlocalizedName("techreborn.storage2");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
|
@ -36,12 +34,9 @@ public class BlockStorage2 extends BaseBlock implements ITexturedBlock
|
|||
this.setDefaultState(this.getDefaultState().withProperty(METADATA, 0));
|
||||
}
|
||||
|
||||
public static ItemStack getStorageBlockByName(String name, int count)
|
||||
{
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
if (types[i].equals(name))
|
||||
{
|
||||
public static ItemStack getStorageBlockByName(String name, int count) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
return new ItemStack(ModBlocks.storage2, count, i);
|
||||
}
|
||||
}
|
||||
|
@ -49,56 +44,47 @@ public class BlockStorage2 extends BaseBlock implements ITexturedBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune)
|
||||
{
|
||||
public Item getItemDropped(IBlockState state, Random rand, 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++)
|
||||
{
|
||||
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(IBlockState state)
|
||||
{
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState BlockStateContainer, EnumFacing facing)
|
||||
{
|
||||
public String getTextureNameFromState(IBlockState BlockStateContainer, EnumFacing facing) {
|
||||
return "techreborn:blocks/storage/" + types[getMetaFromState(BlockStateContainer)] + "_block";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates()
|
||||
{
|
||||
public int amountOfStates() {
|
||||
return types.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
if(meta > types.length){
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if (meta > types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
return this.getDefaultState().withProperty(METADATA, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(METADATA);
|
||||
}
|
||||
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
protected BlockStateContainer createBlockState() {
|
||||
|
||||
METADATA = PropertyInteger.create("type", 0, types.length - 1);
|
||||
return new BlockStateContainer(this, METADATA);
|
||||
|
|
|
@ -5,39 +5,33 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import reborncore.common.blocks.IAdvancedRotationTexture;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
public class BlockSupercondensator extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockSupercondensator extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockSupercondensator(Material material)
|
||||
{
|
||||
public BlockSupercondensator(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.supercondensator");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "supercondensator_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "supercondensator_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "supercondensator_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "machine_bottom";
|
||||
}
|
||||
|
||||
|
|
|
@ -11,66 +11,56 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.multiblock.TileBlastFurnace;
|
||||
|
||||
public class BlockBlastFurnace extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
public class BlockBlastFurnace extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/advanced_machines/";
|
||||
|
||||
public BlockBlastFurnace(Material material)
|
||||
{
|
||||
public BlockBlastFurnace(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.blastfurnace");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
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)
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.blastFurnaceID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAdvanced()
|
||||
{
|
||||
public boolean isAdvanced() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "industrial_blast_furnace_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "industrial_blast_furnace_front_on";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + "advanced_machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "advanced_machine_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "advanced_machine_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,62 +10,52 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileCentrifuge;
|
||||
|
||||
public class BlockCentrifuge extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
public class BlockCentrifuge extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/advanced_machines/";
|
||||
|
||||
public BlockCentrifuge()
|
||||
{
|
||||
public BlockCentrifuge() {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.centrifuge");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileCentrifuge();
|
||||
}
|
||||
|
||||
@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())
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking()) {
|
||||
player.openGui(Core.INSTANCE, GuiHandler.centrifugeID, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "industrial_centrifuge_side_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "industrial_centrifuge_side_on";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return getFrontOff();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "industrial_centrifuge_top_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "industrial_centrifuge_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,45 +5,38 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import reborncore.common.blocks.IRotationTexture;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
public class BlockDistillationTower extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
public class BlockDistillationTower extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/advanced_machines/";
|
||||
|
||||
public BlockDistillationTower(Material material)
|
||||
{
|
||||
public BlockDistillationTower(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.distillationtower");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "distillation_tower_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "distillation_tower_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + "advanced_machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "industrial_centrifuge_top_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "industrial_centrifuge_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,60 +11,51 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.multiblock.TileImplosionCompressor;
|
||||
|
||||
public class BlockImplosionCompressor extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
public class BlockImplosionCompressor extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/advanced_machines/";
|
||||
|
||||
public BlockImplosionCompressor(Material material)
|
||||
{
|
||||
public BlockImplosionCompressor(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.implosioncompressor");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileImplosionCompressor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.implosionCompresserID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "implosion_compressor_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "implosion_compressor_front_on";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + "advanced_machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "industrial_centrifuge_top_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "implosion_compressor_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,60 +11,51 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileIndustrialElectrolyzer;
|
||||
|
||||
public class BlockIndustrialElectrolyzer extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
public class BlockIndustrialElectrolyzer extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockIndustrialElectrolyzer(Material material)
|
||||
{
|
||||
public BlockIndustrialElectrolyzer(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.industrialelectrolyzer");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileIndustrialElectrolyzer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.industrialElectrolyzerID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "industrial_electrolyzer_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "industrial_electrolyzer_front_on";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + "industrial_electrolyzer_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "machine_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "machine_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,30 +12,25 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.multiblock.TileIndustrialGrinder;
|
||||
|
||||
public class BlockIndustrialGrinder extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
public class BlockIndustrialGrinder extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/advanced_machines/";
|
||||
|
||||
public BlockIndustrialGrinder(Material material)
|
||||
{
|
||||
public BlockIndustrialGrinder(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.industrialgrinder");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileIndustrialGrinder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player))
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
|
||||
return true;
|
||||
}
|
||||
if (!player.isSneaking())
|
||||
|
@ -44,32 +39,27 @@ public class BlockIndustrialGrinder extends BlockMachineBase implements IRotatio
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "industrial_grinder_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "industrial_grinder_front_on";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + "machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "industrial_grinder_top_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "industrial_centrifuge_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,30 +12,25 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.multiblock.TileIndustrialSawmill;
|
||||
|
||||
public class BlockIndustrialSawmill extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
public class BlockIndustrialSawmill extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/advanced_machines/";
|
||||
|
||||
public BlockIndustrialSawmill(Material material)
|
||||
{
|
||||
public BlockIndustrialSawmill(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.industrialsawmill");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileIndustrialSawmill();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player))
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
|
||||
return true;
|
||||
}
|
||||
if (!player.isSneaking())
|
||||
|
@ -44,32 +39,27 @@ public class BlockIndustrialSawmill extends BlockMachineBase implements IRotatio
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "industrial_sawmill_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "industrial_sawmill_front_on";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + "advanced_machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "advanced_machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "advanced_machine_side";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,33 +1,27 @@
|
|||
package techreborn.blocks.fluid;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import reborncore.RebornCore;
|
||||
|
||||
public class BlockFluidBase extends BlockFluidClassic
|
||||
{
|
||||
public class BlockFluidBase extends BlockFluidClassic {
|
||||
|
||||
public BlockFluidBase(Fluid fluid, Material material)
|
||||
{
|
||||
public BlockFluidBase(Fluid fluid, Material material) {
|
||||
super(fluid, material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean canDisplace(IBlockAccess world, BlockPos pos) {
|
||||
if (world.getBlockState(pos).getBlock().getMaterial(world.getBlockState(pos)).isLiquid())
|
||||
return false;
|
||||
return super.canDisplace(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displaceIfPossible(World world, BlockPos pos)
|
||||
{
|
||||
public boolean displaceIfPossible(World world, BlockPos pos) {
|
||||
if (world.getBlockState(pos).getBlock().getMaterial(world.getBlockState(pos)).isLiquid())
|
||||
return false;
|
||||
return super.displaceIfPossible(world, pos);
|
||||
|
|
|
@ -3,16 +3,13 @@ package techreborn.blocks.fluid;
|
|||
import me.modmuss50.jsonDestroyer.api.ITexturedFluid;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import reborncore.RebornCore;
|
||||
import techreborn.Core;
|
||||
|
||||
public class BlockFluidTechReborn extends BlockFluidBase implements ITexturedFluid
|
||||
{
|
||||
public class BlockFluidTechReborn extends BlockFluidBase implements ITexturedFluid {
|
||||
|
||||
String name;
|
||||
|
||||
public BlockFluidTechReborn(Fluid fluid, Material material, String name)
|
||||
{
|
||||
public BlockFluidTechReborn(Fluid fluid, Material material, String name) {
|
||||
super(fluid, material);
|
||||
setUnlocalizedName(name);
|
||||
this.name = name;
|
||||
|
|
|
@ -3,16 +3,12 @@ package techreborn.blocks.fluid;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import reborncore.common.util.Color;
|
||||
import techreborn.Core;
|
||||
|
||||
public class TechRebornFluid extends Fluid
|
||||
{
|
||||
public TechRebornFluid(String fluidName)
|
||||
{
|
||||
public class TechRebornFluid extends Fluid {
|
||||
public TechRebornFluid(String fluidName) {
|
||||
super(fluidName,
|
||||
new ResourceLocation("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"),
|
||||
new ResourceLocation("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"));
|
||||
new ResourceLocation("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"),
|
||||
new ResourceLocation("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"));
|
||||
FluidRegistry.addBucketForFluid(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,30 +12,25 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.generator.TileDieselGenerator;
|
||||
|
||||
public class BlockDieselGenerator extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockDieselGenerator extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/generators/";
|
||||
|
||||
public BlockDieselGenerator(Material material)
|
||||
{
|
||||
public BlockDieselGenerator(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.dieselgenerator");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileDieselGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player))
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
|
||||
return true;
|
||||
}
|
||||
if (!player.isSneaking())
|
||||
|
@ -44,26 +39,22 @@ public class BlockDieselGenerator extends BlockMachineBase implements IAdvancedR
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "generator_machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "generator_machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "diesel_generator_top_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "generator_machine_bottom";
|
||||
}
|
||||
|
||||
|
|
|
@ -8,45 +8,38 @@ import reborncore.common.blocks.IAdvancedRotationTexture;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.generator.TileDragonEggSiphoner;
|
||||
|
||||
public class BlockDragonEggSiphoner extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockDragonEggSiphoner extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/generators/";
|
||||
|
||||
public BlockDragonEggSiphoner(Material material)
|
||||
{
|
||||
public BlockDragonEggSiphoner(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.dragoneggsiphoner");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileDragonEggSiphoner();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "dragon_egg_energy_siphon_side_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "dragon_egg_energy_siphon_side_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "dragon_egg_energy_siphon_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "generator_machine_bottom";
|
||||
}
|
||||
|
||||
|
|
|
@ -12,30 +12,25 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.generator.TileGasTurbine;
|
||||
|
||||
public class BlockGasTurbine extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockGasTurbine extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/generators/";
|
||||
|
||||
public BlockGasTurbine(Material material)
|
||||
{
|
||||
public BlockGasTurbine(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.gasTurbine");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileGasTurbine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player))
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
|
||||
return true;
|
||||
}
|
||||
if (!player.isSneaking())
|
||||
|
@ -44,26 +39,22 @@ public class BlockGasTurbine extends BlockMachineBase implements IAdvancedRotati
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "generator_machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "generator_machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "gas_generator_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "gas_generator_bottom";
|
||||
}
|
||||
|
||||
|
|
|
@ -10,62 +10,52 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.generator.TileGenerator;
|
||||
|
||||
public class BlockGenerator extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
public class BlockGenerator extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/generators/";
|
||||
|
||||
public BlockGenerator()
|
||||
{
|
||||
public BlockGenerator() {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.generator");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileGenerator();
|
||||
}
|
||||
|
||||
@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())
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking()) {
|
||||
player.openGui(Core.INSTANCE, GuiHandler.generatorID, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "generator_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "generator_front_on";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + "generator_machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "generator_machine_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "generator_machine_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,45 +8,38 @@ import reborncore.common.blocks.IAdvancedRotationTexture;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.generator.TileHeatGenerator;
|
||||
|
||||
public class BlockHeatGenerator extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockHeatGenerator extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/generators/";
|
||||
|
||||
public BlockHeatGenerator(Material material)
|
||||
{
|
||||
public BlockHeatGenerator(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.heatgenerator");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileHeatGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "heat_generator_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "heat_generator_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "heat_generator_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "heat_generator_bottom";
|
||||
}
|
||||
|
||||
|
|
|
@ -5,39 +5,33 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import reborncore.common.blocks.IAdvancedRotationTexture;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
public class BlockMagicEnergyAbsorber extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockMagicEnergyAbsorber extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/generators/";
|
||||
|
||||
public BlockMagicEnergyAbsorber(Material material)
|
||||
{
|
||||
public BlockMagicEnergyAbsorber(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.magicenergyabsorber");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "magic_energy_absorber_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "magic_energy_absorber_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "magic_energy_absorber_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "magic_energy_absorber_bottom";
|
||||
}
|
||||
|
||||
|
|
|
@ -5,39 +5,33 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import reborncore.common.blocks.IAdvancedRotationTexture;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
public class BlockMagicEnergyConverter extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockMagicEnergyConverter extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/generators/";
|
||||
|
||||
public BlockMagicEnergyConverter(Material material)
|
||||
{
|
||||
public BlockMagicEnergyConverter(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.magicenergyconverter");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "magic_energy_converter_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "magic_energy_converter_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "magic_energy_converter_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "magic_energy_converter_bottom";
|
||||
}
|
||||
|
||||
|
|
|
@ -5,39 +5,33 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import reborncore.common.blocks.IAdvancedRotationTexture;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
public class BlockPlasmaGenerator extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockPlasmaGenerator extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/generators/";
|
||||
|
||||
public BlockPlasmaGenerator(Material material)
|
||||
{
|
||||
public BlockPlasmaGenerator(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.plasmagenerator");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "plasma_generator_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "plasma_generator_side_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "plasma_generator_side_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "plasma_generator_side_off";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,30 +12,25 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.generator.TileSemifluidGenerator;
|
||||
|
||||
public class BlockSemiFluidGenerator extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockSemiFluidGenerator extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/generators/";
|
||||
|
||||
public BlockSemiFluidGenerator(Material material)
|
||||
{
|
||||
public BlockSemiFluidGenerator(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.semifluidgenerator");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileSemifluidGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player))
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
|
||||
return true;
|
||||
}
|
||||
if (!player.isSneaking())
|
||||
|
@ -44,26 +39,22 @@ public class BlockSemiFluidGenerator extends BlockMachineBase implements IAdvanc
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "semifluid_generator_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "semifluid_generator_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "generator_machine_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "generator_machine_bottom";
|
||||
}
|
||||
|
||||
|
|
|
@ -18,14 +18,12 @@ import techreborn.tiles.generator.TileSolarPanel;
|
|||
/**
|
||||
* Created by modmuss50 on 25/02/2016.
|
||||
*/
|
||||
public class BlockSolarPanel extends BaseTileBlock implements ITexturedBlock
|
||||
{
|
||||
public class BlockSolarPanel extends BaseTileBlock implements ITexturedBlock {
|
||||
|
||||
public static PropertyBool ACTIVE = PropertyBool.create("active");
|
||||
private final String prefix = "techreborn:blocks/machine/generators/";
|
||||
|
||||
public BlockSolarPanel()
|
||||
{
|
||||
public BlockSolarPanel() {
|
||||
super(Material.IRON);
|
||||
setUnlocalizedName("techreborn.solarpanel");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -33,78 +31,67 @@ public class BlockSolarPanel extends BaseTileBlock implements ITexturedBlock
|
|||
setHardness(2.0F);
|
||||
}
|
||||
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
protected BlockStateContainer createBlockState() {
|
||||
ACTIVE = PropertyBool.create("active");
|
||||
return new BlockStateContainer(this, ACTIVE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(ACTIVE, meta != 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(ACTIVE) ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileSolarPanel();
|
||||
}
|
||||
|
||||
|
||||
@Override public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block neighborBlock)
|
||||
{
|
||||
if(worldIn.canBlockSeeSky(pos.up()) && !worldIn.isRaining() && !worldIn.isThundering()
|
||||
&& worldIn.isDaytime()){
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block neighborBlock) {
|
||||
if (worldIn.canBlockSeeSky(pos.up()) && !worldIn.isRaining() && !worldIn.isThundering()
|
||||
&& worldIn.isDaytime()) {
|
||||
worldIn.setBlockState(pos,
|
||||
worldIn.getBlockState(pos).withProperty(BlockSolarPanel.ACTIVE, true));
|
||||
}else{
|
||||
worldIn.getBlockState(pos).withProperty(BlockSolarPanel.ACTIVE, true));
|
||||
} else {
|
||||
|
||||
worldIn.setBlockState(pos,
|
||||
worldIn.getBlockState(pos).withProperty(BlockSolarPanel.ACTIVE, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY,
|
||||
float hitZ, int meta, EntityLivingBase placer)
|
||||
{
|
||||
if(!worldIn.isRemote)
|
||||
{
|
||||
if (worldIn.canBlockSeeSky(pos.up()) && !worldIn.isRaining() && !worldIn.isThundering() && worldIn.isDaytime())
|
||||
{
|
||||
return this.getDefaultState().withProperty(ACTIVE, true);
|
||||
|
||||
} else
|
||||
{
|
||||
return this.getDefaultState().withProperty(ACTIVE, false);
|
||||
}
|
||||
}else{return this.getDefaultState().withProperty(ACTIVE, false);
|
||||
worldIn.getBlockState(pos).withProperty(BlockSolarPanel.ACTIVE, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState state, EnumFacing side)
|
||||
{
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY,
|
||||
float hitZ, int meta, EntityLivingBase placer) {
|
||||
if (!worldIn.isRemote) {
|
||||
if (worldIn.canBlockSeeSky(pos.up()) && !worldIn.isRaining() && !worldIn.isThundering() && worldIn.isDaytime()) {
|
||||
return this.getDefaultState().withProperty(ACTIVE, true);
|
||||
|
||||
} else {
|
||||
return this.getDefaultState().withProperty(ACTIVE, false);
|
||||
}
|
||||
} else {
|
||||
return this.getDefaultState().withProperty(ACTIVE, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState state, EnumFacing side) {
|
||||
boolean isActive = state.getValue(ACTIVE);
|
||||
if (side == EnumFacing.UP)
|
||||
{
|
||||
if (side == EnumFacing.UP) {
|
||||
return prefix + "solar_panel_top_" + (isActive ? "on" : "off");
|
||||
} else if (side == EnumFacing.DOWN)
|
||||
{
|
||||
} else if (side == EnumFacing.DOWN) {
|
||||
return prefix + "generator_machine_bottom";
|
||||
}
|
||||
return prefix + "solar_panel_side_" + (isActive ? "on" : "off");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates()
|
||||
{
|
||||
public int amountOfStates() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,30 +11,25 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.generator.TileThermalGenerator;
|
||||
|
||||
public class BlockThermalGenerator extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockThermalGenerator extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/generators/";
|
||||
|
||||
public BlockThermalGenerator()
|
||||
{
|
||||
public BlockThermalGenerator() {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.thermalGenerator");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileThermalGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player))
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (fillBlockWithFluid(world, new BlockPos(x, y, z), player)) {
|
||||
return true;
|
||||
}
|
||||
if (!player.isSneaking())
|
||||
|
@ -43,26 +38,22 @@ public class BlockThermalGenerator extends BlockMachineBase implements IAdvanced
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return isActive ? prefix + "thermal_generator_side_on" : prefix + "thermal_generator_side_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return isActive ? prefix + "thermal_generator_side_on" : prefix + "thermal_generator_side_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return isActive ? prefix + "thermal_generator_top_on" : prefix + "thermal_generator_top_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "generator_machine_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,13 +14,11 @@ import techreborn.tiles.generator.TileWaterMill;
|
|||
/**
|
||||
* Created by modmuss50 on 25/02/2016.
|
||||
*/
|
||||
public class BlockWaterMill extends BaseTileBlock implements ITexturedBlock
|
||||
{
|
||||
public class BlockWaterMill extends BaseTileBlock implements ITexturedBlock {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/generators/";
|
||||
|
||||
public BlockWaterMill()
|
||||
{
|
||||
public BlockWaterMill() {
|
||||
super(Material.IRON);
|
||||
setUnlocalizedName("techreborn.watermill");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -29,29 +27,24 @@ public class BlockWaterMill extends BaseTileBlock implements ITexturedBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileWaterMill();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState state, EnumFacing side)
|
||||
{
|
||||
public String getTextureNameFromState(IBlockState state, EnumFacing side) {
|
||||
boolean isActive = false;
|
||||
if (side == EnumFacing.UP)
|
||||
{
|
||||
if (side == EnumFacing.UP) {
|
||||
return prefix + "generator_machine_bottom";// + (isActive ? "on" :
|
||||
// "off");
|
||||
} else if (side == EnumFacing.DOWN)
|
||||
{
|
||||
// "off");
|
||||
} else if (side == EnumFacing.DOWN) {
|
||||
return prefix + "generator_machine_bottom";
|
||||
}
|
||||
return prefix + "solar_panel_side_" + (isActive ? "on" : "off");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates()
|
||||
{
|
||||
public int amountOfStates() {
|
||||
return 2;
|
||||
}
|
||||
}
|
|
@ -14,13 +14,11 @@ import techreborn.tiles.generator.TileWindMill;
|
|||
/**
|
||||
* Created by modmuss50 on 25/02/2016.
|
||||
*/
|
||||
public class BlockWindMill extends BaseTileBlock implements ITexturedBlock
|
||||
{
|
||||
public class BlockWindMill extends BaseTileBlock implements ITexturedBlock {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/generators/";
|
||||
|
||||
public BlockWindMill()
|
||||
{
|
||||
public BlockWindMill() {
|
||||
super(Material.IRON);
|
||||
setUnlocalizedName("techreborn.windmill");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -29,29 +27,24 @@ public class BlockWindMill extends BaseTileBlock implements ITexturedBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileWindMill();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState state, EnumFacing side)
|
||||
{
|
||||
public String getTextureNameFromState(IBlockState state, EnumFacing side) {
|
||||
boolean isActive = false;
|
||||
if (side == EnumFacing.UP)
|
||||
{
|
||||
if (side == EnumFacing.UP) {
|
||||
return prefix + "generator_machine_bottom";// + (isActive ? "on" :
|
||||
// "off");
|
||||
} else if (side == EnumFacing.DOWN)
|
||||
{
|
||||
// "off");
|
||||
} else if (side == EnumFacing.DOWN) {
|
||||
return prefix + "generator_machine_bottom";
|
||||
}
|
||||
return prefix + "solar_panel_side_" + (isActive ? "on" : "off");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates()
|
||||
{
|
||||
public int amountOfStates() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package techreborn.blocks.iron_machines;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -18,68 +15,61 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileAlloyFurnace;
|
||||
|
||||
public class BlockAlloyFurnace extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockAlloyFurnace extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/iron_machines/";
|
||||
|
||||
public BlockAlloyFurnace(Material material)
|
||||
{
|
||||
public BlockAlloyFurnace(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.alloyfurnace");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileAlloyFurnace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.alloyFurnaceID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
items.add(new ItemStack(this));
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "alloy_furnace_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "alloy_furnace_front_on";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + "iron_machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "iron_machine_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "iron_machine_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package techreborn.blocks.iron_machines;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -22,36 +18,35 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileIronFurnace;
|
||||
|
||||
public class BlockIronFurnace extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockIronFurnace extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/iron_machines/";
|
||||
|
||||
public BlockIronFurnace()
|
||||
{
|
||||
public BlockIronFurnace() {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.ironfurnace");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileIronFurnace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.ironFurnace, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
items.add(new ItemStack(this));
|
||||
return items;
|
||||
|
@ -59,10 +54,8 @@ public class BlockIronFurnace extends BlockMachineBase implements IRotationTextu
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
|
||||
{
|
||||
if (this.isActive(state))
|
||||
{
|
||||
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
|
||||
if (this.isActive(state)) {
|
||||
EnumFacing enumfacing = state.getValue(FACING);
|
||||
double d0 = (double) pos.getX() + 0.5D;
|
||||
double d1 = (double) pos.getY() + rand.nextDouble() * 6.0D / 16.0D;
|
||||
|
@ -70,58 +63,52 @@ public class BlockIronFurnace extends BlockMachineBase implements IRotationTextu
|
|||
double d3 = 0.52D;
|
||||
double d4 = rand.nextDouble() * 0.6D - 0.3D;
|
||||
|
||||
switch (enumfacing)
|
||||
{
|
||||
switch (enumfacing) {
|
||||
case WEST:
|
||||
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D,
|
||||
new int[0]);
|
||||
new int[0]);
|
||||
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
break;
|
||||
case EAST:
|
||||
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D,
|
||||
new int[0]);
|
||||
new int[0]);
|
||||
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
break;
|
||||
case NORTH:
|
||||
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D,
|
||||
new int[0]);
|
||||
new int[0]);
|
||||
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
break;
|
||||
case SOUTH:
|
||||
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D,
|
||||
new int[0]);
|
||||
new int[0]);
|
||||
worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "iron_furnace_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "iron_furnace_front_on";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + "iron_machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "iron_machine_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "iron_machine_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,60 +11,51 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileAssemblingMachine;
|
||||
|
||||
public class BlockAssemblingMachine extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
public class BlockAssemblingMachine extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockAssemblingMachine(Material material)
|
||||
{
|
||||
public BlockAssemblingMachine(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.assemblingmachine");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileAssemblingMachine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.assemblingmachineID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "assembling_machine_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "assembling_machine_front_on";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + "machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "machine_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "assembling_machine_top";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,60 +11,51 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileChargeBench;
|
||||
|
||||
public class BlockChargeBench extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
public class BlockChargeBench extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockChargeBench(Material material)
|
||||
{
|
||||
public BlockChargeBench(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.chargebench");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileChargeBench();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.chargeBench, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "chargeBench_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "chargeBench_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + "chargeBench_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "chargeBench_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "chargeBench_side";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,60 +11,51 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileChemicalReactor;
|
||||
|
||||
public class BlockChemicalReactor extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
public class BlockChemicalReactor extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockChemicalReactor(Material material)
|
||||
{
|
||||
public BlockChemicalReactor(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.chemicalreactor");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileChemicalReactor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.chemicalReactorID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "chemical_reactor_side_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "chemical_reactor_side_on";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + "machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "machine_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "chemical_reactor_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,54 +11,46 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileChunkLoader;
|
||||
|
||||
public class BlockChunkLoader extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockChunkLoader extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockChunkLoader(Material material)
|
||||
{
|
||||
public BlockChunkLoader(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.chunkloader");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileChunkLoader();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.chunkloaderID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "industrial_chunk_loader_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "industrial_chunk_loader_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "machine_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "machine_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,60 +11,51 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileMatterFabricator;
|
||||
|
||||
public class BlockMatterFabricator extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockMatterFabricator extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockMatterFabricator(Material material)
|
||||
{
|
||||
public BlockMatterFabricator(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.matterfabricator");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileMatterFabricator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.matterfabID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAdvanced()
|
||||
{
|
||||
public boolean isAdvanced() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return isActive ? prefix + "matter_fabricator_on" : prefix + "matter_fabricator_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return isActive ? prefix + "matter_fabricator_on" : prefix + "matter_fabricator_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return isActive ? prefix + "matter_fabricator_on" : prefix + "matter_fabricator_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return isActive ? prefix + "matter_fabricator_on" : prefix + "matter_fabricator_off";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,54 +11,46 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileRollingMachine;
|
||||
|
||||
public class BlockRollingMachine extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockRollingMachine extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockRollingMachine(Material material)
|
||||
{
|
||||
public BlockRollingMachine(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.rollingmachine");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileRollingMachine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.rollingMachineID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return isActive ? prefix + "rolling_machine_side_on" : prefix + "rolling_machine_side_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "machine_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "machine_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,62 +11,52 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileScrapboxinator;
|
||||
|
||||
public class BlockScrapboxinator extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
public class BlockScrapboxinator extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockScrapboxinator(Material material)
|
||||
{
|
||||
public BlockScrapboxinator(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.scrapboxinator");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileScrapboxinator();
|
||||
}
|
||||
|
||||
@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())
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking()) {
|
||||
player.openGui(Core.INSTANCE, GuiHandler.scrapboxinatorID, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "scrapboxinator_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "scrapboxinator_front_on";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + "machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "machine_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "machine_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -17,13 +16,11 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.multiblock.TileVacuumFreezer;
|
||||
|
||||
public class BlockVacuumFreezer extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
public class BlockVacuumFreezer extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/greg_machines/";
|
||||
|
||||
public BlockVacuumFreezer(Material material)
|
||||
{
|
||||
public BlockVacuumFreezer(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.vacuumfreezer");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -34,36 +31,32 @@ public class BlockVacuumFreezer extends BlockMachineBase implements IAdvancedRot
|
|||
return new TileVacuumFreezer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!player.isSneaking()) {
|
||||
player.openGui(Core.INSTANCE, GuiHandler.vacuumFreezerID, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!player.isSneaking()) {
|
||||
player.openGui(Core.INSTANCE, GuiHandler.vacuumFreezerID, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
@Override
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "vacuum_freezer_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "vacuum_freezer_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "machine_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,23 +13,20 @@ import techreborn.tiles.TileAesu;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockAESU extends BlockEnergyStorage
|
||||
{
|
||||
public BlockAESU()
|
||||
{
|
||||
public class BlockAESU extends BlockEnergyStorage {
|
||||
public BlockAESU() {
|
||||
super("AESU", GuiHandler.aesuID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileAesu();
|
||||
}
|
||||
|
||||
@Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
ArrayList<ItemStack> list = new ArrayList<>();
|
||||
list.add(new ItemStack(ModBlocks.machineframe, 1 , 2));
|
||||
list.add(new ItemStack(ModBlocks.machineframe, 1, 2));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,21 +15,18 @@ import java.util.List;
|
|||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
public class BlockBatBox extends BlockEnergyStorage
|
||||
{
|
||||
public BlockBatBox()
|
||||
{
|
||||
public class BlockBatBox extends BlockEnergyStorage {
|
||||
public BlockBatBox() {
|
||||
super("Batbox", GuiHandler.batboxID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileBatBox();
|
||||
}
|
||||
|
||||
@Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
ArrayList<ItemStack> list = new ArrayList<>();
|
||||
list.add(new ItemStack(this));
|
||||
return list;
|
||||
|
|
|
@ -3,48 +3,35 @@ package techreborn.blocks.storage;
|
|||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterators;
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDynamicLiquid;
|
||||
import net.minecraft.block.BlockStaticLiquid;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyDirection;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidBase;
|
||||
import reborncore.common.BaseTileBlock;
|
||||
import reborncore.common.blocks.IRotationTexture;
|
||||
import techreborn.Core;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Created by Rushmead
|
||||
*/
|
||||
public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotationTexture, ITexturedBlock
|
||||
{
|
||||
public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotationTexture, ITexturedBlock {
|
||||
public static PropertyDirection FACING = PropertyDirection.create("facing", Facings.ALL);
|
||||
protected final String prefix = "techreborn:blocks/machine/storage/";
|
||||
public String name;
|
||||
public int guiID;
|
||||
|
||||
public BlockEnergyStorage(String name, int guiID)
|
||||
{
|
||||
public BlockEnergyStorage(String name, int guiID) {
|
||||
super(Material.ROCK);
|
||||
setHardness(2f);
|
||||
setUnlocalizedName("techreborn." + name.toLowerCase());
|
||||
|
@ -56,149 +43,116 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand,
|
||||
ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, guiID, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
protected BlockStateContainer createBlockState() {
|
||||
FACING = PropertyDirection.create("facing", Facings.ALL);
|
||||
return new BlockStateContainer(this, FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
|
||||
ItemStack stack)
|
||||
{
|
||||
ItemStack stack) {
|
||||
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
|
||||
EnumFacing facing = placer.getHorizontalFacing().getOpposite();
|
||||
if (placer.rotationPitch < -50)
|
||||
{
|
||||
if (placer.rotationPitch < -50) {
|
||||
facing = EnumFacing.DOWN;
|
||||
} else if (placer.rotationPitch > 50)
|
||||
{
|
||||
} else if (placer.rotationPitch > 50) {
|
||||
facing = EnumFacing.UP;
|
||||
}
|
||||
setFacing(facing, worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int facingInt = getSideFromEnum(state.getValue(FACING));
|
||||
return facingInt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
EnumFacing facing = getSideFromint(meta);
|
||||
return this.getDefaultState().withProperty(FACING, facing);
|
||||
}
|
||||
|
||||
public void setFacing(EnumFacing facing, World world, BlockPos pos)
|
||||
{
|
||||
public void setFacing(EnumFacing facing, World world, BlockPos pos) {
|
||||
world.setBlockState(pos, world.getBlockState(pos).withProperty(FACING, facing));
|
||||
}
|
||||
|
||||
public EnumFacing getSideFromint(int i)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
public EnumFacing getSideFromint(int i) {
|
||||
if (i == 0) {
|
||||
return EnumFacing.NORTH;
|
||||
} else if (i == 1)
|
||||
{
|
||||
} else if (i == 1) {
|
||||
return EnumFacing.SOUTH;
|
||||
} else if (i == 2)
|
||||
{
|
||||
} else if (i == 2) {
|
||||
return EnumFacing.EAST;
|
||||
} else if (i == 3)
|
||||
{
|
||||
} else if (i == 3) {
|
||||
return EnumFacing.WEST;
|
||||
} else if (i == 4)
|
||||
{
|
||||
} else if (i == 4) {
|
||||
return EnumFacing.UP;
|
||||
} else if (i == 5)
|
||||
{
|
||||
} else if (i == 5) {
|
||||
return EnumFacing.DOWN;
|
||||
}
|
||||
return EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
public int getSideFromEnum(EnumFacing facing)
|
||||
{
|
||||
if (facing == EnumFacing.NORTH)
|
||||
{
|
||||
public int getSideFromEnum(EnumFacing facing) {
|
||||
if (facing == EnumFacing.NORTH) {
|
||||
return 0;
|
||||
} else if (facing == EnumFacing.SOUTH)
|
||||
{
|
||||
} else if (facing == EnumFacing.SOUTH) {
|
||||
return 1;
|
||||
} else if (facing == EnumFacing.EAST)
|
||||
{
|
||||
} else if (facing == EnumFacing.EAST) {
|
||||
return 2;
|
||||
} else if (facing == EnumFacing.WEST)
|
||||
{
|
||||
} else if (facing == EnumFacing.WEST) {
|
||||
return 3;
|
||||
} else if (facing == EnumFacing.UP)
|
||||
{
|
||||
} else if (facing == EnumFacing.UP) {
|
||||
return 4;
|
||||
} else if (facing == EnumFacing.DOWN)
|
||||
{
|
||||
} else if (facing == EnumFacing.DOWN) {
|
||||
return 5;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
return prefix + name.toLowerCase() + "_front";
|
||||
public String getFrontOff() {
|
||||
return prefix + name.toLowerCase() + "_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
return prefix + name.toLowerCase() + "_front";
|
||||
public String getFrontOn() {
|
||||
return prefix + name.toLowerCase() + "_front";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
return prefix + name.toLowerCase() + "_side";
|
||||
public String getSide() {
|
||||
return prefix + name.toLowerCase() + "_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
return prefix + name.toLowerCase() + "_top";
|
||||
public String getTop() {
|
||||
return prefix + name.toLowerCase() + "_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + name.toLowerCase() + "_bottom";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState blockState, EnumFacing facing)
|
||||
{
|
||||
if (this instanceof IRotationTexture)
|
||||
{
|
||||
public String getTextureNameFromState(IBlockState blockState, EnumFacing facing) {
|
||||
if (this instanceof IRotationTexture) {
|
||||
IRotationTexture rotationTexture = this;
|
||||
if (getFacing(blockState) == facing)
|
||||
{
|
||||
if (getFacing(blockState) == facing) {
|
||||
return rotationTexture.getFrontOff();
|
||||
}
|
||||
if (facing == EnumFacing.UP)
|
||||
{
|
||||
if (facing == EnumFacing.UP) {
|
||||
return rotationTexture.getTop();
|
||||
}
|
||||
if (facing == EnumFacing.DOWN)
|
||||
{
|
||||
if (facing == EnumFacing.DOWN) {
|
||||
return rotationTexture.getBottom();
|
||||
}
|
||||
return rotationTexture.getSide();
|
||||
|
@ -206,40 +160,33 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
|
|||
return "techreborn:blocks/machine/machine_side";
|
||||
}
|
||||
|
||||
public EnumFacing getFacing(IBlockState state)
|
||||
{
|
||||
public EnumFacing getFacing(IBlockState state) {
|
||||
return state.getValue(FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int amountOfStates()
|
||||
{
|
||||
public int amountOfStates() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
public enum Facings implements Predicate<EnumFacing>,Iterable<EnumFacing>
|
||||
{
|
||||
public enum Facings implements Predicate<EnumFacing>, Iterable<EnumFacing> {
|
||||
ALL;
|
||||
|
||||
public EnumFacing[] facings()
|
||||
{
|
||||
public EnumFacing[] facings() {
|
||||
return new EnumFacing[] { EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST,
|
||||
EnumFacing.UP, EnumFacing.DOWN };
|
||||
EnumFacing.UP, EnumFacing.DOWN };
|
||||
}
|
||||
|
||||
public EnumFacing random(Random rand)
|
||||
{
|
||||
public EnumFacing random(Random rand) {
|
||||
EnumFacing[] aenumfacing = this.facings();
|
||||
return aenumfacing[rand.nextInt(aenumfacing.length)];
|
||||
}
|
||||
|
||||
public boolean apply(EnumFacing p_apply_1_)
|
||||
{
|
||||
public boolean apply(EnumFacing p_apply_1_) {
|
||||
return p_apply_1_ != null;
|
||||
}
|
||||
|
||||
public Iterator<EnumFacing> iterator()
|
||||
{
|
||||
public Iterator<EnumFacing> iterator() {
|
||||
return Iterators.forArray(this.facings());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,41 +9,35 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.idsu.TileIDSU;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockIDSU extends BlockEnergyStorage
|
||||
{
|
||||
public BlockIDSU()
|
||||
{
|
||||
public class BlockIDSU extends BlockEnergyStorage {
|
||||
public BlockIDSU() {
|
||||
super("IDSU", GuiHandler.idsuID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileIDSU();
|
||||
}
|
||||
|
||||
|
||||
@Override public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY,
|
||||
float hitZ, int meta, EntityLivingBase placer)
|
||||
{
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY,
|
||||
float hitZ, int meta, EntityLivingBase placer) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileIDSU)
|
||||
{
|
||||
if (tile instanceof TileIDSU) {
|
||||
((TileIDSU) tile).ownerUdid = placer.getUniqueID().toString();
|
||||
}
|
||||
return this.getDefaultState();
|
||||
}
|
||||
|
||||
@Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
ArrayList<ItemStack> list = new ArrayList<>();
|
||||
list.add(new ItemStack(this, 1 , 2));
|
||||
list.add(new ItemStack(this, 1, 2));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,29 +7,25 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.lesu.TileLesu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockLESU extends BlockEnergyStorage
|
||||
{
|
||||
public BlockLESU()
|
||||
{
|
||||
public class BlockLESU extends BlockEnergyStorage {
|
||||
public BlockLESU() {
|
||||
super("LESU", GuiHandler.lesuID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileLesu();
|
||||
}
|
||||
|
||||
@Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
ArrayList<ItemStack> list = new ArrayList<>();
|
||||
list.add(new ItemStack(this, 1 , 2));
|
||||
list.add(new ItemStack(this, 1, 2));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package techreborn.blocks.storage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -17,78 +14,68 @@ import reborncore.common.blocks.IAdvancedRotationTexture;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.lesu.TileLesuStorage;
|
||||
|
||||
public class BlockLESUStorage extends BlockMachineBase implements IAdvancedRotationTexture
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockLESUStorage extends BlockMachineBase implements IAdvancedRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/storage/";
|
||||
|
||||
public BlockLESUStorage(Material material)
|
||||
{
|
||||
public BlockLESUStorage(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.lesustorage");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack)
|
||||
{
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, player, itemstack);
|
||||
if (world.getTileEntity(new BlockPos(x, y, z)) instanceof TileLesuStorage)
|
||||
{
|
||||
if (world.getTileEntity(new BlockPos(x, y, z)) instanceof TileLesuStorage) {
|
||||
((TileLesuStorage) world.getTileEntity(new BlockPos(x, y, z))).rebuildNetwork();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
if (world.getTileEntity(new BlockPos(x, y, z)) instanceof TileLesuStorage)
|
||||
{
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
if (world.getTileEntity(new BlockPos(x, y, z)) instanceof TileLesuStorage) {
|
||||
((TileLesuStorage) world.getTileEntity(new BlockPos(x, y, z))).removeFromNetwork();
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
items.add(new ItemStack(this));
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileLesuStorage();
|
||||
}
|
||||
|
||||
public boolean shouldConnectToBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
public boolean shouldConnectToBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int meta) {
|
||||
return block == this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFront(boolean isActive)
|
||||
{
|
||||
public String getFront(boolean isActive) {
|
||||
return prefix + "lesu_block";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide(boolean isActive)
|
||||
{
|
||||
public String getSide(boolean isActive) {
|
||||
return prefix + "lesu_block";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop(boolean isActive)
|
||||
{
|
||||
public String getTop(boolean isActive) {
|
||||
return prefix + "lesu_block";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom(boolean isActive)
|
||||
{
|
||||
public String getBottom(boolean isActive) {
|
||||
return prefix + "lesu_block";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,23 +16,20 @@ import java.util.List;
|
|||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
public class BlockMFE extends BlockEnergyStorage
|
||||
{
|
||||
public BlockMFE()
|
||||
{
|
||||
public class BlockMFE extends BlockEnergyStorage {
|
||||
public BlockMFE() {
|
||||
super("MFE", GuiHandler.mfeID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileMFE();
|
||||
}
|
||||
|
||||
@Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
ArrayList<ItemStack> list = new ArrayList<>();
|
||||
list.add(new ItemStack(ModBlocks.machineframe, 1 , 1));
|
||||
list.add(new ItemStack(ModBlocks.machineframe, 1, 1));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,24 +16,21 @@ import java.util.List;
|
|||
/**
|
||||
* Created by modmuss50 on 14/03/2016.
|
||||
*/
|
||||
public class BlockMFSU extends BlockEnergyStorage
|
||||
{
|
||||
public BlockMFSU()
|
||||
{
|
||||
public class BlockMFSU extends BlockEnergyStorage {
|
||||
public BlockMFSU() {
|
||||
super("MFSU", GuiHandler.mfsuID);
|
||||
setHardness(2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileMFSU();
|
||||
}
|
||||
|
||||
@Override public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
{
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
ArrayList<ItemStack> list = new ArrayList<>();
|
||||
list.add(new ItemStack(ModBlocks.machineframe, 1 , 1));
|
||||
list.add(new ItemStack(ModBlocks.machineframe, 1, 1));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,60 +11,51 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileAlloySmelter;
|
||||
|
||||
public class BlockAlloySmelter extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
public class BlockAlloySmelter extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/tier1_machines/";
|
||||
|
||||
public BlockAlloySmelter(Material material)
|
||||
{
|
||||
public BlockAlloySmelter(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.alloysmelter");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
||||
return new TileAlloySmelter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
|
||||
float hitY, float hitZ)
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.alloySmelterID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "electric_alloy_furnace_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "electric_alloy_furnace_front_on";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + "tier1_machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "tier1_machine_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "tier1_machine_bottom";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,62 +11,52 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.teir1.TileCompressor;
|
||||
|
||||
public class BlockCompressor extends BlockMachineBase implements IRotationTexture
|
||||
{
|
||||
public class BlockCompressor extends BlockMachineBase implements IRotationTexture {
|
||||
|
||||
private final String prefix = "techreborn:blocks/machine/tier1_machines/";
|
||||
|
||||
public BlockCompressor(Material material)
|
||||
{
|
||||
public BlockCompressor(Material material) {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.compressor");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileCompressor();
|
||||
}
|
||||
|
||||
@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())
|
||||
{
|
||||
float hitY, float hitZ) {
|
||||
if (!player.isSneaking()) {
|
||||
player.openGui(Core.INSTANCE, GuiHandler.compressorID, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOff()
|
||||
{
|
||||
public String getFrontOff() {
|
||||
return prefix + "compressor_front_off";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrontOn()
|
||||
{
|
||||
public String getFrontOn() {
|
||||
return prefix + "compressor_front_on";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSide()
|
||||
{
|
||||
public String getSide() {
|
||||
return prefix + "tier1_machine_side";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTop()
|
||||
{
|
||||
public String getTop() {
|
||||
return prefix + "tier1_machine_top";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBottom()
|
||||
{
|
||||
public String getBottom() {
|
||||
return prefix + "tier1_machine_bottom";
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue