mirror of
https://github.com/GTNewHorizons/WirelessCraftingTerminal.git
synced 2026-11-19 11:49:18 +00:00
1 parent
bc922551c5
commit
2b5b5f3d81
31 files changed
+679
-663
No files matched your search
@@ -1,160 +0,0 @@
|
||||
package net.p455w0rd.wirelesscraftingterminal.api.recipes.game;
|
||||
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.MissingIngredientError;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.RegistrationError;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.recipes.IIngredient;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ShapelessRecipe implements IRecipe, IRecipeBakeable
|
||||
{
|
||||
|
||||
private final ArrayList<Object> input = new ArrayList<Object>();
|
||||
private ItemStack output = null;
|
||||
private boolean disable = false;
|
||||
|
||||
public ShapelessRecipe( final ItemStack result, final Object... recipe )
|
||||
{
|
||||
this.output = result.copy();
|
||||
for( final Object in : recipe )
|
||||
{
|
||||
if( in instanceof IIngredient )
|
||||
{
|
||||
this.input.add( in );
|
||||
}
|
||||
else
|
||||
{
|
||||
final StringBuilder ret = new StringBuilder( "Invalid shapeless ore recipe: " );
|
||||
for( final Object tmp : recipe )
|
||||
{
|
||||
ret.append( tmp ).append( ", " );
|
||||
}
|
||||
ret.append( this.output );
|
||||
throw new IllegalArgumentException( ret.toString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return !this.disable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches( final InventoryCrafting var1, final World world )
|
||||
{
|
||||
if( this.disable )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final ArrayList<Object> required = new ArrayList<Object>( this.input );
|
||||
|
||||
for( int x = 0; x < var1.getSizeInventory(); x++ )
|
||||
{
|
||||
final ItemStack slot = var1.getStackInSlot( x );
|
||||
|
||||
if( slot != null )
|
||||
{
|
||||
boolean inRecipe = false;
|
||||
|
||||
for( final Object next : required )
|
||||
{
|
||||
boolean match = false;
|
||||
|
||||
if( next instanceof IIngredient )
|
||||
{
|
||||
try
|
||||
{
|
||||
for( final ItemStack item : ( (IIngredient) next ).getItemStackSet() )
|
||||
{
|
||||
match = match || this.checkItemEquals( item, slot );
|
||||
}
|
||||
}
|
||||
catch( final RegistrationError e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
catch( final MissingIngredientError e )
|
||||
{
|
||||
// :P
|
||||
}
|
||||
}
|
||||
|
||||
if( match )
|
||||
{
|
||||
inRecipe = true;
|
||||
required.remove( next );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !inRecipe )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return required.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult( final InventoryCrafting var1 )
|
||||
{
|
||||
return this.output.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return this.input.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return this.output;
|
||||
}
|
||||
|
||||
private boolean checkItemEquals( final ItemStack target, final ItemStack input )
|
||||
{
|
||||
return( target.getItem() == input.getItem() && ( target.getItemDamage() == OreDictionary.WILDCARD_VALUE || target.getItemDamage() == input.getItemDamage() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the input for this recipe, any mod accessing this value should never manipulate the values in this array
|
||||
* as it will effect the recipe itself.
|
||||
*
|
||||
* @return The recipes input vales.
|
||||
*/
|
||||
public ArrayList<Object> getInput()
|
||||
{
|
||||
return this.input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bake() throws RegistrationError
|
||||
{
|
||||
try
|
||||
{
|
||||
this.disable = false;
|
||||
for( final Object o : this.input )
|
||||
{
|
||||
if( o instanceof IIngredient )
|
||||
{
|
||||
( (IIngredient) o ).bake();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( final MissingIngredientError e )
|
||||
{
|
||||
this.disable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,38 +8,46 @@ import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.widgets.WCTGuiButton;
|
||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.widgets.WCTGuiCheckBox;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerMagnet;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMagnetFilterMode;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMagnetFilter;
|
||||
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
||||
|
||||
public class GuiMagnet extends GuiContainer {
|
||||
|
||||
private GuiButton modeBtn;
|
||||
public static boolean mode = true;
|
||||
private WCTGuiButton modeBtn;
|
||||
public boolean mode = true;
|
||||
public boolean ignoreNBT = false;
|
||||
public boolean ignoreMeta = false;
|
||||
public boolean useOreDict = false;
|
||||
private ItemStack magnetItem;
|
||||
private WCTGuiCheckBox ignoreNBTBox;
|
||||
private WCTGuiCheckBox ignoreMetaBox;
|
||||
private WCTGuiCheckBox useOreDictBox;
|
||||
|
||||
public GuiMagnet(ContainerMagnet c) {
|
||||
super(c);
|
||||
this.xSize = 176;
|
||||
this.width = this.xSize;
|
||||
this.ySize = 168;
|
||||
this.ySize = 208;
|
||||
this.height = this.ySize;
|
||||
magnetItem = c.heldItem;
|
||||
GuiMagnet.mode = getMode();
|
||||
this.magnetItem = c.magnetItem;
|
||||
this.loadSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
bindTexture("magnetfilter.png");
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 168);
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 208);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
this.mc.fontRenderer.drawString(LocaleHandler.MagnetFilterTitle.getLocal(), 7, 5, 4210752);
|
||||
this.mc.fontRenderer.drawString(I18n.format("container.inventory"), 7, 74, 4210752);
|
||||
this.mc.fontRenderer.drawString(I18n.format("container.inventory"), 7, 114, 4210752);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -47,38 +55,95 @@ public class GuiMagnet extends GuiContainer {
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.buttonList.clear();
|
||||
this.buttonList.add(this.modeBtn = new GuiButton(1, this.guiLeft + 108, this.guiTop + 3, 60, 10, getLabel(GuiMagnet.mode)));
|
||||
this.buttonList.add(this.modeBtn = new WCTGuiButton(0, this.guiLeft + 104, this.guiTop + 4, 64, 14, getLabel(this.mode)));
|
||||
this.buttonList.add(this.ignoreNBTBox = new WCTGuiCheckBox(1, this.guiLeft + 61, this.guiTop + 20, "Ignore NBT Data", this.ignoreNBT, 107));
|
||||
this.buttonList.add(this.ignoreMetaBox = new WCTGuiCheckBox(2, this.guiLeft + 61, this.guiTop + 32, "Ignore Meta Data", this.ignoreMeta, 107));
|
||||
this.buttonList.add(this.useOreDictBox = new WCTGuiCheckBox(3, this.guiLeft + 61, this.guiTop + 44, "Use Ore Dictionary", this.useOreDict, 107));
|
||||
}
|
||||
|
||||
|
||||
String getLabel(boolean filterMode) {
|
||||
return filterMode ? "Whitelisting" : "Blacklisting";
|
||||
}
|
||||
|
||||
private void loadSettings() {
|
||||
if (magnetItem == null) {
|
||||
return;
|
||||
}
|
||||
if (!magnetItem.hasTagCompound()) {
|
||||
NetworkHandler.instance.sendToServer(new PacketMagnetFilter(0, false));
|
||||
}
|
||||
this.mode = getMode(1);
|
||||
this.ignoreNBT = getMode(2);
|
||||
this.ignoreMeta = getMode(3);
|
||||
this.useOreDict = getMode(4);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn == this.modeBtn) {
|
||||
btn.displayString = getLabel(!GuiMagnet.mode);
|
||||
GuiMagnet.mode = !GuiMagnet.mode;
|
||||
setMode(GuiMagnet.mode);
|
||||
btn.displayString = getLabel(!this.mode);
|
||||
this.mode = !this.mode;
|
||||
updateMode(1, this.mode);
|
||||
}
|
||||
else if (btn == this.ignoreNBTBox) {
|
||||
this.ignoreNBT = !this.ignoreNBT;
|
||||
updateMode(2, this.ignoreNBT);
|
||||
}
|
||||
else if (btn == this.ignoreMetaBox) {
|
||||
this.ignoreMeta = !this.ignoreMeta;
|
||||
updateMode(3, this.ignoreMeta);
|
||||
}
|
||||
else if (btn == this.useOreDictBox) {
|
||||
this.useOreDict = !this.useOreDict;
|
||||
updateMode(4, this.useOreDict);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void setMode(boolean mode) {
|
||||
final PacketMagnetFilterMode p = new PacketMagnetFilterMode(mode);
|
||||
NetworkHandler.instance.sendToServer( p );
|
||||
|
||||
private void updateMode(int type, boolean mode) {
|
||||
NetworkHandler.instance.sendToServer(new PacketMagnetFilter(type, mode));
|
||||
}
|
||||
|
||||
private synchronized boolean getMode() {
|
||||
if (!magnetItem.hasTagCompound()) {
|
||||
NetworkHandler.instance.sendToServer(new PacketMagnetFilterMode(true));
|
||||
}
|
||||
|
||||
private boolean getMode(int type) {
|
||||
NBTTagCompound nbtTC = magnetItem.getTagCompound();
|
||||
if (nbtTC.hasKey("Whitelisting")) {
|
||||
return nbtTC.getBoolean("Whitelisting");
|
||||
if (type == 1) {
|
||||
if (nbtTC.hasKey("Whitelisting")) {
|
||||
return nbtTC.getBoolean("Whitelisting");
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (type == 2) {
|
||||
if (nbtTC.hasKey("IgnoreNBT")) {
|
||||
return nbtTC.getBoolean("IgnoreNBT");
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (type == 3) {
|
||||
if (nbtTC.hasKey("IgnoreMeta")) {
|
||||
return nbtTC.getBoolean("IgnoreMeta");
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (type == 4) {
|
||||
if (nbtTC.hasKey("UseOreDict")) {
|
||||
return nbtTC.getBoolean("UseOreDict");
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void bindTexture(final String file) {
|
||||
final ResourceLocation loc = new ResourceLocation("ae2wct", "textures/gui/" + file);
|
||||
|
||||
+20
-5
@@ -24,6 +24,7 @@ import com.google.common.base.Stopwatch;
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.SearchBoxMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.TerminalStyle;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
@@ -128,6 +129,7 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
|
||||
private GuiImgButton searchBoxSettings;
|
||||
private GuiImgButton clearBtn;
|
||||
private GuiTrashButton trashBtn;
|
||||
private GuiImgButton terminalStyleBox;
|
||||
public boolean devicePowered = false;
|
||||
private boolean isNEIEnabled;
|
||||
private boolean wasTextboxFocused = false;
|
||||
@@ -188,6 +190,10 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
|
||||
final Enum cv = iBtn.getCurrentValue();
|
||||
final Enum next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
|
||||
|
||||
if( btn == this.terminalStyleBox )
|
||||
{
|
||||
AEConfig.instance.settings.putSetting( iBtn.getSetting(), next );
|
||||
}
|
||||
if (btn == this.searchBoxSettings) {
|
||||
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||
}
|
||||
@@ -202,7 +208,7 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
|
||||
|
||||
iBtn.set(next);
|
||||
|
||||
if (next.getClass() == SearchBoxMode.class) {
|
||||
if (next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class) {
|
||||
this.reinitalize();
|
||||
}
|
||||
}
|
||||
@@ -234,8 +240,7 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
|
||||
if (s != null) {
|
||||
if (s.getHasStack()) {
|
||||
containerWCT.trashSlot.clearStack();
|
||||
final PacketEmptyTrash p = new PacketEmptyTrash();
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
NetworkHandler.instance.sendToServer(new PacketEmptyTrash());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -293,6 +298,7 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
|
||||
public void initGui() {
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
this.maxRows = this.getMaxRows();
|
||||
this.perRow = AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ( ( this.width - this.standardSize ) / 18 );
|
||||
this.isNEIEnabled = IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.NEI);
|
||||
int top = isNEIEnabled ? 22 : 0;
|
||||
final int magicNumber = 114 + 1;
|
||||
@@ -317,7 +323,14 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
|
||||
this.getMeSlots().add(new InternalSlotME(this.repo, x + y * this.perRow, this.offsetX + x * 18, 18 + y * 18));
|
||||
}
|
||||
}
|
||||
this.xSize = this.standardSize;
|
||||
if( AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) != TerminalStyle.FULL )
|
||||
{
|
||||
this.xSize = this.standardSize + ( ( this.perRow - 9 ) * 18 );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.xSize = this.standardSize;
|
||||
}
|
||||
super.initGui();
|
||||
|
||||
this.ySize = magicNumber + this.rows * 18 + this.reservedSpace;
|
||||
@@ -354,6 +367,8 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
|
||||
|
||||
this.buttonList.add(this.searchBoxSettings = new GuiImgButton(this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE)));
|
||||
offset += 20;
|
||||
|
||||
this.buttonList.add( this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance.settings.getSetting( Settings.TERMINAL_STYLE ) ) );
|
||||
|
||||
this.searchField = new MEGuiTextField(this.fontRendererObj, SEARCH_X, SEARCH_Y, SEARCH_WIDTH, SEARCH_HEIGHT);
|
||||
|
||||
@@ -404,7 +419,7 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
|
||||
}
|
||||
|
||||
int getMaxRows() {
|
||||
return Integer.MAX_VALUE;
|
||||
return AEConfig.instance.getConfigManager().getSetting( Settings.TERMINAL_STYLE ) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
protected void repositionSlot(final AppEngSlot s) {
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package net.p455w0rd.wirelesscraftingterminal.client.gui.widgets;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class WCTGuiButton extends GuiButton {
|
||||
|
||||
protected static final ResourceLocation buttonTextures = new ResourceLocation("minecraft", "textures/gui/widgets.png");
|
||||
|
||||
public WCTGuiButton(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_)
|
||||
{
|
||||
this(p_i1020_1_, p_i1020_2_, p_i1020_3_, 200, 20, p_i1020_4_);
|
||||
}
|
||||
|
||||
public WCTGuiButton(int p_i1021_1_, int p_i1021_2_, int p_i1021_3_, int p_i1021_4_, int p_i1021_5_, String p_i1021_6_)
|
||||
{
|
||||
super(p_i1021_1_, p_i1021_2_, p_i1021_3_, p_i1021_4_, p_i1021_5_, p_i1021_6_);
|
||||
this.width = 200;
|
||||
this.height = 20;
|
||||
this.enabled = true;
|
||||
this.visible = true;
|
||||
this.id = p_i1021_1_;
|
||||
this.xPosition = p_i1021_2_;
|
||||
this.yPosition = p_i1021_3_;
|
||||
this.width = p_i1021_4_;
|
||||
this.height = p_i1021_5_;
|
||||
this.displayString = p_i1021_6_;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_)
|
||||
{
|
||||
if (this.visible)
|
||||
{
|
||||
FontRenderer fontrenderer = p_146112_1_.fontRenderer;
|
||||
p_146112_1_.getTextureManager().bindTexture(buttonTextures);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height;
|
||||
int k = this.getHoverState(this.field_146123_n);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height);
|
||||
this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height - 2);
|
||||
this.drawTexturedModalRect(this.xPosition + 2, this.yPosition + (this.height - 2), 200 - (this.width - 2), 64 + k * 20, this.width - 2, 2);
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition + (this.height - 1), 200 - this.width, 65 + k * 20, this.width, 1);
|
||||
this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_);
|
||||
int l = 14737632;
|
||||
|
||||
if (packedFGColour != 0)
|
||||
{
|
||||
l = packedFGColour;
|
||||
}
|
||||
else if (!this.enabled)
|
||||
{
|
||||
l = 10526880;
|
||||
}
|
||||
else if (this.field_146123_n)
|
||||
{
|
||||
l = 16777120;
|
||||
}
|
||||
|
||||
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package net.p455w0rd.wirelesscraftingterminal.client.gui.widgets;
|
||||
|
||||
import cpw.mods.fml.client.config.GuiCheckBox;
|
||||
import cpw.mods.fml.client.config.GuiUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
|
||||
public class WCTGuiCheckBox extends GuiCheckBox {
|
||||
|
||||
private boolean isChecked;
|
||||
private int boxWidth;
|
||||
|
||||
public WCTGuiCheckBox(int id, int xPos, int yPos, String displayString, boolean isChecked, int width) {
|
||||
super(id, xPos, yPos, displayString, isChecked);
|
||||
this.isChecked = isChecked;
|
||||
this.boxWidth = 11;
|
||||
this.height = 11;
|
||||
//this.width = this.boxWidth + 2 + Minecraft.getMinecraft().fontRenderer.getStringWidth(displayString);
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY)
|
||||
{
|
||||
if (this.visible)
|
||||
{
|
||||
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.boxWidth && mouseY < this.yPosition + this.height;
|
||||
GuiUtils.drawContinuousTexturedBox(buttonTextures, this.xPosition + (this.width - this.boxWidth), this.yPosition, 0, 46, this.boxWidth, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
|
||||
this.mouseDragged(mc, mouseX, mouseY);
|
||||
int color = 14737632;
|
||||
|
||||
if (!this.enabled)
|
||||
{
|
||||
color = 10526880;
|
||||
}
|
||||
else {
|
||||
color = 4210752;
|
||||
}
|
||||
if (this.isChecked)
|
||||
this.drawCenteredString(mc.fontRenderer, "✔", this.xPosition + (this.width - this.boxWidth) + this.boxWidth / 2 + 1, this.yPosition + 1, 0x00FF00);
|
||||
|
||||
this.drawStringNoShadow(mc.fontRenderer, displayString, xPosition, yPosition + 2, color);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawStringNoShadow(FontRenderer p_73731_1_, String p_73731_2_, int p_73731_3_, int p_73731_4_, int p_73731_5_)
|
||||
{
|
||||
p_73731_1_.drawString(p_73731_2_, p_73731_3_, p_73731_4_, p_73731_5_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(Minecraft p_146116_1_, int p_146116_2_, int p_146116_3_)
|
||||
{
|
||||
if (this.enabled && this.visible && p_146116_2_ >= this.xPosition && p_146116_3_ >= this.yPosition && p_146116_2_ < this.xPosition + this.width && p_146116_3_ < this.yPosition + this.height)
|
||||
{
|
||||
this.isChecked = !this.isChecked;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isChecked()
|
||||
{
|
||||
return this.isChecked;
|
||||
}
|
||||
|
||||
public void setIsChecked(boolean isChecked)
|
||||
{
|
||||
this.isChecked = isChecked;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-2
@@ -39,8 +39,7 @@ public class ContainerCraftAmount extends WCTBaseContainer
|
||||
|
||||
public IGrid getGrid()
|
||||
{
|
||||
final WCTIActionHost h = ( (WCTIActionHost) this.getTarget() );
|
||||
return h.getActionableNode().getGrid();
|
||||
return this.obj2.getTargetGrid();
|
||||
}
|
||||
|
||||
public World getWorld()
|
||||
|
||||
+1
-2
@@ -292,8 +292,7 @@ public class ContainerCraftConfirm extends WCTBaseContainer
|
||||
|
||||
private IGrid getGrid()
|
||||
{
|
||||
final WCTIActionHost h = ( (WCTIActionHost) this.getTarget() );
|
||||
return h.getActionableNode().getGrid();
|
||||
return this.obj2.getTargetGrid();
|
||||
}
|
||||
|
||||
private boolean cpuMatches( final ICraftingCPU c )
|
||||
|
||||
+7
-7
@@ -18,7 +18,7 @@ import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||
public class ContainerMagnet extends Container {
|
||||
|
||||
public final InventoryPlayer inventoryPlayer;
|
||||
public ItemStack heldItem;
|
||||
public ItemStack magnetItem;
|
||||
public WCTInventoryMagnetFilter magnetInventory;
|
||||
private int distributeState = 0;
|
||||
private int pressedKeyInRange = -1;
|
||||
@@ -29,25 +29,25 @@ public class ContainerMagnet extends Container {
|
||||
|
||||
public ContainerMagnet(EntityPlayer player, InventoryPlayer inventoryPlayer) {
|
||||
this.inventoryPlayer = inventoryPlayer;
|
||||
this.heldItem = RandomUtils.getMagnet(inventoryPlayer);
|
||||
this.magnetInventory = new WCTInventoryMagnetFilter(heldItem);
|
||||
|
||||
this.magnetItem = RandomUtils.getMagnet(inventoryPlayer);
|
||||
this.magnetInventory = new WCTInventoryMagnetFilter(magnetItem);
|
||||
this.magnetInventory.setContainer(this);
|
||||
// Add player inventory slots
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new Slot(this.inventoryPlayer, j + i * 9 + 9, j * 18 + 8, 86 + i * 18));
|
||||
this.addSlotToContainer(new Slot(this.inventoryPlayer, j + i * 9 + 9, j * 18 + 8, 126 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
// Add hotbar slots
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new Slot(this.inventoryPlayer, i, i * 18 + 8, 144));
|
||||
this.addSlotToContainer(new Slot(this.inventoryPlayer, i, i * 18 + 8, 184));
|
||||
}
|
||||
|
||||
// Add filter slots
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new SlotMagnetFilter(this.magnetInventory, j + i * 9, j * 18 + 8, 18 + i * 18));
|
||||
this.addSlotToContainer(new SlotMagnetFilter(this.magnetInventory, j + i * 9, j * 18 + 8, 58 + i * 18));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-10
@@ -778,7 +778,7 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Platform.isServer()) {
|
||||
//if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
if (!isInRange()) {
|
||||
if (!isBoosterInstalled() || !Reference.WCT_BOOSTER_ENABLED) {
|
||||
if (this.isValidContainer()) {
|
||||
@@ -802,7 +802,7 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
|
||||
else {
|
||||
this.setPowerMultiplier(AEConfig.instance.wireless_getDrainRate(this.obj.getRange()));
|
||||
}
|
||||
}
|
||||
//}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@@ -914,14 +914,11 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
|
||||
protected boolean networkIsPowered() {
|
||||
final WCTIActionHost host = this.getActionHost();
|
||||
if (host != null) {
|
||||
final IGridNode gn = host.getActionableNode(Reference.WCT_BOOSTER_ENABLED && this.isBoosterInstalled());
|
||||
if (gn != null) {
|
||||
final IGrid g = gn.getGrid();
|
||||
if (g != null) {
|
||||
final IEnergyGrid eg = g.getCache(IEnergyGrid.class);
|
||||
if (eg.isNetworkPowered()) {
|
||||
return true;
|
||||
}
|
||||
final IGrid grid = this.obj.getTargetGrid();
|
||||
if (grid != null) {
|
||||
final IEnergyGrid eg = grid.getCache(IEnergyGrid.class);
|
||||
if (eg.isNetworkPowered()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+32
-23
@@ -21,7 +21,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.networking.security.WCTIActionHost;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.networking.security.WCTPlayerSource;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.guisync.GuiSync;
|
||||
@@ -34,17 +36,18 @@ import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotFake;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotInaccessible;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotPlayerHotBar;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotPlayerInv;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketInventoryAction;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketPartialItem;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
|
||||
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
@@ -69,6 +72,7 @@ public abstract class WCTBaseContainer extends Container {
|
||||
private final TileEntity tileEntity;
|
||||
private final IPart part;
|
||||
public final IGuiItemObject obj;
|
||||
public final WirelessTerminalGuiObject obj2;
|
||||
private final List<PacketPartialItem> dataChunks = new LinkedList<PacketPartialItem>();
|
||||
private final HashMap<Integer, SyncData> syncData = new HashMap<Integer, SyncData>();
|
||||
private boolean isContainerValid = true;
|
||||
@@ -89,10 +93,23 @@ public abstract class WCTBaseContainer extends Container {
|
||||
this.tileEntity = myTile;
|
||||
this.part = myPart;
|
||||
this.obj = gio;
|
||||
EntityPlayer player = ip.player;
|
||||
this.obj2 = getGuiObject(RandomUtils.getWirelessTerm(ip), player, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
this.mySrc = new WCTPlayerSource(ip.player, this.getActionHost());
|
||||
this.prepareSync();
|
||||
}
|
||||
|
||||
protected WirelessTerminalGuiObject getGuiObject(final ItemStack it, final EntityPlayer player, final World w, final int x, final int y, final int z) {
|
||||
if (it != null) {
|
||||
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance().registries().wireless().getWirelessTerminalHandler(it);
|
||||
if (wh != null) {
|
||||
return new WirelessTerminalGuiObject(wh, it, player, w, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected WCTIActionHost getActionHost() {
|
||||
if (this.obj instanceof WCTIActionHost) {
|
||||
return (WCTIActionHost) this.obj;
|
||||
@@ -129,6 +146,9 @@ public abstract class WCTBaseContainer extends Container {
|
||||
this.part = anchor instanceof IPart ? (IPart) anchor : null;
|
||||
this.obj = anchor instanceof IGuiItemObject ? (IGuiItemObject) anchor : null;
|
||||
|
||||
EntityPlayer player = ip.player;
|
||||
this.obj2 = getGuiObject(RandomUtils.getWirelessTerm(ip), player, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
|
||||
if (this.tileEntity == null && this.part == null && this.obj == null) {
|
||||
throw new IllegalArgumentException("Must have a valid anchor, instead " + anchor + " in " + ip);
|
||||
}
|
||||
@@ -245,28 +265,17 @@ public abstract class WCTBaseContainer extends Container {
|
||||
}
|
||||
|
||||
protected boolean hasAccess(final SecurityPermissions perm, final boolean requirePower) {
|
||||
final WCTIActionHost host = this.getActionHost();
|
||||
|
||||
if (host != null) {
|
||||
final IGridNode gn = host.getActionableNode();
|
||||
if (gn != null) {
|
||||
final IGrid g = gn.getGrid();
|
||||
if (g != null) {
|
||||
if (requirePower) {
|
||||
final IEnergyGrid eg = g.getCache(IEnergyGrid.class);
|
||||
if (!eg.isNetworkPowered()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
final ISecurityGrid sg = g.getCache(ISecurityGrid.class);
|
||||
if (sg.hasPermission(this.getInventoryPlayer().player, perm)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
final IGrid grid = this.obj2.getTargetGrid();
|
||||
if (grid != null) {
|
||||
final IEnergyGrid eg = grid.getCache(IEnergyGrid.class);
|
||||
if (!eg.isNetworkPowered()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
final ISecurityGrid sg = grid.getCache(ISecurityGrid.class);
|
||||
if (sg.hasPermission(this.getInventoryPlayer().player, perm)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -281,8 +290,8 @@ public abstract class WCTBaseContainer extends Container {
|
||||
if (this.part != null) {
|
||||
return this.part;
|
||||
}
|
||||
if (this.obj != null) {
|
||||
return this.obj;
|
||||
if (this.obj2 != null) {
|
||||
return this.obj2;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+5
@@ -5,12 +5,14 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerMagnet;
|
||||
|
||||
public class WCTInventoryMagnetFilter implements IInventory {
|
||||
|
||||
private String name = "MagnetFilter";
|
||||
private final ItemStack invItem;
|
||||
private ItemStack[] inventory;
|
||||
private ContainerMagnet container;
|
||||
|
||||
public WCTInventoryMagnetFilter(ItemStack stack) {
|
||||
super();
|
||||
@@ -21,6 +23,8 @@ public class WCTInventoryMagnetFilter implements IInventory {
|
||||
}
|
||||
readFromNBT(stack.getTagCompound());
|
||||
}
|
||||
|
||||
public void setContainer(ContainerMagnet container) { this.container = container; }
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
@@ -90,6 +94,7 @@ public class WCTInventoryMagnetFilter implements IInventory {
|
||||
@Override
|
||||
public void markDirty() {
|
||||
writeNBT(invItem.getTagCompound());
|
||||
container.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -66,7 +66,6 @@ public class RandomUtils {
|
||||
if (playerInv.player.getHeldItem() != null && playerInv.player.getHeldItem().getItem() instanceof ItemMagnet) {
|
||||
return playerInv.player.getHeldItem();
|
||||
}
|
||||
int invSize = playerInv.getSizeInventory();
|
||||
// if not true, try to return first magnet card from first
|
||||
// wireless term that has a MagnetCard installed
|
||||
ItemStack wirelessTerm = getWirelessTerm(playerInv);
|
||||
@@ -82,6 +81,7 @@ public class RandomUtils {
|
||||
}
|
||||
// No wireless crafting terminal with Magnet Card installed,
|
||||
// is there a Magnet Card in the player's inventory?
|
||||
int invSize = playerInv.getSizeInventory();
|
||||
ItemStack magnetItem = null;
|
||||
if (invSize <= 0) {
|
||||
return null;
|
||||
@@ -98,5 +98,39 @@ public class RandomUtils {
|
||||
}
|
||||
return magnetItem;
|
||||
}
|
||||
|
||||
public static boolean isMagnetInitialized(ItemStack magnetItem) {
|
||||
if (magnetItem != null && magnetItem.getItem() instanceof ItemMagnet) {
|
||||
if (magnetItem.hasTagCompound()) {
|
||||
if (magnetItem.getTagCompound().hasKey("Initialized")) {
|
||||
return magnetItem.getTagCompound().getBoolean("Initialized");
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isMagnetInstalled(InventoryPlayer ip) {
|
||||
NBTTagCompound magnetNBTForm = RandomUtils.getWirelessTerm(ip).getTagCompound().getTagList("MagnetSlot", 10).getCompoundTagAt(0);
|
||||
if (magnetNBTForm != null) {
|
||||
ItemStack magnetItem = ItemStack.loadItemStackFromNBT(magnetNBTForm);
|
||||
if (magnetItem != null && magnetItem.getItem() instanceof ItemMagnet) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean readBoolean(ItemStack is, String key) {
|
||||
return (is.hasTagCompound() ? is.getTagCompound().getBoolean(key) : false);
|
||||
}
|
||||
|
||||
public static int readInt(ItemStack is, String key) {
|
||||
return (is.hasTagCompound() ? is.getTagCompound().getInteger(key) : 0);
|
||||
}
|
||||
|
||||
public static ItemStack readStack(NBTTagCompound nbtTC, String key) {
|
||||
return (nbtTC.hasKey(key) ? ItemStack.loadItemStackFromNBT(nbtTC) : null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,14 +12,14 @@ import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketCraftReques
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketEmptyTrash;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketInventoryAction;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMEInventoryUpdate;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMagnetFilterMode;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMagnetFilter;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketNEIRecipe;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketOpenGui;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketPartialItem;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSetJobBytes;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwapSlots;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchGuis;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchMagnetMode;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSetMagnet;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketUpdateCPUInfo;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketValueConfig;
|
||||
|
||||
@@ -43,11 +43,11 @@ public class WCTPacketHandlerBase {
|
||||
|
||||
PACKET_CRAFTING_REQUEST(PacketCraftRequest.class),
|
||||
|
||||
PACKET_MAGNETFILTER_MODE(PacketMagnetFilterMode.class),
|
||||
PACKET_MAGNETFILTER_MODE(PacketMagnetFilter.class),
|
||||
|
||||
PACKET_OPENWIRELESSTERM(PacketOpenGui.class),
|
||||
|
||||
PACKET_SWITCHMAGNETMODE(PacketSwitchMagnetMode.class),
|
||||
PACKET_SWITCHMAGNETMODE(PacketSetMagnet.class),
|
||||
|
||||
PACKET_EMPTY_TRASH(PacketEmptyTrash.class),
|
||||
|
||||
|
||||
+2
-11
@@ -6,17 +6,14 @@ import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftAmount;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.container.ContainerCraftConfirm;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingJob;
|
||||
|
||||
@@ -49,13 +46,7 @@ public class PacketCraftRequest extends WCTPacket {
|
||||
final ContainerCraftAmount cca = (ContainerCraftAmount) player.openContainer;
|
||||
final Object target = cca.getTarget();
|
||||
if (target instanceof IGridHost) {
|
||||
final IGridHost gh = (IGridHost) target;
|
||||
final IGridNode gn = gh.getGridNode(ForgeDirection.UNKNOWN);
|
||||
if (gn == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final IGrid g = gn.getGrid();
|
||||
final IGrid g = cca.obj2.getTargetGrid();
|
||||
if (g == null || cca.getItemToCraft() == null) {
|
||||
return;
|
||||
}
|
||||
@@ -84,7 +75,7 @@ public class PacketCraftRequest extends WCTPacket {
|
||||
if (futureJob != null) {
|
||||
futureJob.cancel(true);
|
||||
}
|
||||
WCTLog.debug(e.getLocalizedMessage());
|
||||
//WCTLog.debug(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
|
||||
|
||||
public class PacketMagnetFilter extends WCTPacket {
|
||||
|
||||
// 0 = initialize
|
||||
// 1 = whitelist/blacklist
|
||||
// 2 = ignore NBT
|
||||
// 3 = ignore meta
|
||||
// 4 = use oredict
|
||||
int whichMode;
|
||||
boolean modeValue;
|
||||
|
||||
public PacketMagnetFilter(final ByteBuf stream) {
|
||||
this.whichMode = stream.readInt();
|
||||
this.modeValue = stream.readBoolean();
|
||||
}
|
||||
|
||||
public PacketMagnetFilter(final int mode, final boolean modeVal) {
|
||||
this.modeValue = modeVal;
|
||||
this.whichMode = mode;
|
||||
final ByteBuf data = Unpooled.buffer();
|
||||
data.writeInt(this.getPacketID());
|
||||
data.writeInt(this.whichMode);
|
||||
data.writeBoolean(this.modeValue);
|
||||
this.configureWrite(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData(final INetworkInfo manager, final WCTPacket packet, final EntityPlayer player) {
|
||||
ItemStack magnetItem = RandomUtils.getMagnet(player.inventory);
|
||||
|
||||
if (!(magnetItem.getItem() instanceof ItemMagnet)) {
|
||||
return;
|
||||
}
|
||||
if (magnetItem != null) {
|
||||
if (!magnetItem.hasTagCompound()) {
|
||||
magnetItem.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
if (this.whichMode == 0) {
|
||||
magnetItem.getTagCompound().setBoolean("Initialized", this.modeValue);
|
||||
}
|
||||
if (this.whichMode == 1) {
|
||||
magnetItem.getTagCompound().setBoolean("Whitelisting", this.modeValue);
|
||||
}
|
||||
else if (this.whichMode == 2) {
|
||||
magnetItem.getTagCompound().setBoolean("IgnoreNBT", this.modeValue);
|
||||
}
|
||||
else if (this.whichMode == 3) {
|
||||
magnetItem.getTagCompound().setBoolean("IgnoreMeta", this.modeValue);
|
||||
}
|
||||
else if (this.whichMode == 4) {
|
||||
magnetItem.getTagCompound().setBoolean("UseOreDict", this.modeValue);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
package net.p455w0rd.wirelesscraftingterminal.core.sync.packets;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiMagnet;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.WCTPacket;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
|
||||
|
||||
public class PacketMagnetFilterMode extends WCTPacket {
|
||||
|
||||
boolean isWhitelisting;
|
||||
|
||||
public PacketMagnetFilterMode(final ByteBuf stream) {
|
||||
this.isWhitelisting = stream.readBoolean();
|
||||
}
|
||||
|
||||
public PacketMagnetFilterMode(final boolean isWhitelisting) {
|
||||
this.isWhitelisting = isWhitelisting;
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
GuiMagnet.mode = this.isWhitelisting;
|
||||
}
|
||||
final ByteBuf data = Unpooled.buffer();
|
||||
data.writeInt(this.getPacketID());
|
||||
data.writeBoolean(this.isWhitelisting);
|
||||
this.configureWrite(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData(final INetworkInfo manager, final WCTPacket packet, final EntityPlayer player) {
|
||||
ItemStack magnetItem = RandomUtils.getMagnet(player.inventory);
|
||||
if (!(magnetItem.getItem() instanceof ItemMagnet)) {
|
||||
return;
|
||||
}
|
||||
if (magnetItem != null) {
|
||||
if (!magnetItem.hasTagCompound()) {
|
||||
magnetItem.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
magnetItem.getTagCompound().setBoolean("Whitelisting", this.isWhitelisting);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientPacketData(final INetworkInfo manager, final WCTPacket packet, final EntityPlayer player) {
|
||||
GuiMagnet.mode = this.isWhitelisting;
|
||||
}
|
||||
}
|
||||
+4
-12
@@ -11,16 +11,16 @@ import net.p455w0rd.wirelesscraftingterminal.core.sync.network.INetworkInfo;
|
||||
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
|
||||
|
||||
public class PacketSwitchMagnetMode extends WCTPacket {
|
||||
public class PacketSetMagnet extends WCTPacket {
|
||||
|
||||
int magnetDamage;
|
||||
|
||||
public PacketSwitchMagnetMode(final ByteBuf stream) {
|
||||
public PacketSetMagnet(final ByteBuf stream) {
|
||||
this.magnetDamage = stream.readInt();
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketSwitchMagnetMode(int itemDamage) {
|
||||
public PacketSetMagnet(int itemDamage) {
|
||||
this.magnetDamage = itemDamage;
|
||||
final ByteBuf data = Unpooled.buffer();
|
||||
|
||||
@@ -38,7 +38,6 @@ public class PacketSwitchMagnetMode extends WCTPacket {
|
||||
if (magnetItem != null) {
|
||||
|
||||
if (magnetItem.getItemDamage() == 2) {
|
||||
//magnetItem.setItemDamage(0);
|
||||
RandomUtils.getWirelessTerm(player.inventory).getTagCompound().getTagList("MagnetSlot", 10).getCompoundTagAt(0).setShort("Damage", (short)0);
|
||||
player.addChatMessage(new ChatComponentText(LocaleHandler.MagnetMode1.getLocal()));
|
||||
}
|
||||
@@ -56,13 +55,6 @@ public class PacketSwitchMagnetMode extends WCTPacket {
|
||||
|
||||
@Override
|
||||
public void clientPacketData(final INetworkInfo network, final WCTPacket packet, final EntityPlayer player) {
|
||||
ItemStack magnetItem = RandomUtils.getMagnet(player.inventory);
|
||||
if (!(magnetItem.getItem() instanceof ItemMagnet)) {
|
||||
return;
|
||||
}
|
||||
if (magnetItem != null) {
|
||||
((ItemMagnet) magnetItem.getItem()).switchMagnetMode(magnetItem, player);
|
||||
//magnetItem.setItemDamage(this.magnetDamage);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ public class ConfigHandler {
|
||||
public static boolean enableEasyMode;
|
||||
public static int ae2wctMaxPower = Reference.WCT_MAX_POWER;
|
||||
public static int boosterDropChance = Reference.WCT_BOOSTER_DROPCHANCE;
|
||||
public static boolean boosterDropsEnabled = Reference.WCT_BOOSTERDROP_ENABLED;
|
||||
private static boolean doSave;
|
||||
public static boolean firstLoad = true;
|
||||
private static int pwrInCfgFile, boosterDropInCfgFile;
|
||||
@@ -48,8 +49,10 @@ public class ConfigHandler {
|
||||
String boosterDesc = LocaleHandler.InfinityBoosterCfgDesc.getLocal();
|
||||
String easyModeDesc = LocaleHandler.EasyModeDesc.getLocal();
|
||||
String boosterDropDesc = LocaleHandler.BoosterDropChance.getLocal();
|
||||
String boosterDropEnabledDesc = LocaleHandler.DisableBoosterDrop.getLocal();
|
||||
enableInfinityBooster = config.getBoolean("enableInfinityBooster", Configuration.CATEGORY_GENERAL, true, boosterDesc);
|
||||
enableEasyMode = config.getBoolean("enableEasyMode", Configuration.CATEGORY_GENERAL, false, easyModeDesc);
|
||||
boosterDropsEnabled = config.getBoolean("boosterDropsEnabled", Configuration.CATEGORY_GENERAL, true, boosterDropEnabledDesc);
|
||||
/*
|
||||
* I did the max power cfg loading like this because while using
|
||||
* Configuration#getInt did enforce the min/max values in-game, it
|
||||
@@ -95,6 +98,7 @@ public class ConfigHandler {
|
||||
Reference.WCT_EASYMODE_ENABLED = enableEasyMode;
|
||||
Reference.WCT_MAX_POWER = ae2wctMaxPower;
|
||||
Reference.WCT_BOOSTER_DROPCHANCE = boosterDropChance;
|
||||
Reference.WCT_BOOSTERDROP_ENABLED = boosterDropsEnabled;
|
||||
|
||||
if (config.hasChanged() || doSave) {
|
||||
config.save();
|
||||
|
||||
@@ -13,12 +13,12 @@ import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.inventory.ContainerPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.p455w0rd.wirelesscraftingterminal.client.gui.GuiWirelessCraftingTerminal;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketOpenGui;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSwitchMagnetMode;
|
||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemMagnet;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketSetMagnet;
|
||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemWirelessCraftingTerminal;
|
||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||
|
||||
@@ -60,14 +60,20 @@ public class KeybindHandler {
|
||||
else if (openMagnetFilter.isPressed()) {
|
||||
ItemStack magnetItem = RandomUtils.getMagnet(p.inventory);
|
||||
//ensure player has a Wireless Crafting Terminal (with Magnet Card Installed) or Magnet Card in their inventory
|
||||
if (magnetItem != null && magnetItem.getItem() instanceof ItemMagnet) {
|
||||
//and that they have manually right=clicked it to initialize it
|
||||
if (RandomUtils.isMagnetInitialized(magnetItem)) {
|
||||
NetworkHandler.instance.sendToServer(new PacketOpenGui(Reference.GUI_MAGNET));
|
||||
}
|
||||
else {
|
||||
p.addChatMessage(new ChatComponentText(LocaleHandler.InitializeMagnet.getLocal()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (changeMagnetMode.isPressed()) {
|
||||
ItemStack magnetItem = RandomUtils.getMagnet(p.inventory);
|
||||
if (magnetItem != null) {
|
||||
NetworkHandler.instance.sendToServer(new PacketSwitchMagnetMode(magnetItem.getItemDamage()));
|
||||
NetworkHandler.instance.sendToServer(new PacketSetMagnet(magnetItem.getItemDamage()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -7,9 +7,9 @@ public enum LocaleHandler {
|
||||
TitleDesc, InfinityBoosterDesc, WirelessTermLabel("gui.labels.ae2wct"),
|
||||
MaxPowerDesc("config.ae2wct"), InfinityBoosterCfgDesc("config.ae2wct"), EasyModeDesc("config.ae2wct"),
|
||||
MagnetDesc, MagnetDesc2, PressShift, OnlyWorks, LinkStatus, Installed, NotInstalled, Active, Inactive,
|
||||
Status, EmptyTrash, EmptyTrashDesc, MagnetFilterTitle, NoNetworkPower("chatmessages.ae2wct"), FilterMode,
|
||||
Status, EmptyTrash, EmptyTrashDesc, MagnetFilterTitle, NoNetworkPower("chatmessages.ae2wct"), InitializeMagnet("chatmessages.ae2wct"), FilterMode,
|
||||
Whitelisting, Blacklisting, MagnetMode1("chatmessages.ae2wct"), MagnetMode2("chatmessages.ae2wct"), MagnetMode3("chatmessages.ae2wct"),
|
||||
MagnetActiveDesc1, MagnetActiveDesc2, BoosterDropChance("config.ae2wct");
|
||||
MagnetActiveDesc1, MagnetActiveDesc2, BoosterDropChance("config.ae2wct"), DisableBoosterDrop("config.ae2wct");
|
||||
|
||||
private final String root;
|
||||
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ import appeng.api.util.IConfigManager;
|
||||
import appeng.container.interfaces.IInventorySlotAware;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
|
||||
public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, IInventorySlotAware, WCTIActionHost {
|
||||
public class WirelessTerminalGuiObject implements IActionHost, IPortableCell, IInventorySlotAware, WCTIActionHost {
|
||||
|
||||
private final ItemStack effectiveItem;
|
||||
private final IWirelessTermHandler wth;
|
||||
|
||||
-247
@@ -1,247 +0,0 @@
|
||||
package net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiCrafting;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.MissingIngredientError;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.exceptions.RegistrationError;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.recipes.IIngredient;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.recipes.game.ShapelessRecipe;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.DefaultOverlayRenderer;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.api.IRecipeOverlayRenderer;
|
||||
import codechicken.nei.api.IStackPositioner;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting" ) );
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void loadCraftingRecipes( final String outputId, final Object... results )
|
||||
{
|
||||
if( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIAEShapelessRecipeHandler.class ) )
|
||||
{
|
||||
final List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for( final IRecipe recipe : recipes )
|
||||
{
|
||||
if( ( recipe instanceof ShapelessRecipe ) )
|
||||
{
|
||||
if( ( (ShapelessRecipe) recipe ).isEnabled() )
|
||||
{
|
||||
final CachedShapelessRecipe cachedRecipe = new CachedShapelessRecipe( (ShapelessRecipe) recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
this.arecipes.add( cachedRecipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.loadCraftingRecipes( outputId, results );
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void loadCraftingRecipes( final ItemStack result )
|
||||
{
|
||||
final List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for( final IRecipe recipe : recipes )
|
||||
{
|
||||
if( ( recipe instanceof ShapelessRecipe ) )
|
||||
{
|
||||
if( ( (ShapelessRecipe) recipe ).isEnabled() && NEIServerUtils.areStacksSameTypeCrafting( recipe.getRecipeOutput(), result ) )
|
||||
{
|
||||
final CachedShapelessRecipe cachedRecipe = new CachedShapelessRecipe( (ShapelessRecipe) recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
this.arecipes.add( cachedRecipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void loadUsageRecipes( final ItemStack ingredient )
|
||||
{
|
||||
final List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for( final IRecipe recipe : recipes )
|
||||
{
|
||||
if( ( recipe instanceof ShapelessRecipe ) )
|
||||
{
|
||||
final CachedShapelessRecipe cachedRecipe = new CachedShapelessRecipe( (ShapelessRecipe) recipe );
|
||||
|
||||
if( ( (ShapelessRecipe) recipe ).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
|
||||
{
|
||||
cachedRecipe.computeVisuals();
|
||||
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
{
|
||||
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient );
|
||||
this.arecipes.add( cachedRecipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture()
|
||||
{
|
||||
return "textures/gui/container/crafting_table.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "crafting";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GuiCrafting.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay( final GuiContainer gui, final Container container, final int recipe )
|
||||
{
|
||||
return ( super.hasOverlay( gui, container, recipe ) ) || ( ( this.isRecipe2x2( recipe ) ) && ( RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer( final GuiContainer gui, final int recipe )
|
||||
{
|
||||
final IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe );
|
||||
if( renderer != null )
|
||||
{
|
||||
return renderer;
|
||||
}
|
||||
|
||||
final IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" );
|
||||
if( positioner == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new DefaultOverlayRenderer( this.getIngredientStacks( recipe ), positioner );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler( final GuiContainer gui, final int recipe )
|
||||
{
|
||||
final IOverlayHandler handler = super.getOverlayHandler( gui, recipe );
|
||||
if( handler != null )
|
||||
{
|
||||
return handler;
|
||||
}
|
||||
|
||||
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
|
||||
}
|
||||
|
||||
private boolean isRecipe2x2( final int recipe )
|
||||
{
|
||||
for( final PositionedStack stack : this.getIngredientStacks( recipe ) )
|
||||
{
|
||||
if( ( stack.relx > 43 ) || ( stack.rely > 24 ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return NEIClientUtils.translate( "recipe.shapeless" );
|
||||
}
|
||||
|
||||
private class CachedShapelessRecipe extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
|
||||
private final List<PositionedStack> ingredients;
|
||||
private final PositionedStack result;
|
||||
|
||||
public CachedShapelessRecipe( final ShapelessRecipe recipe )
|
||||
{
|
||||
this.result = new PositionedStack( recipe.getRecipeOutput(), 119, 24 );
|
||||
this.ingredients = new ArrayList<PositionedStack>();
|
||||
this.setIngredients( recipe.getInput().toArray() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIAEShapelessRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
private void setIngredients( final Object[] items )
|
||||
{
|
||||
final boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI();
|
||||
for( int x = 0; x < 3; x++ )
|
||||
{
|
||||
for( int y = 0; y < 3; y++ )
|
||||
{
|
||||
if( items.length > ( y * 3 + x ) )
|
||||
{
|
||||
final IIngredient ing = (IIngredient) items[( y * 3 + x )];
|
||||
|
||||
try
|
||||
{
|
||||
final ItemStack[] is = ing.getItemStackSet();
|
||||
final PositionedStack stack = new PositionedStack( useSingleItems ? Platform.findPreferred( is ) : ing.getItemStackSet(), 25 + x * 18, 6 + y * 18, false );
|
||||
stack.setMaxSize( 1 );
|
||||
this.ingredients.add( stack );
|
||||
}
|
||||
catch( final RegistrationError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
catch( final MissingIngredientError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void computeVisuals()
|
||||
{
|
||||
for( final PositionedStack p : this.ingredients )
|
||||
{
|
||||
p.generatePermutations();
|
||||
}
|
||||
|
||||
this.result.generatePermutations();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ import appeng.api.AEApi;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
@@ -39,11 +38,14 @@ import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.networking.security.WCTIActionHost;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.networking.security.WCTPlayerSource;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketMagnetFilter;
|
||||
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
|
||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||
@@ -84,7 +86,7 @@ public class ItemMagnet extends Item {
|
||||
public void setItemStack(ItemStack is) {
|
||||
this.thisItemStack = is;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return false;
|
||||
@@ -120,7 +122,7 @@ public class ItemMagnet extends Item {
|
||||
else if (is.getItemDamage() == 2) {
|
||||
list.add(color("white") + " " + LocaleHandler.MagnetActiveDesc2.getLocal());
|
||||
}
|
||||
|
||||
|
||||
String white = LocaleHandler.Whitelisting.getLocal();
|
||||
String black = LocaleHandler.Blacklisting.getLocal();
|
||||
|
||||
@@ -156,6 +158,9 @@ public class ItemMagnet extends Item {
|
||||
switchMagnetMode(item, player);
|
||||
}
|
||||
else {
|
||||
if (!RandomUtils.isMagnetInitialized(item)) {
|
||||
NetworkHandler.instance.sendToServer(new PacketMagnetFilter(0, true));
|
||||
}
|
||||
int x = (int) player.posX;
|
||||
int y = (int) player.posY;
|
||||
int z = (int) player.posZ;
|
||||
@@ -164,7 +169,7 @@ public class ItemMagnet extends Item {
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
public void switchMagnetMode(ItemStack item, EntityPlayer player) {
|
||||
if (item.getItemDamage() == 0) {
|
||||
item.setItemDamage(1);
|
||||
@@ -192,7 +197,7 @@ public class ItemMagnet extends Item {
|
||||
return;
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
|
||||
List<ItemStack> filteredList = getFilteredItems(this.getItemStack());
|
||||
// items
|
||||
Iterator iterator = getEntitiesInRange(EntityItem.class, world, (int) player.posX, (int) player.posY, (int) player.posZ, this.distanceFromPlayer).iterator();
|
||||
@@ -203,10 +208,12 @@ public class ItemMagnet extends Item {
|
||||
|
||||
EntityItemPickupEvent pickupEvent = new EntityItemPickupEvent(player, itemToGet);
|
||||
ItemPickupEvent itemPickupEvent = new ItemPickupEvent(player, itemToGet);
|
||||
MinecraftForge.EVENT_BUS.post(pickupEvent);
|
||||
ItemStack itemStackToGet = itemToGet.getEntityItem();
|
||||
int stackSize = itemStackToGet.stackSize;
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(pickupEvent);
|
||||
FMLCommonHandler.instance().bus().post(itemPickupEvent);
|
||||
|
||||
if (this.obj == null) {
|
||||
this.obj = getGuiObject(wirelessTerm, player, world, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
this.civ = (IPortableCell) this.obj;
|
||||
@@ -216,7 +223,9 @@ public class ItemMagnet extends Item {
|
||||
this.mySrc = new WCTPlayerSource(player, (WCTIActionHost) this.obj);
|
||||
}
|
||||
|
||||
if (obj.rangeCheck(isBoosterInstalled(wirelessTerm) && Reference.WCT_BOOSTER_ENABLED) && hasNetworkAccess(SecurityPermissions.INJECT, true, player, wirelessTerm)) {
|
||||
boolean ignoreRange = (isBoosterInstalled(wirelessTerm) && Reference.WCT_BOOSTER_ENABLED);
|
||||
boolean hasAxxess = hasNetworkAccess(SecurityPermissions.INJECT, true, player, wirelessTerm);
|
||||
if ((ignoreRange && hasAxxess) || (obj.rangeCheck(false) && hasAxxess)) {
|
||||
IAEItemStack ais = AEApi.instance().storage().createItemStack(itemStackToGet);
|
||||
ais.setStackSize(stackSize);
|
||||
if (!itemToGet.isDead) {
|
||||
@@ -225,7 +234,7 @@ public class ItemMagnet extends Item {
|
||||
if (getMode(this.getItemStack())) {
|
||||
if (isItemFiltered(itemStackToGet, filteredList) && filteredList != null && filteredList.size() > 0) {
|
||||
itemToGet.setDead();
|
||||
doInject(ais, pickupEvent, stackSize, player, itemToGet, itemStackToGet, world);
|
||||
doInject(ais, stackSize, player, itemToGet, itemStackToGet, world);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
@@ -234,7 +243,9 @@ public class ItemMagnet extends Item {
|
||||
player.onItemPickup(itemToGet, stackSize);
|
||||
world.playSoundAtEntity(player, "random.pop", 0.15F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
}
|
||||
FMLCommonHandler.instance().bus().post(itemPickupEvent);
|
||||
}
|
||||
else {
|
||||
doVanillaPickup(itemToGet, player, itemStackToGet, world, stackSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -242,7 +253,7 @@ public class ItemMagnet extends Item {
|
||||
else {
|
||||
if (!isItemFiltered(itemStackToGet, filteredList) || filteredList == null || filteredList.size() <= 0) {
|
||||
itemToGet.setDead();
|
||||
doInject(ais, pickupEvent, stackSize, player, itemToGet, itemStackToGet, world);
|
||||
doInject(ais, stackSize, player, itemToGet, itemStackToGet, world);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
@@ -251,18 +262,17 @@ public class ItemMagnet extends Item {
|
||||
player.onItemPickup(itemToGet, stackSize);
|
||||
world.playSoundAtEntity(player, "random.pop", 0.15F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
}
|
||||
FMLCommonHandler.instance().bus().post(itemPickupEvent);
|
||||
}
|
||||
else {
|
||||
doVanillaPickup(itemToGet, player, itemStackToGet, world, stackSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// network isn't powered, WCT has no power, too far away with no booster installed..something is preventing use of WCT, so use niller cannix
|
||||
else {
|
||||
if (pickupEvent.getResult() == Result.ALLOW || stackSize <= 0 || player.inventory.addItemStackToInventory(itemStackToGet)) {
|
||||
player.onItemPickup(itemToGet, stackSize);
|
||||
world.playSoundAtEntity(player, "random.pop", 0.15F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
}
|
||||
doVanillaPickup(itemToGet, player, itemStackToGet, world, stackSize);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,35 +292,68 @@ public class ItemMagnet extends Item {
|
||||
world.playSoundAtEntity(player, "random.orb", 0.08F, 0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.8F));
|
||||
}
|
||||
}
|
||||
|
||||
private void doInject(IAEItemStack ais, EntityItemPickupEvent pickupEvent, int stackSize, EntityPlayer player, EntityItem itemToGet, ItemStack itemStackToGet, World world) {
|
||||
ais = Platform.poweredInsert(this.powerSrc, this.cellInv, ais, this.mySrc);
|
||||
if (ais != null) {
|
||||
if (pickupEvent.getResult() == Result.ALLOW || stackSize <= 0) {
|
||||
|
||||
private void doVanillaPickup(EntityItem itemToGet, EntityPlayer player, ItemStack itemStackToGet, World world, int stackSize) {
|
||||
if (itemToGet.getDistanceToEntity(player) <= 2.0F) {
|
||||
if (player.inventory.addItemStackToInventory(itemStackToGet)) {
|
||||
player.onItemPickup(itemToGet, stackSize);
|
||||
player.inventory.addItemStackToInventory(itemStackToGet);
|
||||
world.playSoundAtEntity(player, "random.pop", 0.15F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasNetworkAccess(final SecurityPermissions perm, final boolean requirePower, EntityPlayer player, ItemStack wirelessTerm) {
|
||||
final WCTIActionHost host = (WCTIActionHost) this.obj;
|
||||
private boolean doesMagnetIgnoreNBT() {
|
||||
return RandomUtils.readBoolean(this.getItemStack(), "IgnoreNBT");
|
||||
}
|
||||
|
||||
if (host != null) {
|
||||
final IGridNode gn = host.getActionableNode(Reference.WCT_BOOSTER_ENABLED && this.isBoosterInstalled(wirelessTerm));
|
||||
if (gn != null) {
|
||||
final IGrid g = gn.getGrid();
|
||||
if (g != null) {
|
||||
if (requirePower) {
|
||||
final IEnergyGrid eg = g.getCache(IEnergyGrid.class);
|
||||
if (!eg.isNetworkPowered()) {
|
||||
return false;
|
||||
}
|
||||
private boolean doesMagnetIgnoreMeta() {
|
||||
return RandomUtils.readBoolean(this.getItemStack(), "IgnoreMeta");
|
||||
}
|
||||
|
||||
private boolean doesMagnetUseOreDict() {
|
||||
return RandomUtils.readBoolean(this.getItemStack(), "UseOreDict");
|
||||
}
|
||||
|
||||
private boolean areOresEqual(ItemStack is1, ItemStack is2) {
|
||||
int[] list1 = OreDictionary.getOreIDs(is1);
|
||||
int[] list2 = OreDictionary.getOreIDs(is2);
|
||||
for (int i = 0; i < list1.length; i++) {
|
||||
for (int j = 0; j < list2.length; j++) {
|
||||
if (list1[i] == list2[j]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isItemFiltered(ItemStack is, List<ItemStack> itemList) {
|
||||
if (is != null && itemList != null) {
|
||||
for (int i = 0; i < itemList.size(); i++) {
|
||||
ItemStack thisStack = (ItemStack) itemList.get(i);
|
||||
if (doesMagnetUseOreDict()) {
|
||||
if (areOresEqual(is, thisStack)) {
|
||||
//if (OreDictionary.itemMatches(is, thisStack, false)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final ISecurityGrid sg = g.getCache(ISecurityGrid.class);
|
||||
if (sg.hasPermission(player, perm)) {
|
||||
}
|
||||
if (doesMagnetIgnoreMeta() && doesMagnetIgnoreNBT()) {
|
||||
if (is.getItem().equals(thisStack.getItem()) && (is.getItem() == thisStack.getItem())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (doesMagnetIgnoreMeta() && !doesMagnetIgnoreNBT()) {
|
||||
if (ItemStack.areItemStackTagsEqual(is, thisStack) && (is.getItem() == thisStack.getItem())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (!doesMagnetIgnoreMeta() && doesMagnetIgnoreNBT()) {
|
||||
if (isMetaEqual(is, thisStack) && (is.getItem() == thisStack.getItem())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isMetaEqual(is, thisStack) && ItemStack.areItemStackTagsEqual(is, thisStack) && (is.getItem() == thisStack.getItem())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -319,22 +362,32 @@ public class ItemMagnet extends Item {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private boolean isItemFiltered(ItemStack is, List<ItemStack> itemList) {
|
||||
if (is != null && itemList != null) {
|
||||
Iterator thisList = itemList.iterator();
|
||||
while (thisList.hasNext()) {
|
||||
ItemStack thisItemStack = (ItemStack) thisList.next();
|
||||
Item thisItem = (Item) thisItemStack.getItem();
|
||||
if (is.getItem() == thisItem) {
|
||||
return true;
|
||||
private boolean isMetaEqual(ItemStack is1, ItemStack is2) {
|
||||
return is1.getItemDamage() == is2.getItemDamage();
|
||||
}
|
||||
|
||||
private boolean hasNetworkAccess(final SecurityPermissions perm, final boolean requirePower, EntityPlayer player, ItemStack wirelessTerm) {
|
||||
final IGrid g = this.obj.getTargetGrid();
|
||||
if (g != null) {
|
||||
if (requirePower) {
|
||||
final IEnergyGrid eg = g.getCache(IEnergyGrid.class);
|
||||
if (!eg.isNetworkPowered()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
final ISecurityGrid sg = g.getCache(ISecurityGrid.class);
|
||||
if (sg.hasPermission(player, perm)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private List<ItemStack> getFilteredItems(ItemStack magnetItem) {
|
||||
if (magnetItem == null) {
|
||||
return null;
|
||||
}
|
||||
if (magnetItem.getItem() instanceof ItemMagnet) {
|
||||
if (magnetItem.hasTagCompound()) {
|
||||
NBTTagCompound nbtTC = magnetItem.getTagCompound();
|
||||
@@ -354,6 +407,15 @@ public class ItemMagnet extends Item {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void doInject(IAEItemStack ais, int stackSize, EntityPlayer player, EntityItem itemToGet, ItemStack itemStackToGet, World world) {
|
||||
ais = Platform.poweredInsert(this.powerSrc, this.cellInv, ais, this.mySrc);
|
||||
if (ais != null) {
|
||||
player.onItemPickup(itemToGet, stackSize);
|
||||
player.inventory.addItemStackToInventory(itemStackToGet);
|
||||
world.playSoundAtEntity(player, "random.pop", 0.15F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isBoosterInstalled(ItemStack wirelessTerm) {
|
||||
if (wirelessTerm.getItem() instanceof ItemWirelessCraftingTerminal) {
|
||||
if (wirelessTerm.hasTagCompound()) {
|
||||
|
||||
@@ -3,12 +3,14 @@ package net.p455w0rd.wirelesscraftingterminal.proxy;
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.boss.EntityWither;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -39,10 +41,10 @@ public class CommonProxy {
|
||||
Achievement magnetAch = AchievementHandler.magnetAch;
|
||||
|
||||
public CommonProxy() {
|
||||
MinecraftForge.EVENT_BUS.register( this );
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
FMLCommonHandler.instance().bus().register(new ConfigHandler());
|
||||
}
|
||||
|
||||
|
||||
public void registerItems() {
|
||||
for (ItemEnum item : ItemEnum.VALUES) {
|
||||
GameRegistry.registerItem(item.getItem(), item.getInternalName());
|
||||
@@ -107,7 +109,6 @@ public class CommonProxy {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerLogin(PlayerLoggedInEvent e) {
|
||||
// SSP Login
|
||||
@@ -128,14 +129,17 @@ public class CommonProxy {
|
||||
// it was giving me too much of a headache..maybe
|
||||
// i'll implement in the future
|
||||
/*
|
||||
AchievementPage achPg = AchievementPage.getAchievementPage("Wireless Crafting Term");
|
||||
if (achPg != null && AchievementList.achievementList.contains(AchievementHandler.boosterAch) && !achPg.getAchievements().contains(AchievementHandler.boosterAch)) {
|
||||
AchievementList.achievementList.remove(AchievementHandler.boosterAch);
|
||||
}
|
||||
if ((Reference.WCT_BOOSTER_ENABLED && hasWCTAch) || hasBoosterAch) {
|
||||
AchievementHandler.addAchievementToPage(AchievementHandler.boosterAch, true, e.player);
|
||||
}
|
||||
*/
|
||||
* AchievementPage achPg = AchievementPage.getAchievementPage(
|
||||
* "Wireless Crafting Term"); if (achPg != null &&
|
||||
* AchievementList.achievementList.contains(AchievementHandler.
|
||||
* boosterAch) &&
|
||||
* !achPg.getAchievements().contains(AchievementHandler.boosterAch))
|
||||
* { AchievementList.achievementList.remove(AchievementHandler.
|
||||
* boosterAch); } if ((Reference.WCT_BOOSTER_ENABLED && hasWCTAch)
|
||||
* || hasBoosterAch) {
|
||||
* AchievementHandler.addAchievementToPage(AchievementHandler.
|
||||
* boosterAch, true, e.player); }
|
||||
*/
|
||||
}
|
||||
else {
|
||||
final PacketConfigSync p = new PacketConfigSync(Reference.WCT_MAX_POWER, Reference.WCT_EASYMODE_ENABLED, Reference.WCT_BOOSTER_ENABLED, Reference.WCT_BOOSTER_DROPCHANCE);
|
||||
@@ -145,7 +149,7 @@ public class CommonProxy {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onMobDrop(LivingDropsEvent event) {
|
||||
if (!Reference.WCT_EASYMODE_ENABLED && Reference.WCT_BOOSTER_ENABLED) {
|
||||
if (!Reference.WCT_EASYMODE_ENABLED && Reference.WCT_BOOSTER_ENABLED && Reference.WCT_BOOSTERDROP_ENABLED) {
|
||||
ItemStack stack = new ItemStack(ItemEnum.BOOSTER_CARD.getItem());
|
||||
EntityItem drop = new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, stack);
|
||||
if (event.entity instanceof EntityDragon) {
|
||||
@@ -171,47 +175,54 @@ public class CommonProxy {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerCraftingEvent(final PlayerEvent.ItemCraftedEvent event) {
|
||||
if (FMLCommonHandler.instance().getSide() == Side.SERVER) {
|
||||
boolean hasWCTAch = ((EntityPlayerMP) event.player).func_147099_x().hasAchievementUnlocked(AchievementHandler.wctAch);
|
||||
if (event.player == null || event.player.isDead || event.player instanceof FakePlayer || event.crafting == null) {
|
||||
if (event.player == null || event.player.isDead || event.player instanceof FakePlayer || event.crafting == null) {
|
||||
return;
|
||||
}
|
||||
if (Loader.isModLoaded("LogisticsPipes")) {
|
||||
if (event.player instanceof logisticspipes.blocks.crafting.FakePlayer) {
|
||||
return;
|
||||
}
|
||||
if (event.crafting.getItem() == ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem()) {
|
||||
AchievementHandler.triggerAch(wctAch, event.player);
|
||||
}
|
||||
if (event.crafting.getItem() == ItemEnum.MAGNET_CARD.getItem() && hasWCTAch) {
|
||||
AchievementHandler.triggerAch(magnetAch, event.player);
|
||||
}
|
||||
/*
|
||||
}
|
||||
boolean hasWCTAch = false;
|
||||
if (event.player instanceof EntityPlayerMP) {
|
||||
hasWCTAch = ((EntityPlayerMP) event.player).func_147099_x().hasAchievementUnlocked(AchievementHandler.wctAch);
|
||||
}
|
||||
if (event.player instanceof EntityClientPlayerMP) {
|
||||
hasWCTAch = ((EntityClientPlayerMP) event.player).getStatFileWriter().hasAchievementUnlocked(AchievementHandler.wctAch);
|
||||
}
|
||||
if (event.crafting.getItem() == ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem()) {
|
||||
AchievementHandler.triggerAch(wctAch, event.player);
|
||||
if (Reference.WCT_BOOSTER_ENABLED) {
|
||||
AchievementHandler.addAchievementToPage(AchievementHandler.boosterAch, true, event.player);
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (Reference.WCT_BOOSTER_ENABLED && Reference.WCT_EASYMODE_ENABLED && hasWCTAch) {
|
||||
if (event.crafting.getItem() == ItemEnum.BOOSTER_CARD.getItem()) {
|
||||
AchievementHandler.triggerAch(boosterAch, event.player);
|
||||
}
|
||||
if (event.crafting.getItem() == ItemEnum.MAGNET_CARD.getItem() && hasWCTAch) {
|
||||
AchievementHandler.triggerAch(magnetAch, event.player);
|
||||
}
|
||||
/*
|
||||
* if (event.crafting.getItem() ==
|
||||
* ItemEnum.WIRELESS_CRAFTING_TERMINAL.getItem()) {
|
||||
* AchievementHandler.triggerAch(wctAch, event.player); if
|
||||
* (Reference.WCT_BOOSTER_ENABLED) {
|
||||
* AchievementHandler.addAchievementToPage(AchievementHandler.
|
||||
* boosterAch, true, event.player); } }
|
||||
*/
|
||||
if (Reference.WCT_BOOSTER_ENABLED && Reference.WCT_EASYMODE_ENABLED && hasWCTAch) {
|
||||
if (event.crafting.getItem() == ItemEnum.BOOSTER_CARD.getItem()) {
|
||||
AchievementHandler.triggerAch(boosterAch, event.player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@SubscribeEvent
|
||||
public void achievementGetEvent(AchievementEvent event) {
|
||||
int index = AchievementList.achievementList.indexOf(wctAch);
|
||||
if (event.achievement.equals(AchievementList.achievementList.get(index))) {
|
||||
if (Reference.WCT_BOOSTER_ENABLED) {
|
||||
EnumChatFormatting purple = EnumChatFormatting.LIGHT_PURPLE;
|
||||
EnumChatFormatting green = EnumChatFormatting.GREEN;
|
||||
event.entityPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.ITALIC + "" + purple + "[" + green + "Wireless Crafting Terminal" + purple + "]: " + green + " New" + purple + " Achievment" + green + " Unlocked" + purple + "!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
* @SubscribeEvent public void achievementGetEvent(AchievementEvent event) {
|
||||
* int index = AchievementList.achievementList.indexOf(wctAch); if
|
||||
* (event.achievement.equals(AchievementList.achievementList.get(index))) {
|
||||
* if (Reference.WCT_BOOSTER_ENABLED) { EnumChatFormatting purple =
|
||||
* EnumChatFormatting.LIGHT_PURPLE; EnumChatFormatting green =
|
||||
* EnumChatFormatting.GREEN; event.entityPlayer.addChatMessage(new
|
||||
* ChatComponentText(EnumChatFormatting.ITALIC + "" + purple + "[" + green +
|
||||
* "Wireless Crafting Terminal" + purple + "]: " + green + " New" + purple +
|
||||
* " Achievment" + green + " Unlocked" + purple + "!")); } } }
|
||||
*/
|
||||
}
|
||||
@@ -2,18 +2,19 @@ package net.p455w0rd.wirelesscraftingterminal.reference;
|
||||
|
||||
public class Reference {
|
||||
public static final String MODID = "ae2wct";
|
||||
public static final String VERSION = "1.7.10-rv3-1.5b";
|
||||
public static final String VERSION = "1.7.10-rv3-1.6b";
|
||||
public static final String NAME = "AE2 Wireless Crafting Terminal";
|
||||
public static final String SERVER_PROXY_CLASS = "net.p455w0rd.wirelesscraftingterminal.proxy.CommonProxy";
|
||||
public static final String CLIENT_PROXY_CLASS = "net.p455w0rd.wirelesscraftingterminal.proxy.ClientProxy";
|
||||
public static final String GUI_FACTORY = "net.p455w0rd.wirelesscraftingterminal.client.gui.GuiFactory";
|
||||
public static final String CREDITS_LIST = "brandon3055, Techjar, AlgorythmX2, thatsIch, Nividica, squeek502, M3gaFr3ak, DrummerMC, cpw, LexManos, Pahimar, diesieben07, Wuppy, Jabelar, blay09, SirSengir, mezz";
|
||||
public static final String CREDITS_LIST = "brandon3055, Techjar, AlgorythmX2, thatsIch, Nividica, squeek502, M3gaFr3ak, DrummerMC, cpw, LexManos, Pahimar, diesieben07, Wuppy, Jabelar, blay09, SirSengir, mezz, jotato";
|
||||
public static final String CONFIG_FILE = "WirelessCraftingTerminal.cfg";
|
||||
public static int WCT_MAX_POWER = 1600000;
|
||||
public static boolean WCT_BOOSTER_ENABLED = true;
|
||||
public static boolean WCT_EASYMODE_ENABLED = false;
|
||||
public static int WCT_CRAFTMATRIX_Y_OFFSET = 100;
|
||||
public static int WCT_BOOSTER_DROPCHANCE = 50;
|
||||
public static boolean WCT_BOOSTERDROP_ENABLED = true;
|
||||
|
||||
// Gui IDs
|
||||
private static int ae2wctGuiIndex = 0;
|
||||
|
||||
Reference in new issue
Block a user