mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-18 11:29:30 +00:00
Finish weather obelisk functionality and add configs
This commit is contained in:
1 parent
bbd305a0ab
commit
d836f76722
13 files changed
+168
-52
No files matched your search
@@ -255,7 +255,7 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileExperienceOblisk.class, eor);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockExperianceOblisk), eor);
|
||||
|
||||
ObeliskRenderer<TileWeatherObelisk> twr = new ObeliskRenderer<TileWeatherObelisk>(new ItemStack(Items.diamond));
|
||||
ObeliskRenderer<TileWeatherObelisk> twr = new ObeliskRenderer<TileWeatherObelisk>(new ItemStack(EnderIO.itemMaterial, 1, Material.WEATHER_CRYSTAL.ordinal()));
|
||||
BlockWeatherObelisk.renderId = BlockAttractor.renderId;
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileWeatherObelisk.class, twr);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockWeatherObelisk), twr);
|
||||
|
||||
@@ -471,6 +471,8 @@ public class EnderIO {
|
||||
@EventHandler
|
||||
public void load(FMLInitializationEvent event) {
|
||||
|
||||
Config.init();
|
||||
|
||||
instance = this;
|
||||
|
||||
PacketHandler.INSTANCE.registerMessage(MessageTileNBT.class, MessageTileNBT.class, PacketHandler.nextID(), Side.SERVER);
|
||||
|
||||
@@ -15,6 +15,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.Log;
|
||||
import crazypants.enderio.machine.weather.TileWeatherObelisk.WeatherTask;
|
||||
import crazypants.vecmath.VecmathUtil;
|
||||
|
||||
public final class Config {
|
||||
@@ -67,6 +68,7 @@ public final class Config {
|
||||
public static final Section sectionMobConfig = new Section("Mob Config", "mobconfig");
|
||||
public static final Section sectionRailConfig = new Section("Rail", "railconfig");
|
||||
public static final Section sectionEnchantments = new Section("Enchantments", "enchantments");
|
||||
public static final Section sectionWeather = new Section("Weather", "weather");
|
||||
public static final Section sectionMisc = new Section("Misc", "misc");
|
||||
|
||||
public static final double DEFAULT_CONDUIT_SCALE = 0.6;
|
||||
@@ -397,6 +399,13 @@ public final class Config {
|
||||
public static boolean spawnGuardStopAllSlimesDebug = false;
|
||||
public static boolean spawnGuardStopAllSquidSpawning = false;
|
||||
|
||||
public static String weatherObeliskClearItem = "minecraft:cake";
|
||||
public static String weatherObeliskRainItem = "minecraft:water_bucket";
|
||||
public static String weatherObeliskThunderItem = "minecraft:lava_bucket";
|
||||
public static int weatherObeliskClearPower = 1000000;
|
||||
public static int weatherObeliskRainPower = 250000;
|
||||
public static int weatherObeliskThunderPower = 500000;
|
||||
|
||||
//Loot Defaults
|
||||
public static boolean lootDarkSteel = true;
|
||||
public static boolean lootItemConduitProbe = true;
|
||||
@@ -1103,7 +1112,20 @@ public final class Config {
|
||||
"When true slimes wont be allowed to spawn at all. Only added to aid testing in super flat worlds.");
|
||||
spawnGuardStopAllSquidSpawning = config.getBoolean("spawnGuardStopAllSquidSpawning", sectionAttractor.name, spawnGuardStopAllSquidSpawning,
|
||||
"When true no squid will be spawned.");
|
||||
|
||||
|
||||
weatherObeliskClearItem = config.get(sectionWeather.name, "weatherObeliskClearItem", weatherObeliskClearItem,
|
||||
"The item required to set the world to clear weather.").getString();
|
||||
weatherObeliskRainItem = config.get(sectionWeather.name, "weatherObeliskRainItem", weatherObeliskRainItem,
|
||||
"The item required to set the world to rainy weather.").getString();
|
||||
weatherObeliskThunderItem = config.get(sectionWeather.name, "weatherObeliskThunderItem", weatherObeliskThunderItem,
|
||||
"The item required to set the world to thundering weather.").getString();
|
||||
weatherObeliskClearPower = config.get(sectionWeather.name, "weatherObeliskClearPower", weatherObeliskClearPower,
|
||||
"The power required to set the world to clear weather").getInt();
|
||||
weatherObeliskRainPower = config.get(sectionWeather.name, "weatherObeliskRainPower", weatherObeliskRainPower,
|
||||
"The power required to set the world to rainy weather").getInt();
|
||||
weatherObeliskThunderPower = config.get(sectionWeather.name, "weatherObeliskThunderPower", weatherObeliskThunderPower,
|
||||
"The power required to set the world to thundering weather").getInt();
|
||||
|
||||
// Loot Config
|
||||
lootDarkSteel = config.getBoolean("lootDarkSteel", sectionLootConfig.name, lootDarkSteel, "Adds Darksteel Ingots to loot tables");
|
||||
lootItemConduitProbe = config.getBoolean("lootItemConduitProbe", sectionLootConfig.name, lootItemConduitProbe, "Adds ItemConduitProbe to loot tables");
|
||||
@@ -1150,13 +1172,32 @@ public final class Config {
|
||||
"Separates wither and normal skeletons into different entities, enables the powered spawner to treat them differently [EXPERIMENTAL - MAY CAUSE ISSUES WITH OTHER MODS]").getBoolean();
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
WeatherTask.CLEAR.setRequiredItem(getStackForString(weatherObeliskClearItem));
|
||||
WeatherTask.RAIN.setRequiredItem(getStackForString(weatherObeliskRainItem));
|
||||
WeatherTask.STORM.setRequiredItem(getStackForString(weatherObeliskThunderItem));
|
||||
}
|
||||
|
||||
public static void postInit() {
|
||||
for (int i = 0; i < Config.hoeStrings.length; i++) {
|
||||
String[] data = hoeStrings[i].split(":");
|
||||
ItemStack hoe = GameRegistry.findItemStack(data[0], data[1], 1);
|
||||
if (hoe!=null) farmHoes.add(hoe);
|
||||
for (String s : hoeStrings) {
|
||||
ItemStack hoe = getStackForString(s);
|
||||
if(hoe != null) {
|
||||
farmHoes.add(hoe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getStackForString(String s) {
|
||||
String[] nameAndMeta = s.split(";");
|
||||
int meta = nameAndMeta.length == 1 ? 0 : Integer.parseInt(nameAndMeta[1]);
|
||||
String[] data = nameAndMeta[0].split(":");
|
||||
ItemStack stack = GameRegistry.findItemStack(data[0], data[1], 1);
|
||||
if(stack == null) {
|
||||
return null;
|
||||
}
|
||||
stack.setItemDamage(meta);
|
||||
return stack;
|
||||
}
|
||||
|
||||
private Config() {
|
||||
}
|
||||
|
||||
@@ -206,9 +206,8 @@ public class MachineRecipes {
|
||||
ItemStack powerConduit = new ItemStack(EnderIO.itemPowerConduit, 1, 0);
|
||||
ItemStack redstoneConduit = new ItemStack(EnderIO.itemRedstoneConduit, 1, 2);
|
||||
ItemStack mJMonitor = new ItemStack(EnderIO.blockPowerMonitor, 1, 0);
|
||||
GameRegistry
|
||||
.addShapedRecipe(mJMonitor, "sms", "sMs", "sps", 's', electricSteel, 'M', machineChassi, 'm', mJReader, 'p', powerConduit,
|
||||
'r', redstoneConduit);
|
||||
GameRegistry.addShapedRecipe(mJMonitor, "sms", "sMs", "sps", 's', electricSteel, 'M', machineChassi, 'm', mJReader, 'p', powerConduit,
|
||||
'r', redstoneConduit);
|
||||
|
||||
//Enchanter
|
||||
ItemStack enchanter = new ItemStack(EnderIO.blockEnchanter);
|
||||
@@ -235,20 +234,23 @@ public class MachineRecipes {
|
||||
//Attractor
|
||||
ItemStack attractor = new ItemStack(EnderIO.blockAttractor);
|
||||
ItemStack attractorCrystal = new ItemStack(EnderIO.itemMaterial, 1, Material.ATTRACTOR_CRYSTAL.ordinal());
|
||||
GameRegistry
|
||||
.addShapedRecipe(attractor, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', attractorCrystal, 'e', energeticAlloy);
|
||||
GameRegistry.addShapedRecipe(attractor, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', attractorCrystal, 'e', energeticAlloy);
|
||||
|
||||
//Aversion
|
||||
ItemStack aversion = new ItemStack(EnderIO.blockSpawnGuard);
|
||||
ItemStack tormentedEnderman = new ItemStack(EnderIO.blockEndermanSkull, 1, BlockEndermanSkull.SkullType.TORMENTED.ordinal());
|
||||
GameRegistry
|
||||
.addShapedRecipe(aversion, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', tormentedEnderman, 'e', energeticAlloy);
|
||||
GameRegistry.addShapedRecipe(aversion, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', tormentedEnderman, 'e', energeticAlloy);
|
||||
|
||||
//Experience
|
||||
ItemStack xp = new ItemStack(EnderIO.blockExperianceOblisk);
|
||||
ItemStack xpItem = new ItemStack(EnderIO.itemXpTransfer);
|
||||
GameRegistry
|
||||
.addShapedRecipe(xp, " x ", " s ", "sms", 's', soularium, 'm', machineChassi, 'x', xpItem);
|
||||
GameRegistry.addShapedRecipe(xp, " x ", " s ", "sms", 's', soularium, 'm', machineChassi, 'x', xpItem);
|
||||
|
||||
//Weather
|
||||
ItemStack weather = new ItemStack(EnderIO.blockWeatherObelisk);
|
||||
ItemStack weatherItem = new ItemStack(EnderIO.itemMaterial, 1, Material.WEATHER_CRYSTAL.ordinal());
|
||||
GameRegistry.addShapedRecipe(weather, " x ", "ese", "sbs", 'x', weatherItem, 'e', energeticAlloy, 's', soularium, 'b', new ItemStack(EnderIO.blockCapBank,
|
||||
1, CapBankType.getMetaFromType(CapBankType.SIMPLE)));
|
||||
|
||||
ClearConfigRecipe inst = new ClearConfigRecipe();
|
||||
MinecraftForge.EVENT_BUS.register(inst);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package crazypants.enderio.machine.soul;
|
||||
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -1,29 +1,36 @@
|
||||
package crazypants.enderio.machine.weather;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import crazypants.enderio.gui.IAdvancedTooltipProvider;
|
||||
import crazypants.enderio.gui.IResourceTooltipProvider;
|
||||
import crazypants.enderio.gui.IconButtonEIO;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import crazypants.enderio.machine.gui.GuiPoweredMachineBase;
|
||||
import crazypants.enderio.machine.weather.TileWeatherObelisk.Task;
|
||||
import crazypants.enderio.machine.weather.TileWeatherObelisk.WeatherTask;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.waila.IWailaInfoProvider;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
public class GuiWeatherObelisk extends GuiPoweredMachineBase<TileWeatherObelisk> {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation("enderio:textures/gui/weatherObelisk.png");
|
||||
private static final NumberFormat fmt = NumberFormat.getNumberInstance();
|
||||
|
||||
public GuiWeatherObelisk(InventoryPlayer inventory, TileWeatherObelisk tileEntity) {
|
||||
super(tileEntity, new ContainerWeatherObelisk(inventory, tileEntity));
|
||||
|
||||
addProgressTooltip(79, 29, 18, 31);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -33,18 +40,43 @@ public class GuiWeatherObelisk extends GuiPoweredMachineBase<TileWeatherObelisk>
|
||||
int x = (xSize / 2) - (BUTTON_SIZE / 2);
|
||||
int y = 8;
|
||||
|
||||
addButton(new IconButtonEIO(this, 0, x - 30, y, IconEIO.SUN), Task.CLEAR);
|
||||
addButton(new IconButtonEIO(this, 1, x, y, IconEIO.RAIN), Task.RAIN);
|
||||
addButton(new IconButtonEIO(this, 2, x + 30, y, IconEIO.THUNDER), Task.STORM);
|
||||
addButton(new IconButtonEIO(this, 0, x - 30, y, IconEIO.SUN), WeatherTask.CLEAR);
|
||||
addButton(new IconButtonEIO(this, 1, x, y, IconEIO.RAIN), WeatherTask.RAIN);
|
||||
addButton(new IconButtonEIO(this, 2, x + 30, y, IconEIO.THUNDER), WeatherTask.STORM);
|
||||
refreshButtons();
|
||||
}
|
||||
|
||||
private void addButton(IconButtonEIO button, Task task) {
|
||||
private void addButton(IconButtonEIO button, WeatherTask task) {
|
||||
String tt1 = EnumChatFormatting.WHITE + Lang.localize("gui.weather.task." + task.name().toLowerCase(Locale.ENGLISH));
|
||||
String tt2 = EnumChatFormatting.GRAY + String.format(Lang.localize("gui.weather.requireditem"), task.requiredItem.getDisplayName());
|
||||
button.setToolTip(tt1, tt2);
|
||||
String tt2 = EnumChatFormatting.AQUA + String.format(Lang.localize("gui.weather.requireditem"), EnumChatFormatting.WHITE + task.requiredItem().getDisplayName());
|
||||
String tt3 = String.format("%s%s %s%s", EnumChatFormatting.GREEN, fmt.format(task.power), EnumChatFormatting.WHITE, Lang.localize("power.rf"));
|
||||
button.setToolTip(tt1, tt2, tt3);
|
||||
button.onGuiInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
if(getTileEntity().getWorldObj().getTotalWorldTime() % 20 == 0) {
|
||||
refreshButtons();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void refreshButtons() {
|
||||
for (GuiButton button : (List<GuiButton>) buttonList) {
|
||||
WeatherTask[] tasks = WeatherTask.values();
|
||||
if(button.id >= 0 && button.id < tasks.length) {
|
||||
WeatherTask task = WeatherTask.values()[button.id];
|
||||
if(WeatherTask.worldIsState(task, getTileEntity().getWorldObj().getWorldInfo())) {
|
||||
button.enabled = false;
|
||||
} else {
|
||||
button.enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showRecipeButton() {
|
||||
return false;
|
||||
@@ -56,7 +88,7 @@ public class GuiWeatherObelisk extends GuiPoweredMachineBase<TileWeatherObelisk>
|
||||
|
||||
this.drawTexturedModalRect(getGuiLeft(), getGuiTop(), 0, 0, getXSize(), getYSize());
|
||||
|
||||
if(getTileEntity().activeTask != null) {
|
||||
if(shouldRenderProgress() && getTileEntity().activeTask != null) {
|
||||
int barHeight = getTileEntity().getProgressScaled(31);
|
||||
Color color = getTileEntity().activeTask.color;
|
||||
GL11.glColor3f((float) color.getRed() / 255f, (float) color.getGreen() / 255f, (float) color.getBlue() / 255f);
|
||||
@@ -95,7 +127,7 @@ public class GuiWeatherObelisk extends GuiPoweredMachineBase<TileWeatherObelisk>
|
||||
super.actionPerformed(b);
|
||||
if (b.id >= 0 && b.id <= 2) {
|
||||
getTileEntity().startTask(b.id);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketActivateWeather(getTileEntity(), Task.values()[b.id]));
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketActivateWeather(getTileEntity(), WeatherTask.values()[b.id]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ public class PacketActivateWeather extends MessageTileEntity<TileWeatherObelisk>
|
||||
|
||||
int taskid;
|
||||
|
||||
public PacketActivateWeather(TileWeatherObelisk te, TileWeatherObelisk.Task task) {
|
||||
public PacketActivateWeather(TileWeatherObelisk te, TileWeatherObelisk.WeatherTask task) {
|
||||
super(te);
|
||||
this.taskid = task == null ? -1 : task.ordinal();
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.machine.weather.TileWeatherObelisk.Task;
|
||||
import crazypants.enderio.machine.weather.TileWeatherObelisk.WeatherTask;
|
||||
|
||||
public class PacketFinishWeather extends PacketActivateWeather {
|
||||
|
||||
public PacketFinishWeather() {}
|
||||
|
||||
public PacketFinishWeather(TileWeatherObelisk te, Task task) {
|
||||
public PacketFinishWeather(TileWeatherObelisk te, WeatherTask task) {
|
||||
super(te, task);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ public class PacketFinishWeather extends PacketActivateWeather {
|
||||
public IMessage onMessage(PacketFinishWeather message, MessageContext ctx) {
|
||||
TileWeatherObelisk te = message.getTileEntity(EnderIO.proxy.getClientWorld());
|
||||
if(te != null) {
|
||||
te.activateClientParticles(Task.values()[message.taskid]);
|
||||
te.activateClientParticles(WeatherTask.values()[message.taskid]);
|
||||
te.powerUsed = 0;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -4,35 +4,38 @@ import java.awt.Color;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntitySmokeFX;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.storage.WorldInfo;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.AbstractPowerConsumerEntity;
|
||||
import crazypants.enderio.machine.SlotDefinition;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.power.BasicCapacitor;
|
||||
import crazypants.enderio.power.Capacitors;
|
||||
import crazypants.enderio.power.ICapacitor;
|
||||
|
||||
public class TileWeatherObelisk extends AbstractPowerConsumerEntity {
|
||||
|
||||
enum Task {
|
||||
// TODO placeholder power vals
|
||||
CLEAR(1000, new ItemStack(Items.cake), Color.YELLOW) {
|
||||
public enum WeatherTask {
|
||||
CLEAR(Config.weatherObeliskClearPower, Color.YELLOW) {
|
||||
@Override
|
||||
void complete(TileEntity te) {
|
||||
rain(te, false);
|
||||
thunder(te, false);
|
||||
}
|
||||
},
|
||||
RAIN(1000, new ItemStack(Items.water_bucket), new Color(120, 120, 255)) {
|
||||
RAIN(Config.weatherObeliskRainPower, new Color(120, 120, 255)) {
|
||||
@Override
|
||||
void complete(TileEntity te) {
|
||||
rain(te, true);
|
||||
thunder(te, false);
|
||||
}
|
||||
},
|
||||
STORM(1000, new ItemStack(Items.lava_bucket), Color.DARK_GRAY) {
|
||||
STORM(Config.weatherObeliskThunderPower, Color.DARK_GRAY) {
|
||||
@Override
|
||||
void complete(TileEntity te) {
|
||||
rain(te, true);
|
||||
@@ -41,12 +44,11 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity {
|
||||
};
|
||||
|
||||
final int power;
|
||||
final ItemStack requiredItem;
|
||||
private ItemStack requiredItem;
|
||||
final Color color;
|
||||
|
||||
Task(int power, ItemStack requiredItem, Color color) {
|
||||
WeatherTask(int power, Color color) {
|
||||
this.power = power;
|
||||
this.requiredItem = requiredItem;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@@ -63,16 +65,35 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity {
|
||||
boolean isValid(ItemStack item) {
|
||||
return item != null && ItemStack.areItemStacksEqual(item, this.requiredItem);
|
||||
}
|
||||
|
||||
public ItemStack requiredItem() {
|
||||
return requiredItem;
|
||||
}
|
||||
|
||||
public void setRequiredItem(ItemStack item) {
|
||||
this.requiredItem = item;
|
||||
}
|
||||
|
||||
public static boolean worldIsState(WeatherTask task, WorldInfo world) {
|
||||
if(world.isRaining()) {
|
||||
return world.isThundering() ? task == STORM : task == RAIN;
|
||||
}
|
||||
return task == CLEAR;
|
||||
}
|
||||
}
|
||||
|
||||
int powerUsed = 0;
|
||||
Task activeTask = null;
|
||||
WeatherTask activeTask = null;
|
||||
|
||||
private Color particleColor;
|
||||
private boolean canBeActive = true;
|
||||
|
||||
|
||||
private static int biggestPowerReq = Math.max(Math.max(Config.weatherObeliskClearPower, Config.weatherObeliskThunderPower), Config.weatherObeliskRainPower);
|
||||
private static final BasicCapacitor cap = new BasicCapacitor(biggestPowerReq / 25, biggestPowerReq);
|
||||
|
||||
public TileWeatherObelisk() {
|
||||
super(new SlotDefinition(1, 0, 0));
|
||||
setCapacitor(Capacitors.ACTIVATED_CAPACITOR);
|
||||
}
|
||||
|
||||
public void updateEntity() {
|
||||
@@ -100,7 +121,7 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity {
|
||||
|
||||
@Override
|
||||
protected boolean isMachineItemValidForSlot(int i, ItemStack itemstack) {
|
||||
for (Task task : Task.values()) {
|
||||
for (WeatherTask task : WeatherTask.values()) {
|
||||
if(task.isValid(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
@@ -118,6 +139,11 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity {
|
||||
return isActive() ? (float) powerUsed / (float) activeTask.power : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICapacitor getCapacitor() {
|
||||
return cap;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean processTasks(boolean redstoneCheckPassed) {
|
||||
boolean res = false;
|
||||
@@ -134,7 +160,7 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity {
|
||||
if(isActive()) {
|
||||
if(getEnergyStored() > getPowerUsePerTick()) {
|
||||
int remaining = activeTask.power - powerUsed;
|
||||
int toUse = Math.min(remaining, getPowerUsePerTick());
|
||||
int toUse = Math.min(remaining, getPowerUsePerTick() / 8);
|
||||
setEnergyStored(getEnergyStored() - toUse);
|
||||
powerUsed += toUse;
|
||||
res = true;
|
||||
@@ -155,7 +181,7 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity {
|
||||
public void startTask(int taskid) {
|
||||
if(activeTask == null && taskid >= 0) {
|
||||
powerUsed = 0;
|
||||
Task task = Task.values()[taskid];
|
||||
WeatherTask task = WeatherTask.values()[taskid];
|
||||
if(task.isValid(inventory[slotDefinition.minInputSlot])) {
|
||||
activeTask = task;
|
||||
decrStackSize(slotDefinition.minInputSlot, 1);
|
||||
@@ -169,7 +195,7 @@ public class TileWeatherObelisk extends AbstractPowerConsumerEntity {
|
||||
|
||||
private int activeParticleTicks = 0;
|
||||
|
||||
public void activateClientParticles(Task task) {
|
||||
public void activateClientParticles(WeatherTask task) {
|
||||
activeParticleTicks = 20;
|
||||
particleColor = task.color;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,8 @@ public enum Material {
|
||||
VIBRANT_CYSTAL("vibrantCrystal", true),
|
||||
DRAK_GRINDING_BALL("darkGrindingBall"),
|
||||
ENDER_CRYSTAL("enderCrystal", true),
|
||||
ATTRACTOR_CRYSTAL("attractorCrystal", true);
|
||||
ATTRACTOR_CRYSTAL("attractorCrystal", true),
|
||||
WEATHER_CRYSTAL("weatherCrystal", true);
|
||||
|
||||
public final String unlocalisedName;
|
||||
public final String iconKey;
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
package crazypants.enderio.material;
|
||||
|
||||
import static crazypants.enderio.EnderIO.itemBasicCapacitor;
|
||||
import static crazypants.util.OreDictionaryHelper.INGOT_TIN;
|
||||
import static crazypants.util.OreDictionaryHelper.hasCopper;
|
||||
import static crazypants.util.OreDictionaryHelper.hasEnderPearlDust;
|
||||
import static crazypants.util.OreDictionaryHelper.hasTin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -9,16 +15,12 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.weather.TileWeatherObelisk.WeatherTask;
|
||||
import crazypants.util.OreDictionaryHelper;
|
||||
import static crazypants.enderio.EnderIO.itemBasicCapacitor;
|
||||
|
||||
import static crazypants.util.OreDictionaryHelper.INGOT_TIN;
|
||||
import static crazypants.util.OreDictionaryHelper.hasCopper;
|
||||
import static crazypants.util.OreDictionaryHelper.hasEnderPearlDust;
|
||||
import static crazypants.util.OreDictionaryHelper.hasTin;
|
||||
|
||||
|
||||
public class MaterialRecipes {
|
||||
@@ -171,6 +173,11 @@ public class MaterialRecipes {
|
||||
GameRegistry.addShapedRecipe(enderCapacitor, " e ", "cgc", " e ", 'e', phasedGold, 'c', activatedCapacitor, 'g', Blocks.glowstone);
|
||||
}
|
||||
|
||||
// Weather Crystal
|
||||
ItemStack main = Config.useHardRecipes ? new ItemStack(EnderIO.itemMaterial, 1, Material.VIBRANT_CYSTAL.ordinal()) : new ItemStack(Items.diamond);
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(EnderIO.itemMaterial, 1, Material.WEATHER_CRYSTAL.ordinal()), main, WeatherTask.CLEAR
|
||||
.requiredItem(), WeatherTask.RAIN.requiredItem(), WeatherTask.STORM.requiredItem()));
|
||||
|
||||
if(Config.reinforcedObsidianEnabled) {
|
||||
ItemStack reinfObs = new ItemStack(EnderIO.blockReinforcedObsidian);
|
||||
ItemStack corners = darkSteel;
|
||||
|
||||
Reference in new issue
Block a user