mirror of
https://github.com/GTNewHorizons/ThaumicEnergistics.git
synced 2026-10-25 20:32:27 +00:00
DPE work
Created block texture for DPE. Fixed DPE not dropping patterns on breaking. Enhancing DPE gui.
This commit is contained in:
1 parent
4ca46e8266
commit
c9adf1dbcb
14 files changed
+507
-21
No files matched your search
+6
-3
@@ -3,7 +3,10 @@
|
||||
Added debug level to logger.
|
||||
Updated essentia terminal lore.
|
||||
Updated essentia terminal gui.
|
||||
Todo: Lore, recipe, texture for Distilation Encoder.
|
||||
Created block texture for DPE.
|
||||
Fixed DPE not dropping patterns on breaking.
|
||||
Enhancing DPE gui.
|
||||
Todo: Lore, recipe for distillation pattern Encoder.
|
||||
|
||||
01/03/2016 0.10.0.0 - Beta
|
||||
Essentia terminal can fill/drain containers when they are dragged and clicked over an aspect.
|
||||
@@ -22,9 +25,9 @@
|
||||
Fixes #53: :D
|
||||
|
||||
12/30/2015 0.10.0.0 - Beta
|
||||
Added Distillation Encoder
|
||||
Added Distillation Pattern Encoder
|
||||
Added pattern handler
|
||||
Implemented Distillation Encoder GUI
|
||||
Implemented Distillation Pattern Encoder GUI
|
||||
Cleaned up tooltip code, and fixed underdraw issue.
|
||||
|
||||
12/29/2015 0.10.0.0 - Beta
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public enum GuiParticle
|
||||
public enum EnumGuiParticles
|
||||
{
|
||||
Orb (thaumcraft.client.fx.ParticleEngine.particleTexture, 0, 128, 16, 16, 16, 0, 16),
|
||||
Rune (thaumcraft.client.fx.ParticleEngine.particleTexture, 0, 96, 16, 16, 16, 0, 16),
|
||||
@@ -36,7 +36,7 @@ public enum GuiParticle
|
||||
*/
|
||||
private ResourceLocation texture;
|
||||
|
||||
private GuiParticle( final ResourceLocation textureLocation, final int U, final int V, final int width, final int height,
|
||||
private EnumGuiParticles( final ResourceLocation textureLocation, final int U, final int V, final int width, final int height,
|
||||
final int UStep, final int VStep, final int Frames )
|
||||
{
|
||||
this.texture = textureLocation;
|
||||
@@ -100,7 +100,7 @@ public enum GuiParticle
|
||||
|
||||
if( needsPrepare )
|
||||
{
|
||||
GuiParticle.finishDraw();
|
||||
EnumGuiParticles.finishDraw();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,35 @@
|
||||
package thaumicenergistics.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumicenergistics.api.storage.IInventoryUpdateReceiver;
|
||||
import thaumicenergistics.client.gui.abstraction.ThEBaseGui;
|
||||
import thaumicenergistics.client.gui.buttons.GuiButtonEncodePattern;
|
||||
import thaumicenergistics.client.textures.AEStateIconsEnum;
|
||||
import thaumicenergistics.client.textures.GuiTextureManager;
|
||||
import thaumicenergistics.common.container.ContainerDistillationEncoder;
|
||||
import thaumicenergistics.common.items.ItemCraftingAspect;
|
||||
import thaumicenergistics.common.network.packet.server.Packet_S_DistillationEncoder;
|
||||
import thaumicenergistics.common.registries.ThEStrings;
|
||||
import thaumicenergistics.common.utils.ThEUtils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiDistillationEncoder
|
||||
extends ThEBaseGui
|
||||
implements IInventoryUpdateReceiver
|
||||
{
|
||||
/**
|
||||
* Gui size.
|
||||
@@ -34,16 +46,56 @@ public class GuiDistillationEncoder
|
||||
*/
|
||||
private static final int BUTTON_ENCODE_POS_X = 146, BUTTON_ENCODE_POS_Y = 94;
|
||||
|
||||
/**
|
||||
* Half of the size of a standard item
|
||||
*/
|
||||
private static final int ITEM_HALF_SIZE = 8;
|
||||
|
||||
/**
|
||||
* Scale to draw the Thaumometer at.
|
||||
*/
|
||||
private static final float THAUMOMETER_SCALE = 2.8f;
|
||||
|
||||
/**
|
||||
* Title of the gui.
|
||||
*/
|
||||
private final String title;
|
||||
|
||||
/**
|
||||
* The GUI's container.
|
||||
*/
|
||||
private final ContainerDistillationEncoder deContainer;
|
||||
|
||||
/**
|
||||
* Thaumcraft's thaumometer
|
||||
*/
|
||||
private final ItemStack thaumometer = new ItemStack( ConfigItems.itemThaumometer );
|
||||
|
||||
/**
|
||||
* Particles
|
||||
*/
|
||||
private final ArrayList<GuiParticleAnimator> particles = new ArrayList<GuiParticleAnimator>();
|
||||
|
||||
/**
|
||||
* The encode button.
|
||||
*/
|
||||
private GuiButtonEncodePattern buttonEncode;
|
||||
|
||||
/**
|
||||
* Hash code of the last itemstack.
|
||||
*/
|
||||
private int lastSourceItemHash = 0;
|
||||
|
||||
/**
|
||||
* Set true when the source item may have been changed.
|
||||
*/
|
||||
private boolean sourceItemDirty = false;
|
||||
|
||||
/**
|
||||
* Set false the first time the GUI is drawn.
|
||||
*/
|
||||
private boolean firstDraw = true;
|
||||
|
||||
public GuiDistillationEncoder( final EntityPlayer player, final World world, final int x, final int y, final int z )
|
||||
{
|
||||
// Call super
|
||||
@@ -55,6 +107,94 @@ public class GuiDistillationEncoder
|
||||
// Set the GUI size
|
||||
this.xSize = GUI_WIDTH;
|
||||
this.ySize = GUI_HEIGHT;
|
||||
|
||||
// Set the container
|
||||
this.deContainer = (ContainerDistillationEncoder)this.inventorySlots;
|
||||
this.deContainer.slotUpdateReceiver = this;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for item changes to the source item.
|
||||
*/
|
||||
private void checkSourceItem()
|
||||
{
|
||||
// Clear the dirty bit
|
||||
this.sourceItemDirty = false;
|
||||
|
||||
// Get the source item
|
||||
ItemStack sourceItem = this.deContainer.slotSourceItem.getDisplayStack();
|
||||
|
||||
// Is there a stack?
|
||||
if( sourceItem == null )
|
||||
{
|
||||
// Reset hash
|
||||
this.lastSourceItemHash = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Compare to last hash
|
||||
int hash = sourceItem.hashCode();
|
||||
if( hash == this.lastSourceItemHash )
|
||||
{
|
||||
// Same item
|
||||
return;
|
||||
}
|
||||
this.lastSourceItemHash = hash;
|
||||
|
||||
// Clear any existing particles
|
||||
this.particles.clear();
|
||||
|
||||
// Check each slot
|
||||
boolean isItemScanned = false;
|
||||
for( Slot slot : this.deContainer.slotSourceAspects )
|
||||
{
|
||||
// Does the slot have a stack?
|
||||
if( slot.getHasStack() )
|
||||
{
|
||||
// Get the aspect for that stack
|
||||
Aspect aspect = ItemCraftingAspect.getAspect( slot.getStack() );
|
||||
if( aspect != null )
|
||||
{
|
||||
// Found something
|
||||
isItemScanned = true;
|
||||
|
||||
// Create the animator
|
||||
GuiParticleAnimator gpa = new GuiParticleAnimator( this.deContainer.slotSourceItem.xDisplayPosition,
|
||||
this.deContainer.slotSourceItem.yDisplayPosition,
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition,
|
||||
0.3f,
|
||||
EnumGuiParticles.Orb );
|
||||
|
||||
// Set FPS
|
||||
gpa.framesPerSecond = 30;
|
||||
|
||||
// Set the color
|
||||
float[] argb = ThEGuiHelper.INSTANCE.convertPackedColorToARGBf( aspect.getColor() );
|
||||
gpa.setColor( argb[1], argb[2], argb[3] );
|
||||
|
||||
// Add to the list
|
||||
this.particles.add( gpa );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( isItemScanned )
|
||||
{
|
||||
// Play the on sound
|
||||
ThEUtils.playClientSound( null, "thaumcraft:hhon" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Play the off sound
|
||||
ThEUtils.playClientSound( null, "thaumcraft:hhoff" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,6 +211,33 @@ public class GuiDistillationEncoder
|
||||
|
||||
// Draw the gui texture
|
||||
this.drawTexturedModalRect( this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize );
|
||||
|
||||
// Calculate the position and rotation of the thaumometer
|
||||
float th_PosX = this.guiLeft + ContainerDistillationEncoder.SLOT_SOURCE_ITEM_POS_X + ITEM_HALF_SIZE;
|
||||
float th_PosY = this.guiTop + ContainerDistillationEncoder.SLOT_SOURCE_ITEM_POS_Y - 0.25f + ITEM_HALF_SIZE;
|
||||
float th_Rotation = ( ( System.currentTimeMillis() % 36000 ) * 0.02f );
|
||||
float th_ScaleOffset = (float)Math.sin( th_Rotation * 0.15f ) * 0.1f;
|
||||
|
||||
// Disable depth testing and push the matrix
|
||||
GL11.glDisable( GL11.GL_DEPTH_TEST );
|
||||
GL11.glPushMatrix();
|
||||
|
||||
// Translate
|
||||
GL11.glTranslatef( th_PosX, th_PosY, 0.0F );
|
||||
|
||||
// Scale
|
||||
GL11.glScalef( THAUMOMETER_SCALE + th_ScaleOffset, THAUMOMETER_SCALE + th_ScaleOffset, 1.0f );
|
||||
|
||||
// Rotate
|
||||
GL11.glRotatef( th_Rotation, 0.0f, 0.0f, 1.0f );
|
||||
|
||||
// Draw thaumometer
|
||||
GuiScreen.itemRender.renderItemAndEffectIntoGUI( this.fontRendererObj, this.mc.getTextureManager(),
|
||||
this.thaumometer, -ITEM_HALF_SIZE, -ITEM_HALF_SIZE );
|
||||
|
||||
// Restore
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable( GL11.GL_DEPTH_TEST );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,6 +249,55 @@ public class GuiDistillationEncoder
|
||||
// Draw the title
|
||||
this.fontRendererObj.drawString( this.title, TITLE_POS_X, TITLE_POS_Y, 0 );
|
||||
|
||||
// Check the source item
|
||||
if( this.sourceItemDirty && !this.firstDraw )
|
||||
{
|
||||
this.checkSourceItem();
|
||||
}
|
||||
|
||||
// Any particles?
|
||||
if( this.particles.size() > 0 )
|
||||
{
|
||||
// Prep
|
||||
EnumGuiParticles.Orb.prepareDraw();
|
||||
|
||||
// Draw each
|
||||
for( Iterator<GuiParticleAnimator> iterator = this.particles.iterator(); iterator.hasNext(); )
|
||||
{
|
||||
if( !iterator.next().draw( this, false ) )
|
||||
{
|
||||
// Remove if done.
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// Finish
|
||||
EnumGuiParticles.finishDraw();
|
||||
}
|
||||
|
||||
this.firstDraw = false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked( final int mouseX, final int mouseY, final int mouseButton )
|
||||
{
|
||||
// Call super
|
||||
super.mouseClicked( mouseX, mouseY, mouseButton );
|
||||
|
||||
// Was the mouse clicked over a widget?
|
||||
for( Slot slot : this.deContainer.slotSourceAspects )
|
||||
{
|
||||
if( slot.getHasStack() && ThEGuiHelper.INSTANCE.isPointInGuiRegion(
|
||||
slot.yDisplayPosition, slot.xDisplayPosition,
|
||||
18, 18, mouseX, mouseY,
|
||||
this.guiLeft, this.guiTop ) )
|
||||
{
|
||||
// Play clicky sound
|
||||
ThEUtils.playClientSound( null, "gui.button.press" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,5 +321,18 @@ public class GuiDistillationEncoder
|
||||
AEStateIconsEnum.STANDARD_ICON_SIZE,
|
||||
AEStateIconsEnum.STANDARD_ICON_SIZE );
|
||||
this.buttonList.add( this.buttonEncode );
|
||||
|
||||
// Reset flags
|
||||
this.sourceItemDirty = false;
|
||||
this.firstDraw = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged( final IInventory sourceInventory )
|
||||
{
|
||||
if( !this.sourceItemDirty && ( sourceInventory == this.deContainer.slotSourceItem.inventory ) )
|
||||
{
|
||||
this.sourceItemDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
public class GuiKnowledgeInscriber
|
||||
extends ThEBaseGui
|
||||
{
|
||||
// TODO: Either subclass guiparticleanimator or move to it completely.
|
||||
private class SaveParticle
|
||||
{
|
||||
private int startX, startY;
|
||||
@@ -78,7 +79,7 @@ public class GuiKnowledgeInscriber
|
||||
int Y = this.startY + (int)( this.distY * this.percent );
|
||||
|
||||
// Draw
|
||||
GuiParticle.Knowledge.drawParticle( gui, X, Y, frame, 0.2f, 0.5f, 1.0f, false );
|
||||
EnumGuiParticles.Knowledge.drawParticle( gui, X, Y, frame, 0.2f, 0.5f, 1.0f, false );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,7 +184,7 @@ public class GuiKnowledgeInscriber
|
||||
// Assume all particles are drawn
|
||||
this.hasParticlesToDraw = false;
|
||||
|
||||
GuiParticle.Knowledge.prepareDraw();
|
||||
EnumGuiParticles.Knowledge.prepareDraw();
|
||||
for( int index = 0; index < this.particles.length; ++index )
|
||||
{
|
||||
// Draw the particle
|
||||
@@ -192,7 +193,7 @@ public class GuiKnowledgeInscriber
|
||||
// Is the particle not done?
|
||||
this.hasParticlesToDraw |= this.particles[index].notFinished();
|
||||
}
|
||||
GuiParticle.finishDraw();
|
||||
EnumGuiParticles.finishDraw();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
package thaumicenergistics.client.gui;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiParticleAnimator
|
||||
{
|
||||
/**
|
||||
* Distance from start to destination.
|
||||
*/
|
||||
private final int distanceX, distanceY;
|
||||
|
||||
/**
|
||||
* Time when the particle was created.
|
||||
*/
|
||||
private final double epoch;
|
||||
|
||||
/**
|
||||
* The amount of time the particle is alive for.
|
||||
*/
|
||||
private final long timeToLive;
|
||||
|
||||
/**
|
||||
* How complete the animation is.
|
||||
*/
|
||||
private double percentComplete;
|
||||
|
||||
/**
|
||||
* Starting position.
|
||||
*/
|
||||
public final int startingX, startingY;
|
||||
|
||||
/**
|
||||
* Destination position.
|
||||
*/
|
||||
public final int destinationX, destinationY;
|
||||
|
||||
/**
|
||||
* The particle to draw.
|
||||
*/
|
||||
public final EnumGuiParticles theParticle;
|
||||
|
||||
/**
|
||||
* Color of the particle.
|
||||
*/
|
||||
public float red = 1.0f, green = 1.0f, blue = 1.0f;
|
||||
|
||||
/**
|
||||
* Particle frames per second.
|
||||
*/
|
||||
public int framesPerSecond = 1;
|
||||
|
||||
public GuiParticleAnimator( final int startX, final int startY, final int destX, final int destY, final float time,
|
||||
@Nonnull final EnumGuiParticles particle )
|
||||
{
|
||||
// Set starting position
|
||||
this.startingX = startX;
|
||||
this.startingY = startY;
|
||||
|
||||
// Set destination
|
||||
this.destinationX = destX;
|
||||
this.destinationY = destY;
|
||||
|
||||
// Set TTL
|
||||
this.timeToLive = (long)( time * 1000.0f );
|
||||
if( this.timeToLive <= 0 )
|
||||
{
|
||||
this.percentComplete = 1.0f;
|
||||
}
|
||||
|
||||
// Set epoch
|
||||
this.epoch = System.currentTimeMillis();
|
||||
|
||||
// Set particle
|
||||
this.theParticle = particle;
|
||||
|
||||
// Calculate distance
|
||||
this.distanceX = destX - startX;
|
||||
this.distanceY = destY - startY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns false if the particle has reached the end of its life.
|
||||
*
|
||||
* @param gui
|
||||
* @param needsPrepare
|
||||
* @return
|
||||
*/
|
||||
public boolean draw( final Gui gui, final boolean needsPrepare )
|
||||
{
|
||||
// Check percentage
|
||||
if( this.percentComplete == 1.0f )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Calculate frame number
|
||||
int frame = (int)( System.currentTimeMillis() / ( 1000 / this.framesPerSecond ) );
|
||||
|
||||
// Draw
|
||||
return this.draw( gui, frame, needsPrepare );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns false if the particle has reached the end of its life.
|
||||
*
|
||||
* @param gui
|
||||
* @param particleFrame
|
||||
* @param needsPrepare
|
||||
* @return
|
||||
*/
|
||||
public boolean draw( final Gui gui, final int particleFrame, final boolean needsPrepare )
|
||||
{
|
||||
// Check percentage
|
||||
if( this.percentComplete == 1.0f )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Calculate percentage
|
||||
this.percentComplete = ( ( System.currentTimeMillis() - this.epoch ) / this.timeToLive );
|
||||
if( this.percentComplete > 1.0f )
|
||||
{
|
||||
this.percentComplete = 1.0f;
|
||||
}
|
||||
|
||||
// Calculate position
|
||||
int posX = this.startingX + (int)( this.distanceX * this.percentComplete );
|
||||
int posY = this.startingY + (int)( this.distanceY * this.percentComplete );
|
||||
|
||||
// Draw the particle
|
||||
this.theParticle.drawParticle( gui, posX, posY, particleFrame, this.red, this.green, this.blue, needsPrepare );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color of the particle.
|
||||
*
|
||||
* @param red
|
||||
* @param green
|
||||
* @param blue
|
||||
*/
|
||||
public void setColor( final float red, final float green, final float blue )
|
||||
{
|
||||
this.red = red;
|
||||
this.green = green;
|
||||
this.blue = blue;
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public final class ThEGuiHelper
|
||||
GL11.glEnable( GL11.GL_DEPTH_TEST );
|
||||
}
|
||||
|
||||
public final byte[] convertPackedColorToARGB( final int color )
|
||||
public final byte[] convertPackedColorToARGBb( final int color )
|
||||
{
|
||||
byte[] colorBytes = new byte[COLOR_ARRAY_SIZE];
|
||||
|
||||
@@ -107,6 +107,20 @@ public final class ThEGuiHelper
|
||||
return colorBytes;
|
||||
}
|
||||
|
||||
public final float[] convertPackedColorToARGBf( final int color )
|
||||
{
|
||||
float[] colorFloats = new float[COLOR_ARRAY_SIZE];
|
||||
|
||||
// Extract bytes
|
||||
for( int i = 0; i < COLOR_ARRAY_SIZE; i++ )
|
||||
{
|
||||
// Get floats
|
||||
colorFloats[COLOR_ARRAY_SIZE - 1 - i] = ( ( color >> this.COLOR_SHIFT_AMOUNT[i] ) & 0xFF ) / 255.0f;
|
||||
}
|
||||
|
||||
return colorFloats;
|
||||
}
|
||||
|
||||
public final int[] createColorGradient( final int fromColor, final int toColor, final int iterations )
|
||||
{
|
||||
// Is there enough iterations to create a gradient?
|
||||
|
||||
@@ -170,7 +170,7 @@ public abstract class AspectWidgetBase
|
||||
}
|
||||
|
||||
// Get the color bytes
|
||||
this.aspectColorBytes = ThEGuiHelper.INSTANCE.convertPackedColorToARGB( this.aspectStack.getAspect().getColor() );
|
||||
this.aspectColorBytes = ThEGuiHelper.INSTANCE.convertPackedColorToARGBb( this.aspectStack.getAspect().getColor() );
|
||||
|
||||
// Set full alpha
|
||||
this.aspectColorBytes[0] = (byte)255;
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
package thaumicenergistics.client.gui.widget;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumicenergistics.api.gui.IAspectSelectorGui;
|
||||
import thaumicenergistics.api.storage.IAspectStack;
|
||||
import thaumicenergistics.client.gui.ThEGuiHelper;
|
||||
import thaumicenergistics.common.utils.ThEUtils;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.util.ReadableNumberConverter;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -318,8 +316,7 @@ public class WidgetAspectSelector
|
||||
if( changed )
|
||||
{
|
||||
// Play clicky sound
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(
|
||||
PositionedSoundRecord.func_147674_a( new ResourceLocation( "gui.button.press" ), 1.0F ) );
|
||||
ThEUtils.playClientSound( null, "gui.button.press" );
|
||||
|
||||
// Set the selected aspect
|
||||
( (IAspectSelectorGui)this.hostGUI ).getContainer().setSelectedAspect( selectedAspect );
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package thaumicenergistics.common.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -16,6 +18,7 @@ import thaumicenergistics.common.ThEGuiHandler;
|
||||
import thaumicenergistics.common.ThaumicEnergistics;
|
||||
import thaumicenergistics.common.registries.BlockEnum;
|
||||
import thaumicenergistics.common.tiles.TileDistillationEncoder;
|
||||
import thaumicenergistics.common.utils.EffectiveSide;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -46,6 +49,41 @@ public class BlockDistillationEncoder
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the block is broken.
|
||||
*/
|
||||
@Override
|
||||
public void breakBlock( final World world, final int x, final int y, final int z, final Block block, final int metaData )
|
||||
{
|
||||
// Is this server side?
|
||||
if( EffectiveSide.isServerSide() )
|
||||
{
|
||||
// Get the tile
|
||||
TileEntity tile = world.getTileEntity( x, y, z );
|
||||
|
||||
if( tile instanceof TileDistillationEncoder )
|
||||
{
|
||||
// Cast
|
||||
TileDistillationEncoder tileDE = (TileDistillationEncoder)tile;
|
||||
|
||||
// Does it have patterns?
|
||||
if( tileDE.hasPatterns() )
|
||||
{
|
||||
// Get the drops
|
||||
ArrayList<ItemStack> drops = tileDE.getDrops( new ArrayList<ItemStack>() );
|
||||
for( ItemStack drop : drops )
|
||||
{
|
||||
// Spawn in the world
|
||||
world.spawnEntityInWorld( new EntityItem( world, 0.5 + x, 0.5 + y, 0.2 + z, drop ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Call super
|
||||
super.breakBlock( world, x, y, z, block, metaData );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the tile entity associated with the block.
|
||||
*/
|
||||
|
||||
+29
-3
@@ -12,6 +12,7 @@ import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.lib.research.ScanManager;
|
||||
import thaumicenergistics.api.storage.IInventoryUpdateReceiver;
|
||||
import thaumicenergistics.common.container.slot.SlotRestrictive;
|
||||
import thaumicenergistics.common.items.ItemCraftingAspect;
|
||||
import thaumicenergistics.common.registries.ItemEnum;
|
||||
@@ -32,7 +33,7 @@ public class ContainerDistillationEncoder
|
||||
/**
|
||||
* Position of the source item slot
|
||||
*/
|
||||
private static final int SLOT_SOURCE_ITEM_POS_X = 15, SLOT_SOURCE_ITEM_POS_Y = 69;
|
||||
public static final int SLOT_SOURCE_ITEM_POS_X = 15, SLOT_SOURCE_ITEM_POS_Y = 69;
|
||||
|
||||
/**
|
||||
* Starting position of the source aspect slots
|
||||
@@ -67,12 +68,12 @@ public class ContainerDistillationEncoder
|
||||
/**
|
||||
* Slot holding the source item.
|
||||
*/
|
||||
protected SlotFake slotSourceItem;
|
||||
public final SlotFake slotSourceItem;
|
||||
|
||||
/**
|
||||
* Slots holding the source item's aspects.
|
||||
*/
|
||||
protected SlotFake[] slotSourceAspects = new SlotFake[TileDistillationEncoder.SLOT_SOURCE_ASPECTS_COUNT];
|
||||
public final SlotFake[] slotSourceAspects = new SlotFake[TileDistillationEncoder.SLOT_SOURCE_ASPECTS_COUNT];
|
||||
|
||||
/**
|
||||
* Slot holding the selected aspect.
|
||||
@@ -94,6 +95,11 @@ public class ContainerDistillationEncoder
|
||||
*/
|
||||
protected DistillationPatternHelper patternHelper;
|
||||
|
||||
/**
|
||||
* Who/what to send updates to when slots change.
|
||||
*/
|
||||
public IInventoryUpdateReceiver slotUpdateReceiver;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -373,6 +379,19 @@ public class ContainerDistillationEncoder
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStackInSlot( final int slotNumber, final ItemStack stack )
|
||||
{
|
||||
// Call super
|
||||
super.putStackInSlot( slotNumber, stack );
|
||||
|
||||
// Call receiver
|
||||
if( EffectiveSide.isClientSide() && ( this.slotUpdateReceiver != null ) )
|
||||
{
|
||||
this.slotUpdateReceiver.onInventoryChanged( this.getSlot( slotNumber ).inventory );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick( final int slotNumber, final int buttonPressed, final int flag, final EntityPlayer player )
|
||||
{
|
||||
@@ -440,6 +459,13 @@ public class ContainerDistillationEncoder
|
||||
}
|
||||
}
|
||||
|
||||
// Selected aspect?
|
||||
if( this.slotSelectedAspect.slotNumber == slotNumber )
|
||||
{
|
||||
// No interaction
|
||||
return null;
|
||||
}
|
||||
|
||||
return super.slotClick( slotNumber, buttonPressed, flag, player );
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ public class CommonDependantItems
|
||||
public ItemStack EssentiaMirror;
|
||||
public ItemStack VisFilter;
|
||||
public ItemStack QuickSilverDrop;
|
||||
public ItemStack Thaumometer;
|
||||
|
||||
// AE Items =========================
|
||||
public Object VibrantGlass;
|
||||
@@ -186,6 +187,7 @@ public class CommonDependantItems
|
||||
this.EssentiaMirror = (ItemStack)this.getItemOrAlt( Config.allowMirrors, new ItemStack( ConfigBlocks.blockMirror, 1, 6 ), this.WardedJar );
|
||||
this.VisFilter = new ItemStack( ConfigItems.itemResource, 1, 8 );
|
||||
this.QuickSilverDrop = new ItemStack( ConfigItems.itemNugget, 1, 5 );
|
||||
this.Thaumometer = new ItemStack( ConfigItems.itemThaumometer );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package thaumicenergistics.common.tiles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -78,6 +79,28 @@ public class TileDistillationEncoder
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of items to drop when broken.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ArrayList<ItemStack> getDrops( final ArrayList<ItemStack> drops )
|
||||
{
|
||||
// Add encoded
|
||||
if( ( this.internalInventory.slots[SLOT_ENCODED_PATTERN] != null ) )
|
||||
{
|
||||
drops.add( this.internalInventory.slots[SLOT_ENCODED_PATTERN] );
|
||||
}
|
||||
|
||||
// Add blank
|
||||
if( ( this.internalInventory.slots[SLOT_BLANK_PATTERNS] != null ) )
|
||||
{
|
||||
drops.add( this.internalInventory.slots[SLOT_BLANK_PATTERNS] );
|
||||
}
|
||||
|
||||
return drops;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the inscriber's inventory.
|
||||
*
|
||||
@@ -93,7 +116,7 @@ public class TileDistillationEncoder
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean hasPattern()
|
||||
public boolean hasPatterns()
|
||||
{
|
||||
// Is there anything in the pattern slots?
|
||||
return( ( this.internalInventory.slots[SLOT_ENCODED_PATTERN] != null )
|
||||
|
||||
@@ -14,7 +14,7 @@ thaumicenergistics.block.essentia.cell.workbench.name=Essentia Cell Workbench
|
||||
thaumicenergistics.block.arcane.assembler.name=Arcane Assembler
|
||||
thaumicenergistics.block.knowledge.inscriber.name=Knowledge Inscriber
|
||||
thaumicenergistics.block.essentia.vibration.chamber.name=Essentia Vibration Chamber
|
||||
thaumicenergistics.block.distillation.encoder.name=Distillation Encoder
|
||||
thaumicenergistics.block.distillation.encoder.name=Distillation Pattern Encoder
|
||||
|
||||
#Cable parts
|
||||
thaumicenergistics.aeparts.essentia.ImportBus.name=Essentia Import Bus
|
||||
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.6 KiB |
Reference in new issue
Block a user