chore: format code
This commit is contained in:
parent
e2e2182522
commit
a267d10ac2
|
@ -0,0 +1,130 @@
|
|||
---
|
||||
AccessModifierOffset: 0
|
||||
AlignAfterOpenBracket: BlockIndent
|
||||
AlignArrayOfStructures: None
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignConsecutiveMacros: None
|
||||
AlignConsecutiveBitFields: None
|
||||
AlignConsecutiveDeclarations: None
|
||||
AlignEscapedNewlines: DontAlign
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments: false
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: Empty
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
AttributeMacros: []
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BitFieldColonSpacing: After
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
BreakAfterJavaFieldAnnotations: true
|
||||
#BreakArrays: false
|
||||
BreakBeforeBinaryOperators: All
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeConceptDeclarations: true
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakInheritanceList: AfterColon
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 90
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
DeriveLineEnding: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false # wtf
|
||||
EmptyLineAfterAccessModifier: Never
|
||||
EmptyLineBeforeAccessModifier: Always
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: false
|
||||
ForEachMacros: ["BOOST_FOREACH"]
|
||||
IfMacros: []
|
||||
IncludeBlocks: Regroup
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseBlocks: false
|
||||
IndentCaseLabels: true
|
||||
IndentExternBlock: Indent
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: BeforeHash
|
||||
#IndentRequiresClause: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
#InsertBraces: false
|
||||
InsertTrailingCommas: Wrapped
|
||||
JavaImportGroups: ["java"]
|
||||
JavaScriptQuotes: Double
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
LambdaBodyIndentation: OuterScope
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: All
|
||||
PackConstructorInitializers: NextLine
|
||||
PointerAlignment: Left
|
||||
QualifierAlignment: Left
|
||||
ReferenceAlignment: Left
|
||||
ReflowComments: true
|
||||
#RemoveSemicolon: true
|
||||
#RequiresClausePosition: OwnLine
|
||||
#RequiresExpressionIndentation: OuterScope
|
||||
SeparateDefinitionBlocks: Always
|
||||
SortIncludes: CaseInsensitive
|
||||
SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: true
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceAroundPointerQualifiers: After
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: false
|
||||
SpaceBeforeInheritanceColon: false
|
||||
SpaceBeforeParens: ControlStatementsExceptControlMacros
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesInAngles: Never
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 0
|
||||
Maximum: -1
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: c++20
|
||||
StatementAttributeLikeMacros: []
|
||||
StatementMacros: []
|
||||
TabWidth: 4
|
||||
TypenameMacros: []
|
||||
UseCRLF: false # wtf
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros: ["BOOST_PP_STRINGSIZE"]
|
|
@ -3,4 +3,7 @@
|
|||
build
|
||||
run
|
||||
bin
|
||||
off
|
||||
off
|
||||
.settings
|
||||
.classpath
|
||||
.project
|
||||
|
|
|
@ -32,8 +32,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class ClientProxy
|
||||
extends CommonProxy {
|
||||
public class ClientProxy extends CommonProxy {
|
||||
@Override
|
||||
public void preInit() {
|
||||
RenderingRegistry.registerBlockHandler(new BlockRenderingHandler());
|
||||
|
@ -42,27 +41,52 @@ extends CommonProxy {
|
|||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityConveyorBelt.class, (TileEntitySpecialRenderer)new RenderConveyorBelt());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRejector.class, (TileEntitySpecialRenderer)new RenderRejector());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityManipulator.class, (TileEntitySpecialRenderer)new RenderManipulator());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCrate.class, (TileEntitySpecialRenderer)new RenderCrate());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityArmbot.class, (TileEntitySpecialRenderer)new RenderArmbot());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDetector.class, (TileEntitySpecialRenderer)new RenderDetector());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCraneController.class, (TileEntitySpecialRenderer)new RenderCraneController());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCraneRail.class, (TileEntitySpecialRenderer)new RenderCraneFrame());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(
|
||||
TileEntityConveyorBelt.class,
|
||||
(TileEntitySpecialRenderer) new RenderConveyorBelt()
|
||||
);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(
|
||||
TileEntityRejector.class, (TileEntitySpecialRenderer) new RenderRejector()
|
||||
);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(
|
||||
TileEntityManipulator.class,
|
||||
(TileEntitySpecialRenderer) new RenderManipulator()
|
||||
);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(
|
||||
TileEntityCrate.class, (TileEntitySpecialRenderer) new RenderCrate()
|
||||
);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(
|
||||
TileEntityArmbot.class, (TileEntitySpecialRenderer) new RenderArmbot()
|
||||
);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(
|
||||
TileEntityDetector.class, (TileEntitySpecialRenderer) new RenderDetector()
|
||||
);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(
|
||||
TileEntityCraneController.class,
|
||||
(TileEntitySpecialRenderer) new RenderCraneController()
|
||||
);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(
|
||||
TileEntityCraneRail.class, (TileEntitySpecialRenderer) new RenderCraneFrame()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
public Object
|
||||
getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null) {
|
||||
switch (ID) {
|
||||
case 1: {
|
||||
return new GuiImprinter(player.inventory, (TileEntityImprinter)tileEntity);
|
||||
return new GuiImprinter(
|
||||
player.inventory, (TileEntityImprinter) tileEntity
|
||||
);
|
||||
}
|
||||
case 2: {
|
||||
if (tileEntity == null || !(tileEntity instanceof TileEntityEncoder)) break;
|
||||
return new GuiEncoder(player.inventory, (TileEntityEncoder)tileEntity);
|
||||
if (tileEntity == null || !(tileEntity instanceof TileEntityEncoder))
|
||||
break;
|
||||
return new GuiEncoder(
|
||||
player.inventory, (TileEntityEncoder) tileEntity
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,4 +98,3 @@ extends CommonProxy {
|
|||
return GuiScreen.isCtrlKeyDown();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,24 +11,34 @@ import net.minecraft.util.StatCollector;
|
|||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
public class GuiAutoCrafting
|
||||
extends GuiContainer {
|
||||
public GuiAutoCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5) {
|
||||
super((Container)new ContainerWorkbench(par1InventoryPlayer, par2World, par3, par4, par5));
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public class GuiAutoCrafting extends GuiContainer {
|
||||
public GuiAutoCrafting(
|
||||
InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5
|
||||
) {
|
||||
super((Container
|
||||
) new ContainerWorkbench(par1InventoryPlayer, par2World, par3, par4, par5));
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer() {
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal((String)"AutoCrafter"), 28, 6, 0x404040);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal((String)"container.inventory"), 8, this.ySize - 96 + 2, 0x404040);
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal((String) "AutoCrafter"), 28, 6, 0x404040
|
||||
);
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal((String) "container.inventory"),
|
||||
8,
|
||||
this.ySize - 96 + 2,
|
||||
0x404040
|
||||
);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
this.mc.renderEngine.getTexture(new ResourceLocation("assemblyline", "textures/gui/gui_crafting.png"));
|
||||
GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
|
||||
this.mc.renderEngine.getTexture(
|
||||
new ResourceLocation("assemblyline", "textures/gui/gui_crafting.png")
|
||||
);
|
||||
GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, (float) 1.0f);
|
||||
int var5 = (this.width - this.xSize) / 2;
|
||||
int var6 = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,13 +5,11 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
@Deprecated
|
||||
public class GuiButtonImage
|
||||
extends GuiButton {
|
||||
public class GuiButtonImage extends GuiButton {
|
||||
private int type = 0;
|
||||
|
||||
public GuiButtonImage(int par1, int par2, int par3, int type) {
|
||||
|
@ -22,16 +20,21 @@ extends GuiButton {
|
|||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int width, int hight) {
|
||||
if (this.visible) {
|
||||
par1Minecraft.getTextureManager().bindTexture(new ResourceLocation("assemblyline", "textures/gui@.png"));
|
||||
GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
|
||||
boolean var4 = width >= this.xPosition && hight >= this.yPosition && width < this.xPosition + this.width && hight < this.yPosition + this.height;
|
||||
par1Minecraft.getTextureManager().bindTexture(
|
||||
new ResourceLocation("assemblyline", "textures/gui@.png")
|
||||
);
|
||||
GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, (float) 1.0f);
|
||||
boolean var4 = width >= this.xPosition && hight >= this.yPosition
|
||||
&& width < this.xPosition + this.width
|
||||
&& hight < this.yPosition + this.height;
|
||||
int var5 = 106;
|
||||
int var6 = 0;
|
||||
if (var4) {
|
||||
var5 += this.height;
|
||||
}
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, var6, var5, this.width, this.height);
|
||||
this.drawTexturedModalRect(
|
||||
this.xPosition, this.yPosition, var6, var5, this.width, this.height
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,24 +1,32 @@
|
|||
package assemblyline.client.gui;
|
||||
|
||||
import cpw.mods.fml.client.GuiScrollingList;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import cpw.mods.fml.client.GuiScrollingList;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiCommandList
|
||||
extends GuiScrollingList {
|
||||
public class GuiCommandList extends GuiScrollingList {
|
||||
private ArrayList commands = new ArrayList();
|
||||
private int selIndex = -1;
|
||||
private Minecraft mc;
|
||||
|
||||
public GuiCommandList(Minecraft client, int width, int height, int top, int bottom, int left, int entryHeight) {
|
||||
public GuiCommandList(
|
||||
Minecraft client,
|
||||
int width,
|
||||
int height,
|
||||
int top,
|
||||
int bottom,
|
||||
int left,
|
||||
int entryHeight
|
||||
) {
|
||||
super(client, width, height, top, bottom, left, entryHeight);
|
||||
this.mc = client;
|
||||
}
|
||||
|
||||
public void setCommands(ArrayList commands) {
|
||||
this.commands = (ArrayList)commands.clone();
|
||||
this.commands = (ArrayList) commands.clone();
|
||||
}
|
||||
|
||||
protected int getSize() {
|
||||
|
@ -34,60 +42,95 @@ extends GuiScrollingList {
|
|||
}
|
||||
|
||||
protected void drawBackground() {
|
||||
GuiCommandList.drawOutlineRect(this.left, this.left + this.listWidth, this.top, this.top + this.listHeight, 0.0f, 0.0f, 0.0f, 0.5f, 0.5f, 0.5f);
|
||||
GuiCommandList.drawOutlineRect(
|
||||
this.left,
|
||||
this.left + this.listWidth,
|
||||
this.top,
|
||||
this.top + this.listHeight,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.5f,
|
||||
0.5f,
|
||||
0.5f
|
||||
);
|
||||
}
|
||||
|
||||
public static void drawOutlineRect(int x1, int y1, int x2, int y2, float rR, float rG, float rB, float lR, float lG, float lB) {
|
||||
public static void drawOutlineRect(
|
||||
int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2,
|
||||
float rR,
|
||||
float rG,
|
||||
float rB,
|
||||
float lR,
|
||||
float lG,
|
||||
float lB
|
||||
) {
|
||||
Tessellator tesselator = Tessellator.instance;
|
||||
GL11.glEnable((int)3042);
|
||||
GL11.glDisable((int)3553);
|
||||
GL11.glBlendFunc((int)770, (int)771);
|
||||
GL11.glColor4f((float)rR, (float)rG, (float)rB, (float)1.0f);
|
||||
GL11.glEnable((int) 3042);
|
||||
GL11.glDisable((int) 3553);
|
||||
GL11.glBlendFunc((int) 770, (int) 771);
|
||||
GL11.glColor4f((float) rR, (float) rG, (float) rB, (float) 1.0f);
|
||||
if (rR > 0.0f && rG > 0.0f && rB > 0.0f) {
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.addVertex((double)x1, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y1, 0.0);
|
||||
tesselator.addVertex((double)x1, (double)y1, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y1, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y1, 0.0);
|
||||
tesselator.draw();
|
||||
}
|
||||
GL11.glColor4f((float)lR, (float)lG, (float)lB, (float)1.0f);
|
||||
GL11.glColor4f((float) lR, (float) lG, (float) lB, (float) 1.0f);
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.addVertex((double)x1, (double)y1, 0.0);
|
||||
tesselator.addVertex((double)x1, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x1 + 1.0, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x1 + 1.0, (double)y1, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y1, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x1 + 1.0, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x1 + 1.0, (double) y1, 0.0);
|
||||
tesselator.draw();
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.addVertex((double)x2 - 1.0, (double)y1, 0.0);
|
||||
tesselator.addVertex((double)x2 - 1.0, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y1, 0.0);
|
||||
tesselator.addVertex((double) x2 - 1.0, (double) y1, 0.0);
|
||||
tesselator.addVertex((double) x2 - 1.0, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y1, 0.0);
|
||||
tesselator.draw();
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.addVertex((double)x1, (double)y1, 0.0);
|
||||
tesselator.addVertex((double)x1, (double)y1 + 1.0, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y1 + 1.0, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y1, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y1, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y1 + 1.0, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y1 + 1.0, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y1, 0.0);
|
||||
tesselator.draw();
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.addVertex((double)x1, (double)y2 - 1.0, 0.0);
|
||||
tesselator.addVertex((double)x1, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y2 - 1.0, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y2 - 1.0, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y2 - 1.0, 0.0);
|
||||
tesselator.draw();
|
||||
GL11.glEnable((int)3553);
|
||||
GL11.glDisable((int)3042);
|
||||
GL11.glEnable((int) 3553);
|
||||
GL11.glDisable((int) 3042);
|
||||
}
|
||||
|
||||
protected void drawSlot(int slotID, int width, int slotY, int slotHeight, Tessellator tessellator) {
|
||||
protected void
|
||||
drawSlot(int slotID, int width, int slotY, int slotHeight, Tessellator tessellator) {
|
||||
if (slotID < this.commands.size()) {
|
||||
String command = (String)this.commands.get(slotID);
|
||||
String command = (String) this.commands.get(slotID);
|
||||
if (this.isSelected(slotID)) {
|
||||
GuiCommandList.drawOutlineRect(this.left, this.left + width, this.top + slotY, this.top + slotY + slotHeight, -1.0f, -1.0f, -1.0f, 0.5f, 0.5f, 0.5f);
|
||||
GuiCommandList.drawOutlineRect(
|
||||
this.left,
|
||||
this.left + width,
|
||||
this.top + slotY,
|
||||
this.top + slotY + slotHeight,
|
||||
-1.0f,
|
||||
-1.0f,
|
||||
-1.0f,
|
||||
0.5f,
|
||||
0.5f,
|
||||
0.5f
|
||||
);
|
||||
}
|
||||
this.mc.fontRenderer.drawString(command, this.left + 4, slotY + 4, 0xAAAAAA, false);
|
||||
this.mc.fontRenderer.drawString(
|
||||
command, this.left + 4, slotY + 4, 0xAAAAAA, false
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package assemblyline.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.machine.encoder.ContainerEncoder;
|
||||
import assemblyline.common.machine.encoder.IInventoryWatcher;
|
||||
import assemblyline.common.machine.encoder.ItemDisk;
|
||||
import assemblyline.common.machine.encoder.TileEntityEncoder;
|
||||
import assemblyline.common.network.MessageEncoder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
@ -17,16 +17,12 @@ import net.minecraft.inventory.Container;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.TranslationHelper;
|
||||
|
||||
public class GuiEncoder
|
||||
extends GuiContainer
|
||||
implements IInventoryWatcher {
|
||||
public class GuiEncoder extends GuiContainer implements IInventoryWatcher {
|
||||
private static final int MAX_COMMANDS = 6;
|
||||
private int containerWidth;
|
||||
private int containerHeight;
|
||||
|
@ -41,7 +37,7 @@ implements IInventoryWatcher {
|
|||
private GuiTextField commandField;
|
||||
|
||||
public GuiEncoder(InventoryPlayer playerInventory, TileEntityEncoder tileEntity) {
|
||||
super((Container)new ContainerEncoder(playerInventory, tileEntity));
|
||||
super((Container) new ContainerEncoder(playerInventory, tileEntity));
|
||||
this.ySize = 237;
|
||||
this.tileEntity = tileEntity;
|
||||
tileEntity.setWatcher(this);
|
||||
|
@ -50,14 +46,43 @@ implements IInventoryWatcher {
|
|||
public void initGui() {
|
||||
super.initGui();
|
||||
this.allowUserInput = true;
|
||||
Keyboard.enableRepeatEvents((boolean)true);
|
||||
Keyboard.enableRepeatEvents((boolean) true);
|
||||
this.containerWidth = (this.width - this.xSize) / 2;
|
||||
this.containerHeight = (this.height - this.ySize) / 2;
|
||||
this.addButton = new GuiButton(0, this.containerWidth + (this.xSize - 25), this.containerHeight + 128 + 0, 18, 20, "+");
|
||||
this.delButton = new GuiButton(1, this.containerWidth + (this.xSize - 43), this.containerHeight + 128 + 0, 18, 20, "-");
|
||||
this.pUpButton = new GuiButton(2, this.containerWidth + (this.xSize - 25), this.containerHeight + 46 + 0, 18, 20, "");
|
||||
this.pDnButton = new GuiButton(3, this.containerWidth + (this.xSize - 25), this.containerHeight + 106 + 0, 18, 20, "");
|
||||
this.commandField = new GuiTextField(this.fontRendererObj, 8, 129, this.xSize - 52, 18);
|
||||
this.addButton = new GuiButton(
|
||||
0,
|
||||
this.containerWidth + (this.xSize - 25),
|
||||
this.containerHeight + 128 + 0,
|
||||
18,
|
||||
20,
|
||||
"+"
|
||||
);
|
||||
this.delButton = new GuiButton(
|
||||
1,
|
||||
this.containerWidth + (this.xSize - 43),
|
||||
this.containerHeight + 128 + 0,
|
||||
18,
|
||||
20,
|
||||
"-"
|
||||
);
|
||||
this.pUpButton = new GuiButton(
|
||||
2,
|
||||
this.containerWidth + (this.xSize - 25),
|
||||
this.containerHeight + 46 + 0,
|
||||
18,
|
||||
20,
|
||||
""
|
||||
);
|
||||
this.pDnButton = new GuiButton(
|
||||
3,
|
||||
this.containerWidth + (this.xSize - 25),
|
||||
this.containerHeight + 106 + 0,
|
||||
18,
|
||||
20,
|
||||
""
|
||||
);
|
||||
this.commandField
|
||||
= new GuiTextField(this.fontRendererObj, 8, 129, this.xSize - 52, 18);
|
||||
this.buttonList.add(this.addButton);
|
||||
this.buttonList.add(this.delButton);
|
||||
this.buttonList.add(this.pUpButton);
|
||||
|
@ -72,12 +97,16 @@ implements IInventoryWatcher {
|
|||
switch (button.id) {
|
||||
case 0: {
|
||||
ItemStack disk;
|
||||
if (this.commandField.getText().equals("")) break;
|
||||
if (this.tileEntity != null && (disk = this.tileEntity.getStackInSlot(0)) != null) {
|
||||
if (this.commandField.getText().equals(""))
|
||||
break;
|
||||
if (this.tileEntity != null
|
||||
&& (disk = this.tileEntity.getStackInSlot(0)) != null) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setBoolean("create", true);
|
||||
nbt.setString("newCommand", this.commandField.getText());
|
||||
AssemblyLine.NETWORK.sendToServer(new MessageEncoder(new Vector3(this.tileEntity), nbt));
|
||||
AssemblyLine.NETWORK.sendToServer(
|
||||
new MessageEncoder(new Vector3(this.tileEntity), nbt)
|
||||
);
|
||||
}
|
||||
this.minCommand = this.commands.size() - 6 + 1;
|
||||
if (this.minCommand < 0) {
|
||||
|
@ -88,24 +117,30 @@ implements IInventoryWatcher {
|
|||
break;
|
||||
}
|
||||
case 1: {
|
||||
if (this.tileEntity == null) break;
|
||||
if (this.tileEntity == null)
|
||||
break;
|
||||
ItemStack disk = this.tileEntity.getStackInSlot(0);
|
||||
if (disk != null && this.selCommand >= 0 && this.selCommand < this.commands.size()) {
|
||||
if (disk != null && this.selCommand >= 0
|
||||
&& this.selCommand < this.commands.size()) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setBoolean("create", false);
|
||||
nbt.setInteger("commandToRemove", this.selCommand);
|
||||
AssemblyLine.NETWORK.sendToServer(new MessageEncoder(new Vector3(this.tileEntity), nbt));
|
||||
AssemblyLine.NETWORK.sendToServer(
|
||||
new MessageEncoder(new Vector3(this.tileEntity), nbt)
|
||||
);
|
||||
}
|
||||
this.selCommand = -1;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
if (this.minCommand <= 0) break;
|
||||
if (this.minCommand <= 0)
|
||||
break;
|
||||
--this.minCommand;
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
if (this.minCommand + 6 >= this.commands.size()) break;
|
||||
if (this.minCommand + 6 >= this.commands.size())
|
||||
break;
|
||||
++this.minCommand;
|
||||
}
|
||||
}
|
||||
|
@ -113,19 +148,29 @@ implements IInventoryWatcher {
|
|||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
|
||||
GL11.glDisable((int)2896);
|
||||
this.fontRendererObj.drawString(TranslationHelper.getLocal("tile.encoder.name"), 68, 8, 0x404040);
|
||||
GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, (float) 1.0f);
|
||||
GL11.glDisable((int) 2896);
|
||||
this.fontRendererObj.drawString(
|
||||
TranslationHelper.getLocal("tile.encoder.name"), 68, 8, 0x404040
|
||||
);
|
||||
this.fontRendererObj.drawString("Disk:", 56, 28, 0x404040);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)(this.pUpButton.xPosition - this.containerWidth + 6), (float)(this.pUpButton.yPosition - this.containerHeight + 7), (float)0.0f);
|
||||
GL11.glTranslatef(
|
||||
(float) (this.pUpButton.xPosition - this.containerWidth + 6),
|
||||
(float) (this.pUpButton.yPosition - this.containerHeight + 7),
|
||||
(float) 0.0f
|
||||
);
|
||||
this.fontRendererObj.drawString("^", 1, 1, 0x444444);
|
||||
this.fontRendererObj.drawString("^", 0, 0, 0xFFFFFF);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)(this.pDnButton.xPosition - this.containerWidth + 6), (float)(this.pDnButton.yPosition - this.containerHeight + 7), (float)0.0f);
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)0.0f, (float)1.0f);
|
||||
GL11.glTranslatef((float)-5.0f, (float)-4.0f, (float)0.0f);
|
||||
GL11.glTranslatef(
|
||||
(float) (this.pDnButton.xPosition - this.containerWidth + 6),
|
||||
(float) (this.pDnButton.yPosition - this.containerHeight + 7),
|
||||
(float) 0.0f
|
||||
);
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 0.0f, (float) 1.0f);
|
||||
GL11.glTranslatef((float) -5.0f, (float) -4.0f, (float) 0.0f);
|
||||
this.fontRendererObj.drawString("^", -1, -1, 0x444444);
|
||||
this.fontRendererObj.drawString("^", 0, 0, 0xFFFFFF);
|
||||
GL11.glPopMatrix();
|
||||
|
@ -137,30 +182,54 @@ implements IInventoryWatcher {
|
|||
|
||||
private void drawCommands() {
|
||||
for (int i = this.minCommand; i < this.minCommand + 6; ++i) {
|
||||
if (i < 0 || i >= this.commands.size()) continue;
|
||||
if (i < 0 || i >= this.commands.size())
|
||||
continue;
|
||||
int relativeCommand = i - this.minCommand;
|
||||
String command = ((String)this.commands.get(i)).toUpperCase();
|
||||
this.drawCommand(command, 8, 47 + relativeCommand * (this.fontRendererObj.FONT_HEIGHT + 4), this.selCommand == i);
|
||||
String command = ((String) this.commands.get(i)).toUpperCase();
|
||||
this.drawCommand(
|
||||
command,
|
||||
8,
|
||||
47 + relativeCommand * (this.fontRendererObj.FONT_HEIGHT + 4),
|
||||
this.selCommand == i
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawCommand(String command, int x, int y, boolean selected) {
|
||||
if (selected) {
|
||||
GuiEncoder.drawOutlineRect(x, y, x + 142, y + this.fontRendererObj.FONT_HEIGHT + 4, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
|
||||
GuiEncoder.drawOutlineRect(
|
||||
x,
|
||||
y,
|
||||
x + 142,
|
||||
y + this.fontRendererObj.FONT_HEIGHT + 4,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
1.0f,
|
||||
1.0f,
|
||||
1.0f
|
||||
);
|
||||
}
|
||||
this.fontRendererObj.drawString(command, x + 3, y + this.fontRendererObj.FONT_HEIGHT / 2 - 1, 0xFFFFFF, false);
|
||||
this.fontRendererObj.drawString(
|
||||
command, x + 3, y + this.fontRendererObj.FONT_HEIGHT / 2 - 1, 0xFFFFFF, false
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
this.commandField.mouseClicked(x - this.containerWidth, y - this.containerHeight, button);
|
||||
this.commandField.mouseClicked(
|
||||
x - this.containerWidth, y - this.containerHeight, button
|
||||
);
|
||||
if (button == 0) {
|
||||
if (x >= this.containerWidth + 8) {
|
||||
if (y >= this.containerHeight + 47 + 0) {
|
||||
if (x <= this.containerWidth + (this.xSize - 25)) {
|
||||
if (y <= this.containerHeight + 46 + 80 + 0) {
|
||||
this.listClicked(x - (this.containerWidth + 8), y - (this.containerHeight + 47 + 0));
|
||||
this.listClicked(
|
||||
x - (this.containerWidth + 8),
|
||||
y - (this.containerHeight + 47 + 0)
|
||||
);
|
||||
} else {
|
||||
this.selCommand = -1;
|
||||
}
|
||||
|
@ -207,7 +276,8 @@ implements IInventoryWatcher {
|
|||
if (this.selCommand < this.minCommand && this.selCommand >= 0) {
|
||||
this.minCommand = this.selCommand;
|
||||
}
|
||||
if (this.selCommand >= this.minCommand + 6 && this.selCommand < this.commands.size()) {
|
||||
if (this.selCommand >= this.minCommand + 6
|
||||
&& this.selCommand < this.commands.size()) {
|
||||
this.minCommand = this.selCommand - 6 + 1;
|
||||
}
|
||||
} else if (keycode == 208) {
|
||||
|
@ -215,7 +285,8 @@ implements IInventoryWatcher {
|
|||
if (this.selCommand >= this.commands.size()) {
|
||||
this.selCommand = -1;
|
||||
}
|
||||
if (this.selCommand >= this.minCommand + 6 && this.selCommand < this.commands.size()) {
|
||||
if (this.selCommand >= this.minCommand + 6
|
||||
&& this.selCommand < this.commands.size()) {
|
||||
this.minCommand = this.selCommand - 6 + 1;
|
||||
}
|
||||
if (this.selCommand < this.minCommand && this.selCommand >= 0) {
|
||||
|
@ -226,60 +297,87 @@ implements IInventoryWatcher {
|
|||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
this.mc.renderEngine.bindTexture(new ResourceLocation("assemblyline", "textures/gui/gui_encoder.png"));
|
||||
GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
|
||||
this.drawTexturedModalRect(this.containerWidth, this.containerHeight + 0, 0, 0, this.xSize, this.ySize);
|
||||
GuiEncoder.drawOutlineRect(this.containerWidth + 7, this.containerHeight + 46 + 0, this.containerWidth + (this.xSize - 25), this.containerHeight + 46 + 80 + 0, 0.0f, 0.0f, 0.0f, 0.5f, 0.5f, 0.5f);
|
||||
this.mc.renderEngine.bindTexture(
|
||||
new ResourceLocation("assemblyline", "textures/gui/gui_encoder.png")
|
||||
);
|
||||
GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, (float) 1.0f);
|
||||
this.drawTexturedModalRect(
|
||||
this.containerWidth, this.containerHeight + 0, 0, 0, this.xSize, this.ySize
|
||||
);
|
||||
GuiEncoder.drawOutlineRect(
|
||||
this.containerWidth + 7,
|
||||
this.containerHeight + 46 + 0,
|
||||
this.containerWidth + (this.xSize - 25),
|
||||
this.containerHeight + 46 + 80 + 0,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.5f,
|
||||
0.5f,
|
||||
0.5f
|
||||
);
|
||||
}
|
||||
|
||||
public static void drawOutlineRect(int x1, int y1, int x2, int y2, float rR, float rG, float rB, float lR, float lG, float lB) {
|
||||
public static void drawOutlineRect(
|
||||
int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2,
|
||||
float rR,
|
||||
float rG,
|
||||
float rB,
|
||||
float lR,
|
||||
float lG,
|
||||
float lB
|
||||
) {
|
||||
Tessellator tesselator = Tessellator.instance;
|
||||
GL11.glEnable((int)3042);
|
||||
GL11.glDisable((int)3553);
|
||||
GL11.glBlendFunc((int)770, (int)771);
|
||||
GL11.glColor4f((float)rR, (float)rG, (float)rB, (float)1.0f);
|
||||
GL11.glEnable((int) 3042);
|
||||
GL11.glDisable((int) 3553);
|
||||
GL11.glBlendFunc((int) 770, (int) 771);
|
||||
GL11.glColor4f((float) rR, (float) rG, (float) rB, (float) 1.0f);
|
||||
if (rR >= 0.0f && rG >= 0.0f && rB >= 0.0f) {
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.addVertex((double)x1, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y1, 0.0);
|
||||
tesselator.addVertex((double)x1, (double)y1, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y1, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y1, 0.0);
|
||||
tesselator.draw();
|
||||
}
|
||||
GL11.glColor4f((float)lR, (float)lG, (float)lB, (float)1.0f);
|
||||
GL11.glColor4f((float) lR, (float) lG, (float) lB, (float) 1.0f);
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.addVertex((double)x1, (double)y1, 0.0);
|
||||
tesselator.addVertex((double)x1, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x1 + 1.0, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x1 + 1.0, (double)y1, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y1, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x1 + 1.0, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x1 + 1.0, (double) y1, 0.0);
|
||||
tesselator.draw();
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.addVertex((double)x2 - 1.0, (double)y1, 0.0);
|
||||
tesselator.addVertex((double)x2 - 1.0, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y1, 0.0);
|
||||
tesselator.addVertex((double) x2 - 1.0, (double) y1, 0.0);
|
||||
tesselator.addVertex((double) x2 - 1.0, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y1, 0.0);
|
||||
tesselator.draw();
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.addVertex((double)x1, (double)y1, 0.0);
|
||||
tesselator.addVertex((double)x1, (double)y1 + 1.0, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y1 + 1.0, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y1, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y1, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y1 + 1.0, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y1 + 1.0, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y1, 0.0);
|
||||
tesselator.draw();
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.addVertex((double)x1, (double)y2 - 1.0, 0.0);
|
||||
tesselator.addVertex((double)x1, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y2, 0.0);
|
||||
tesselator.addVertex((double)x2, (double)y2 - 1.0, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y2 - 1.0, 0.0);
|
||||
tesselator.addVertex((double) x1, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y2, 0.0);
|
||||
tesselator.addVertex((double) x2, (double) y2 - 1.0, 0.0);
|
||||
tesselator.draw();
|
||||
GL11.glEnable((int)3553);
|
||||
GL11.glDisable((int)3042);
|
||||
GL11.glEnable((int) 3553);
|
||||
GL11.glDisable((int) 3042);
|
||||
}
|
||||
|
||||
private void updateCommands() {
|
||||
if (this.commands != null) {
|
||||
ItemStack disk;
|
||||
this.commands.clear();
|
||||
if (this.tileEntity != null && (disk = this.tileEntity.getStackInSlot(0)) != null) {
|
||||
if (this.tileEntity != null
|
||||
&& (disk = this.tileEntity.getStackInSlot(0)) != null) {
|
||||
this.commands = ItemDisk.getCommands(disk);
|
||||
}
|
||||
if (this.minCommand + 6 >= this.commands.size()) {
|
||||
|
@ -294,7 +392,7 @@ implements IInventoryWatcher {
|
|||
@Override
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
Keyboard.enableRepeatEvents((boolean)false);
|
||||
Keyboard.enableRepeatEvents((boolean) false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -302,4 +400,3 @@ implements IInventoryWatcher {
|
|||
this.updateCommands();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,18 +6,18 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
|||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import universalelectricity.prefab.TranslationHelper;
|
||||
|
||||
public class GuiImprinter
|
||||
extends GuiContainer {
|
||||
public class GuiImprinter extends GuiContainer {
|
||||
private int containerWidth;
|
||||
private int containerHeight;
|
||||
private TileEntityImprinter tileEntity;
|
||||
|
||||
public GuiImprinter(InventoryPlayer par1InventoryPlayer, TileEntityImprinter tileEntity) {
|
||||
super((Container)new ContainerImprinter(par1InventoryPlayer, tileEntity));
|
||||
public GuiImprinter(
|
||||
InventoryPlayer par1InventoryPlayer, TileEntityImprinter tileEntity
|
||||
) {
|
||||
super((Container) new ContainerImprinter(par1InventoryPlayer, tileEntity));
|
||||
this.tileEntity = tileEntity;
|
||||
this.ySize = 201;
|
||||
}
|
||||
|
@ -25,17 +25,24 @@ extends GuiContainer {
|
|||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
this.fontRendererObj.drawString("Use Inventories:", 70, 58, 0x404040);
|
||||
this.fontRendererObj.drawString("" + this.tileEntity.searchInventories, 105, 67, 0x404040);
|
||||
this.fontRendererObj.drawString(TranslationHelper.getLocal("tile.imprinter.name"), 68, 6, 0x404040);
|
||||
this.fontRendererObj.drawString(
|
||||
"" + this.tileEntity.searchInventories, 105, 67, 0x404040
|
||||
);
|
||||
this.fontRendererObj.drawString(
|
||||
TranslationHelper.getLocal("tile.imprinter.name"), 68, 6, 0x404040
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
this.mc.renderEngine.bindTexture(new ResourceLocation("assemblyline", "textures/gui/gui_imprinter.png"));
|
||||
GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
|
||||
this.mc.renderEngine.bindTexture(
|
||||
new ResourceLocation("assemblyline", "textures/gui/gui_imprinter.png")
|
||||
);
|
||||
GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, (float) 1.0f);
|
||||
this.containerWidth = (this.width - this.xSize) / 2;
|
||||
this.containerHeight = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(this.containerWidth, this.containerHeight, 0, 0, this.xSize, this.ySize);
|
||||
this.drawTexturedModalRect(
|
||||
this.containerWidth, this.containerHeight, 0, 0, this.xSize, this.ySize
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ package assemblyline.client.model;
|
|||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelAngledBelt
|
||||
extends ModelBase {
|
||||
public class ModelAngledBelt extends ModelBase {
|
||||
ModelRenderer MRoller1;
|
||||
ModelRenderer bBELT;
|
||||
ModelRenderer MRoller2;
|
||||
|
@ -14,31 +13,31 @@ extends ModelBase {
|
|||
public ModelAngledBelt() {
|
||||
this.textureWidth = 128;
|
||||
this.textureHeight = 128;
|
||||
this.MRoller1 = new ModelRenderer((ModelBase)this, 0, 26);
|
||||
this.MRoller1 = new ModelRenderer((ModelBase) this, 0, 26);
|
||||
this.MRoller1.addBox(-7.0f, -1.0f, -1.0f, 14, 2, 2);
|
||||
this.MRoller1.setRotationPoint(0.0f, 14.0f, 0.0f);
|
||||
this.MRoller1.setTextureSize(128, 128);
|
||||
this.MRoller1.mirror = true;
|
||||
this.setRotation(this.MRoller1, 0.7853982f, 0.0f, 0.0f);
|
||||
this.bBELT = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.bBELT = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.bBELT.addBox(0.0f, 0.0f, 0.0f, 14, 1, 23);
|
||||
this.bBELT.setRotationPoint(-7.0f, 23.5f, -8.0f);
|
||||
this.bBELT.setTextureSize(128, 128);
|
||||
this.bBELT.mirror = true;
|
||||
this.setRotation(this.bBELT, 0.7853982f, 0.0f, 0.0f);
|
||||
this.MRoller2 = new ModelRenderer((ModelBase)this, 0, 26);
|
||||
this.MRoller2 = new ModelRenderer((ModelBase) this, 0, 26);
|
||||
this.MRoller2.addBox(-7.0f, -1.0f, -1.0f, 14, 2, 2);
|
||||
this.MRoller2.setRotationPoint(0.0f, 9.0f, 5.0f);
|
||||
this.MRoller2.setTextureSize(128, 128);
|
||||
this.MRoller2.mirror = true;
|
||||
this.setRotation(this.MRoller2, 0.7853982f, 0.0f, 0.0f);
|
||||
this.tBELT = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.tBELT = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.tBELT.addBox(0.0f, 0.0f, 0.0f, 14, 1, 23);
|
||||
this.tBELT.setRotationPoint(-7.0f, 19.0f, -8.0f);
|
||||
this.tBELT.setTextureSize(128, 128);
|
||||
this.tBELT.mirror = true;
|
||||
this.setRotation(this.tBELT, 0.7853982f, 0.0f, 0.0f);
|
||||
this.MRoller3 = new ModelRenderer((ModelBase)this, 0, 26);
|
||||
this.MRoller3 = new ModelRenderer((ModelBase) this, 0, 26);
|
||||
this.MRoller3.addBox(-7.0f, -1.0f, -1.0f, 14, 2, 2);
|
||||
this.MRoller3.setRotationPoint(0.0f, 19.0f, -5.0f);
|
||||
this.MRoller3.setTextureSize(128, 128);
|
||||
|
@ -65,4 +64,3 @@ extends ModelBase {
|
|||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@ import net.minecraft.client.model.ModelRenderer;
|
|||
import net.minecraft.entity.Entity;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ModelArmbot
|
||||
extends ModelBase {
|
||||
public class ModelArmbot extends ModelBase {
|
||||
ModelRenderer baseTop;
|
||||
ModelRenderer base;
|
||||
ModelRenderer armMountRight;
|
||||
|
@ -25,85 +24,85 @@ extends ModelBase {
|
|||
public ModelArmbot() {
|
||||
this.textureWidth = 128;
|
||||
this.textureHeight = 128;
|
||||
this.baseTop = new ModelRenderer((ModelBase)this, 0, 94);
|
||||
this.baseTop = new ModelRenderer((ModelBase) this, 0, 94);
|
||||
this.baseTop.addBox(-6.0f, 0.0f, -6.0f, 12, 3, 12);
|
||||
this.baseTop.setRotationPoint(0.0f, 18.0f, 0.0f);
|
||||
this.baseTop.setTextureSize(64, 32);
|
||||
this.baseTop.mirror = true;
|
||||
this.setRotation(this.baseTop, 0.0f, 0.0f, 0.0f);
|
||||
this.base = new ModelRenderer((ModelBase)this, 0, 109);
|
||||
this.base = new ModelRenderer((ModelBase) this, 0, 109);
|
||||
this.base.addBox(-8.0f, 0.0f, -8.0f, 16, 3, 16);
|
||||
this.base.setRotationPoint(0.0f, 21.0f, 0.0f);
|
||||
this.base.setTextureSize(64, 32);
|
||||
this.base.mirror = true;
|
||||
this.setRotation(this.base, 0.0f, 0.0f, 0.0f);
|
||||
this.armMountRight = new ModelRenderer((ModelBase)this, 24, 85);
|
||||
this.armMountRight = new ModelRenderer((ModelBase) this, 24, 85);
|
||||
this.armMountRight.addBox(-3.8f, -5.0f, -2.0f, 4, 5, 4);
|
||||
this.armMountRight.setRotationPoint(0.0f, 17.0f, 0.0f);
|
||||
this.armMountRight.setTextureSize(128, 128);
|
||||
this.armMountRight.mirror = true;
|
||||
this.setRotation(this.armMountRight, 0.0f, 0.0f, 0.0f);
|
||||
this.armMountLeft = new ModelRenderer((ModelBase)this, 0, 85);
|
||||
this.armMountLeft = new ModelRenderer((ModelBase) this, 0, 85);
|
||||
this.armMountLeft.addBox(2.0f, -5.0f, -2.0f, 2, 5, 4);
|
||||
this.armMountLeft.setRotationPoint(0.0f, 17.0f, 0.0f);
|
||||
this.armMountLeft.setTextureSize(64, 32);
|
||||
this.armMountLeft.mirror = true;
|
||||
this.setRotation(this.armMountLeft, 0.0f, 0.0f, 0.0f);
|
||||
this.armLower = new ModelRenderer((ModelBase)this, 116, 0);
|
||||
this.armLower = new ModelRenderer((ModelBase) this, 116, 0);
|
||||
this.armLower.addBox(0.3f, -15.0f, -1.5f, 2, 16, 4);
|
||||
this.armLower.setRotationPoint(0.0f, 14.0f, 0.0f);
|
||||
this.armLower.setTextureSize(64, 32);
|
||||
this.armLower.mirror = true;
|
||||
this.setRotation(this.armLower, 0.5235988f, 0.0f, 0.0f);
|
||||
this.armLower2 = new ModelRenderer((ModelBase)this, 104, 0);
|
||||
this.armLower2 = new ModelRenderer((ModelBase) this, 104, 0);
|
||||
this.armLower2.addBox(-2.3f, -15.0f, -1.5f, 2, 16, 4);
|
||||
this.armLower2.setRotationPoint(0.0f, 14.0f, 0.0f);
|
||||
this.armLower2.setTextureSize(64, 32);
|
||||
this.armLower2.mirror = true;
|
||||
this.setRotation(this.armLower2, 0.5235988f, 0.0f, 0.0f);
|
||||
this.armLower3 = new ModelRenderer((ModelBase)this, 92, 0);
|
||||
this.armLower3 = new ModelRenderer((ModelBase) this, 92, 0);
|
||||
this.armLower3.addBox(-1.0f, -14.0f, -2.0f, 2, 14, 4);
|
||||
this.armLower3.setRotationPoint(0.0f, 14.0f, 0.0f);
|
||||
this.armLower3.setTextureSize(64, 32);
|
||||
this.armLower3.mirror = true;
|
||||
this.setRotation(this.armLower3, 0.5235988f, 0.0f, 0.0f);
|
||||
this.armUpper = new ModelRenderer((ModelBase)this, 0, 70);
|
||||
this.armUpper = new ModelRenderer((ModelBase) this, 0, 70);
|
||||
this.armUpper.addBox(-1.0f, -10.0f, -1.5f, 2, 12, 3);
|
||||
this.armUpper.setRotationPoint(0.0f, 2.0f, -7.0f);
|
||||
this.armUpper.setTextureSize(64, 32);
|
||||
this.armUpper.mirror = true;
|
||||
this.setRotation(this.armUpper, 2.513274f, 0.0f, 0.0f);
|
||||
this.baseRotation = new ModelRenderer((ModelBase)this, 0, 60);
|
||||
this.baseRotation = new ModelRenderer((ModelBase) this, 0, 60);
|
||||
this.baseRotation.addBox(-4.5f, 0.0f, -4.5f, 9, 1, 9);
|
||||
this.baseRotation.setRotationPoint(0.0f, 17.0f, 0.0f);
|
||||
this.baseRotation.setTextureSize(64, 32);
|
||||
this.baseRotation.mirror = true;
|
||||
this.setRotation(this.baseRotation, 0.0f, 0.0f, 0.0f);
|
||||
this.clampBody = new ModelRenderer((ModelBase)this, 0, 7);
|
||||
this.clampBody = new ModelRenderer((ModelBase) this, 0, 7);
|
||||
this.clampBody.addBox(-1.5f, -12.0f, -2.5f, 3, 2, 5);
|
||||
this.clampBody.setRotationPoint(0.0f, 2.0f, -7.0f);
|
||||
this.clampBody.setTextureSize(64, 32);
|
||||
this.clampBody.mirror = true;
|
||||
this.setRotation(this.clampBody, 2.513274f, 0.0f, 0.0f);
|
||||
this.clampBody2 = new ModelRenderer((ModelBase)this, 0, 56);
|
||||
this.clampBody2 = new ModelRenderer((ModelBase) this, 0, 56);
|
||||
this.clampBody2.addBox(-1.0f, -14.0f, -1.0f, 2, 2, 2);
|
||||
this.clampBody2.setRotationPoint(0.0f, 2.0f, -7.0f);
|
||||
this.clampBody2.setTextureSize(64, 32);
|
||||
this.clampBody2.mirror = true;
|
||||
this.setRotation(this.clampBody2, 2.513274f, 0.0f, 0.0f);
|
||||
this.clampClawLower = new ModelRenderer((ModelBase)this, 0, 25);
|
||||
this.clampClawLower = new ModelRenderer((ModelBase) this, 0, 25);
|
||||
this.clampClawLower.addBox(-1.0f, -4.0f, -1.0f, 2, 5, 1);
|
||||
this.clampClawLower.setRotationPoint(0.0f, 13.0f, -15.0f);
|
||||
this.clampClawLower.setTextureSize(64, 32);
|
||||
this.clampClawLower.mirror = true;
|
||||
this.setRotation(this.clampClawLower, 2.9147f, 0.0f, 0.0f);
|
||||
this.clampClawLower2 = new ModelRenderer((ModelBase)this, 0, 31);
|
||||
this.clampClawLower2 = new ModelRenderer((ModelBase) this, 0, 31);
|
||||
this.clampClawLower2.addBox(-1.2f, -3.5f, 0.0f, 1, 6, 1);
|
||||
this.clampClawLower2.setRotationPoint(0.0f, 14.0f, -16.0f);
|
||||
this.clampClawLower2.setTextureSize(64, 32);
|
||||
this.clampClawLower2.mirror = true;
|
||||
this.setRotation(this.clampClawLower2, 2.897247f, 0.0f, 0.0f);
|
||||
this.clampClawLower3 = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.clampClawLower3 = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.clampClawLower3.addBox(0.2f, -3.5f, 0.0f, 1, 6, 1);
|
||||
this.clampClawLower3.setRotationPoint(0.0f, 14.0f, -16.0f);
|
||||
this.clampClawLower3.setTextureSize(64, 32);
|
||||
|
@ -111,7 +110,8 @@ extends ModelBase {
|
|||
this.setRotation(this.clampClawLower3, 2.897247f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
public void
|
||||
render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
this.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
this.render(f5, entity.rotationYaw, entity.rotationPitch);
|
||||
|
@ -121,21 +121,25 @@ extends ModelBase {
|
|||
this.baseTop.render(f5);
|
||||
this.base.render(f5);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef((float)rotationYaw, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float) rotationYaw, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
this.armMountRight.render(f5);
|
||||
this.armMountLeft.render(f5);
|
||||
this.baseRotation.render(f5);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef((float)rotationYaw, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glTranslatef((float)0.0f, (float)0.9f, (float)0.0f);
|
||||
GL11.glRotatef((float)(-rotationPitch), (float)1.0f, (float)0.0f, (float)0.0f);
|
||||
GL11.glTranslatef((float)0.0f, (float)-0.9f, (float)0.0f);
|
||||
GL11.glRotatef((float) rotationYaw, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
GL11.glTranslatef((float) 0.0f, (float) 0.9f, (float) 0.0f);
|
||||
GL11.glRotatef(
|
||||
(float) (-rotationPitch), (float) 1.0f, (float) 0.0f, (float) 0.0f
|
||||
);
|
||||
GL11.glTranslatef((float) 0.0f, (float) -0.9f, (float) 0.0f);
|
||||
this.armLower.render(f5);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)0.0f, (float)0.1f, (float)-0.35f);
|
||||
GL11.glRotatef((float)(-rotationPitch), (float)1.0f, (float)0.0f, (float)0.0f);
|
||||
GL11.glTranslatef((float)0.0f, (float)-0.05f, (float)0.35f);
|
||||
GL11.glTranslatef((float) 0.0f, (float) 0.1f, (float) -0.35f);
|
||||
GL11.glRotatef(
|
||||
(float) (-rotationPitch), (float) 1.0f, (float) 0.0f, (float) 0.0f
|
||||
);
|
||||
GL11.glTranslatef((float) 0.0f, (float) -0.05f, (float) 0.35f);
|
||||
this.armUpper.render(f5);
|
||||
this.clampBody.render(f5);
|
||||
this.clampBody2.render(f5);
|
||||
|
@ -151,4 +155,3 @@ extends ModelBase {
|
|||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ package assemblyline.client.model;
|
|||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelConveyorBelt
|
||||
extends ModelBase {
|
||||
public class ModelConveyorBelt extends ModelBase {
|
||||
ModelRenderer bBELTLong;
|
||||
ModelRenderer FBELT;
|
||||
ModelRenderer BacBELT;
|
||||
|
@ -30,127 +29,127 @@ extends ModelBase {
|
|||
public ModelConveyorBelt() {
|
||||
this.textureWidth = 128;
|
||||
this.textureHeight = 128;
|
||||
this.bBELTLong = new ModelRenderer((ModelBase)this, 0, 66);
|
||||
this.bBELTLong = new ModelRenderer((ModelBase) this, 0, 66);
|
||||
this.bBELTLong.addBox(0.0f, 0.0f, 0.0f, 14, 1, 16);
|
||||
this.bBELTLong.setRotationPoint(-7.0f, 22.0f, -8.0f);
|
||||
this.bBELTLong.setTextureSize(128, 128);
|
||||
this.bBELTLong.mirror = true;
|
||||
this.setRotation(this.bBELTLong, 0.0f, 0.0f, 0.0f);
|
||||
this.FBELT = new ModelRenderer((ModelBase)this, 0, 16);
|
||||
this.FBELT = new ModelRenderer((ModelBase) this, 0, 16);
|
||||
this.FBELT.addBox(0.0f, 0.0f, 0.0f, 14, 2, 1);
|
||||
this.FBELT.setRotationPoint(-7.0f, 20.0f, -8.0f);
|
||||
this.FBELT.setTextureSize(128, 128);
|
||||
this.FBELT.mirror = true;
|
||||
this.setRotation(this.FBELT, 0.0f, 0.0f, 0.0f);
|
||||
this.BacBELT = new ModelRenderer((ModelBase)this, 0, 16);
|
||||
this.BacBELT = new ModelRenderer((ModelBase) this, 0, 16);
|
||||
this.BacBELT.addBox(0.0f, 0.0f, 0.0f, 14, 2, 1);
|
||||
this.BacBELT.setRotationPoint(-7.0f, 20.0f, 7.0f);
|
||||
this.BacBELT.setTextureSize(128, 128);
|
||||
this.BacBELT.mirror = true;
|
||||
this.setRotation(this.BacBELT, 0.0f, 0.0f, 0.0f);
|
||||
this.BBelt = new ModelRenderer((ModelBase)this, 0, 31);
|
||||
this.BBelt = new ModelRenderer((ModelBase) this, 0, 31);
|
||||
this.BBelt.addBox(0.0f, 0.0f, 0.0f, 14, 1, 14);
|
||||
this.BBelt.setRotationPoint(-7.0f, 22.0f, -7.0f);
|
||||
this.BBelt.setTextureSize(128, 128);
|
||||
this.BBelt.mirror = true;
|
||||
this.setRotation(this.BBelt, 0.0f, 0.0f, 0.0f);
|
||||
this.FRL = new ModelRenderer((ModelBase)this, 0, 20);
|
||||
this.FRL = new ModelRenderer((ModelBase) this, 0, 20);
|
||||
this.FRL.addBox(0.0f, 0.0f, 0.0f, 1, 3, 2);
|
||||
this.FRL.setRotationPoint(-8.0f, 21.0f, -6.0f);
|
||||
this.FRL.setTextureSize(128, 128);
|
||||
this.FRL.mirror = true;
|
||||
this.setRotation(this.FRL, 0.0f, 0.0f, 0.0f);
|
||||
this.MRL = new ModelRenderer((ModelBase)this, 0, 20);
|
||||
this.MRL = new ModelRenderer((ModelBase) this, 0, 20);
|
||||
this.MRL.addBox(0.0f, 0.0f, 0.0f, 1, 3, 2);
|
||||
this.MRL.setRotationPoint(-8.0f, 21.0f, -1.0f);
|
||||
this.MRL.setTextureSize(128, 128);
|
||||
this.MRL.mirror = true;
|
||||
this.setRotation(this.MRL, 0.0f, 0.0f, 0.0f);
|
||||
this.FLL = new ModelRenderer((ModelBase)this, 0, 20);
|
||||
this.FLL = new ModelRenderer((ModelBase) this, 0, 20);
|
||||
this.FLL.addBox(0.0f, 0.0f, 0.0f, 1, 3, 2);
|
||||
this.FLL.setRotationPoint(7.0f, 21.0f, -6.0f);
|
||||
this.FLL.setTextureSize(128, 128);
|
||||
this.FLL.mirror = true;
|
||||
this.setRotation(this.FLL, 0.0f, 0.0f, 0.0f);
|
||||
this.BLL = new ModelRenderer((ModelBase)this, 0, 20);
|
||||
this.BLL = new ModelRenderer((ModelBase) this, 0, 20);
|
||||
this.BLL.addBox(0.0f, 0.0f, 0.0f, 1, 3, 2);
|
||||
this.BLL.setRotationPoint(7.0f, 21.0f, 4.0f);
|
||||
this.BLL.setTextureSize(128, 128);
|
||||
this.BLL.mirror = true;
|
||||
this.setRotation(this.BLL, 0.0f, 0.0f, 0.0f);
|
||||
this.MRoller = new ModelRenderer((ModelBase)this, 0, 26);
|
||||
this.MRoller = new ModelRenderer((ModelBase) this, 0, 26);
|
||||
this.MRoller.addBox(-7.0f, -1.0f, -1.0f, 14, 2, 2);
|
||||
this.MRoller.setRotationPoint(0.0f, 21.0f, 0.0f);
|
||||
this.MRoller.setTextureSize(128, 128);
|
||||
this.MRoller.mirror = true;
|
||||
this.setRotation(this.MRoller, 0.0f, 0.0f, 0.0f);
|
||||
this.BRoller = new ModelRenderer((ModelBase)this, 0, 26);
|
||||
this.BRoller = new ModelRenderer((ModelBase) this, 0, 26);
|
||||
this.BRoller.addBox(-7.0f, -1.0f, -1.0f, 14, 2, 2);
|
||||
this.BRoller.setRotationPoint(0.0f, 21.0f, 5.0f);
|
||||
this.BRoller.setTextureSize(128, 128);
|
||||
this.BRoller.mirror = true;
|
||||
this.setRotation(this.BRoller, 0.0f, 0.0f, 0.0f);
|
||||
this.tBELT = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.tBELT = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.tBELT.addBox(0.0f, 0.0f, 0.0f, 14, 1, 14);
|
||||
this.tBELT.setRotationPoint(-7.0f, 19.0f, -7.0f);
|
||||
this.tBELT.setTextureSize(128, 128);
|
||||
this.tBELT.mirror = true;
|
||||
this.setRotation(this.tBELT, 0.0f, 0.0f, 0.0f);
|
||||
this.FRoller = new ModelRenderer((ModelBase)this, 0, 26);
|
||||
this.FRoller = new ModelRenderer((ModelBase) this, 0, 26);
|
||||
this.FRoller.addBox(-7.0f, -1.0f, -1.0f, 14, 2, 2);
|
||||
this.FRoller.setRotationPoint(0.0f, 21.0f, -5.0f);
|
||||
this.FRoller.setTextureSize(128, 128);
|
||||
this.FRoller.mirror = true;
|
||||
this.setRotation(this.FRoller, 0.0f, 0.0f, 0.0f);
|
||||
this.BRL = new ModelRenderer((ModelBase)this, 0, 20);
|
||||
this.BRL = new ModelRenderer((ModelBase) this, 0, 20);
|
||||
this.BRL.addBox(0.0f, 0.0f, 0.0f, 1, 3, 2);
|
||||
this.BRL.setRotationPoint(-8.0f, 21.0f, 4.0f);
|
||||
this.BRL.setTextureSize(128, 128);
|
||||
this.BRL.mirror = true;
|
||||
this.setRotation(this.BRL, 0.0f, 0.0f, 0.0f);
|
||||
this.BML = new ModelRenderer((ModelBase)this, 0, 20);
|
||||
this.BML = new ModelRenderer((ModelBase) this, 0, 20);
|
||||
this.BML.addBox(0.0f, 0.0f, 0.0f, 1, 3, 2);
|
||||
this.BML.setRotationPoint(7.0f, 21.0f, -1.0f);
|
||||
this.BML.setTextureSize(128, 128);
|
||||
this.BML.mirror = true;
|
||||
this.setRotation(this.BML, 0.0f, 0.0f, 0.0f);
|
||||
this.tBELTLong = new ModelRenderer((ModelBase)this, 0, 48);
|
||||
this.tBELTLong = new ModelRenderer((ModelBase) this, 0, 48);
|
||||
this.tBELTLong.addBox(0.0f, 0.0f, 0.0f, 14, 1, 16);
|
||||
this.tBELTLong.setRotationPoint(-7.0f, 19.0f, -8.0f);
|
||||
this.tBELTLong.setTextureSize(128, 128);
|
||||
this.tBELTLong.mirror = true;
|
||||
this.setRotation(this.tBELTLong, 0.0f, 0.0f, 0.0f);
|
||||
this.tBELT15 = new ModelRenderer((ModelBase)this, 0, 84);
|
||||
this.tBELT15 = new ModelRenderer((ModelBase) this, 0, 84);
|
||||
this.tBELT15.addBox(0.0f, 0.0f, 0.0f, 14, 1, 15);
|
||||
this.tBELT15.setRotationPoint(-7.0f, 19.0f, -8.0f);
|
||||
this.tBELT15.setTextureSize(128, 128);
|
||||
this.tBELT15.mirror = true;
|
||||
this.setRotation(this.tBELT15, 0.0f, 0.0f, 0.0f);
|
||||
this.bBELT15 = new ModelRenderer((ModelBase)this, 0, 84);
|
||||
this.bBELT15 = new ModelRenderer((ModelBase) this, 0, 84);
|
||||
this.bBELT15.addBox(0.0f, 0.0f, 0.0f, 14, 1, 15);
|
||||
this.bBELT15.setRotationPoint(-7.0f, 22.0f, -8.0f);
|
||||
this.bBELT15.setTextureSize(128, 128);
|
||||
this.bBELT15.mirror = true;
|
||||
this.setRotation(this.bBELT15, 0.0f, 0.0f, 0.0f);
|
||||
this.c4 = new ModelRenderer((ModelBase)this, 60, 20);
|
||||
this.c4 = new ModelRenderer((ModelBase) this, 60, 20);
|
||||
this.c4.addBox(0.0f, 0.0f, 0.0f, 1, 16, 1);
|
||||
this.c4.setRotationPoint(7.0f, 8.0f, 7.0f);
|
||||
this.c4.setTextureSize(128, 128);
|
||||
this.c4.mirror = true;
|
||||
this.setRotation(this.c4, 0.0f, 0.0f, 0.0f);
|
||||
this.c3 = new ModelRenderer((ModelBase)this, 60, 20);
|
||||
this.c3 = new ModelRenderer((ModelBase) this, 60, 20);
|
||||
this.c3.addBox(0.0f, 0.0f, 0.0f, 1, 16, 1);
|
||||
this.c3.setRotationPoint(7.0f, 8.0f, -8.0f);
|
||||
this.c3.setTextureSize(128, 128);
|
||||
this.c3.mirror = true;
|
||||
this.setRotation(this.c3, 0.0f, 0.0f, 0.0f);
|
||||
this.c2 = new ModelRenderer((ModelBase)this, 60, 20);
|
||||
this.c2 = new ModelRenderer((ModelBase) this, 60, 20);
|
||||
this.c2.addBox(0.0f, 0.0f, 0.0f, 1, 16, 1);
|
||||
this.c2.setRotationPoint(-8.0f, 8.0f, 7.0f);
|
||||
this.c2.setTextureSize(128, 128);
|
||||
this.c2.mirror = true;
|
||||
this.setRotation(this.c2, 0.0f, 0.0f, 0.0f);
|
||||
this.c1 = new ModelRenderer((ModelBase)this, 60, 20);
|
||||
this.c1 = new ModelRenderer((ModelBase) this, 60, 20);
|
||||
this.c1.addBox(0.0f, 0.0f, 0.0f, 1, 16, 1);
|
||||
this.c1.setRotationPoint(-8.0f, 8.0f, -8.0f);
|
||||
this.c1.setTextureSize(128, 128);
|
||||
|
@ -158,7 +157,9 @@ extends ModelBase {
|
|||
this.setRotation(this.c1, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
public void render(float f5, float radians, boolean front, boolean back, boolean above, boolean legs) {
|
||||
public void render(
|
||||
float f5, float radians, boolean front, boolean back, boolean above, boolean legs
|
||||
) {
|
||||
boolean rightCap;
|
||||
boolean mid = front && back;
|
||||
boolean leftCap = !front && back;
|
||||
|
@ -214,4 +215,3 @@ extends ModelBase {
|
|||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ package assemblyline.client.model;
|
|||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelCraneArmMount
|
||||
extends ModelBase {
|
||||
public class ModelCraneArmMount extends ModelBase {
|
||||
private ModelRenderer RailGuard1;
|
||||
private ModelRenderer ArmMount;
|
||||
private ModelRenderer RailGuard2;
|
||||
|
@ -17,49 +16,49 @@ extends ModelBase {
|
|||
public ModelCraneArmMount() {
|
||||
this.textureWidth = 64;
|
||||
this.textureHeight = 64;
|
||||
this.RailGuard1 = new ModelRenderer((ModelBase)this, 0, 20);
|
||||
this.RailGuard1 = new ModelRenderer((ModelBase) this, 0, 20);
|
||||
this.RailGuard1.addBox(0.0f, 0.0f, 0.0f, 16, 8, 2);
|
||||
this.RailGuard1.setRotationPoint(-8.0f, 12.0f, 4.0f);
|
||||
this.RailGuard1.setTextureSize(64, 32);
|
||||
this.RailGuard1.mirror = true;
|
||||
this.setRotation(this.RailGuard1, 0.0f, 0.0f, 0.0f);
|
||||
this.ArmMount = new ModelRenderer((ModelBase)this, 36, 26);
|
||||
this.ArmMount = new ModelRenderer((ModelBase) this, 36, 26);
|
||||
this.ArmMount.addBox(0.0f, 0.0f, 0.0f, 8, 4, 2);
|
||||
this.ArmMount.setRotationPoint(-4.0f, 4.0f, -8.0f);
|
||||
this.ArmMount.setTextureSize(64, 32);
|
||||
this.ArmMount.mirror = true;
|
||||
this.setRotation(this.ArmMount, 0.0f, 0.0f, 0.0f);
|
||||
this.RailGuard2 = new ModelRenderer((ModelBase)this, 0, 20);
|
||||
this.RailGuard2 = new ModelRenderer((ModelBase) this, 0, 20);
|
||||
this.RailGuard2.addBox(0.0f, 0.0f, 0.0f, 16, 8, 2);
|
||||
this.RailGuard2.setRotationPoint(-8.0f, 12.0f, -6.0f);
|
||||
this.RailGuard2.setTextureSize(64, 32);
|
||||
this.RailGuard2.mirror = true;
|
||||
this.setRotation(this.RailGuard2, 0.0f, 0.0f, 0.0f);
|
||||
this.Base = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.Base = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.Base.addBox(0.0f, 0.0f, 0.0f, 16, 4, 16);
|
||||
this.Base.setRotationPoint(-8.0f, 8.0f, -8.0f);
|
||||
this.Base.setTextureSize(64, 32);
|
||||
this.Base.mirror = true;
|
||||
this.setRotation(this.Base, 0.0f, 0.0f, 0.0f);
|
||||
this.WheelMount1 = new ModelRenderer((ModelBase)this, 0, 30);
|
||||
this.WheelMount1 = new ModelRenderer((ModelBase) this, 0, 30);
|
||||
this.WheelMount1.addBox(0.0f, 0.0f, 0.0f, 14, 4, 4);
|
||||
this.WheelMount1.setRotationPoint(-7.0f, 4.0f, 2.0f);
|
||||
this.WheelMount1.setTextureSize(64, 32);
|
||||
this.WheelMount1.mirror = true;
|
||||
this.setRotation(this.WheelMount1, 0.0f, 0.0f, 0.0f);
|
||||
this.Wheel2 = new ModelRenderer((ModelBase)this, 36, 20);
|
||||
this.Wheel2 = new ModelRenderer((ModelBase) this, 36, 20);
|
||||
this.Wheel2.addBox(0.0f, 0.0f, 0.0f, 5, 4, 2);
|
||||
this.Wheel2.setRotationPoint(1.0f, 6.0f, -1.0f);
|
||||
this.Wheel2.setTextureSize(64, 32);
|
||||
this.Wheel2.mirror = true;
|
||||
this.setRotation(this.Wheel2, 0.0f, 0.0f, 0.0f);
|
||||
this.WheelMount2 = new ModelRenderer((ModelBase)this, 0, 30);
|
||||
this.WheelMount2 = new ModelRenderer((ModelBase) this, 0, 30);
|
||||
this.WheelMount2.addBox(0.0f, 0.0f, 0.0f, 14, 4, 4);
|
||||
this.WheelMount2.setRotationPoint(-7.0f, 4.0f, -6.0f);
|
||||
this.WheelMount2.setTextureSize(64, 32);
|
||||
this.WheelMount2.mirror = true;
|
||||
this.setRotation(this.WheelMount2, 0.0f, 0.0f, 0.0f);
|
||||
this.Wheel1 = new ModelRenderer((ModelBase)this, 36, 20);
|
||||
this.Wheel1 = new ModelRenderer((ModelBase) this, 36, 20);
|
||||
this.Wheel1.addBox(0.0f, 0.0f, 0.0f, 5, 4, 2);
|
||||
this.Wheel1.setRotationPoint(-6.0f, 6.0f, -1.0f);
|
||||
this.Wheel1.setTextureSize(64, 32);
|
||||
|
@ -84,4 +83,3 @@ extends ModelBase {
|
|||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ package assemblyline.client.model;
|
|||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelCraneController
|
||||
extends ModelBase {
|
||||
public class ModelCraneController extends ModelBase {
|
||||
ModelRenderer Base2;
|
||||
ModelRenderer Base;
|
||||
ModelRenderer ConnectorFront;
|
||||
|
@ -18,55 +17,55 @@ extends ModelBase {
|
|||
public ModelCraneController() {
|
||||
this.textureWidth = 128;
|
||||
this.textureHeight = 64;
|
||||
this.Base2 = new ModelRenderer((ModelBase)this, 0, 24);
|
||||
this.Base2 = new ModelRenderer((ModelBase) this, 0, 24);
|
||||
this.Base2.addBox(0.0f, 0.0f, 0.0f, 12, 4, 12);
|
||||
this.Base2.setRotationPoint(-6.0f, 12.0f, -6.0f);
|
||||
this.Base2.setTextureSize(128, 64);
|
||||
this.Base2.mirror = true;
|
||||
this.setRotation(this.Base2, 0.0f, 0.0f, 0.0f);
|
||||
this.Base = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.Base = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.Base.addBox(0.0f, 0.0f, 0.0f, 16, 8, 16);
|
||||
this.Base.setRotationPoint(-8.0f, 16.0f, -8.0f);
|
||||
this.Base.setTextureSize(128, 64);
|
||||
this.Base.mirror = true;
|
||||
this.setRotation(this.Base, 0.0f, 0.0f, 0.0f);
|
||||
this.ConnectorFront = new ModelRenderer((ModelBase)this, 64, 0);
|
||||
this.ConnectorFront = new ModelRenderer((ModelBase) this, 64, 0);
|
||||
this.ConnectorFront.addBox(0.0f, 0.0f, 0.0f, 8, 8, 8);
|
||||
this.ConnectorFront.setRotationPoint(-4.0f, 12.0f, 0.0f);
|
||||
this.ConnectorFront.setTextureSize(128, 64);
|
||||
this.ConnectorFront.mirror = true;
|
||||
this.setRotation(this.ConnectorFront, 0.0f, 1.570796f, 0.0f);
|
||||
this.Decoration1 = new ModelRenderer((ModelBase)this, 54, 24);
|
||||
this.Decoration1 = new ModelRenderer((ModelBase) this, 54, 24);
|
||||
this.Decoration1.addBox(0.0f, 0.0f, 0.0f, 2, 1, 1);
|
||||
this.Decoration1.setRotationPoint(2.0f, 15.0f, 6.0f);
|
||||
this.Decoration1.setTextureSize(128, 64);
|
||||
this.Decoration1.mirror = true;
|
||||
this.setRotation(this.Decoration1, 0.0f, 0.0f, 0.0f);
|
||||
this.Decoration2 = new ModelRenderer((ModelBase)this, 54, 24);
|
||||
this.Decoration2 = new ModelRenderer((ModelBase) this, 54, 24);
|
||||
this.Decoration2.addBox(0.0f, 0.0f, 0.0f, 2, 1, 1);
|
||||
this.Decoration2.setRotationPoint(-4.0f, 15.0f, 6.0f);
|
||||
this.Decoration2.setTextureSize(128, 64);
|
||||
this.Decoration2.mirror = true;
|
||||
this.setRotation(this.Decoration2, 0.0f, 0.0f, 0.0f);
|
||||
this.Decoration3 = new ModelRenderer((ModelBase)this, 48, 24);
|
||||
this.Decoration3 = new ModelRenderer((ModelBase) this, 48, 24);
|
||||
this.Decoration3.addBox(0.0f, 0.0f, 0.0f, 1, 1, 2);
|
||||
this.Decoration3.setRotationPoint(-7.0f, 15.0f, 2.0f);
|
||||
this.Decoration3.setTextureSize(128, 64);
|
||||
this.Decoration3.mirror = true;
|
||||
this.setRotation(this.Decoration3, 0.0f, 0.0f, 0.0f);
|
||||
this.Decoration4 = new ModelRenderer((ModelBase)this, 48, 24);
|
||||
this.Decoration4 = new ModelRenderer((ModelBase) this, 48, 24);
|
||||
this.Decoration4.addBox(0.0f, 0.0f, 0.0f, 1, 1, 2);
|
||||
this.Decoration4.setRotationPoint(-7.0f, 15.0f, -4.0f);
|
||||
this.Decoration4.setTextureSize(128, 64);
|
||||
this.Decoration4.mirror = true;
|
||||
this.setRotation(this.Decoration4, 0.0f, 0.0f, 0.0f);
|
||||
this.ConnectorTop = new ModelRenderer((ModelBase)this, 64, 0);
|
||||
this.ConnectorTop = new ModelRenderer((ModelBase) this, 64, 0);
|
||||
this.ConnectorTop.addBox(0.0f, 0.0f, 0.0f, 8, 8, 8);
|
||||
this.ConnectorTop.setRotationPoint(-4.0f, 16.0f, -4.0f);
|
||||
this.ConnectorTop.setTextureSize(128, 64);
|
||||
this.ConnectorTop.mirror = true;
|
||||
this.setRotation(this.ConnectorTop, 0.0f, 0.0f, -1.570796f);
|
||||
this.ConnectorRight = new ModelRenderer((ModelBase)this, 64, 0);
|
||||
this.ConnectorRight = new ModelRenderer((ModelBase) this, 64, 0);
|
||||
this.ConnectorRight.addBox(0.0f, 0.0f, 0.0f, 8, 8, 8);
|
||||
this.ConnectorRight.setRotationPoint(0.0f, 12.0f, -4.0f);
|
||||
this.ConnectorRight.setTextureSize(128, 64);
|
||||
|
@ -114,4 +113,3 @@ extends ModelBase {
|
|||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ package assemblyline.client.model;
|
|||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelCraneRail
|
||||
extends ModelBase {
|
||||
public class ModelCraneRail extends ModelBase {
|
||||
ModelRenderer SegmentUBLeft;
|
||||
ModelRenderer SegmentUFLeft;
|
||||
ModelRenderer SegmentBFLeft;
|
||||
|
@ -55,277 +54,277 @@ extends ModelBase {
|
|||
public ModelCraneRail() {
|
||||
this.textureWidth = 64;
|
||||
this.textureHeight = 32;
|
||||
this.SegmentBLBack = new ModelRenderer((ModelBase)this, 10, 13);
|
||||
this.SegmentBLBack = new ModelRenderer((ModelBase) this, 10, 13);
|
||||
this.SegmentBLBack.addBox(0.0f, 0.0f, 0.0f, 1, 1, 4);
|
||||
this.SegmentBLBack.setRotationPoint(3.0f, 19.0f, 4.0f);
|
||||
this.SegmentBLBack.setTextureSize(64, 32);
|
||||
this.SegmentBLBack.mirror = true;
|
||||
this.setRotation(this.SegmentBLBack, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentLUBack = new ModelRenderer((ModelBase)this, 10, 13);
|
||||
this.SegmentLUBack = new ModelRenderer((ModelBase) this, 10, 13);
|
||||
this.SegmentLUBack.addBox(0.0f, 0.0f, 0.0f, 1, 1, 4);
|
||||
this.SegmentLUBack.setRotationPoint(3.0f, 12.0f, 4.0f);
|
||||
this.SegmentLUBack.setTextureSize(64, 32);
|
||||
this.SegmentLUBack.mirror = true;
|
||||
this.setRotation(this.SegmentLUBack, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentRUBack = new ModelRenderer((ModelBase)this, 10, 13);
|
||||
this.SegmentRUBack = new ModelRenderer((ModelBase) this, 10, 13);
|
||||
this.SegmentRUBack.addBox(0.0f, 0.0f, 0.0f, 1, 1, 4);
|
||||
this.SegmentRUBack.setRotationPoint(-4.0f, 12.0f, 4.0f);
|
||||
this.SegmentRUBack.setTextureSize(64, 32);
|
||||
this.SegmentRUBack.mirror = true;
|
||||
this.setRotation(this.SegmentRUBack, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentBRBack = new ModelRenderer((ModelBase)this, 10, 13);
|
||||
this.SegmentBRBack = new ModelRenderer((ModelBase) this, 10, 13);
|
||||
this.SegmentBRBack.addBox(0.0f, 0.0f, 0.0f, 1, 1, 4);
|
||||
this.SegmentBRBack.setRotationPoint(-4.0f, 19.0f, 4.0f);
|
||||
this.SegmentBRBack.setTextureSize(64, 32);
|
||||
this.SegmentBRBack.mirror = true;
|
||||
this.setRotation(this.SegmentBRBack, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentBLFront = new ModelRenderer((ModelBase)this, 10, 13);
|
||||
this.SegmentBLFront = new ModelRenderer((ModelBase) this, 10, 13);
|
||||
this.SegmentBLFront.addBox(0.0f, 0.0f, 0.0f, 1, 1, 4);
|
||||
this.SegmentBLFront.setRotationPoint(3.0f, 19.0f, -8.0f);
|
||||
this.SegmentBLFront.setTextureSize(64, 32);
|
||||
this.SegmentBLFront.mirror = true;
|
||||
this.setRotation(this.SegmentBLFront, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentLUFront = new ModelRenderer((ModelBase)this, 10, 13);
|
||||
this.SegmentLUFront = new ModelRenderer((ModelBase) this, 10, 13);
|
||||
this.SegmentLUFront.addBox(0.0f, 0.0f, 0.0f, 1, 1, 4);
|
||||
this.SegmentLUFront.setRotationPoint(3.0f, 12.0f, -8.0f);
|
||||
this.SegmentLUFront.setTextureSize(64, 32);
|
||||
this.SegmentLUFront.mirror = true;
|
||||
this.setRotation(this.SegmentLUFront, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentRUFront = new ModelRenderer((ModelBase)this, 10, 13);
|
||||
this.SegmentRUFront = new ModelRenderer((ModelBase) this, 10, 13);
|
||||
this.SegmentRUFront.addBox(0.0f, 0.0f, 0.0f, 1, 1, 4);
|
||||
this.SegmentRUFront.setRotationPoint(-4.0f, 12.0f, -8.0f);
|
||||
this.SegmentRUFront.setTextureSize(64, 32);
|
||||
this.SegmentRUFront.mirror = true;
|
||||
this.setRotation(this.SegmentRUFront, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentBRFront = new ModelRenderer((ModelBase)this, 10, 13);
|
||||
this.SegmentBRFront = new ModelRenderer((ModelBase) this, 10, 13);
|
||||
this.SegmentBRFront.addBox(0.0f, 0.0f, 0.0f, 1, 1, 4);
|
||||
this.SegmentBRFront.setRotationPoint(-4.0f, 19.0f, -8.0f);
|
||||
this.SegmentBRFront.setTextureSize(64, 32);
|
||||
this.SegmentBRFront.mirror = true;
|
||||
this.setRotation(this.SegmentBRFront, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentLBUp = new ModelRenderer((ModelBase)this, 20, 13);
|
||||
this.SegmentLBUp = new ModelRenderer((ModelBase) this, 20, 13);
|
||||
this.SegmentLBUp.addBox(0.0f, 0.0f, 0.0f, 1, 4, 1);
|
||||
this.SegmentLBUp.setRotationPoint(3.0f, 8.0f, 3.0f);
|
||||
this.SegmentLBUp.setTextureSize(64, 32);
|
||||
this.SegmentLBUp.mirror = true;
|
||||
this.setRotation(this.SegmentLBUp, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentRBUp = new ModelRenderer((ModelBase)this, 20, 13);
|
||||
this.SegmentRBUp = new ModelRenderer((ModelBase) this, 20, 13);
|
||||
this.SegmentRBUp.addBox(0.0f, 0.0f, 0.0f, 1, 4, 1);
|
||||
this.SegmentRBUp.setRotationPoint(-4.0f, 8.0f, 3.0f);
|
||||
this.SegmentRBUp.setTextureSize(64, 32);
|
||||
this.SegmentRBUp.mirror = true;
|
||||
this.setRotation(this.SegmentRBUp, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentLFUp = new ModelRenderer((ModelBase)this, 20, 13);
|
||||
this.SegmentLFUp = new ModelRenderer((ModelBase) this, 20, 13);
|
||||
this.SegmentLFUp.addBox(0.0f, 0.0f, 0.0f, 1, 4, 1);
|
||||
this.SegmentLFUp.setRotationPoint(3.0f, 8.0f, -4.0f);
|
||||
this.SegmentLFUp.setTextureSize(64, 32);
|
||||
this.SegmentLFUp.mirror = true;
|
||||
this.setRotation(this.SegmentLFUp, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentRFUp = new ModelRenderer((ModelBase)this, 20, 13);
|
||||
this.SegmentRFUp = new ModelRenderer((ModelBase) this, 20, 13);
|
||||
this.SegmentRFUp.addBox(0.0f, 0.0f, 0.0f, 1, 4, 1);
|
||||
this.SegmentRFUp.setRotationPoint(-4.0f, 8.0f, -4.0f);
|
||||
this.SegmentRFUp.setTextureSize(64, 32);
|
||||
this.SegmentRFUp.mirror = true;
|
||||
this.setRotation(this.SegmentRFUp, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentUBRight = new ModelRenderer((ModelBase)this, 0, 13);
|
||||
this.SegmentUBRight = new ModelRenderer((ModelBase) this, 0, 13);
|
||||
this.SegmentUBRight.addBox(0.0f, 0.0f, 0.0f, 4, 1, 1);
|
||||
this.SegmentUBRight.setRotationPoint(-8.0f, 12.0f, 3.0f);
|
||||
this.SegmentUBRight.setTextureSize(64, 32);
|
||||
this.SegmentUBRight.mirror = true;
|
||||
this.setRotation(this.SegmentUBRight, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentBFRight = new ModelRenderer((ModelBase)this, 0, 13);
|
||||
this.SegmentBFRight = new ModelRenderer((ModelBase) this, 0, 13);
|
||||
this.SegmentBFRight.addBox(0.0f, 0.0f, 0.0f, 4, 1, 1);
|
||||
this.SegmentBFRight.setRotationPoint(-8.0f, 19.0f, -4.0f);
|
||||
this.SegmentBFRight.setTextureSize(64, 32);
|
||||
this.SegmentBFRight.mirror = true;
|
||||
this.setRotation(this.SegmentBFRight, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentUFRight = new ModelRenderer((ModelBase)this, 0, 13);
|
||||
this.SegmentUFRight = new ModelRenderer((ModelBase) this, 0, 13);
|
||||
this.SegmentUFRight.addBox(0.0f, 0.0f, 0.0f, 4, 1, 1);
|
||||
this.SegmentUFRight.setRotationPoint(-8.0f, 12.0f, -4.0f);
|
||||
this.SegmentUFRight.setTextureSize(64, 32);
|
||||
this.SegmentUFRight.mirror = true;
|
||||
this.setRotation(this.SegmentUFRight, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentBBRight = new ModelRenderer((ModelBase)this, 0, 13);
|
||||
this.SegmentBBRight = new ModelRenderer((ModelBase) this, 0, 13);
|
||||
this.SegmentBBRight.addBox(0.0f, 0.0f, 0.0f, 4, 1, 1);
|
||||
this.SegmentBBRight.setRotationPoint(-8.0f, 19.0f, 3.0f);
|
||||
this.SegmentBBRight.setTextureSize(64, 32);
|
||||
this.SegmentBBRight.mirror = true;
|
||||
this.setRotation(this.SegmentBBRight, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentLFDown = new ModelRenderer((ModelBase)this, 20, 13);
|
||||
this.SegmentLFDown = new ModelRenderer((ModelBase) this, 20, 13);
|
||||
this.SegmentLFDown.addBox(0.0f, 0.0f, 0.0f, 1, 4, 1);
|
||||
this.SegmentLFDown.setRotationPoint(3.0f, 20.0f, -4.0f);
|
||||
this.SegmentLFDown.setTextureSize(64, 32);
|
||||
this.SegmentLFDown.mirror = true;
|
||||
this.setRotation(this.SegmentLFDown, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentLBDown = new ModelRenderer((ModelBase)this, 20, 13);
|
||||
this.SegmentLBDown = new ModelRenderer((ModelBase) this, 20, 13);
|
||||
this.SegmentLBDown.addBox(0.0f, 0.0f, 0.0f, 1, 4, 1);
|
||||
this.SegmentLBDown.setRotationPoint(3.0f, 20.0f, 3.0f);
|
||||
this.SegmentLBDown.setTextureSize(64, 32);
|
||||
this.SegmentLBDown.mirror = true;
|
||||
this.setRotation(this.SegmentLBDown, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentRBDown = new ModelRenderer((ModelBase)this, 20, 13);
|
||||
this.SegmentRBDown = new ModelRenderer((ModelBase) this, 20, 13);
|
||||
this.SegmentRBDown.addBox(0.0f, 0.0f, 0.0f, 1, 4, 1);
|
||||
this.SegmentRBDown.setRotationPoint(-4.0f, 20.0f, 3.0f);
|
||||
this.SegmentRBDown.setTextureSize(64, 32);
|
||||
this.SegmentRBDown.mirror = true;
|
||||
this.setRotation(this.SegmentRBDown, 0.0f, 0.0f, 0.0f);
|
||||
this.FootTop = new ModelRenderer((ModelBase)this, 24, 0);
|
||||
this.FootTop = new ModelRenderer((ModelBase) this, 24, 0);
|
||||
this.FootTop.addBox(0.0f, 0.0f, 0.0f, 10, 2, 10);
|
||||
this.FootTop.setRotationPoint(-5.0f, 20.0f, -5.0f);
|
||||
this.FootTop.setTextureSize(64, 32);
|
||||
this.FootTop.mirror = true;
|
||||
this.setRotation(this.FootTop, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentRFDown = new ModelRenderer((ModelBase)this, 20, 13);
|
||||
this.SegmentRFDown = new ModelRenderer((ModelBase) this, 20, 13);
|
||||
this.SegmentRFDown.addBox(0.0f, 0.0f, 0.0f, 1, 4, 1);
|
||||
this.SegmentRFDown.setRotationPoint(-4.0f, 20.0f, -4.0f);
|
||||
this.SegmentRFDown.setTextureSize(64, 32);
|
||||
this.SegmentRFDown.mirror = true;
|
||||
this.setRotation(this.SegmentRFDown, 0.0f, 0.0f, 0.0f);
|
||||
this.FootBottom = new ModelRenderer((ModelBase)this, 0, 18);
|
||||
this.FootBottom = new ModelRenderer((ModelBase) this, 0, 18);
|
||||
this.FootBottom.addBox(0.0f, 0.0f, 0.0f, 12, 2, 12);
|
||||
this.FootBottom.setRotationPoint(-6.0f, 22.0f, -6.0f);
|
||||
this.FootBottom.setTextureSize(64, 32);
|
||||
this.FootBottom.mirror = true;
|
||||
this.setRotation(this.FootBottom, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentBFMid = new ModelRenderer((ModelBase)this, 30, 12);
|
||||
this.SegmentBFMid = new ModelRenderer((ModelBase) this, 30, 12);
|
||||
this.SegmentBFMid.addBox(0.0f, 0.0f, 0.0f, 8, 1, 1);
|
||||
this.SegmentBFMid.setRotationPoint(-4.0f, 19.0f, -4.0f);
|
||||
this.SegmentBFMid.setTextureSize(64, 32);
|
||||
this.SegmentBFMid.mirror = true;
|
||||
this.setRotation(this.SegmentBFMid, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentUBMid = new ModelRenderer((ModelBase)this, 30, 12);
|
||||
this.SegmentUBMid = new ModelRenderer((ModelBase) this, 30, 12);
|
||||
this.SegmentUBMid.addBox(0.0f, 0.0f, 0.0f, 8, 1, 1);
|
||||
this.SegmentUBMid.setRotationPoint(-4.0f, 12.0f, 3.0f);
|
||||
this.SegmentUBMid.setTextureSize(64, 32);
|
||||
this.SegmentUBMid.mirror = true;
|
||||
this.setRotation(this.SegmentUBMid, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentBBMid = new ModelRenderer((ModelBase)this, 30, 12);
|
||||
this.SegmentBBMid = new ModelRenderer((ModelBase) this, 30, 12);
|
||||
this.SegmentBBMid.addBox(0.0f, 0.0f, 0.0f, 8, 1, 1);
|
||||
this.SegmentBBMid.setRotationPoint(-4.0f, 19.0f, 3.0f);
|
||||
this.SegmentBBMid.setTextureSize(64, 32);
|
||||
this.SegmentBBMid.mirror = true;
|
||||
this.setRotation(this.SegmentBBMid, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentUFMid = new ModelRenderer((ModelBase)this, 30, 12);
|
||||
this.SegmentUFMid = new ModelRenderer((ModelBase) this, 30, 12);
|
||||
this.SegmentUFMid.addBox(0.0f, 0.0f, 0.0f, 8, 1, 1);
|
||||
this.SegmentUFMid.setRotationPoint(-4.0f, 12.0f, -4.0f);
|
||||
this.SegmentUFMid.setTextureSize(64, 32);
|
||||
this.SegmentUFMid.mirror = true;
|
||||
this.setRotation(this.SegmentUFMid, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentLBMid = new ModelRenderer((ModelBase)this, 48, 19);
|
||||
this.SegmentLBMid = new ModelRenderer((ModelBase) this, 48, 19);
|
||||
this.SegmentLBMid.addBox(0.0f, 0.0f, 0.0f, 1, 6, 1);
|
||||
this.SegmentLBMid.setRotationPoint(3.0f, 13.0f, 3.0f);
|
||||
this.SegmentLBMid.setTextureSize(64, 32);
|
||||
this.SegmentLBMid.mirror = true;
|
||||
this.setRotation(this.SegmentLBMid, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentLFMid = new ModelRenderer((ModelBase)this, 48, 19);
|
||||
this.SegmentLFMid = new ModelRenderer((ModelBase) this, 48, 19);
|
||||
this.SegmentLFMid.addBox(0.0f, 0.0f, 0.0f, 1, 6, 1);
|
||||
this.SegmentLFMid.setRotationPoint(3.0f, 13.0f, -4.0f);
|
||||
this.SegmentLFMid.setTextureSize(64, 32);
|
||||
this.SegmentLFMid.mirror = true;
|
||||
this.setRotation(this.SegmentLFMid, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentRBMid = new ModelRenderer((ModelBase)this, 48, 19);
|
||||
this.SegmentRBMid = new ModelRenderer((ModelBase) this, 48, 19);
|
||||
this.SegmentRBMid.addBox(0.0f, 0.0f, 0.0f, 1, 6, 1);
|
||||
this.SegmentRBMid.setRotationPoint(-4.0f, 13.0f, 3.0f);
|
||||
this.SegmentRBMid.setTextureSize(64, 32);
|
||||
this.SegmentRBMid.mirror = true;
|
||||
this.setRotation(this.SegmentRBMid, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentRFMid = new ModelRenderer((ModelBase)this, 48, 19);
|
||||
this.SegmentRFMid = new ModelRenderer((ModelBase) this, 48, 19);
|
||||
this.SegmentRFMid.addBox(0.0f, 0.0f, 0.0f, 1, 6, 1);
|
||||
this.SegmentRFMid.setRotationPoint(-4.0f, 13.0f, -4.0f);
|
||||
this.SegmentRFMid.setTextureSize(64, 32);
|
||||
this.SegmentRFMid.mirror = true;
|
||||
this.setRotation(this.SegmentRFMid, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentMidDiag4 = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.SegmentMidDiag4 = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.SegmentMidDiag4.addBox(0.0f, 0.0f, 0.0f, 1, 1, 10);
|
||||
this.SegmentMidDiag4.setRotationPoint(-3.99f, 12.0f, -3.0f);
|
||||
this.SegmentMidDiag4.setTextureSize(64, 32);
|
||||
this.SegmentMidDiag4.mirror = true;
|
||||
this.setRotation(this.SegmentMidDiag4, -0.7853982f, 0.0f, 0.0f);
|
||||
this.SegmentRUMid = new ModelRenderer((ModelBase)this, 48, 12);
|
||||
this.SegmentRUMid = new ModelRenderer((ModelBase) this, 48, 12);
|
||||
this.SegmentRUMid.addBox(0.0f, 0.0f, 0.0f, 1, 1, 6);
|
||||
this.SegmentRUMid.setRotationPoint(-4.0f, 12.0f, -3.0f);
|
||||
this.SegmentRUMid.setTextureSize(64, 32);
|
||||
this.SegmentRUMid.mirror = true;
|
||||
this.setRotation(this.SegmentRUMid, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentBRMid = new ModelRenderer((ModelBase)this, 48, 12);
|
||||
this.SegmentBRMid = new ModelRenderer((ModelBase) this, 48, 12);
|
||||
this.SegmentBRMid.addBox(0.0f, 0.0f, 0.0f, 1, 1, 6);
|
||||
this.SegmentBRMid.setRotationPoint(-4.0f, 19.0f, -3.0f);
|
||||
this.SegmentBRMid.setTextureSize(64, 32);
|
||||
this.SegmentBRMid.mirror = true;
|
||||
this.setRotation(this.SegmentBRMid, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentBLMid = new ModelRenderer((ModelBase)this, 48, 12);
|
||||
this.SegmentBLMid = new ModelRenderer((ModelBase) this, 48, 12);
|
||||
this.SegmentBLMid.addBox(0.0f, 0.0f, 0.0f, 1, 1, 6);
|
||||
this.SegmentBLMid.setRotationPoint(3.0f, 19.0f, -3.0f);
|
||||
this.SegmentBLMid.setTextureSize(64, 32);
|
||||
this.SegmentBLMid.mirror = true;
|
||||
this.setRotation(this.SegmentBLMid, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentLUMid = new ModelRenderer((ModelBase)this, 48, 12);
|
||||
this.SegmentLUMid = new ModelRenderer((ModelBase) this, 48, 12);
|
||||
this.SegmentLUMid.addBox(0.0f, 0.0f, 0.0f, 1, 1, 6);
|
||||
this.SegmentLUMid.setRotationPoint(3.0f, 12.0f, -3.0f);
|
||||
this.SegmentLUMid.setTextureSize(64, 32);
|
||||
this.SegmentLUMid.mirror = true;
|
||||
this.setRotation(this.SegmentLUMid, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentMidDiag3 = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.SegmentMidDiag3 = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.SegmentMidDiag3.addBox(0.0f, 0.0f, 0.0f, 1, 1, 10);
|
||||
this.SegmentMidDiag3.setRotationPoint(-4.0f, 19.0f, -4.0f);
|
||||
this.SegmentMidDiag3.setTextureSize(64, 32);
|
||||
this.SegmentMidDiag3.mirror = true;
|
||||
this.setRotation(this.SegmentMidDiag3, 0.7853982f, 0.0f, 0.0f);
|
||||
this.SegmentMidDiag7 = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.SegmentMidDiag7 = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.SegmentMidDiag7.addBox(0.0f, 0.0f, 0.0f, 1, 1, 10);
|
||||
this.SegmentMidDiag7.setRotationPoint(-2.99f, 12.0f, 4.0f);
|
||||
this.SegmentMidDiag7.setTextureSize(64, 32);
|
||||
this.SegmentMidDiag7.mirror = true;
|
||||
this.setRotation(this.SegmentMidDiag7, -0.7853982f, 1.570796f, 0.0f);
|
||||
this.SegmentMidDiag8 = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.SegmentMidDiag8 = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.SegmentMidDiag8.addBox(0.0f, 0.0f, 0.0f, 1, 1, 10);
|
||||
this.SegmentMidDiag8.setRotationPoint(-4.0f, 19.0f, 4.0f);
|
||||
this.SegmentMidDiag8.setTextureSize(64, 32);
|
||||
this.SegmentMidDiag8.mirror = true;
|
||||
this.setRotation(this.SegmentMidDiag8, 0.7853982f, 1.570796f, 0.0f);
|
||||
this.SegmentMidDiag1 = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.SegmentMidDiag1 = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.SegmentMidDiag1.addBox(0.0f, 0.0f, 0.0f, 1, 1, 10);
|
||||
this.SegmentMidDiag1.setRotationPoint(3.0f, 19.0f, -4.0f);
|
||||
this.SegmentMidDiag1.setTextureSize(64, 32);
|
||||
this.SegmentMidDiag1.mirror = true;
|
||||
this.setRotation(this.SegmentMidDiag1, 0.7853982f, 0.0f, 0.0f);
|
||||
this.SegmentMidDiag2 = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.SegmentMidDiag2 = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.SegmentMidDiag2.addBox(0.0f, 0.0f, 0.0f, 1, 1, 10);
|
||||
this.SegmentMidDiag2.setRotationPoint(3.01f, 12.0f, -3.0f);
|
||||
this.SegmentMidDiag2.setTextureSize(64, 32);
|
||||
this.SegmentMidDiag2.mirror = true;
|
||||
this.setRotation(this.SegmentMidDiag2, -0.7853982f, 0.0f, 0.0f);
|
||||
this.SegmentMidDiag6 = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.SegmentMidDiag6 = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.SegmentMidDiag6.addBox(0.0f, 0.0f, 0.0f, 1, 1, 10);
|
||||
this.SegmentMidDiag6.setRotationPoint(-4.0f, 19.0f, -3.0f);
|
||||
this.SegmentMidDiag6.setTextureSize(64, 32);
|
||||
this.SegmentMidDiag6.mirror = true;
|
||||
this.setRotation(this.SegmentMidDiag6, 0.7853982f, 1.570796f, 0.0f);
|
||||
this.SegmentMidDiag5 = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.SegmentMidDiag5 = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.SegmentMidDiag5.addBox(0.0f, 0.0f, 0.0f, 1, 1, 10);
|
||||
this.SegmentMidDiag5.setRotationPoint(-2.99f, 12.0f, -3.0f);
|
||||
this.SegmentMidDiag5.setTextureSize(64, 32);
|
||||
this.SegmentMidDiag5.mirror = true;
|
||||
this.setRotation(this.SegmentMidDiag5, -0.7853982f, 1.570796f, 0.0f);
|
||||
this.SegmentUBLeft = new ModelRenderer((ModelBase)this, 0, 13);
|
||||
this.SegmentUBLeft = new ModelRenderer((ModelBase) this, 0, 13);
|
||||
this.SegmentUBLeft.addBox(0.0f, 0.0f, 0.0f, 4, 1, 1);
|
||||
this.SegmentUBLeft.setRotationPoint(4.0f, 12.0f, 3.0f);
|
||||
this.SegmentUBLeft.setTextureSize(64, 32);
|
||||
this.SegmentUBLeft.mirror = true;
|
||||
this.setRotation(this.SegmentUBLeft, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentUFLeft = new ModelRenderer((ModelBase)this, 0, 13);
|
||||
this.SegmentUFLeft = new ModelRenderer((ModelBase) this, 0, 13);
|
||||
this.SegmentUFLeft.addBox(0.0f, 0.0f, 0.0f, 4, 1, 1);
|
||||
this.SegmentUFLeft.setRotationPoint(4.0f, 12.0f, -4.0f);
|
||||
this.SegmentUFLeft.setTextureSize(64, 32);
|
||||
this.SegmentUFLeft.mirror = true;
|
||||
this.setRotation(this.SegmentUFLeft, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentBFLeft = new ModelRenderer((ModelBase)this, 0, 13);
|
||||
this.SegmentBFLeft = new ModelRenderer((ModelBase) this, 0, 13);
|
||||
this.SegmentBFLeft.addBox(0.0f, 0.0f, 0.0f, 4, 1, 1);
|
||||
this.SegmentBFLeft.setRotationPoint(4.0f, 19.0f, -4.0f);
|
||||
this.SegmentBFLeft.setTextureSize(64, 32);
|
||||
this.SegmentBFLeft.mirror = true;
|
||||
this.setRotation(this.SegmentBFLeft, 0.0f, 0.0f, 0.0f);
|
||||
this.SegmentBBLeft = new ModelRenderer((ModelBase)this, 0, 13);
|
||||
this.SegmentBBLeft = new ModelRenderer((ModelBase) this, 0, 13);
|
||||
this.SegmentBBLeft.addBox(0.0f, 0.0f, 0.0f, 4, 1, 1);
|
||||
this.SegmentBBLeft.setRotationPoint(4.0f, 19.0f, 3.0f);
|
||||
this.SegmentBBLeft.setTextureSize(64, 32);
|
||||
|
@ -381,7 +380,15 @@ extends ModelBase {
|
|||
this.SegmentBBLeft.setRotationPoint(4.0f, 19.0f, 3.0f);
|
||||
}
|
||||
|
||||
public void render(boolean up, boolean down, boolean left, boolean right, boolean front, boolean back, boolean foot) {
|
||||
public void render(
|
||||
boolean up,
|
||||
boolean down,
|
||||
boolean left,
|
||||
boolean right,
|
||||
boolean front,
|
||||
boolean back,
|
||||
boolean foot
|
||||
) {
|
||||
float scale = 0.0625f;
|
||||
if (up) {
|
||||
this.SegmentLBUp.render(scale);
|
||||
|
@ -451,4 +458,3 @@ extends ModelBase {
|
|||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ package assemblyline.client.model;
|
|||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelDropBox
|
||||
extends ModelBase {
|
||||
public class ModelDropBox extends ModelBase {
|
||||
ModelRenderer Left;
|
||||
ModelRenderer Top;
|
||||
ModelRenderer Front;
|
||||
|
@ -19,61 +18,61 @@ extends ModelBase {
|
|||
public ModelDropBox() {
|
||||
this.textureWidth = 128;
|
||||
this.textureHeight = 128;
|
||||
this.Left = new ModelRenderer((ModelBase)this, 33, 43);
|
||||
this.Left = new ModelRenderer((ModelBase) this, 33, 43);
|
||||
this.Left.addBox(7.0f, -10.0f, -8.0f, 1, 7, 15);
|
||||
this.Left.setRotationPoint(0.0f, 19.0f, 0.0f);
|
||||
this.Left.setTextureSize(128, 128);
|
||||
this.Left.mirror = true;
|
||||
this.setRotation(this.Left, 0.0f, 0.0f, 0.0f);
|
||||
this.Top = new ModelRenderer((ModelBase)this, 0, 65);
|
||||
this.Top = new ModelRenderer((ModelBase) this, 0, 65);
|
||||
this.Top.addBox(-7.0f, -11.0f, -7.0f, 14, 1, 14);
|
||||
this.Top.setRotationPoint(0.0f, 19.0f, 0.0f);
|
||||
this.Top.setTextureSize(128, 128);
|
||||
this.Top.mirror = true;
|
||||
this.setRotation(this.Top, 0.0f, 0.0f, 0.0f);
|
||||
this.Front = new ModelRenderer((ModelBase)this, 0, 33);
|
||||
this.Front = new ModelRenderer((ModelBase) this, 0, 33);
|
||||
this.Front.addBox(-8.0f, -4.0f, -7.5f, 16, 5, 1);
|
||||
this.Front.setRotationPoint(0.0f, 19.0f, 0.0f);
|
||||
this.Front.setTextureSize(128, 128);
|
||||
this.Front.mirror = true;
|
||||
this.setRotation(this.Front, 0.5235988f, 0.0f, 0.0f);
|
||||
this.LeftB = new ModelRenderer((ModelBase)this, 36, 21);
|
||||
this.LeftB = new ModelRenderer((ModelBase) this, 36, 21);
|
||||
this.LeftB.addBox(7.0f, -3.0f, -6.0f, 1, 8, 13);
|
||||
this.LeftB.setRotationPoint(0.0f, 19.0f, 0.0f);
|
||||
this.LeftB.setTextureSize(128, 128);
|
||||
this.LeftB.mirror = true;
|
||||
this.setRotation(this.LeftB, 0.0f, 0.0f, 0.0f);
|
||||
this.Back = new ModelRenderer((ModelBase)this, 0, 96);
|
||||
this.Back = new ModelRenderer((ModelBase) this, 0, 96);
|
||||
this.Back.addBox(-5.0f, -8.0f, 4.0f, 10, 10, 4);
|
||||
this.Back.setRotationPoint(0.0f, 19.0f, 0.0f);
|
||||
this.Back.setTextureSize(128, 128);
|
||||
this.Back.mirror = true;
|
||||
this.setRotation(this.Back, 0.0f, 0.0f, 0.0f);
|
||||
this.Right = new ModelRenderer((ModelBase)this, 0, 42);
|
||||
this.Right = new ModelRenderer((ModelBase) this, 0, 42);
|
||||
this.Right.addBox(-8.0f, -10.0f, -8.0f, 1, 7, 15);
|
||||
this.Right.setRotationPoint(0.0f, 19.0f, 0.0f);
|
||||
this.Right.setTextureSize(128, 128);
|
||||
this.Right.mirror = true;
|
||||
this.setRotation(this.Right, 0.0f, 0.0f, 0.0f);
|
||||
this.RightB = new ModelRenderer((ModelBase)this, 36, 0);
|
||||
this.RightB = new ModelRenderer((ModelBase) this, 36, 0);
|
||||
this.RightB.addBox(-8.0f, -3.0f, -6.0f, 1, 8, 13);
|
||||
this.RightB.setRotationPoint(0.0f, 19.0f, 0.0f);
|
||||
this.RightB.setTextureSize(128, 128);
|
||||
this.RightB.mirror = true;
|
||||
this.setRotation(this.RightB, 0.0f, 0.0f, 0.0f);
|
||||
this.Bottom = new ModelRenderer((ModelBase)this, 0, 81);
|
||||
this.Bottom = new ModelRenderer((ModelBase) this, 0, 81);
|
||||
this.Bottom.addBox(-7.0f, 4.0f, -6.0f, 14, 1, 13);
|
||||
this.Bottom.setRotationPoint(0.0f, 19.0f, 0.0f);
|
||||
this.Bottom.setTextureSize(128, 128);
|
||||
this.Bottom.mirror = true;
|
||||
this.setRotation(this.Bottom, 0.0f, 0.0f, 0.0f);
|
||||
this.Back3 = new ModelRenderer((ModelBase)this, 0, 23);
|
||||
this.Back3 = new ModelRenderer((ModelBase) this, 0, 23);
|
||||
this.Back3.addBox(-7.0f, -10.0f, -9.0f, 14, 8, 1);
|
||||
this.Back3.setRotationPoint(0.0f, 19.0f, 0.0f);
|
||||
this.Back3.setTextureSize(128, 128);
|
||||
this.Back3.mirror = true;
|
||||
this.setRotation(this.Back3, -0.1919862f, 0.0f, 0.0f);
|
||||
this.Back2 = new ModelRenderer((ModelBase)this, 0, 7);
|
||||
this.Back2 = new ModelRenderer((ModelBase) this, 0, 7);
|
||||
this.Back2.addBox(-7.0f, -10.0f, 3.0f, 14, 14, 1);
|
||||
this.Back2.setRotationPoint(0.0f, 19.0f, 0.0f);
|
||||
this.Back2.setTextureSize(128, 128);
|
||||
|
@ -100,4 +99,3 @@ extends ModelBase {
|
|||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package assemblyline.client.model;
|
|||
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ModelHelper {
|
||||
|
@ -15,61 +14,62 @@ public class ModelHelper {
|
|||
private static float texScale = 16.0f;
|
||||
private static boolean clip = false;
|
||||
|
||||
private static void drawQuadRaw(Vec3 v1, Vec3 v2, Vec3 v3, Vec3 v4, ForgeDirection side) {
|
||||
private static void
|
||||
drawQuadRaw(Vec3 v1, Vec3 v2, Vec3 v3, Vec3 v4, ForgeDirection side) {
|
||||
float yMax;
|
||||
float xMax;
|
||||
GL11.glBegin((int)7);
|
||||
GL11.glBegin((int) 7);
|
||||
float quadWidth = 1.0f;
|
||||
float quadHeight = 1.0f;
|
||||
float subWidth = (float)sTexWidth / (float)gTexWidth;
|
||||
float subHeight = (float)sTexHeight / (float)gTexHeight;
|
||||
float xMin = (float)texOffsetX / (float)sTexWidth * subWidth;
|
||||
float yMin = (float)texOffsetY / (float)sTexHeight * subHeight;
|
||||
float subWidth = (float) sTexWidth / (float) gTexWidth;
|
||||
float subHeight = (float) sTexHeight / (float) gTexHeight;
|
||||
float xMin = (float) texOffsetX / (float) sTexWidth * subWidth;
|
||||
float yMin = (float) texOffsetY / (float) sTexHeight * subHeight;
|
||||
float subSqX = 0.0f;
|
||||
float subSqY = 0.0f;
|
||||
float subSqWidth = 0.25f * ((float)sTexWidth / (float)gTexWidth);
|
||||
float subSqHeight = 0.5f * ((float)sTexHeight / (float)gTexHeight);
|
||||
float subSqWidth = 0.25f * ((float) sTexWidth / (float) gTexWidth);
|
||||
float subSqHeight = 0.5f * ((float) sTexHeight / (float) gTexHeight);
|
||||
switch (side) {
|
||||
case UP: {
|
||||
subSqX = 2.0f * subSqWidth;
|
||||
subSqY = 0.0f;
|
||||
quadWidth = (float)Math.abs(v2.xCoord - v1.xCoord);
|
||||
quadHeight = (float)Math.abs(v4.zCoord - v1.zCoord);
|
||||
quadWidth = (float) Math.abs(v2.xCoord - v1.xCoord);
|
||||
quadHeight = (float) Math.abs(v4.zCoord - v1.zCoord);
|
||||
break;
|
||||
}
|
||||
case DOWN: {
|
||||
subSqX = 1.0f * subSqWidth;
|
||||
subSqY = 0.0f;
|
||||
quadWidth = (float)Math.abs(v2.xCoord - v1.xCoord);
|
||||
quadHeight = (float)Math.abs(v4.zCoord - v1.zCoord);
|
||||
quadWidth = (float) Math.abs(v2.xCoord - v1.xCoord);
|
||||
quadHeight = (float) Math.abs(v4.zCoord - v1.zCoord);
|
||||
break;
|
||||
}
|
||||
case EAST: {
|
||||
subSqX = 0.0f;
|
||||
subSqY = subSqHeight;
|
||||
quadWidth = (float)Math.abs(v2.zCoord - v1.zCoord);
|
||||
quadHeight = (float)Math.abs(v4.yCoord - v1.yCoord);
|
||||
quadWidth = (float) Math.abs(v2.zCoord - v1.zCoord);
|
||||
quadHeight = (float) Math.abs(v4.yCoord - v1.yCoord);
|
||||
break;
|
||||
}
|
||||
case WEST: {
|
||||
subSqX = 2.0f * subSqWidth;
|
||||
subSqY = subSqHeight;
|
||||
quadWidth = (float)Math.abs(v2.zCoord - v1.zCoord);
|
||||
quadHeight = (float)Math.abs(v4.yCoord - v1.yCoord);
|
||||
quadWidth = (float) Math.abs(v2.zCoord - v1.zCoord);
|
||||
quadHeight = (float) Math.abs(v4.yCoord - v1.yCoord);
|
||||
break;
|
||||
}
|
||||
case SOUTH: {
|
||||
subSqX = subSqWidth;
|
||||
subSqY = subSqHeight;
|
||||
quadWidth = (float)Math.abs(v2.xCoord - v1.xCoord);
|
||||
quadHeight = (float)Math.abs(v4.yCoord - v1.yCoord);
|
||||
quadWidth = (float) Math.abs(v2.xCoord - v1.xCoord);
|
||||
quadHeight = (float) Math.abs(v4.yCoord - v1.yCoord);
|
||||
break;
|
||||
}
|
||||
case NORTH: {
|
||||
subSqX = 3.0f * subSqWidth;
|
||||
subSqY = subSqHeight;
|
||||
quadWidth = (float)Math.abs(v2.xCoord - v1.xCoord);
|
||||
quadHeight = (float)Math.abs(v4.yCoord - v1.yCoord);
|
||||
quadWidth = (float) Math.abs(v2.xCoord - v1.xCoord);
|
||||
quadHeight = (float) Math.abs(v4.yCoord - v1.yCoord);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -82,18 +82,20 @@ public class ModelHelper {
|
|||
xMax = xMin + subSqWidth;
|
||||
yMax = yMin + subSqHeight;
|
||||
}
|
||||
GL11.glTexCoord2f((float)xMin, (float)yMin);
|
||||
GL11.glVertex3d((double)v1.xCoord, (double)v1.yCoord, (double)v1.zCoord);
|
||||
GL11.glTexCoord2f((float)xMax, (float)yMin);
|
||||
GL11.glVertex3d((double)v2.xCoord, (double)v2.yCoord, (double)v2.zCoord);
|
||||
GL11.glTexCoord2f((float)xMax, (float)yMax);
|
||||
GL11.glVertex3d((double)v3.xCoord, (double)v3.yCoord, (double)v3.zCoord);
|
||||
GL11.glTexCoord2f((float)xMin, (float)yMax);
|
||||
GL11.glVertex3d((double)v4.xCoord, (double)v4.yCoord, (double)v4.zCoord);
|
||||
GL11.glTexCoord2f((float) xMin, (float) yMin);
|
||||
GL11.glVertex3d((double) v1.xCoord, (double) v1.yCoord, (double) v1.zCoord);
|
||||
GL11.glTexCoord2f((float) xMax, (float) yMin);
|
||||
GL11.glVertex3d((double) v2.xCoord, (double) v2.yCoord, (double) v2.zCoord);
|
||||
GL11.glTexCoord2f((float) xMax, (float) yMax);
|
||||
GL11.glVertex3d((double) v3.xCoord, (double) v3.yCoord, (double) v3.zCoord);
|
||||
GL11.glTexCoord2f((float) xMin, (float) yMax);
|
||||
GL11.glVertex3d((double) v4.xCoord, (double) v4.yCoord, (double) v4.zCoord);
|
||||
GL11.glEnd();
|
||||
}
|
||||
|
||||
private static void drawCuboidRaw(Vec3 v1, Vec3 v2, Vec3 v3, Vec3 v4, Vec3 v5, Vec3 v6, Vec3 v7, Vec3 v8) {
|
||||
private static void drawCuboidRaw(
|
||||
Vec3 v1, Vec3 v2, Vec3 v3, Vec3 v4, Vec3 v5, Vec3 v6, Vec3 v7, Vec3 v8
|
||||
) {
|
||||
ModelHelper.drawQuadRaw(v1, v2, v3, v4, ForgeDirection.UP);
|
||||
ModelHelper.drawQuadRaw(v7, v6, v3, v2, ForgeDirection.EAST);
|
||||
ModelHelper.drawQuadRaw(v5, v6, v7, v8, ForgeDirection.DOWN);
|
||||
|
@ -102,21 +104,23 @@ public class ModelHelper {
|
|||
ModelHelper.drawQuadRaw(v8, v7, v2, v1, ForgeDirection.SOUTH);
|
||||
}
|
||||
|
||||
public static void drawCuboid(float xOffset, float yOffset, float zOffset, float xSize, float ySize, float zSize) {
|
||||
public static void drawCuboid(
|
||||
float xOffset, float yOffset, float zOffset, float xSize, float ySize, float zSize
|
||||
) {
|
||||
float x = xOffset;
|
||||
float y = yOffset;
|
||||
float z = zOffset;
|
||||
float x2 = x + xSize;
|
||||
float y2 = y + ySize;
|
||||
float z2 = z + zSize;
|
||||
Vec3 v1 = Vec3.createVectorHelper((double)x, (double)y2, (double)z2);
|
||||
Vec3 v2 = Vec3.createVectorHelper((double)x2, (double)y2, (double)z2);
|
||||
Vec3 v3 = Vec3.createVectorHelper((double)x2, (double)y2, (double)z);
|
||||
Vec3 v4 = Vec3.createVectorHelper((double)x, (double)y2, (double)z);
|
||||
Vec3 v5 = Vec3.createVectorHelper((double)x, (double)y, (double)z);
|
||||
Vec3 v6 = Vec3.createVectorHelper((double)x2, (double)y, (double)z);
|
||||
Vec3 v7 = Vec3.createVectorHelper((double)x2, (double)y, (double)z2);
|
||||
Vec3 v8 = Vec3.createVectorHelper((double)x, (double)y, (double)z2);
|
||||
Vec3 v1 = Vec3.createVectorHelper((double) x, (double) y2, (double) z2);
|
||||
Vec3 v2 = Vec3.createVectorHelper((double) x2, (double) y2, (double) z2);
|
||||
Vec3 v3 = Vec3.createVectorHelper((double) x2, (double) y2, (double) z);
|
||||
Vec3 v4 = Vec3.createVectorHelper((double) x, (double) y2, (double) z);
|
||||
Vec3 v5 = Vec3.createVectorHelper((double) x, (double) y, (double) z);
|
||||
Vec3 v6 = Vec3.createVectorHelper((double) x2, (double) y, (double) z);
|
||||
Vec3 v7 = Vec3.createVectorHelper((double) x2, (double) y, (double) z2);
|
||||
Vec3 v8 = Vec3.createVectorHelper((double) x, (double) y, (double) z2);
|
||||
ModelHelper.drawCuboidRaw(v1, v2, v3, v4, v5, v6, v7, v8);
|
||||
}
|
||||
|
||||
|
@ -139,4 +143,3 @@ public class ModelHelper {
|
|||
ModelHelper.clip = clip;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ package assemblyline.client.model;
|
|||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelLaserDrill
|
||||
extends ModelBase {
|
||||
public class ModelLaserDrill extends ModelBase {
|
||||
ModelRenderer Tip;
|
||||
ModelRenderer Upper_plating;
|
||||
ModelRenderer Middle_plating;
|
||||
|
@ -23,85 +22,85 @@ extends ModelBase {
|
|||
public ModelLaserDrill() {
|
||||
this.textureWidth = 64;
|
||||
this.textureHeight = 32;
|
||||
this.Tip = new ModelRenderer((ModelBase)this, 0, 8);
|
||||
this.Tip = new ModelRenderer((ModelBase) this, 0, 8);
|
||||
this.Tip.addBox(-1.0f, 0.0f, -1.0f, 2, 16, 2);
|
||||
this.Tip.setRotationPoint(0.0f, 8.0f, 0.0f);
|
||||
this.Tip.setTextureSize(64, 32);
|
||||
this.Tip.mirror = true;
|
||||
this.setRotation(this.Tip, 0.0f, 0.0f, 0.0f);
|
||||
this.Upper_plating = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.Upper_plating = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.Upper_plating.addBox(-2.0f, 0.0f, -2.0f, 4, 1, 4);
|
||||
this.Upper_plating.setRotationPoint(0.0f, 11.0f, 0.0f);
|
||||
this.Upper_plating.setTextureSize(64, 32);
|
||||
this.Upper_plating.mirror = true;
|
||||
this.setRotation(this.Upper_plating, 0.0f, 0.0f, 0.0f);
|
||||
this.Middle_plating = new ModelRenderer((ModelBase)this, 16, 0);
|
||||
this.Middle_plating = new ModelRenderer((ModelBase) this, 16, 0);
|
||||
this.Middle_plating.addBox(-3.0f, 0.0f, -3.0f, 6, 1, 6);
|
||||
this.Middle_plating.setRotationPoint(0.0f, 15.0f, 0.0f);
|
||||
this.Middle_plating.setTextureSize(64, 32);
|
||||
this.Middle_plating.mirror = true;
|
||||
this.setRotation(this.Middle_plating, 0.0f, 0.0f, 0.0f);
|
||||
this.Shape3_1 = new ModelRenderer((ModelBase)this, 8, 8);
|
||||
this.Shape3_1 = new ModelRenderer((ModelBase) this, 8, 8);
|
||||
this.Shape3_1.addBox(2.0f, 0.0f, -1.0f, 1, 6, 2);
|
||||
this.Shape3_1.setRotationPoint(0.0f, 11.0f, 0.0f);
|
||||
this.Shape3_1.setTextureSize(64, 32);
|
||||
this.Shape3_1.mirror = true;
|
||||
this.setRotation(this.Shape3_1, 0.0f, -3.141593f, 0.0f);
|
||||
this.Shape3_2 = new ModelRenderer((ModelBase)this, 8, 8);
|
||||
this.Shape3_2 = new ModelRenderer((ModelBase) this, 8, 8);
|
||||
this.Shape3_2.addBox(2.0f, 0.0f, -1.0f, 1, 6, 2);
|
||||
this.Shape3_2.setRotationPoint(0.0f, 11.0f, 0.0f);
|
||||
this.Shape3_2.setTextureSize(64, 32);
|
||||
this.Shape3_2.mirror = true;
|
||||
this.setRotation(this.Shape3_2, 0.0f, -1.570796f, 0.0f);
|
||||
this.Shape3_3 = new ModelRenderer((ModelBase)this, 8, 8);
|
||||
this.Shape3_3 = new ModelRenderer((ModelBase) this, 8, 8);
|
||||
this.Shape3_3.addBox(2.0f, 0.0f, -1.0f, 1, 6, 2);
|
||||
this.Shape3_3.setRotationPoint(0.0f, 11.0f, 0.0f);
|
||||
this.Shape3_3.setTextureSize(64, 32);
|
||||
this.Shape3_3.mirror = true;
|
||||
this.setRotation(this.Shape3_3, 0.0f, 1.570796f, 0.0f);
|
||||
this.Shape3_4 = new ModelRenderer((ModelBase)this, 8, 8);
|
||||
this.Shape3_4 = new ModelRenderer((ModelBase) this, 8, 8);
|
||||
this.Shape3_4.addBox(2.0f, 0.0f, -1.0f, 1, 6, 2);
|
||||
this.Shape3_4.setRotationPoint(0.0f, 11.0f, 0.0f);
|
||||
this.Shape3_4.setTextureSize(64, 32);
|
||||
this.Shape3_4.mirror = true;
|
||||
this.setRotation(this.Shape3_4, 0.0f, 0.0f, 0.0f);
|
||||
this.LowerPlating_1 = new ModelRenderer((ModelBase)this, 40, 0);
|
||||
this.LowerPlating_1 = new ModelRenderer((ModelBase) this, 40, 0);
|
||||
this.LowerPlating_1.addBox(-2.0f, 0.0f, -2.0f, 4, 1, 4);
|
||||
this.LowerPlating_1.setRotationPoint(0.0f, 18.0f, 0.0f);
|
||||
this.LowerPlating_1.setTextureSize(64, 32);
|
||||
this.LowerPlating_1.mirror = true;
|
||||
this.setRotation(this.LowerPlating_1, 0.0f, 0.0f, 0.0f);
|
||||
this.LowerPlating_2 = new ModelRenderer((ModelBase)this, 40, 0);
|
||||
this.LowerPlating_2 = new ModelRenderer((ModelBase) this, 40, 0);
|
||||
this.LowerPlating_2.addBox(-2.0f, 0.0f, -2.0f, 4, 1, 4);
|
||||
this.LowerPlating_2.setRotationPoint(0.0f, 20.0f, 0.0f);
|
||||
this.LowerPlating_2.setTextureSize(64, 32);
|
||||
this.LowerPlating_2.mirror = true;
|
||||
this.setRotation(this.LowerPlating_2, 0.0f, 0.0f, 0.0f);
|
||||
this.Bump_1 = new ModelRenderer((ModelBase)this, 56, 0);
|
||||
this.Bump_1 = new ModelRenderer((ModelBase) this, 56, 0);
|
||||
this.Bump_1.addBox(-0.5f, -0.5f, -0.5f, 1, 4, 1);
|
||||
this.Bump_1.setRotationPoint(0.0f, 12.0f, 3.0f);
|
||||
this.Bump_1.setTextureSize(64, 32);
|
||||
this.Bump_1.mirror = true;
|
||||
this.setRotation(this.Bump_1, 0.0f, 0.7853982f, 0.0f);
|
||||
this.Bump_2 = new ModelRenderer((ModelBase)this, 56, 0);
|
||||
this.Bump_2 = new ModelRenderer((ModelBase) this, 56, 0);
|
||||
this.Bump_2.addBox(-0.5f, -0.5f, -0.5f, 1, 4, 1);
|
||||
this.Bump_2.setRotationPoint(3.0f, 12.0f, 0.0f);
|
||||
this.Bump_2.setTextureSize(64, 32);
|
||||
this.Bump_2.mirror = true;
|
||||
this.setRotation(this.Bump_2, 0.0f, 0.7853982f, 0.0f);
|
||||
this.Bump_3 = new ModelRenderer((ModelBase)this, 56, 0);
|
||||
this.Bump_3 = new ModelRenderer((ModelBase) this, 56, 0);
|
||||
this.Bump_3.addBox(-0.5f, -0.5f, -0.5f, 1, 4, 1);
|
||||
this.Bump_3.setRotationPoint(0.0f, 12.0f, -3.0f);
|
||||
this.Bump_3.setTextureSize(64, 32);
|
||||
this.Bump_3.mirror = true;
|
||||
this.setRotation(this.Bump_3, 0.0f, 0.7853982f, 0.0f);
|
||||
this.Bump_4 = new ModelRenderer((ModelBase)this, 56, 0);
|
||||
this.Bump_4 = new ModelRenderer((ModelBase) this, 56, 0);
|
||||
this.Bump_4.addBox(-0.5f, -0.5f, -0.5f, 1, 4, 1);
|
||||
this.Bump_4.setRotationPoint(-3.0f, 12.0f, 0.0f);
|
||||
this.Bump_4.setTextureSize(64, 32);
|
||||
this.Bump_4.mirror = true;
|
||||
this.setRotation(this.Bump_4, 0.0f, 0.7853982f, 0.0f);
|
||||
this.Cross = new ModelRenderer((ModelBase)this, 14, 8);
|
||||
this.Cross = new ModelRenderer((ModelBase) this, 14, 8);
|
||||
this.Cross.addBox(-0.5f, -0.5f, -0.5f, 3, 1, 3);
|
||||
this.Cross.setRotationPoint(-1.5f, 11.0f, 0.0f);
|
||||
this.Cross.setTextureSize(64, 32);
|
||||
|
@ -132,4 +131,3 @@ extends ModelBase {
|
|||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ package assemblyline.client.model;
|
|||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelManipulator
|
||||
extends ModelBase {
|
||||
public class ModelManipulator extends ModelBase {
|
||||
ModelRenderer bBELTLong;
|
||||
ModelRenderer FBELT;
|
||||
ModelRenderer BacPanel;
|
||||
|
@ -29,121 +28,121 @@ extends ModelBase {
|
|||
public ModelManipulator() {
|
||||
this.textureWidth = 128;
|
||||
this.textureHeight = 128;
|
||||
this.bBELTLong = new ModelRenderer((ModelBase)this, 0, 66);
|
||||
this.bBELTLong = new ModelRenderer((ModelBase) this, 0, 66);
|
||||
this.bBELTLong.addBox(0.0f, 0.0f, 0.0f, 14, 1, 16);
|
||||
this.bBELTLong.setRotationPoint(-7.0f, 22.0f, -8.0f);
|
||||
this.bBELTLong.setTextureSize(128, 128);
|
||||
this.bBELTLong.mirror = true;
|
||||
this.setRotation(this.bBELTLong, 0.0f, 0.0f, 0.0f);
|
||||
this.FBELT = new ModelRenderer((ModelBase)this, 0, 16);
|
||||
this.FBELT = new ModelRenderer((ModelBase) this, 0, 16);
|
||||
this.FBELT.addBox(0.0f, 0.0f, 0.0f, 14, 2, 1);
|
||||
this.FBELT.setRotationPoint(-7.0f, 20.0f, -8.0f);
|
||||
this.FBELT.setTextureSize(128, 128);
|
||||
this.FBELT.mirror = true;
|
||||
this.setRotation(this.FBELT, 0.0f, 0.0f, 0.0f);
|
||||
this.BacPanel = new ModelRenderer((ModelBase)this, 0, 86);
|
||||
this.BacPanel = new ModelRenderer((ModelBase) this, 0, 86);
|
||||
this.BacPanel.addBox(0.0f, -12.0f, 0.0f, 14, 12, 1);
|
||||
this.BacPanel.setRotationPoint(-7.0f, 24.0f, 7.0f);
|
||||
this.BacPanel.setTextureSize(128, 128);
|
||||
this.BacPanel.mirror = true;
|
||||
this.setRotation(this.BacPanel, 0.0f, 0.0f, 0.0f);
|
||||
this.BBelt = new ModelRenderer((ModelBase)this, 0, 31);
|
||||
this.BBelt = new ModelRenderer((ModelBase) this, 0, 31);
|
||||
this.BBelt.addBox(0.0f, 0.0f, 0.0f, 14, 1, 14);
|
||||
this.BBelt.setRotationPoint(-7.0f, 22.0f, -7.0f);
|
||||
this.BBelt.setTextureSize(128, 128);
|
||||
this.BBelt.mirror = true;
|
||||
this.setRotation(this.BBelt, 0.0f, 0.0f, 0.0f);
|
||||
this.FRL = new ModelRenderer((ModelBase)this, 0, 20);
|
||||
this.FRL = new ModelRenderer((ModelBase) this, 0, 20);
|
||||
this.FRL.addBox(0.0f, 0.0f, 0.0f, 1, 3, 2);
|
||||
this.FRL.setRotationPoint(-8.0f, 21.0f, -6.0f);
|
||||
this.FRL.setTextureSize(128, 128);
|
||||
this.FRL.mirror = true;
|
||||
this.setRotation(this.FRL, 0.0f, 0.0f, 0.0f);
|
||||
this.MRL = new ModelRenderer((ModelBase)this, 0, 20);
|
||||
this.MRL = new ModelRenderer((ModelBase) this, 0, 20);
|
||||
this.MRL.addBox(0.0f, 0.0f, 0.0f, 1, 3, 2);
|
||||
this.MRL.setRotationPoint(-8.0f, 21.0f, -1.0f);
|
||||
this.MRL.setTextureSize(128, 128);
|
||||
this.MRL.mirror = true;
|
||||
this.setRotation(this.MRL, 0.0f, 0.0f, 0.0f);
|
||||
this.FLL = new ModelRenderer((ModelBase)this, 0, 20);
|
||||
this.FLL = new ModelRenderer((ModelBase) this, 0, 20);
|
||||
this.FLL.addBox(0.0f, 0.0f, 0.0f, 1, 3, 2);
|
||||
this.FLL.setRotationPoint(7.0f, 21.0f, -6.0f);
|
||||
this.FLL.setTextureSize(128, 128);
|
||||
this.FLL.mirror = true;
|
||||
this.setRotation(this.FLL, 0.0f, 0.0f, 0.0f);
|
||||
this.BLL = new ModelRenderer((ModelBase)this, 0, 20);
|
||||
this.BLL = new ModelRenderer((ModelBase) this, 0, 20);
|
||||
this.BLL.addBox(0.0f, 0.0f, 0.0f, 1, 3, 2);
|
||||
this.BLL.setRotationPoint(7.0f, 21.0f, 4.0f);
|
||||
this.BLL.setTextureSize(128, 128);
|
||||
this.BLL.mirror = true;
|
||||
this.setRotation(this.BLL, 0.0f, 0.0f, 0.0f);
|
||||
this.MRoller = new ModelRenderer((ModelBase)this, 0, 26);
|
||||
this.MRoller = new ModelRenderer((ModelBase) this, 0, 26);
|
||||
this.MRoller.addBox(-7.0f, -1.0f, -1.0f, 14, 2, 2);
|
||||
this.MRoller.setRotationPoint(0.0f, 21.0f, 0.0f);
|
||||
this.MRoller.setTextureSize(128, 128);
|
||||
this.MRoller.mirror = true;
|
||||
this.setRotation(this.MRoller, 0.0f, 0.0f, 0.0f);
|
||||
this.BRoller = new ModelRenderer((ModelBase)this, 0, 26);
|
||||
this.BRoller = new ModelRenderer((ModelBase) this, 0, 26);
|
||||
this.BRoller.addBox(-7.0f, -1.0f, -1.0f, 14, 2, 2);
|
||||
this.BRoller.setRotationPoint(0.0f, 21.0f, 5.0f);
|
||||
this.BRoller.setTextureSize(128, 128);
|
||||
this.BRoller.mirror = true;
|
||||
this.setRotation(this.BRoller, 0.0f, 0.0f, 0.0f);
|
||||
this.tBELT = new ModelRenderer((ModelBase)this, 0, 0);
|
||||
this.tBELT = new ModelRenderer((ModelBase) this, 0, 0);
|
||||
this.tBELT.addBox(0.0f, 0.0f, 0.0f, 14, 1, 14);
|
||||
this.tBELT.setRotationPoint(-7.0f, 19.0f, -7.0f);
|
||||
this.tBELT.setTextureSize(128, 128);
|
||||
this.tBELT.mirror = true;
|
||||
this.setRotation(this.tBELT, 0.0f, 0.0f, 0.0f);
|
||||
this.FRoller = new ModelRenderer((ModelBase)this, 0, 26);
|
||||
this.FRoller = new ModelRenderer((ModelBase) this, 0, 26);
|
||||
this.FRoller.addBox(-7.0f, -1.0f, -1.0f, 14, 2, 2);
|
||||
this.FRoller.setRotationPoint(0.0f, 21.0f, -5.0f);
|
||||
this.FRoller.setTextureSize(128, 128);
|
||||
this.FRoller.mirror = true;
|
||||
this.setRotation(this.FRoller, 0.0f, 0.0f, 0.0f);
|
||||
this.BRL = new ModelRenderer((ModelBase)this, 0, 20);
|
||||
this.BRL = new ModelRenderer((ModelBase) this, 0, 20);
|
||||
this.BRL.addBox(0.0f, 0.0f, 0.0f, 1, 3, 2);
|
||||
this.BRL.setRotationPoint(-8.0f, 21.0f, 4.0f);
|
||||
this.BRL.setTextureSize(128, 128);
|
||||
this.BRL.mirror = true;
|
||||
this.setRotation(this.BRL, 0.0f, 0.0f, 0.0f);
|
||||
this.BML = new ModelRenderer((ModelBase)this, 0, 20);
|
||||
this.BML = new ModelRenderer((ModelBase) this, 0, 20);
|
||||
this.BML.addBox(0.0f, 0.0f, 0.0f, 1, 3, 2);
|
||||
this.BML.setRotationPoint(7.0f, 21.0f, -1.0f);
|
||||
this.BML.setTextureSize(128, 128);
|
||||
this.BML.mirror = true;
|
||||
this.setRotation(this.BML, 0.0f, 0.0f, 0.0f);
|
||||
this.tBELTLong = new ModelRenderer((ModelBase)this, 0, 48);
|
||||
this.tBELTLong = new ModelRenderer((ModelBase) this, 0, 48);
|
||||
this.tBELTLong.addBox(0.0f, 0.0f, 0.0f, 14, 1, 16);
|
||||
this.tBELTLong.setRotationPoint(-7.0f, 19.0f, -8.0f);
|
||||
this.tBELTLong.setTextureSize(128, 128);
|
||||
this.tBELTLong.mirror = true;
|
||||
this.setRotation(this.tBELTLong, 0.0f, 0.0f, 0.0f);
|
||||
this.RPanel = new ModelRenderer((ModelBase)this, 65, 41);
|
||||
this.RPanel = new ModelRenderer((ModelBase) this, 65, 41);
|
||||
this.RPanel.addBox(0.0f, -2.0f, -8.0f, 1, 4, 16);
|
||||
this.RPanel.setRotationPoint(-8.0f, 19.0f, 0.0f);
|
||||
this.RPanel.setTextureSize(128, 128);
|
||||
this.RPanel.mirror = true;
|
||||
this.setRotation(this.RPanel, 0.0f, 0.0f, 0.0f);
|
||||
this.LPanel = new ModelRenderer((ModelBase)this, 65, 20);
|
||||
this.LPanel = new ModelRenderer((ModelBase) this, 65, 20);
|
||||
this.LPanel.addBox(0.0f, -2.0f, -8.0f, 1, 4, 16);
|
||||
this.LPanel.setRotationPoint(7.0f, 19.0f, 0.0f);
|
||||
this.LPanel.setTextureSize(128, 128);
|
||||
this.LPanel.mirror = true;
|
||||
this.setRotation(this.LPanel, 0.0f, 0.0f, 0.0f);
|
||||
this.TopPanel = new ModelRenderer((ModelBase)this, 0, 105);
|
||||
this.TopPanel = new ModelRenderer((ModelBase) this, 0, 105);
|
||||
this.TopPanel.addBox(0.0f, 0.0f, 0.0f, 14, 2, 10);
|
||||
this.TopPanel.setRotationPoint(-7.0f, 12.0f, -3.0f);
|
||||
this.TopPanel.setTextureSize(128, 128);
|
||||
this.TopPanel.mirror = true;
|
||||
this.setRotation(this.TopPanel, 0.0f, 0.0f, 0.0f);
|
||||
this.RCPanel = new ModelRenderer((ModelBase)this, 50, 105);
|
||||
this.RCPanel = new ModelRenderer((ModelBase) this, 50, 105);
|
||||
this.RCPanel.addBox(-1.0f, 0.0f, 0.0f, 2, 5, 10);
|
||||
this.RCPanel.setRotationPoint(-7.0f, 14.0f, -3.0f);
|
||||
this.RCPanel.setTextureSize(128, 128);
|
||||
this.RCPanel.mirror = true;
|
||||
this.setRotation(this.RCPanel, 0.0f, 0.0f, 0.0f);
|
||||
this.LCPanel = new ModelRenderer((ModelBase)this, 76, 105);
|
||||
this.LCPanel = new ModelRenderer((ModelBase) this, 76, 105);
|
||||
this.LCPanel.addBox(0.0f, 0.0f, 0.0f, 2, 5, 10);
|
||||
this.LCPanel.setRotationPoint(6.0f, 14.0f, -3.0f);
|
||||
this.LCPanel.setTextureSize(128, 128);
|
||||
|
@ -186,4 +185,3 @@ extends ModelBase {
|
|||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ package assemblyline.client.model;
|
|||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelRejectorPiston
|
||||
extends ModelBase {
|
||||
public class ModelRejectorPiston extends ModelBase {
|
||||
ModelRenderer BodyBottom;
|
||||
ModelRenderer PistonFace2;
|
||||
ModelRenderer PistonShaft;
|
||||
|
@ -25,97 +24,97 @@ extends ModelBase {
|
|||
public ModelRejectorPiston() {
|
||||
this.textureWidth = 128;
|
||||
this.textureHeight = 128;
|
||||
this.BodyBottom = new ModelRenderer((ModelBase)this, 29, 69);
|
||||
this.BodyBottom = new ModelRenderer((ModelBase) this, 29, 69);
|
||||
this.BodyBottom.addBox(-5.0f, 0.0f, -2.0f, 10, 5, 15);
|
||||
this.BodyBottom.setRotationPoint(0.0f, 19.0f, -6.0f);
|
||||
this.BodyBottom.setTextureSize(128, 128);
|
||||
this.BodyBottom.mirror = true;
|
||||
this.setRotation(this.BodyBottom, 0.0f, 0.0f, 0.0f);
|
||||
this.PistonFace2 = new ModelRenderer((ModelBase)this, 0, 53);
|
||||
this.PistonFace2 = new ModelRenderer((ModelBase) this, 0, 53);
|
||||
this.PistonFace2.addBox(-2.0f, -2.0f, -1.0f, 4, 6, 1);
|
||||
this.PistonFace2.setRotationPoint(0.0f, 15.0f, -6.0f);
|
||||
this.PistonFace2.setTextureSize(128, 128);
|
||||
this.PistonFace2.mirror = true;
|
||||
this.setRotation(this.PistonFace2, 0.0f, 0.0f, 0.0f);
|
||||
this.PistonShaft = new ModelRenderer((ModelBase)this, 0, 75);
|
||||
this.PistonShaft = new ModelRenderer((ModelBase) this, 0, 75);
|
||||
this.PistonShaft.addBox(-1.5f, -1.5f, 0.0f, 3, 3, 10);
|
||||
this.PistonShaft.setRotationPoint(0.0f, 16.0f, -6.0f);
|
||||
this.PistonShaft.setTextureSize(128, 128);
|
||||
this.PistonShaft.mirror = true;
|
||||
this.setRotation(this.PistonShaft, 0.0f, 0.0f, 0.0f);
|
||||
this.Piston = new ModelRenderer((ModelBase)this, 0, 22);
|
||||
this.Piston = new ModelRenderer((ModelBase) this, 0, 22);
|
||||
this.Piston.addBox(-3.0f, -1.0f, 0.0f, 6, 6, 10);
|
||||
this.Piston.setRotationPoint(0.0f, 14.0f, -5.0f);
|
||||
this.Piston.setTextureSize(128, 128);
|
||||
this.Piston.mirror = true;
|
||||
this.setRotation(this.Piston, 0.0f, 0.0f, 0.0f);
|
||||
this.H1 = new ModelRenderer((ModelBase)this, 33, 23);
|
||||
this.H1 = new ModelRenderer((ModelBase) this, 33, 23);
|
||||
this.H1.addBox(-1.5f, 0.0f, 0.0f, 3, 1, 8);
|
||||
this.H1.setRotationPoint(0.0f, 12.0f, -4.0f);
|
||||
this.H1.setTextureSize(128, 128);
|
||||
this.H1.mirror = true;
|
||||
this.setRotation(this.H1, 0.0f, 0.0f, 0.0f);
|
||||
this.H2 = new ModelRenderer((ModelBase)this, 90, 23);
|
||||
this.H2 = new ModelRenderer((ModelBase) this, 90, 23);
|
||||
this.H2.addBox(0.0f, -1.5f, 0.0f, 1, 3, 8);
|
||||
this.H2.setRotationPoint(-4.0f, 16.0f, -4.0f);
|
||||
this.H2.setTextureSize(128, 128);
|
||||
this.H2.mirror = true;
|
||||
this.setRotation(this.H2, 0.0f, 0.0f, 0.0f);
|
||||
this.H3 = new ModelRenderer((ModelBase)this, 70, 23);
|
||||
this.H3 = new ModelRenderer((ModelBase) this, 70, 23);
|
||||
this.H3.addBox(0.0f, -1.5f, 0.0f, 1, 3, 8);
|
||||
this.H3.setRotationPoint(3.0f, 16.0f, -4.0f);
|
||||
this.H3.setTextureSize(128, 128);
|
||||
this.H3.mirror = true;
|
||||
this.setRotation(this.H3, 0.0f, 0.0f, 0.0f);
|
||||
this.PistonFace = new ModelRenderer((ModelBase)this, 0, 62);
|
||||
this.PistonFace = new ModelRenderer((ModelBase) this, 0, 62);
|
||||
this.PistonFace.addBox(-3.0f, -2.0f, -1.0f, 6, 4, 1);
|
||||
this.PistonFace.setRotationPoint(0.0f, 16.0f, -6.0f);
|
||||
this.PistonFace.setTextureSize(128, 128);
|
||||
this.PistonFace.mirror = true;
|
||||
this.setRotation(this.PistonFace, 0.0f, 0.0f, 0.0f);
|
||||
this.WireCCRight = new ModelRenderer((ModelBase)this, 69, 52);
|
||||
this.WireCCRight = new ModelRenderer((ModelBase) this, 69, 52);
|
||||
this.WireCCRight.addBox(-3.0f, -3.0f, 0.0f, 6, 11, 1);
|
||||
this.WireCCRight.setRotationPoint(0.0f, 16.0f, 7.0f);
|
||||
this.WireCCRight.setTextureSize(128, 128);
|
||||
this.WireCCRight.mirror = true;
|
||||
this.setRotation(this.WireCCRight, 0.0f, 0.0f, 0.0f);
|
||||
this.WireCCLeft = new ModelRenderer((ModelBase)this, 54, 37);
|
||||
this.WireCCLeft = new ModelRenderer((ModelBase) this, 54, 37);
|
||||
this.WireCCLeft.addBox(0.0f, -3.0f, -3.0f, 1, 8, 6);
|
||||
this.WireCCLeft.setRotationPoint(7.0f, 16.0f, 0.0f);
|
||||
this.WireCCLeft.setTextureSize(128, 128);
|
||||
this.WireCCLeft.mirror = true;
|
||||
this.setRotation(this.WireCCLeft, 0.0f, 0.0f, 0.0f);
|
||||
this.BodyP2 = new ModelRenderer((ModelBase)this, 100, 60);
|
||||
this.BodyP2 = new ModelRenderer((ModelBase) this, 100, 60);
|
||||
this.BodyP2.addBox(1.0f, -2.0f, -2.0f, 2, 7, 4);
|
||||
this.BodyP2.setRotationPoint(-8.0f, 16.0f, 0.0f);
|
||||
this.BodyP2.setTextureSize(128, 128);
|
||||
this.BodyP2.mirror = true;
|
||||
this.setRotation(this.BodyP2, 0.0f, 0.0f, 0.0f);
|
||||
this.BodyP1 = new ModelRenderer((ModelBase)this, 87, 60);
|
||||
this.BodyP1 = new ModelRenderer((ModelBase) this, 87, 60);
|
||||
this.BodyP1.addBox(3.0f, -2.0f, -2.0f, 2, 7, 4);
|
||||
this.BodyP1.setRotationPoint(2.0f, 16.0f, 0.0f);
|
||||
this.BodyP1.setTextureSize(128, 128);
|
||||
this.BodyP1.mirror = true;
|
||||
this.setRotation(this.BodyP1, 0.0f, 0.0f, 0.0f);
|
||||
this.LeftSide = new ModelRenderer((ModelBase)this, 29, 91);
|
||||
this.LeftSide = new ModelRenderer((ModelBase) this, 29, 91);
|
||||
this.LeftSide.addBox(0.0f, 0.0f, -2.0f, 3, 3, 14);
|
||||
this.LeftSide.setRotationPoint(5.0f, 21.0f, -5.0f);
|
||||
this.LeftSide.setTextureSize(128, 128);
|
||||
this.LeftSide.mirror = true;
|
||||
this.setRotation(this.LeftSide, 0.0f, 0.0f, 0.0f);
|
||||
this.RightSide = new ModelRenderer((ModelBase)this, 64, 91);
|
||||
this.RightSide = new ModelRenderer((ModelBase) this, 64, 91);
|
||||
this.RightSide.addBox(0.0f, 0.0f, -2.0f, 3, 3, 14);
|
||||
this.RightSide.setRotationPoint(-8.0f, 21.0f, -5.0f);
|
||||
this.RightSide.setTextureSize(128, 128);
|
||||
this.RightSide.mirror = true;
|
||||
this.setRotation(this.RightSide, 0.0f, 0.0f, 0.0f);
|
||||
this.PistonBack = new ModelRenderer((ModelBase)this, 0, 12);
|
||||
this.PistonBack = new ModelRenderer((ModelBase) this, 0, 12);
|
||||
this.PistonBack.addBox(-2.5f, -2.5f, -1.0f, 5, 5, 2);
|
||||
this.PistonBack.setRotationPoint(0.0f, 16.0f, 6.0f);
|
||||
this.PistonBack.setTextureSize(128, 128);
|
||||
this.PistonBack.mirror = true;
|
||||
this.setRotation(this.PistonBack, 0.0f, 0.0f, 0.0f);
|
||||
this.WireCCFront = new ModelRenderer((ModelBase)this, 69, 37);
|
||||
this.WireCCFront = new ModelRenderer((ModelBase) this, 69, 37);
|
||||
this.WireCCFront.addBox(0.0f, -3.0f, -3.0f, 1, 8, 6);
|
||||
this.WireCCFront.setRotationPoint(-8.0f, 16.0f, 0.0f);
|
||||
this.WireCCFront.setTextureSize(128, 128);
|
||||
|
@ -140,9 +139,9 @@ extends ModelBase {
|
|||
}
|
||||
|
||||
public void renderPiston(float f5, int p) {
|
||||
this.PistonFace2.setRotationPoint(0.0f, 15.0f, -6.0f - (float)p);
|
||||
this.PistonShaft.setRotationPoint(0.0f, 16.0f, -6.0f - (float)p);
|
||||
this.PistonFace.setRotationPoint(0.0f, 16.0f, -6.0f - (float)p);
|
||||
this.PistonFace2.setRotationPoint(0.0f, 15.0f, -6.0f - (float) p);
|
||||
this.PistonShaft.setRotationPoint(0.0f, 16.0f, -6.0f - (float) p);
|
||||
this.PistonFace.setRotationPoint(0.0f, 16.0f, -6.0f - (float) p);
|
||||
this.PistonFace2.render(f5);
|
||||
this.PistonShaft.render(f5);
|
||||
this.PistonFace.render(f5);
|
||||
|
@ -154,4 +153,3 @@ extends ModelBase {
|
|||
model.rotateAngleZ = z;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,72 +15,95 @@ import net.minecraft.util.ResourceLocation;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
public class BlockRenderingHandler
|
||||
implements ISimpleBlockRenderingHandler {
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public class BlockRenderingHandler implements ISimpleBlockRenderingHandler {
|
||||
public static BlockRenderingHandler instance = new BlockRenderingHandler();
|
||||
public static final int BLOCK_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
|
||||
public static final int BLOCK_RENDER_ID
|
||||
= RenderingRegistry.getNextAvailableRenderId();
|
||||
private ModelConveyorBelt modelConveyorBelt = new ModelConveyorBelt();
|
||||
private ModelRejectorPiston modelEjector = new ModelRejectorPiston();
|
||||
private ModelManipulator modelInjector = new ModelManipulator();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
public void
|
||||
renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (block == AssemblyLine.blockConveyorBelt) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)0.0f, (float)1.5f, (float)0.0f);
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)0.0f, (float)1.0f);
|
||||
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(new ResourceLocation("assemblyline", "textures/models/belt/frame0.png"));
|
||||
GL11.glTranslatef((float) 0.0f, (float) 1.5f, (float) 0.0f);
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 0.0f, (float) 1.0f);
|
||||
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(
|
||||
new ResourceLocation("assemblyline", "textures/models/belt/frame0.png")
|
||||
);
|
||||
this.modelConveyorBelt.render(0.0625f, 0.0f, false, false, false, false);
|
||||
GL11.glPopMatrix();
|
||||
} else if (block == AssemblyLine.blockRejector) {
|
||||
FMLClientHandler.instance().getClient().getTextureManager();
|
||||
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(new ResourceLocation("assemblyline", "textures/models/rejector.png"));
|
||||
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(
|
||||
new ResourceLocation("assemblyline", "textures/models/rejector.png")
|
||||
);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)0.6f, (float)1.5f, (float)0.6f);
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)0.0f, (float)1.0f);
|
||||
GL11.glRotatef((float)-90.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glTranslatef((float) 0.6f, (float) 1.5f, (float) 0.6f);
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 0.0f, (float) 1.0f);
|
||||
GL11.glRotatef((float) -90.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
this.modelEjector.render(0.0625f);
|
||||
this.modelEjector.renderPiston(0.0625f, 1);
|
||||
GL11.glPopMatrix();
|
||||
} else if (block == AssemblyLine.blockManipulator) {
|
||||
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(new ResourceLocation("assemblyline", "textures/models/manipulator1.png"));
|
||||
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(
|
||||
new ResourceLocation("assemblyline", "textures/models/manipulator1.png")
|
||||
);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)0.6f, (float)1.5f, (float)0.6f);
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)0.0f, (float)1.0f);
|
||||
GL11.glRotatef((float)-90.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glTranslatef((float) 0.6f, (float) 1.5f, (float) 0.6f);
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 0.0f, (float) 1.0f);
|
||||
GL11.glRotatef((float) -90.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
this.modelInjector.render(0.0625f, true, 0);
|
||||
GL11.glPopMatrix();
|
||||
} else if (block == AssemblyLine.blockArmbot) {
|
||||
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(new ResourceLocation("assemblyline", "textures/models/armbot.png"));
|
||||
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(
|
||||
new ResourceLocation("assemblyline", "textures/models/armbot.png")
|
||||
);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)0.4f, (float)0.8f, (float)0.0f);
|
||||
GL11.glScalef((float)0.7f, (float)0.7f, (float)0.7f);
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)0.0f, (float)1.0f);
|
||||
GL11.glRotatef((float)-90.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glTranslatef((float) 0.4f, (float) 0.8f, (float) 0.0f);
|
||||
GL11.glScalef((float) 0.7f, (float) 0.7f, (float) 0.7f);
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 0.0f, (float) 1.0f);
|
||||
GL11.glRotatef((float) -90.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
RenderArmbot.MODEL.render(0.0625f, 0.0f, 0.0f);
|
||||
GL11.glPopMatrix();
|
||||
} else if (block == AssemblyLine.blockCraneController) {
|
||||
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(new ResourceLocation("assemblyline", "textures/models/crane_controller_off.png"));
|
||||
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(
|
||||
new ResourceLocation(
|
||||
"assemblyline", "textures/models/crane_controller_off.png"
|
||||
)
|
||||
);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)0.0f, (float)1.0f);
|
||||
GL11.glRotatef((float)-90.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glTranslatef((float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 0.0f, (float) 1.0f);
|
||||
GL11.glRotatef((float) -90.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
RenderCraneController.MODEL.render(0.0625f, false, false);
|
||||
GL11.glPopMatrix();
|
||||
} else if (block == AssemblyLine.blockCraneFrame) {
|
||||
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(new ResourceLocation("assemblyline", "textures/models/crane_frame.png"));
|
||||
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(
|
||||
new ResourceLocation("assemblyline", "textures/models/crane_frame.png")
|
||||
);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)0.0f, (float)1.0f);
|
||||
GL11.glRotatef((float)-90.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glTranslatef((float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 0.0f, (float) 1.0f);
|
||||
GL11.glRotatef((float) -90.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
RenderCraneFrame.MODEL.render(true, true, false, false, false, false, false);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
Block block,
|
||||
int modelId,
|
||||
RenderBlocks renderer
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -94,4 +117,3 @@ implements ISimpleBlockRenderingHandler {
|
|||
return BLOCK_RENDER_ID;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,46 +13,83 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
public class RenderArmbot
|
||||
extends TileEntitySpecialRenderer {
|
||||
public class RenderArmbot extends TileEntitySpecialRenderer {
|
||||
public static final ModelArmbot MODEL = new ModelArmbot();
|
||||
public static final String TEXTURE = "armbot.png";
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
|
||||
public void
|
||||
renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
|
||||
if (tileEntity instanceof TileEntityArmbot) {
|
||||
EntityClientPlayerMP player;
|
||||
MovingObjectPosition objectPosition;
|
||||
String cmdText = ((TileEntityArmbot)tileEntity).getCommandDisplayText();
|
||||
if (!(cmdText == null || cmdText.isEmpty() || (objectPosition = (player = Minecraft.getMinecraft().thePlayer).rayTrace(8.0, 1.0f)) == null || objectPosition.blockX != tileEntity.xCoord || objectPosition.blockY != tileEntity.yCoord && objectPosition.blockY != tileEntity.yCoord + 1 || objectPosition.blockZ != tileEntity.zCoord)) {
|
||||
RenderHelper.renderFloatingText(cmdText, (float)x + 0.5f, (float)y + 0.25f, (float)z + 0.5f, 0xFFFFFF);
|
||||
String cmdText = ((TileEntityArmbot) tileEntity).getCommandDisplayText();
|
||||
if (!(cmdText == null || cmdText.isEmpty()
|
||||
|| (objectPosition
|
||||
= (player = Minecraft.getMinecraft().thePlayer).rayTrace(8.0, 1.0f))
|
||||
== null
|
||||
|| objectPosition.blockX != tileEntity.xCoord
|
||||
|| objectPosition.blockY != tileEntity.yCoord
|
||||
&& objectPosition.blockY != tileEntity.yCoord + 1
|
||||
|| objectPosition.blockZ != tileEntity.zCoord)) {
|
||||
RenderHelper.renderFloatingText(
|
||||
cmdText,
|
||||
(float) x + 0.5f,
|
||||
(float) y + 0.25f,
|
||||
(float) z + 0.5f,
|
||||
0xFFFFFF
|
||||
);
|
||||
}
|
||||
this.bindTexture(new ResourceLocation("assemblyline", "textures/models/armbot.png"));
|
||||
this.bindTexture(
|
||||
new ResourceLocation("assemblyline", "textures/models/armbot.png")
|
||||
);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)((float)x + 0.5f), (float)((float)y + 1.5f), (float)((float)z + 0.5f));
|
||||
GL11.glScalef((float)1.0f, (float)-1.0f, (float)-1.0f);
|
||||
MODEL.render(0.0625f, ((TileEntityArmbot)tileEntity).renderYaw, ((TileEntityArmbot)tileEntity).renderPitch);
|
||||
GL11.glTranslatef(
|
||||
(float) ((float) x + 0.5f),
|
||||
(float) ((float) y + 1.5f),
|
||||
(float) ((float) z + 0.5f)
|
||||
);
|
||||
GL11.glScalef((float) 1.0f, (float) -1.0f, (float) -1.0f);
|
||||
MODEL.render(
|
||||
0.0625f,
|
||||
((TileEntityArmbot) tileEntity).renderYaw,
|
||||
((TileEntityArmbot) tileEntity).renderPitch
|
||||
);
|
||||
GL11.glPopMatrix();
|
||||
Vector3 handPosition = ((TileEntityArmbot)tileEntity).getDeltaHandPosition();
|
||||
Vector3 handPosition = ((TileEntityArmbot) tileEntity).getDeltaHandPosition();
|
||||
handPosition.add(0.5);
|
||||
handPosition.add(new Vector3(x, y, z));
|
||||
RenderItem renderItem = (RenderItem)RenderManager.instance.getEntityClassRenderObject(EntityItem.class);
|
||||
RenderItem renderItem = (RenderItem
|
||||
) RenderManager.instance.getEntityClassRenderObject(EntityItem.class);
|
||||
TextureManager renderEngine = Minecraft.getMinecraft().renderEngine;
|
||||
for (ItemStack itemStack : ((TileEntityArmbot)tileEntity).getGrabbedItems()) {
|
||||
if (itemStack == null) continue;
|
||||
if (((TileEntityArmbot)tileEntity).renderEntityItem == null) {
|
||||
((TileEntityArmbot)tileEntity).renderEntityItem = new EntityItem(tileEntity.getWorldObj(), 0.0, 0.0, 0.0, itemStack);
|
||||
} else if (!itemStack.isItemEqual(((TileEntityArmbot)tileEntity).renderEntityItem.getEntityItem())) {
|
||||
((TileEntityArmbot)tileEntity).renderEntityItem = new EntityItem(tileEntity.getWorldObj(), 0.0, 0.0, 0.0, itemStack);
|
||||
for (ItemStack itemStack :
|
||||
((TileEntityArmbot) tileEntity).getGrabbedItems()) {
|
||||
if (itemStack == null)
|
||||
continue;
|
||||
if (((TileEntityArmbot) tileEntity).renderEntityItem == null) {
|
||||
((TileEntityArmbot) tileEntity).renderEntityItem = new EntityItem(
|
||||
tileEntity.getWorldObj(), 0.0, 0.0, 0.0, itemStack
|
||||
);
|
||||
} else if (!itemStack.isItemEqual(((TileEntityArmbot) tileEntity)
|
||||
.renderEntityItem.getEntityItem()
|
||||
)) {
|
||||
((TileEntityArmbot) tileEntity).renderEntityItem = new EntityItem(
|
||||
tileEntity.getWorldObj(), 0.0, 0.0, 0.0, itemStack
|
||||
);
|
||||
}
|
||||
renderItem.doRender(((TileEntityArmbot)tileEntity).renderEntityItem, handPosition.x, handPosition.y, handPosition.z, 0.0f, f);
|
||||
renderItem.doRender(
|
||||
((TileEntityArmbot) tileEntity).renderEntityItem,
|
||||
handPosition.x,
|
||||
handPosition.y,
|
||||
handPosition.z,
|
||||
0.0f,
|
||||
f
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,98 +9,159 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
public class RenderConveyorBelt
|
||||
extends TileEntitySpecialRenderer {
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public class RenderConveyorBelt extends TileEntitySpecialRenderer {
|
||||
public static final ModelConveyorBelt MODEL = new ModelConveyorBelt();
|
||||
public static final ModelAngledBelt MODEL2 = new ModelAngledBelt();
|
||||
|
||||
private void renderAModelAt(TileEntityConveyorBelt tileEntity, double x, double y, double z, float f) {
|
||||
private void renderAModelAt(
|
||||
TileEntityConveyorBelt tileEntity, double x, double y, double z, float f
|
||||
) {
|
||||
boolean mid = tileEntity.getIsMiddleBelt();
|
||||
TileEntityConveyorBelt.SlantType slantType = tileEntity.getSlant();
|
||||
int face = tileEntity.getDirection().ordinal();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)((float)x + 0.5f), (float)((float)y + 1.5f), (float)((float)z + 0.5f));
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)0.0f, (float)1.0f);
|
||||
GL11.glTranslatef(
|
||||
(float) ((float) x + 0.5f),
|
||||
(float) ((float) y + 1.5f),
|
||||
(float) ((float) z + 0.5f)
|
||||
);
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 0.0f, (float) 1.0f);
|
||||
int frame = tileEntity.getAnimationFrame();
|
||||
if (slantType != null && slantType != TileEntityConveyorBelt.SlantType.NONE) {
|
||||
boolean slantAdjust;
|
||||
switch (face) {
|
||||
case 2: {
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef(
|
||||
(float) 180.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
GL11.glRotatef((float)0.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef(
|
||||
(float) 0.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
GL11.glRotatef((float)90.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef(
|
||||
(float) 90.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
GL11.glRotatef((float)-90.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef(
|
||||
(float) -90.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f
|
||||
);
|
||||
}
|
||||
}
|
||||
if (slantType == TileEntityConveyorBelt.SlantType.UP) {
|
||||
this.bindTexture(new ResourceLocation("assemblyline", "textures/models/slantedbelt/frame" + frame + ".png"));
|
||||
GL11.glTranslatef((float)0.0f, (float)0.8f, (float)-0.8f);
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)1.0f, (float)1.0f);
|
||||
this.bindTexture(new ResourceLocation(
|
||||
"assemblyline", "textures/models/slantedbelt/frame" + frame + ".png"
|
||||
));
|
||||
GL11.glTranslatef((float) 0.0f, (float) 0.8f, (float) -0.8f);
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 1.0f, (float) 1.0f);
|
||||
slantAdjust = false;
|
||||
TileEntity test = tileEntity.getWorldObj().getTileEntity(tileEntity.xCoord + tileEntity.getDirection().offsetX, tileEntity.yCoord, tileEntity.zCoord + tileEntity.getDirection().offsetZ);
|
||||
if (test != null && test instanceof TileEntityConveyorBelt && ((TileEntityConveyorBelt)test).getSlant() == TileEntityConveyorBelt.SlantType.TOP) {
|
||||
GL11.glRotatef((float)10.0f, (float)1.0f, (float)0.0f, (float)0.0f);
|
||||
TileEntity test = tileEntity.getWorldObj().getTileEntity(
|
||||
tileEntity.xCoord + tileEntity.getDirection().offsetX,
|
||||
tileEntity.yCoord,
|
||||
tileEntity.zCoord + tileEntity.getDirection().offsetZ
|
||||
);
|
||||
if (test != null && test instanceof TileEntityConveyorBelt
|
||||
&& ((TileEntityConveyorBelt) test).getSlant()
|
||||
== TileEntityConveyorBelt.SlantType.TOP) {
|
||||
GL11.glRotatef(
|
||||
(float) 10.0f, (float) 1.0f, (float) 0.0f, (float) 0.0f
|
||||
);
|
||||
slantAdjust = true;
|
||||
}
|
||||
MODEL2.render(0.0625f, true);
|
||||
} else if (slantType == TileEntityConveyorBelt.SlantType.DOWN) {
|
||||
this.bindTexture(new ResourceLocation("assemblyline", "textures/models/slantedbelt/frame" + frame + ".png"));
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
this.bindTexture(new ResourceLocation(
|
||||
"assemblyline", "textures/models/slantedbelt/frame" + frame + ".png"
|
||||
));
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
slantAdjust = false;
|
||||
TileEntity test = tileEntity.getWorldObj().getTileEntity(tileEntity.xCoord - tileEntity.getDirection().offsetX, tileEntity.yCoord, tileEntity.zCoord - tileEntity.getDirection().offsetZ);
|
||||
if (test != null && test instanceof TileEntityConveyorBelt && ((TileEntityConveyorBelt)test).getSlant() == TileEntityConveyorBelt.SlantType.TOP) {
|
||||
GL11.glRotatef((float)-10.0f, (float)1.0f, (float)0.0f, (float)0.0f);
|
||||
GL11.glTranslatef((float)0.0f, (float)0.25f, (float)0.0f);
|
||||
TileEntity test = tileEntity.getWorldObj().getTileEntity(
|
||||
tileEntity.xCoord - tileEntity.getDirection().offsetX,
|
||||
tileEntity.yCoord,
|
||||
tileEntity.zCoord - tileEntity.getDirection().offsetZ
|
||||
);
|
||||
if (test != null && test instanceof TileEntityConveyorBelt
|
||||
&& ((TileEntityConveyorBelt) test).getSlant()
|
||||
== TileEntityConveyorBelt.SlantType.TOP) {
|
||||
GL11.glRotatef(
|
||||
(float) -10.0f, (float) 1.0f, (float) 0.0f, (float) 0.0f
|
||||
);
|
||||
GL11.glTranslatef((float) 0.0f, (float) 0.25f, (float) 0.0f);
|
||||
slantAdjust = true;
|
||||
}
|
||||
MODEL2.render(0.0625f, slantAdjust);
|
||||
} else {
|
||||
this.bindTexture(new ResourceLocation("assemblyline", "textures/models/belt/frame" + frame + ".png"));
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glTranslatef((float)0.0f, (float)-0.68f, (float)0.0f);
|
||||
MODEL.render(0.0625f, (float)Math.toRadians(tileEntity.wheelRotation), tileEntity.getIsLastBelt(), tileEntity.getIsFirstBelt(), false, false);
|
||||
this.bindTexture(new ResourceLocation(
|
||||
"assemblyline", "textures/models/belt/frame" + frame + ".png"
|
||||
));
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
GL11.glTranslatef((float) 0.0f, (float) -0.68f, (float) 0.0f);
|
||||
MODEL.render(
|
||||
0.0625f,
|
||||
(float) Math.toRadians(tileEntity.wheelRotation),
|
||||
tileEntity.getIsLastBelt(),
|
||||
tileEntity.getIsFirstBelt(),
|
||||
false,
|
||||
false
|
||||
);
|
||||
}
|
||||
} else {
|
||||
switch (face) {
|
||||
case 2: {
|
||||
GL11.glRotatef((float)0.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef(
|
||||
(float) 0.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef(
|
||||
(float) 180.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
GL11.glRotatef((float)-90.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef(
|
||||
(float) -90.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
GL11.glRotatef((float)90.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef(
|
||||
(float) 90.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f
|
||||
);
|
||||
}
|
||||
}
|
||||
this.bindTexture(new ResourceLocation("assemblyline", "textures/models/belt/frame" + frame + ".png"));
|
||||
MODEL.render(0.0625f, (float)Math.toRadians(tileEntity.wheelRotation), tileEntity.getIsLastBelt(), tileEntity.getIsFirstBelt(), false, true);
|
||||
this.bindTexture(new ResourceLocation(
|
||||
"assemblyline", "textures/models/belt/frame" + frame + ".png"
|
||||
));
|
||||
MODEL.render(
|
||||
0.0625f,
|
||||
(float) Math.toRadians(tileEntity.wheelRotation),
|
||||
tileEntity.getIsLastBelt(),
|
||||
tileEntity.getIsFirstBelt(),
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
Block ent = tileEntity.getWorldObj().getBlock(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
Block ent = tileEntity.getWorldObj().getBlock(
|
||||
tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord
|
||||
);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) {
|
||||
this.renderAModelAt((TileEntityConveyorBelt)tileEntity, var2, var4, var6, var8);
|
||||
public void renderTileEntityAt(
|
||||
TileEntity tileEntity, double var2, double var4, double var6, float var8
|
||||
) {
|
||||
this.renderAModelAt((TileEntityConveyorBelt) tileEntity, var2, var4, var6, var8);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,20 +6,29 @@ import assemblyline.common.machine.crane.TileEntityCraneController;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderCraneController
|
||||
extends RenderImprintable {
|
||||
public class RenderCraneController extends RenderImprintable {
|
||||
public static final String TEXTURE = "crane_controller_off.png";
|
||||
public static final String TEXTURE_VALID = "crane_controller_on.png";
|
||||
public static final ModelCraneController MODEL = new ModelCraneController();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
|
||||
public void
|
||||
renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityCraneController) {
|
||||
this.bindTexture(new ResourceLocation("assemblyline", "textures/models/" + (((TileEntityCraneController)tileEntity).isCraneValid() ? TEXTURE_VALID : TEXTURE)));
|
||||
ForgeDirection front = ForgeDirection.getOrientation((int)tileEntity.getWorldObj().getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
|
||||
this.bindTexture(new ResourceLocation(
|
||||
"assemblyline",
|
||||
"textures/models/"
|
||||
+ (((TileEntityCraneController) tileEntity).isCraneValid()
|
||||
? TEXTURE_VALID
|
||||
: TEXTURE)
|
||||
));
|
||||
ForgeDirection front = ForgeDirection.getOrientation(
|
||||
(int) tileEntity.getWorldObj().getBlockMetadata(
|
||||
tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord
|
||||
)
|
||||
);
|
||||
ForgeDirection right = CraneHelper.rotateClockwise(front);
|
||||
float angle = 0.0f;
|
||||
switch (front) {
|
||||
|
@ -38,16 +47,27 @@ extends RenderImprintable {
|
|||
int tX = tileEntity.xCoord;
|
||||
int tY = tileEntity.yCoord;
|
||||
int tZ = tileEntity.zCoord;
|
||||
boolean connectFront = CraneHelper.canFrameConnectTo(tileEntity, tX + front.offsetX, tY, tZ + front.offsetZ, front.getOpposite());
|
||||
boolean connectRight = CraneHelper.canFrameConnectTo(tileEntity, tX + right.offsetX, tY, tZ + right.offsetZ, right.getOpposite());
|
||||
boolean connectFront = CraneHelper.canFrameConnectTo(
|
||||
tileEntity,
|
||||
tX + front.offsetX,
|
||||
tY,
|
||||
tZ + front.offsetZ,
|
||||
front.getOpposite()
|
||||
);
|
||||
boolean connectRight = CraneHelper.canFrameConnectTo(
|
||||
tileEntity,
|
||||
tX + right.offsetX,
|
||||
tY,
|
||||
tZ + right.offsetZ,
|
||||
right.getOpposite()
|
||||
);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated((double)(x + 0.5), (double)(y + 1.5), (double)(z + 0.5));
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)0.0f, (float)1.0f);
|
||||
GL11.glRotatef((float)angle, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glEnable((int)2896);
|
||||
GL11.glTranslated((double) (x + 0.5), (double) (y + 1.5), (double) (z + 0.5));
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 0.0f, (float) 1.0f);
|
||||
GL11.glRotatef((float) angle, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
GL11.glEnable((int) 2896);
|
||||
MODEL.render(0.0625f, connectRight, connectFront);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,38 +7,59 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderCraneFrame
|
||||
extends TileEntitySpecialRenderer {
|
||||
public class RenderCraneFrame extends TileEntitySpecialRenderer {
|
||||
public static final String TEXTURE = "crane_frame.png";
|
||||
public static final ModelCraneRail MODEL = new ModelCraneRail();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
|
||||
public void
|
||||
renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityCraneRail) {
|
||||
int tX = tileEntity.xCoord;
|
||||
int tY = tileEntity.yCoord;
|
||||
int tZ = tileEntity.zCoord;
|
||||
boolean renderUp = CraneHelper.canFrameConnectTo(tileEntity, tX, tY + 1, tZ, ForgeDirection.DOWN);
|
||||
boolean renderDown = CraneHelper.canFrameConnectTo(tileEntity, tX, tY - 1, tZ, ForgeDirection.UP);
|
||||
boolean renderLeft = CraneHelper.canFrameConnectTo(tileEntity, tX - 1, tY, tZ, ForgeDirection.EAST);
|
||||
boolean renderRight = CraneHelper.canFrameConnectTo(tileEntity, tX + 1, tY, tZ, ForgeDirection.WEST);
|
||||
boolean renderFront = CraneHelper.canFrameConnectTo(tileEntity, tX, tY, tZ - 1, ForgeDirection.SOUTH);
|
||||
boolean renderBack = CraneHelper.canFrameConnectTo(tileEntity, tX, tY, tZ + 1, ForgeDirection.NORTH);
|
||||
boolean renderFoot = tileEntity.getWorldObj().isSideSolid(tX, tY - 1, tZ, ForgeDirection.UP);
|
||||
boolean renderUp = CraneHelper.canFrameConnectTo(
|
||||
tileEntity, tX, tY + 1, tZ, ForgeDirection.DOWN
|
||||
);
|
||||
boolean renderDown = CraneHelper.canFrameConnectTo(
|
||||
tileEntity, tX, tY - 1, tZ, ForgeDirection.UP
|
||||
);
|
||||
boolean renderLeft = CraneHelper.canFrameConnectTo(
|
||||
tileEntity, tX - 1, tY, tZ, ForgeDirection.EAST
|
||||
);
|
||||
boolean renderRight = CraneHelper.canFrameConnectTo(
|
||||
tileEntity, tX + 1, tY, tZ, ForgeDirection.WEST
|
||||
);
|
||||
boolean renderFront = CraneHelper.canFrameConnectTo(
|
||||
tileEntity, tX, tY, tZ - 1, ForgeDirection.SOUTH
|
||||
);
|
||||
boolean renderBack = CraneHelper.canFrameConnectTo(
|
||||
tileEntity, tX, tY, tZ + 1, ForgeDirection.NORTH
|
||||
);
|
||||
boolean renderFoot
|
||||
= tileEntity.getWorldObj().isSideSolid(tX, tY - 1, tZ, ForgeDirection.UP);
|
||||
if (renderLeft && renderRight || renderFront && renderBack) {
|
||||
renderFoot = false;
|
||||
}
|
||||
this.bindTexture(new ResourceLocation("assemblyline", "textures/models/crane_frame.png"));
|
||||
this.bindTexture(
|
||||
new ResourceLocation("assemblyline", "textures/models/crane_frame.png")
|
||||
);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated((double)(x + 0.5), (double)(y + 1.5), (double)(z + 0.5));
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)0.0f, (float)1.0f);
|
||||
GL11.glEnable((int)2896);
|
||||
MODEL.render(renderUp, renderDown && !renderFoot, renderLeft, renderRight, renderFront, renderBack, renderFoot);
|
||||
GL11.glTranslated((double) (x + 0.5), (double) (y + 1.5), (double) (z + 0.5));
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 0.0f, (float) 1.0f);
|
||||
GL11.glEnable((int) 2896);
|
||||
MODEL.render(
|
||||
renderUp,
|
||||
renderDown && !renderFoot,
|
||||
renderLeft,
|
||||
renderRight,
|
||||
renderFront,
|
||||
renderBack,
|
||||
renderFoot
|
||||
);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,21 +15,21 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
public class RenderCrate
|
||||
extends TileEntitySpecialRenderer {
|
||||
public class RenderCrate extends TileEntitySpecialRenderer {
|
||||
private final RenderBlocks renderBlocks = new RenderBlocks();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8) {
|
||||
public void
|
||||
renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8) {
|
||||
Vector3 vec = new Vector3(x, y, z);
|
||||
double distance = vec.distanceTo(new Vector3(0.0, 0.0, 0.0));
|
||||
if (tileEntity instanceof TileEntityCrate && distance < 15.0) {
|
||||
TileEntityCrate tileCrate = (TileEntityCrate)tileEntity;
|
||||
RenderItem renderItem = (RenderItem)RenderManager.instance.getEntityClassRenderObject(EntityItem.class);
|
||||
TileEntityCrate tileCrate = (TileEntityCrate) tileEntity;
|
||||
RenderItem renderItem = (RenderItem
|
||||
) RenderManager.instance.getEntityClassRenderObject(EntityItem.class);
|
||||
String itemName = "Empty";
|
||||
String amount = "";
|
||||
ItemStack itemStack = tileCrate.getStackInSlot(0);
|
||||
|
@ -38,121 +38,185 @@ extends TileEntitySpecialRenderer {
|
|||
amount = Integer.toString(itemStack.stackSize);
|
||||
}
|
||||
for (int side = 2; side < 6; ++side) {
|
||||
ForgeDirection direction = ForgeDirection.getOrientation((int)side);
|
||||
if (tileCrate.getWorldObj().isSideSolid(tileCrate.xCoord + direction.offsetX, tileCrate.yCoord, tileCrate.zCoord + direction.offsetZ, direction.getOpposite())) continue;
|
||||
ForgeDirection direction = ForgeDirection.getOrientation((int) side);
|
||||
if (tileCrate.getWorldObj().isSideSolid(
|
||||
tileCrate.xCoord + direction.offsetX,
|
||||
tileCrate.yCoord,
|
||||
tileCrate.zCoord + direction.offsetZ,
|
||||
direction.getOpposite()
|
||||
))
|
||||
continue;
|
||||
this.setupLight(tileCrate, direction.offsetX, direction.offsetZ);
|
||||
OpenGlHelper.setLightmapTextureCoords((int)OpenGlHelper.lightmapTexUnit, (float)240.0f, (float)240.0f);
|
||||
OpenGlHelper.setLightmapTextureCoords(
|
||||
(int) OpenGlHelper.lightmapTexUnit, (float) 240.0f, (float) 240.0f
|
||||
);
|
||||
if (itemStack != null) {
|
||||
GL11.glPushMatrix();
|
||||
switch (side) {
|
||||
case 2: {
|
||||
GL11.glTranslated((double)(x + 0.65), (double)(y + 0.9), (double)(z - 0.01));
|
||||
GL11.glTranslated(
|
||||
(double) (x + 0.65),
|
||||
(double) (y + 0.9),
|
||||
(double) (z - 0.01)
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
GL11.glTranslated((double)(x + 0.35), (double)(y + 0.9), (double)(z + 1.01));
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glTranslated(
|
||||
(double) (x + 0.35),
|
||||
(double) (y + 0.9),
|
||||
(double) (z + 1.01)
|
||||
);
|
||||
GL11.glRotatef(
|
||||
(float) 180.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
GL11.glTranslated((double)(x - 0.01), (double)(y + 0.9), (double)(z + 0.35));
|
||||
GL11.glRotatef((float)90.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glTranslated(
|
||||
(double) (x - 0.01),
|
||||
(double) (y + 0.9),
|
||||
(double) (z + 0.35)
|
||||
);
|
||||
GL11.glRotatef(
|
||||
(float) 90.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
GL11.glTranslated((double)(x + 1.01), (double)(y + 0.9), (double)(z + 0.65));
|
||||
GL11.glRotatef((float)-90.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glTranslated(
|
||||
(double) (x + 1.01),
|
||||
(double) (y + 0.9),
|
||||
(double) (z + 0.65)
|
||||
);
|
||||
GL11.glRotatef(
|
||||
(float) -90.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f
|
||||
);
|
||||
}
|
||||
}
|
||||
float scale = 0.03125f;
|
||||
GL11.glScalef((float)(0.6f * scale), (float)(0.6f * scale), (float)0.0f);
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)0.0f, (float)1.0f);
|
||||
GL11.glScalef(
|
||||
(float) (0.6f * scale), (float) (0.6f * scale), (float) 0.0f
|
||||
);
|
||||
GL11.glRotatef(
|
||||
(float) 180.0f, (float) 0.0f, (float) 0.0f, (float) 1.0f
|
||||
);
|
||||
TextureManager renderEngine = Minecraft.getMinecraft().renderEngine;
|
||||
GL11.glDisable((int)2896);
|
||||
if (!ForgeHooksClient.renderInventoryItem((RenderBlocks)this.renderBlocks, renderEngine, (ItemStack)itemStack, (boolean)true, (float)0.0f, (float)0.0f, (float)0.0f)) {
|
||||
renderItem.renderItemIntoGUI(this.func_147498_b(), renderEngine, itemStack, 0, 0);
|
||||
GL11.glDisable((int) 2896);
|
||||
if (!ForgeHooksClient.renderInventoryItem(
|
||||
(RenderBlocks) this.renderBlocks,
|
||||
renderEngine,
|
||||
(ItemStack) itemStack,
|
||||
(boolean) true,
|
||||
(float) 0.0f,
|
||||
(float) 0.0f,
|
||||
(float) 0.0f
|
||||
)) {
|
||||
renderItem.renderItemIntoGUI(
|
||||
this.func_147498_b(), renderEngine, itemStack, 0, 0
|
||||
);
|
||||
}
|
||||
GL11.glEnable((int)2896);
|
||||
GL11.glEnable((int) 2896);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
this.renderText(itemName, side, 0.02f, x, y - (double)0.35f, z);
|
||||
if (amount == "") continue;
|
||||
this.renderText(amount, side, 0.02f, x, y - (double)0.15f, z);
|
||||
this.renderText(itemName, side, 0.02f, x, y - (double) 0.35f, z);
|
||||
if (amount == "")
|
||||
continue;
|
||||
this.renderText(amount, side, 0.02f, x, y - (double) 0.15f, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setupLight(TileEntity tileEntity, int xDifference, int zDifference) {
|
||||
World world = tileEntity.getWorldObj();
|
||||
if (world.getBlock(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference).isOpaqueCube()) {
|
||||
if (world
|
||||
.getBlock(
|
||||
tileEntity.xCoord + xDifference,
|
||||
tileEntity.yCoord,
|
||||
tileEntity.zCoord + zDifference
|
||||
)
|
||||
.isOpaqueCube()) {
|
||||
return;
|
||||
}
|
||||
int br = world.getLightBrightnessForSkyBlocks(tileEntity.xCoord + xDifference, tileEntity.yCoord, tileEntity.zCoord + zDifference, 0);
|
||||
int br = world.getLightBrightnessForSkyBlocks(
|
||||
tileEntity.xCoord + xDifference,
|
||||
tileEntity.yCoord,
|
||||
tileEntity.zCoord + zDifference,
|
||||
0
|
||||
);
|
||||
int var11 = br % 65536;
|
||||
int var12 = br / 65536;
|
||||
float scale = 0.6f;
|
||||
OpenGlHelper.setLightmapTextureCoords((int)OpenGlHelper.lightmapTexUnit, (float)((float)var11 * scale), (float)((float)var12 * scale));
|
||||
OpenGlHelper.setLightmapTextureCoords(
|
||||
(int) OpenGlHelper.lightmapTexUnit,
|
||||
(float) ((float) var11 * scale),
|
||||
(float) ((float) var12 * scale)
|
||||
);
|
||||
}
|
||||
|
||||
private void renderText(String text, int side, float maxScale, double x, double y, double z) {
|
||||
private void
|
||||
renderText(String text, int side, float maxScale, double x, double y, double z) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPolygonOffset((float)-10.0f, (float)-10.0f);
|
||||
GL11.glEnable((int)32823);
|
||||
GL11.glPolygonOffset((float) -10.0f, (float) -10.0f);
|
||||
GL11.glEnable((int) 32823);
|
||||
float displayX = 0.0f;
|
||||
float displayY = 0.0f;
|
||||
float displayWidth = 1.0f;
|
||||
float displayHeight = 1.0f;
|
||||
GL11.glTranslated((double)x, (double)y, (double)z);
|
||||
GL11.glTranslated((double) x, (double) y, (double) z);
|
||||
switch (side) {
|
||||
case 3: {
|
||||
GL11.glTranslatef((float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float)0.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float)90.0f, (float)1.0f, (float)0.0f, (float)0.0f);
|
||||
GL11.glTranslatef((float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
GL11.glRotatef((float) 0.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
GL11.glRotatef((float) 90.0f, (float) 1.0f, (float) 0.0f, (float) 0.0f);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
GL11.glTranslatef((float)1.0f, (float)1.0f, (float)1.0f);
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float)90.0f, (float)1.0f, (float)0.0f, (float)0.0f);
|
||||
GL11.glTranslatef((float) 1.0f, (float) 1.0f, (float) 1.0f);
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
GL11.glRotatef((float) 90.0f, (float) 1.0f, (float) 0.0f, (float) 0.0f);
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
GL11.glTranslatef((float)0.0f, (float)1.0f, (float)1.0f);
|
||||
GL11.glRotatef((float)90.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float)90.0f, (float)1.0f, (float)0.0f, (float)0.0f);
|
||||
GL11.glTranslatef((float) 0.0f, (float) 1.0f, (float) 1.0f);
|
||||
GL11.glRotatef((float) 90.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
GL11.glRotatef((float) 90.0f, (float) 1.0f, (float) 0.0f, (float) 0.0f);
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
GL11.glTranslatef((float)1.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float)-90.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float)90.0f, (float)1.0f, (float)0.0f, (float)0.0f);
|
||||
GL11.glTranslatef((float) 1.0f, (float) 1.0f, (float) 0.0f);
|
||||
GL11.glRotatef((float) -90.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
GL11.glRotatef((float) 90.0f, (float) 1.0f, (float) 0.0f, (float) 0.0f);
|
||||
}
|
||||
}
|
||||
GL11.glTranslatef((float)(displayWidth / 2.0f), (float)1.0f, (float)(displayHeight / 2.0f));
|
||||
GL11.glRotatef((float)-90.0f, (float)1.0f, (float)0.0f, (float)0.0f);
|
||||
GL11.glTranslatef(
|
||||
(float) (displayWidth / 2.0f), (float) 1.0f, (float) (displayHeight / 2.0f)
|
||||
);
|
||||
GL11.glRotatef((float) -90.0f, (float) 1.0f, (float) 0.0f, (float) 0.0f);
|
||||
FontRenderer fontRenderer = super.func_147498_b();
|
||||
int requiredWidth = Math.max(fontRenderer.getStringWidth(text), 1);
|
||||
int lineHeight = fontRenderer.FONT_HEIGHT + 2;
|
||||
int requiredHeight = lineHeight * 1;
|
||||
float scaler = 0.8f;
|
||||
float scaleX = displayWidth / (float)requiredWidth;
|
||||
float scaleY = displayHeight / (float)requiredHeight;
|
||||
float scaleX = displayWidth / (float) requiredWidth;
|
||||
float scaleY = displayHeight / (float) requiredHeight;
|
||||
float scale = scaleX * scaler;
|
||||
if (maxScale > 0.0f) {
|
||||
scale = Math.min(scale, maxScale);
|
||||
}
|
||||
GL11.glScalef((float)scale, (float)(-scale), (float)scale);
|
||||
GL11.glDepthMask((boolean)false);
|
||||
int realHeight = (int)Math.floor(displayHeight / scale);
|
||||
int realWidth = (int)Math.floor(displayWidth / scale);
|
||||
GL11.glScalef((float) scale, (float) (-scale), (float) scale);
|
||||
GL11.glDepthMask((boolean) false);
|
||||
int realHeight = (int) Math.floor(displayHeight / scale);
|
||||
int realWidth = (int) Math.floor(displayWidth / scale);
|
||||
int offsetX = (realWidth - requiredWidth) / 2;
|
||||
int offsetY = (realHeight - requiredHeight) / 2;
|
||||
GL11.glDisable((int)2896);
|
||||
fontRenderer.drawString("\u00a7f" + text, offsetX - realWidth / 2, 1 + offsetY - realHeight / 2, 1);
|
||||
GL11.glEnable((int)2896);
|
||||
GL11.glDepthMask((boolean)true);
|
||||
GL11.glDisable((int)32823);
|
||||
GL11.glDisable((int) 2896);
|
||||
fontRenderer.drawString(
|
||||
"\u00a7f" + text, offsetX - realWidth / 2, 1 + offsetY - realHeight / 2, 1
|
||||
);
|
||||
GL11.glEnable((int) 2896);
|
||||
GL11.glDepthMask((boolean) true);
|
||||
GL11.glDisable((int) 32823);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,17 +7,17 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
public class RenderDetector
|
||||
extends RenderImprintable {
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public class RenderDetector extends RenderImprintable {
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8) {
|
||||
public void
|
||||
renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8) {
|
||||
super.renderTileEntityAt(tileEntity, x, y, z, var8);
|
||||
}
|
||||
|
||||
public static void render(boolean isInverted, Vector3 position) { //TODO: WTF
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated((double)position.x, (double)position.y, (double)position.z);
|
||||
GL11.glTranslated((double) position.x, (double) position.y, (double) position.z);
|
||||
if (isInverted) {
|
||||
// empty if block
|
||||
}
|
||||
|
@ -35,4 +35,3 @@ extends RenderImprintable {
|
|||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,44 +11,54 @@ public class RenderHelper {
|
|||
RenderHelper.renderFloatingText(text, x, y, z, 0xFFFFFF);
|
||||
}
|
||||
|
||||
public static void renderFloatingText(String text, float x, float y, float z, int color) {
|
||||
public static void
|
||||
renderFloatingText(String text, float x, float y, float z, int color) {
|
||||
RenderManager renderManager = RenderManager.instance;
|
||||
FontRenderer fontRenderer = renderManager.getFontRenderer();
|
||||
float scale = 0.027f;
|
||||
GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)0.5f);
|
||||
GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, (float) 0.5f);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)(x + 0.0f), (float)(y + 2.3f), (float)z);
|
||||
GL11.glNormal3f((float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float)(-renderManager.playerViewY), (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float)renderManager.playerViewX, (float)1.0f, (float)0.0f, (float)0.0f);
|
||||
GL11.glScalef((float)(-scale), (float)(-scale), (float)scale);
|
||||
GL11.glDisable((int)2896);
|
||||
OpenGlHelper.setLightmapTextureCoords((int)OpenGlHelper.lightmapTexUnit, (float)240.0f, (float)240.0f);
|
||||
GL11.glDepthMask((boolean)false);
|
||||
GL11.glDisable((int)2929);
|
||||
GL11.glEnable((int)3042);
|
||||
GL11.glBlendFunc((int)770, (int)771);
|
||||
GL11.glTranslatef((float) (x + 0.0f), (float) (y + 2.3f), (float) z);
|
||||
GL11.glNormal3f((float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
GL11.glRotatef(
|
||||
(float) (-renderManager.playerViewY), (float) 0.0f, (float) 1.0f, (float) 0.0f
|
||||
);
|
||||
GL11.glRotatef(
|
||||
(float) renderManager.playerViewX, (float) 1.0f, (float) 0.0f, (float) 0.0f
|
||||
);
|
||||
GL11.glScalef((float) (-scale), (float) (-scale), (float) scale);
|
||||
GL11.glDisable((int) 2896);
|
||||
OpenGlHelper.setLightmapTextureCoords(
|
||||
(int) OpenGlHelper.lightmapTexUnit, (float) 240.0f, (float) 240.0f
|
||||
);
|
||||
GL11.glDepthMask((boolean) false);
|
||||
GL11.glDisable((int) 2929);
|
||||
GL11.glEnable((int) 3042);
|
||||
GL11.glBlendFunc((int) 770, (int) 771);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int yOffset = 0;
|
||||
GL11.glDisable((int)3553);
|
||||
GL11.glDisable((int) 3553);
|
||||
tessellator.startDrawingQuads();
|
||||
int stringMiddle = fontRenderer.getStringWidth(text) / 2;
|
||||
tessellator.setColorRGBA_F(0.0f, 0.0f, 0.0f, 0.5f);
|
||||
tessellator.addVertex((double)(-stringMiddle - 1), (double)(-1 + yOffset), 0.0);
|
||||
tessellator.addVertex((double)(-stringMiddle - 1), (double)(8 + yOffset), 0.0);
|
||||
tessellator.addVertex((double)(stringMiddle + 1), (double)(8 + yOffset), 0.0);
|
||||
tessellator.addVertex((double)(stringMiddle + 1), (double)(-1 + yOffset), 0.0);
|
||||
tessellator.addVertex((double) (-stringMiddle - 1), (double) (-1 + yOffset), 0.0);
|
||||
tessellator.addVertex((double) (-stringMiddle - 1), (double) (8 + yOffset), 0.0);
|
||||
tessellator.addVertex((double) (stringMiddle + 1), (double) (8 + yOffset), 0.0);
|
||||
tessellator.addVertex((double) (stringMiddle + 1), (double) (-1 + yOffset), 0.0);
|
||||
tessellator.draw();
|
||||
GL11.glEnable((int)3553);
|
||||
GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)0.5f);
|
||||
fontRenderer.drawString(text, -fontRenderer.getStringWidth(text) / 2, yOffset, color);
|
||||
GL11.glEnable((int)2929);
|
||||
GL11.glDepthMask((boolean)true);
|
||||
fontRenderer.drawString(text, -fontRenderer.getStringWidth(text) / 2, yOffset, color);
|
||||
GL11.glEnable((int)2896);
|
||||
GL11.glDisable((int)3042);
|
||||
GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
|
||||
GL11.glEnable((int) 3553);
|
||||
GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, (float) 0.5f);
|
||||
fontRenderer.drawString(
|
||||
text, -fontRenderer.getStringWidth(text) / 2, yOffset, color
|
||||
);
|
||||
GL11.glEnable((int) 2929);
|
||||
GL11.glDepthMask((boolean) true);
|
||||
fontRenderer.drawString(
|
||||
text, -fontRenderer.getStringWidth(text) / 2, yOffset, color
|
||||
);
|
||||
GL11.glEnable((int) 2896);
|
||||
GL11.glDisable((int) 3042);
|
||||
GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, (float) 1.0f);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package assemblyline.client.render;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import assemblyline.common.machine.imprinter.ItemImprinter;
|
||||
import assemblyline.common.machine.imprinter.TileEntityFilterable;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
@ -11,24 +12,55 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
||||
public abstract class RenderImprintable
|
||||
extends TileEntitySpecialRenderer {
|
||||
public abstract class RenderImprintable extends TileEntitySpecialRenderer {
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8) {
|
||||
public void
|
||||
renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8) {
|
||||
EntityClientPlayerMP player;
|
||||
MovingObjectPosition objectPosition;
|
||||
TileEntityFilterable tileFilterable;
|
||||
ItemStack filter;
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityFilterable && (filter = (tileFilterable = (TileEntityFilterable)tileEntity).getFilter()) != null && (objectPosition = (player = Minecraft.getMinecraft().thePlayer).rayTrace(8.0, 1.0f)) != null && objectPosition.blockX == tileFilterable.xCoord && objectPosition.blockY == tileFilterable.yCoord && objectPosition.blockZ == tileFilterable.zCoord) {
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityFilterable
|
||||
&& (filter = (tileFilterable = (TileEntityFilterable) tileEntity).getFilter())
|
||||
!= null
|
||||
&& (objectPosition
|
||||
= (player = Minecraft.getMinecraft().thePlayer).rayTrace(8.0, 1.0f))
|
||||
!= null
|
||||
&& objectPosition.blockX == tileFilterable.xCoord
|
||||
&& objectPosition.blockY == tileFilterable.yCoord
|
||||
&& objectPosition.blockZ == tileFilterable.zCoord) {
|
||||
ArrayList filters = ItemImprinter.getFilters(filter);
|
||||
for (int i = 0; i < filters.size(); ++i) {
|
||||
if (((TileEntityFilterable)tileEntity).isInverted()) {
|
||||
RenderHelper.renderFloatingText(((ItemStack)filters.get(i)).getTooltip((EntityPlayer)player, Minecraft.getMinecraft().gameSettings.advancedItemTooltips).get(0).toString(), (float)x + 0.5f, (float)y + (float)i * 0.25f - 1.0f, (float)z + 0.5f, 0xFF8888);
|
||||
if (((TileEntityFilterable) tileEntity).isInverted()) {
|
||||
RenderHelper.renderFloatingText(
|
||||
((ItemStack) filters.get(i))
|
||||
.getTooltip(
|
||||
(EntityPlayer) player,
|
||||
Minecraft.getMinecraft().gameSettings.advancedItemTooltips
|
||||
)
|
||||
.get(0)
|
||||
.toString(),
|
||||
(float) x + 0.5f,
|
||||
(float) y + (float) i * 0.25f - 1.0f,
|
||||
(float) z + 0.5f,
|
||||
0xFF8888
|
||||
);
|
||||
continue;
|
||||
}
|
||||
RenderHelper.renderFloatingText(((ItemStack)filters.get(i)).getTooltip((EntityPlayer)player, Minecraft.getMinecraft().gameSettings.advancedItemTooltips).get(0).toString(), (float)x + 0.5f, (float)y + (float)i * 0.25f - 1.0f, (float)z + 0.5f, 0x88FF88);
|
||||
RenderHelper.renderFloatingText(
|
||||
((ItemStack) filters.get(i))
|
||||
.getTooltip(
|
||||
(EntityPlayer) player,
|
||||
Minecraft.getMinecraft().gameSettings.advancedItemTooltips
|
||||
)
|
||||
.get(0)
|
||||
.toString(),
|
||||
(float) x + 0.5f,
|
||||
(float) y + (float) i * 0.25f - 1.0f,
|
||||
(float) z + 0.5f,
|
||||
0x88FF88
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,40 +4,49 @@ import assemblyline.client.model.ModelManipulator;
|
|||
import assemblyline.common.machine.TileEntityManipulator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderManipulator
|
||||
extends RenderImprintable {
|
||||
public class RenderManipulator extends RenderImprintable {
|
||||
private ModelManipulator model = new ModelManipulator();
|
||||
|
||||
private void renderAModelAt(TileEntityManipulator tileEntity, double x, double y, double z, float f) {
|
||||
private void renderAModelAt(
|
||||
TileEntityManipulator tileEntity, double x, double y, double z, float f
|
||||
) {
|
||||
int face = tileEntity.getDirection().ordinal();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)((float)x + 0.5f), (float)((float)y + 1.5f), (float)((float)z + 0.5f));
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)0.0f, (float)1.0f);
|
||||
GL11.glTranslatef(
|
||||
(float) ((float) x + 0.5f),
|
||||
(float) ((float) y + 1.5f),
|
||||
(float) ((float) z + 0.5f)
|
||||
);
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 0.0f, (float) 1.0f);
|
||||
if (tileEntity.isOutput()) {
|
||||
this.bindTexture(new ResourceLocation("assemblyline", "textures/models/manipulator1.png"));
|
||||
this.bindTexture(
|
||||
new ResourceLocation("assemblyline", "textures/models/manipulator1.png")
|
||||
);
|
||||
} else {
|
||||
this.bindTexture(new ResourceLocation("assemblyline", "textures/models/manipulator2.png"));
|
||||
this.bindTexture(
|
||||
new ResourceLocation("assemblyline", "textures/models/manipulator2.png")
|
||||
);
|
||||
}
|
||||
if (face == 2) {
|
||||
GL11.glRotatef((float)0.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float) 0.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
} else if (face == 3) {
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
} else if (face == 4) {
|
||||
GL11.glRotatef((float)270.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float) 270.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
} else if (face == 5) {
|
||||
GL11.glRotatef((float)90.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float) 90.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
}
|
||||
this.model.render(0.0625f, true, 0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) {
|
||||
this.renderAModelAt((TileEntityManipulator)tileEntity, var2, var4, var6, var8);
|
||||
public void renderTileEntityAt(
|
||||
TileEntity tileEntity, double var2, double var4, double var6, float var8
|
||||
) {
|
||||
this.renderAModelAt((TileEntityManipulator) tileEntity, var2, var4, var6, var8);
|
||||
super.renderTileEntityAt(tileEntity, var2, var4, var6, var8);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,33 +4,38 @@ import assemblyline.client.model.ModelRejectorPiston;
|
|||
import assemblyline.common.machine.TileEntityRejector;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RenderRejector
|
||||
extends RenderImprintable {
|
||||
public class RenderRejector extends RenderImprintable {
|
||||
private ModelRejectorPiston model = new ModelRejectorPiston();
|
||||
|
||||
private void renderAModelAt(TileEntityRejector tileEntity, double x, double y, double z, float f) {
|
||||
private void
|
||||
renderAModelAt(TileEntityRejector tileEntity, double x, double y, double z, float f) {
|
||||
boolean fire = tileEntity.firePiston;
|
||||
int face = tileEntity.getDirection().ordinal();
|
||||
int pos = 0;
|
||||
if (fire) {
|
||||
pos = 8;
|
||||
}
|
||||
this.bindTexture(new ResourceLocation("assemblyline", "textures/models/rejector.png"));
|
||||
this.bindTexture(
|
||||
new ResourceLocation("assemblyline", "textures/models/rejector.png")
|
||||
);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)((float)x + 0.5f), (float)((float)y + 1.5f), (float)((float)z + 0.5f));
|
||||
GL11.glScalef((float)1.0f, (float)-1.0f, (float)-1.0f);
|
||||
GL11.glTranslatef(
|
||||
(float) ((float) x + 0.5f),
|
||||
(float) ((float) y + 1.5f),
|
||||
(float) ((float) z + 0.5f)
|
||||
);
|
||||
GL11.glScalef((float) 1.0f, (float) -1.0f, (float) -1.0f);
|
||||
if (face == 2) {
|
||||
GL11.glRotatef((float)180.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float) 180.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
}
|
||||
if (face == 3) {
|
||||
GL11.glRotatef((float)0.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float) 0.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
} else if (face == 4) {
|
||||
GL11.glRotatef((float)90.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float) 90.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
} else if (face == 5) {
|
||||
GL11.glRotatef((float)270.0f, (float)0.0f, (float)1.0f, (float)0.0f);
|
||||
GL11.glRotatef((float) 270.0f, (float) 0.0f, (float) 1.0f, (float) 0.0f);
|
||||
}
|
||||
this.model.render(0.0625f);
|
||||
this.model.renderPiston(0.0625f, pos);
|
||||
|
@ -38,9 +43,10 @@ extends RenderImprintable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8) {
|
||||
this.renderAModelAt((TileEntityRejector)tileEntity, var2, var4, var6, var8);
|
||||
public void renderTileEntityAt(
|
||||
TileEntity tileEntity, double var2, double var4, double var6, float var8
|
||||
) {
|
||||
this.renderAModelAt((TileEntityRejector) tileEntity, var2, var4, var6, var8);
|
||||
super.renderTileEntityAt(tileEntity, var2, var4, var6, var8);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package assemblyline.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import assemblyline.common.CommonProxy;
|
||||
import assemblyline.common.TabAssemblyLine;
|
||||
import assemblyline.common.block.BlockCrate;
|
||||
|
@ -23,9 +27,9 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
|||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.ModMetadata;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
@ -33,9 +37,6 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
|||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Logger;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
|
@ -48,17 +49,26 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
|
|||
import universalelectricity.prefab.TranslationHelper;
|
||||
import universalelectricity.prefab.multiblock.BlockMulti;
|
||||
|
||||
@Mod(modid="AssemblyLine", name="Assembly Line", version=AssemblyLine.VERSION, dependencies="required-after:basiccomponents", useMetadata=true)
|
||||
@Mod(
|
||||
modid = "AssemblyLine",
|
||||
name = "Assembly Line",
|
||||
version = AssemblyLine.VERSION,
|
||||
dependencies = "required-after:basiccomponents",
|
||||
useMetadata = true
|
||||
)
|
||||
public class AssemblyLine {
|
||||
public static final String MOD_ID = "AssemblyLine";
|
||||
public static final String MOD_NAME = "Assembly Line";
|
||||
public static final String VERSION = "1.0.2";
|
||||
public static final String CHANNEL = "AssemblyLine";
|
||||
@SidedProxy(clientSide="assemblyline.client.ClientProxy", serverSide="assemblyline.common.CommonProxy")
|
||||
@SidedProxy(
|
||||
clientSide = "assemblyline.client.ClientProxy",
|
||||
serverSide = "assemblyline.common.CommonProxy"
|
||||
)
|
||||
public static CommonProxy proxy;
|
||||
@Mod.Instance(value="AssemblyLine")
|
||||
@Mod.Instance(value = "AssemblyLine")
|
||||
public static AssemblyLine instance;
|
||||
@Mod.Metadata(value="AssemblyLine")
|
||||
@Mod.Metadata(value = "AssemblyLine")
|
||||
public static ModMetadata meta;
|
||||
public static final String LANGUAGE_PATH = "/assets/assemblyline/languages/";
|
||||
private static final String[] LANGUAGES_SUPPORTED;
|
||||
|
@ -104,11 +114,14 @@ public class AssemblyLine {
|
|||
blockTurntable = new BlockTurntable();
|
||||
itemImprint = new ItemImprinter();
|
||||
itemDisk = new ItemDisk();
|
||||
REQUIRE_NO_POWER = !CONFIGURATION.get("general", "requirePower", true).getBoolean(true);
|
||||
REQUIRE_NO_POWER
|
||||
= !CONFIGURATION.get("general", "requirePower", true).getBoolean(true);
|
||||
CONFIGURATION.save();
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler((Object)this, (IGuiHandler)proxy);
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler((Object) this, (IGuiHandler) proxy);
|
||||
NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel(MOD_ID);
|
||||
NETWORK.registerMessage(new MessageEncoderHandler(), MessageEncoder.class, 0, Side.SERVER);
|
||||
NETWORK.registerMessage(
|
||||
new MessageEncoderHandler(), MessageEncoder.class, 0, Side.SERVER
|
||||
);
|
||||
GameRegistry.registerBlock(blockConveyorBelt, "conveyor_belt");
|
||||
GameRegistry.registerBlock(blockCrate, ItemBlockCrate.class, "crate");
|
||||
GameRegistry.registerBlock(blockManipulator, "manipulator");
|
||||
|
@ -131,42 +144,186 @@ public class AssemblyLine {
|
|||
public void load(FMLInitializationEvent evt) {
|
||||
proxy.init();
|
||||
GrabDictionary.registerList();
|
||||
FMLog.info("Loaded: " + TranslationHelper.loadLanguages(LANGUAGE_PATH, LANGUAGES_SUPPORTED) + " languages.");
|
||||
FMLog.info(
|
||||
"Loaded: "
|
||||
+ TranslationHelper.loadLanguages(LANGUAGE_PATH, LANGUAGES_SUPPORTED)
|
||||
+ " languages."
|
||||
);
|
||||
this.createStandardRecipes();
|
||||
this.createUERecipes();
|
||||
}
|
||||
|
||||
private void createUERecipes() {
|
||||
System.out.println("BasicComponents Found...adding UE recipes for Assembly Line.");
|
||||
GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(blockArmbot, new Object[]{"II ", "SIS", "MCM", Character.valueOf('S'), "plateSteel", Character.valueOf('C'), "circuitAdvanced", Character.valueOf('I'), "ingotSteel", Character.valueOf('M'), "motor"}));
|
||||
GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(itemDisk, new Object[]{"III", "ICI", "III", Character.valueOf('I'), itemImprint, Character.valueOf('C'), "circuitAdvanced"}));
|
||||
GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(blockEncoder, new Object[]{"SIS", "SCS", "SSS", Character.valueOf('I'), itemImprint, Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), "circuitAdvanced"}));
|
||||
GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(blockDetector, new Object[]{"SES", "SCS", "S S", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), "circuitBasic", Character.valueOf('E'), Items.ender_eye}));
|
||||
GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(blockConveyorBelt, 10), new Object[]{"III", "WMW", Character.valueOf('I'), "ingotSteel", Character.valueOf('W'), Blocks.planks, Character.valueOf('M'), "motor"}));
|
||||
GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(blockRejector, new Object[]{"WPW", "@R@", Character.valueOf('@'), "ingotSteel", Character.valueOf('R'), Items.redstone, Character.valueOf('P'), Blocks.piston, Character.valueOf('C'), "circuitBasic", Character.valueOf('W'), "copperWire"}));
|
||||
GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(blockTurntable, new Object[]{"M", "P", Character.valueOf('M'), "motor", Character.valueOf('P'), Blocks.piston}));
|
||||
GameRegistry.addRecipe((IRecipe)new ShapelessOreRecipe(new ItemStack(blockManipulator, 2), new Object[]{Blocks.dispenser, "circuitBasic"}));
|
||||
System.out.println("BasicComponents Found...adding UE recipes for Assembly Line."
|
||||
);
|
||||
GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe(
|
||||
blockArmbot,
|
||||
new Object[] { "II ",
|
||||
"SIS",
|
||||
"MCM",
|
||||
Character.valueOf('S'),
|
||||
"plateSteel",
|
||||
Character.valueOf('C'),
|
||||
"circuitAdvanced",
|
||||
Character.valueOf('I'),
|
||||
"ingotSteel",
|
||||
Character.valueOf('M'),
|
||||
"motor" }
|
||||
));
|
||||
GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe(
|
||||
itemDisk,
|
||||
new Object[] { "III",
|
||||
"ICI",
|
||||
"III",
|
||||
Character.valueOf('I'),
|
||||
itemImprint,
|
||||
Character.valueOf('C'),
|
||||
"circuitAdvanced" }
|
||||
));
|
||||
GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe(
|
||||
blockEncoder,
|
||||
new Object[] { "SIS",
|
||||
"SCS",
|
||||
"SSS",
|
||||
Character.valueOf('I'),
|
||||
itemImprint,
|
||||
Character.valueOf('S'),
|
||||
"ingotSteel",
|
||||
Character.valueOf('C'),
|
||||
"circuitAdvanced" }
|
||||
));
|
||||
GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe(
|
||||
blockDetector,
|
||||
new Object[] { "SES",
|
||||
"SCS",
|
||||
"S S",
|
||||
Character.valueOf('S'),
|
||||
"ingotSteel",
|
||||
Character.valueOf('C'),
|
||||
"circuitBasic",
|
||||
Character.valueOf('E'),
|
||||
Items.ender_eye }
|
||||
));
|
||||
GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe(
|
||||
new ItemStack(blockConveyorBelt, 10),
|
||||
new Object[] { "III",
|
||||
"WMW",
|
||||
Character.valueOf('I'),
|
||||
"ingotSteel",
|
||||
Character.valueOf('W'),
|
||||
Blocks.planks,
|
||||
Character.valueOf('M'),
|
||||
"motor" }
|
||||
));
|
||||
GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe(
|
||||
blockRejector,
|
||||
new Object[] { "WPW",
|
||||
"@R@",
|
||||
Character.valueOf('@'),
|
||||
"ingotSteel",
|
||||
Character.valueOf('R'),
|
||||
Items.redstone,
|
||||
Character.valueOf('P'),
|
||||
Blocks.piston,
|
||||
Character.valueOf('C'),
|
||||
"circuitBasic",
|
||||
Character.valueOf('W'),
|
||||
"copperWire" }
|
||||
));
|
||||
GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe(
|
||||
blockTurntable,
|
||||
new Object[] { "M",
|
||||
"P",
|
||||
Character.valueOf('M'),
|
||||
"motor",
|
||||
Character.valueOf('P'),
|
||||
Blocks.piston }
|
||||
));
|
||||
GameRegistry.addRecipe((IRecipe) new ShapelessOreRecipe(
|
||||
new ItemStack(blockManipulator, 2),
|
||||
new Object[] { Blocks.dispenser, "circuitBasic" }
|
||||
));
|
||||
}
|
||||
|
||||
private void createStandardRecipes() {
|
||||
GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(itemImprint, 2), new Object[]{"R", "P", "I", Character.valueOf('P'), Items.paper, Character.valueOf('R'), Items.redstone, Character.valueOf('I'), new ItemStack(Items.dye, 1, 0)}));
|
||||
GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(blockImprinter, new Object[]{"SIS", "SPS", "WCW", Character.valueOf('S'), Items.iron_ingot, Character.valueOf('C'), Blocks.chest, Character.valueOf('W'), Blocks.crafting_table, Character.valueOf('P'), Blocks.piston, Character.valueOf('I'), new ItemStack(Items.dye, 1, 0)}));
|
||||
GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(blockCrate, 1, 0), new Object[]{"TST", "S S", "TST", Character.valueOf('S'), Items.iron_ingot, Character.valueOf('T'), Blocks.log}));
|
||||
GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(blockCrate, 1, 1), new Object[]{"TST", "SCS", "TST", Character.valueOf('C'), new ItemStack(blockCrate, 1, 0), Character.valueOf('S'), Items.iron_ingot, Character.valueOf('T'), Blocks.log}));
|
||||
GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(blockCrate, 1, 2), new Object[]{"TST", "SCS", "TST", Character.valueOf('C'), new ItemStack(blockCrate, 1, 1), Character.valueOf('S'), Items.iron_ingot, Character.valueOf('T'), Blocks.log}));
|
||||
GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe(
|
||||
new ItemStack(itemImprint, 2),
|
||||
new Object[] { "R",
|
||||
"P",
|
||||
"I",
|
||||
Character.valueOf('P'),
|
||||
Items.paper,
|
||||
Character.valueOf('R'),
|
||||
Items.redstone,
|
||||
Character.valueOf('I'),
|
||||
new ItemStack(Items.dye, 1, 0) }
|
||||
));
|
||||
GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe(
|
||||
blockImprinter,
|
||||
new Object[] { "SIS",
|
||||
"SPS",
|
||||
"WCW",
|
||||
Character.valueOf('S'),
|
||||
Items.iron_ingot,
|
||||
Character.valueOf('C'),
|
||||
Blocks.chest,
|
||||
Character.valueOf('W'),
|
||||
Blocks.crafting_table,
|
||||
Character.valueOf('P'),
|
||||
Blocks.piston,
|
||||
Character.valueOf('I'),
|
||||
new ItemStack(Items.dye, 1, 0) }
|
||||
));
|
||||
GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe(
|
||||
new ItemStack(blockCrate, 1, 0),
|
||||
new Object[] { "TST",
|
||||
"S S",
|
||||
"TST",
|
||||
Character.valueOf('S'),
|
||||
Items.iron_ingot,
|
||||
Character.valueOf('T'),
|
||||
Blocks.log }
|
||||
));
|
||||
GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe(
|
||||
new ItemStack(blockCrate, 1, 1),
|
||||
new Object[] { "TST",
|
||||
"SCS",
|
||||
"TST",
|
||||
Character.valueOf('C'),
|
||||
new ItemStack(blockCrate, 1, 0),
|
||||
Character.valueOf('S'),
|
||||
Items.iron_ingot,
|
||||
Character.valueOf('T'),
|
||||
Blocks.log }
|
||||
));
|
||||
GameRegistry.addRecipe((IRecipe) new ShapedOreRecipe(
|
||||
new ItemStack(blockCrate, 1, 2),
|
||||
new Object[] { "TST",
|
||||
"SCS",
|
||||
"TST",
|
||||
Character.valueOf('C'),
|
||||
new ItemStack(blockCrate, 1, 1),
|
||||
Character.valueOf('S'),
|
||||
Items.iron_ingot,
|
||||
Character.valueOf('T'),
|
||||
Blocks.log }
|
||||
));
|
||||
}
|
||||
|
||||
public static void printSidedData(String data) {
|
||||
System.out.print(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT ? "[C]" : "[S]");
|
||||
System.out.print(
|
||||
FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT ? "[C]" : "[S]"
|
||||
);
|
||||
System.out.println(" " + data);
|
||||
}
|
||||
|
||||
static {
|
||||
LANGUAGES_SUPPORTED = new String[]{"en_US"};
|
||||
CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), "UniversalElectricity/AssemblyLine.cfg"));
|
||||
LANGUAGES_SUPPORTED = new String[] { "en_US" };
|
||||
CONFIGURATION = new Configuration(new File(
|
||||
Loader.instance().getConfigDir(), "UniversalElectricity/AssemblyLine.cfg"
|
||||
));
|
||||
ic2Wrench = null;
|
||||
FMLog = Logger.getLogger(MOD_NAME);
|
||||
REQUIRE_NO_POWER = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
package assemblyline.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import assemblyline.common.block.TileEntityCrate;
|
||||
import assemblyline.common.machine.TileEntityManipulator;
|
||||
import assemblyline.common.machine.TileEntityRejector;
|
||||
|
@ -15,41 +21,48 @@ import assemblyline.common.machine.imprinter.TileEntityImprinter;
|
|||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import universalelectricity.prefab.multiblock.TileEntityMulti;
|
||||
|
||||
public class CommonProxy
|
||||
implements IGuiHandler {
|
||||
public class CommonProxy implements IGuiHandler {
|
||||
public static final int GUI_IMPRINTER = 1;
|
||||
public static final int GUI_ENCODER = 2;
|
||||
|
||||
public void preInit() {
|
||||
}
|
||||
public void preInit() {}
|
||||
|
||||
public void init() {
|
||||
GameRegistry.registerTileEntity(TileEntityConveyorBelt.class, (String)"ALConveyorBelt");
|
||||
GameRegistry.registerTileEntity(TileEntityRejector.class, (String)"ALSorter");
|
||||
GameRegistry.registerTileEntity(TileEntityManipulator.class, (String)"ALManipulator");
|
||||
GameRegistry.registerTileEntity(TileEntityCrate.class, (String)"ALCrate");
|
||||
GameRegistry.registerTileEntity(TileEntityDetector.class, (String)"ALDetector");
|
||||
GameRegistry.registerTileEntity(TileEntityEncoder.class, (String)"ALEncoder");
|
||||
GameRegistry.registerTileEntity(TileEntityArmbot.class, (String)"ALArmbot");
|
||||
GameRegistry.registerTileEntity(TileEntityCraneController.class, (String)"ALCraneController");
|
||||
GameRegistry.registerTileEntity(TileEntityCraneRail.class, (String)"ALCraneRail");
|
||||
GameRegistry.registerTileEntity(TileEntityImprinter.class, (String)"ALImprinter");
|
||||
GameRegistry.registerTileEntity(TileEntityMulti.class, (String)"ALMulti");
|
||||
GameRegistry.registerTileEntity(
|
||||
TileEntityConveyorBelt.class, (String) "ALConveyorBelt"
|
||||
);
|
||||
GameRegistry.registerTileEntity(TileEntityRejector.class, (String) "ALSorter");
|
||||
GameRegistry.registerTileEntity(
|
||||
TileEntityManipulator.class, (String) "ALManipulator"
|
||||
);
|
||||
GameRegistry.registerTileEntity(TileEntityCrate.class, (String) "ALCrate");
|
||||
GameRegistry.registerTileEntity(TileEntityDetector.class, (String) "ALDetector");
|
||||
GameRegistry.registerTileEntity(TileEntityEncoder.class, (String) "ALEncoder");
|
||||
GameRegistry.registerTileEntity(TileEntityArmbot.class, (String) "ALArmbot");
|
||||
GameRegistry.registerTileEntity(
|
||||
TileEntityCraneController.class, (String) "ALCraneController"
|
||||
);
|
||||
GameRegistry.registerTileEntity(
|
||||
TileEntityCraneRail.class, (String) "ALCraneRail"
|
||||
);
|
||||
GameRegistry.registerTileEntity(
|
||||
TileEntityImprinter.class, (String) "ALImprinter"
|
||||
);
|
||||
GameRegistry.registerTileEntity(TileEntityMulti.class, (String) "ALMulti");
|
||||
}
|
||||
|
||||
private void extractZipToLocation(File zipFile, String sourceFolder, String destFolder) {
|
||||
private void
|
||||
extractZipToLocation(File zipFile, String sourceFolder, String destFolder) {
|
||||
try {
|
||||
File destFile = new File(FMLCommonHandler.instance().getMinecraftServerInstance().getFile("."), destFolder);
|
||||
File destFile = new File(
|
||||
FMLCommonHandler.instance().getMinecraftServerInstance().getFile("."),
|
||||
destFolder
|
||||
);
|
||||
String destinationName = destFile.getAbsolutePath();
|
||||
byte[] buf = new byte[1024];
|
||||
ZipInputStream zipinputstream = null;
|
||||
|
@ -62,12 +75,16 @@ implements IGuiHandler {
|
|||
zipentry = zipinputstream.getNextEntry();
|
||||
continue;
|
||||
}
|
||||
String entryName = destinationName + zipentryName.substring(Math.min(zipentryName.length(), sourceFolder.length() - 1));
|
||||
String entryName = destinationName
|
||||
+ zipentryName.substring(
|
||||
Math.min(zipentryName.length(), sourceFolder.length() - 1)
|
||||
);
|
||||
entryName = entryName.replace('/', File.separatorChar);
|
||||
entryName = entryName.replace('\\', File.separatorChar);
|
||||
File newFile = new File(entryName);
|
||||
if (zipentry.isDirectory()) {
|
||||
if (!newFile.mkdirs()) break;
|
||||
if (!newFile.mkdirs())
|
||||
break;
|
||||
zipentry = zipinputstream.getNextEntry();
|
||||
continue;
|
||||
}
|
||||
|
@ -80,30 +97,36 @@ implements IGuiHandler {
|
|||
zipentry = zipinputstream.getNextEntry();
|
||||
}
|
||||
zipinputstream.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
System.out.println("Error while loading AssemblyLine Lua libraries: ");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
public Object
|
||||
getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null) {
|
||||
switch (ID) {
|
||||
case 1: {
|
||||
return new ContainerImprinter(player.inventory, (TileEntityImprinter)tileEntity);
|
||||
return new ContainerImprinter(
|
||||
player.inventory, (TileEntityImprinter) tileEntity
|
||||
);
|
||||
}
|
||||
case 2: {
|
||||
if (tileEntity == null || !(tileEntity instanceof TileEntityEncoder)) break;
|
||||
return new ContainerEncoder(player.inventory, (TileEntityEncoder)tileEntity);
|
||||
if (tileEntity == null || !(tileEntity instanceof TileEntityEncoder))
|
||||
break;
|
||||
return new ContainerEncoder(
|
||||
player.inventory, (TileEntityEncoder) tileEntity
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
public Object
|
||||
getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -111,4 +134,3 @@ implements IGuiHandler {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,7 @@ public class Pair {
|
|||
if (!(o instanceof Pair)) {
|
||||
return false;
|
||||
}
|
||||
Pair pairo = (Pair)o;
|
||||
Pair pairo = (Pair) o;
|
||||
return this.left.equals(pairo.getKey()) && this.right.equals(pairo.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
package assemblyline.common;
|
||||
|
||||
import assemblyline.common.block.TileEntityCrate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import assemblyline.common.block.TileEntityCrate;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.core.vector.VectorHelper;
|
||||
|
||||
public class PathfinderCrate {
|
||||
public IPathCallBack callBackCheck = new IPathCallBack(){
|
||||
|
||||
public IPathCallBack callBackCheck = new IPathCallBack() {
|
||||
@Override
|
||||
public boolean isValidNode(PathfinderCrate finder, ForgeDirection direction, TileEntity provider, TileEntity node) {
|
||||
public boolean isValidNode(
|
||||
PathfinderCrate finder,
|
||||
ForgeDirection direction,
|
||||
TileEntity provider,
|
||||
TileEntity node
|
||||
) {
|
||||
return node instanceof TileEntityCrate;
|
||||
}
|
||||
|
||||
|
@ -35,8 +40,20 @@ public class PathfinderCrate {
|
|||
return false;
|
||||
}
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
TileEntity connectedTile = VectorHelper.getTileEntityFromSide(provider.getWorldObj(), new Vector3(provider), ForgeDirection.getOrientation((int)i));
|
||||
if (this.iteratedNodes.contains((Object)connectedTile) || !this.callBackCheck.isValidNode(this, ForgeDirection.getOrientation((int)i), provider, connectedTile) || this.findNodes(connectedTile)) continue;
|
||||
TileEntity connectedTile = VectorHelper.getTileEntityFromSide(
|
||||
provider.getWorldObj(),
|
||||
new Vector3(provider),
|
||||
ForgeDirection.getOrientation((int) i)
|
||||
);
|
||||
if (this.iteratedNodes.contains((Object) connectedTile)
|
||||
|| !this.callBackCheck.isValidNode(
|
||||
this,
|
||||
ForgeDirection.getOrientation((int) i),
|
||||
provider,
|
||||
connectedTile
|
||||
)
|
||||
|| this.findNodes(connectedTile))
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -55,9 +72,10 @@ public class PathfinderCrate {
|
|||
}
|
||||
|
||||
public static interface IPathCallBack {
|
||||
public boolean isValidNode(PathfinderCrate var1, ForgeDirection var2, TileEntity var3, TileEntity var4);
|
||||
public boolean isValidNode(
|
||||
PathfinderCrate var1, ForgeDirection var2, TileEntity var3, TileEntity var4
|
||||
);
|
||||
|
||||
public boolean onSearch(PathfinderCrate var1, TileEntity var2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class TabAssemblyLine
|
||||
extends CreativeTabs {
|
||||
public class TabAssemblyLine extends CreativeTabs {
|
||||
public static final TabAssemblyLine INSTANCE = new TabAssemblyLine("assemblyline");
|
||||
public static ItemStack itemStack;
|
||||
|
||||
|
@ -22,4 +21,3 @@ extends CreativeTabs {
|
|||
return itemStack.getItem();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,27 +10,27 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import universalelectricity.prefab.block.BlockAdvanced;
|
||||
|
||||
public abstract class BlockALMachine
|
||||
extends BlockAdvanced {
|
||||
public abstract class BlockALMachine extends BlockAdvanced {
|
||||
public IIcon machine_icon;
|
||||
|
||||
public BlockALMachine(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister iconReg) {
|
||||
this.machine_icon = iconReg.registerIcon("assemblyline:machine");
|
||||
}
|
||||
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
public IIcon
|
||||
getIcon(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
return this.machine_icon;
|
||||
}
|
||||
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return this.machine_icon;
|
||||
|
@ -40,6 +40,4 @@ extends BlockAdvanced {
|
|||
public TileEntity createTileEntity(World w, int meta) {
|
||||
return this.createNewTileEntity(w, meta);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package assemblyline.common.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.PathfinderCrate;
|
||||
import assemblyline.common.TabAssemblyLine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
@ -22,8 +23,7 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
|
||||
public class BlockCrate
|
||||
extends BlockALMachine {
|
||||
public class BlockCrate extends BlockALMachine {
|
||||
IIcon crate_icon;
|
||||
|
||||
public BlockCrate() {
|
||||
|
@ -33,7 +33,7 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg) {
|
||||
this.crate_icon = iconReg.registerIcon("assemblyline:crate");
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ extends BlockALMachine {
|
|||
@Override
|
||||
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
|
||||
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityCrate) {
|
||||
TileEntityCrate tileEntity = (TileEntityCrate)world.getTileEntity(x, y, z);
|
||||
TileEntityCrate tileEntity = (TileEntityCrate) world.getTileEntity(x, y, z);
|
||||
boolean allMode = world.getWorldTime() - tileEntity.prevClickTime < 10L;
|
||||
tileEntity.prevClickTime = world.getWorldTime();
|
||||
this.tryEject(tileEntity, player, allMode);
|
||||
|
@ -59,42 +59,65 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
if (super.onBlockActivated(world, x, y, z, entityPlayer, side, hitX, hitY, hitZ)) {
|
||||
public boolean onBlockActivated(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer entityPlayer,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ
|
||||
) {
|
||||
if (super.onBlockActivated(
|
||||
world, x, y, z, entityPlayer, side, hitX, hitY, hitZ
|
||||
)) {
|
||||
return true;
|
||||
}
|
||||
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityCrate) {
|
||||
TileEntityCrate tileEntity = (TileEntityCrate)world.getTileEntity(x, y, z);
|
||||
TileEntityCrate tileEntity = (TileEntityCrate) world.getTileEntity(x, y, z);
|
||||
boolean allMode = world.getWorldTime() - tileEntity.prevClickTime < 10L;
|
||||
tileEntity.prevClickTime = world.getWorldTime();
|
||||
ItemStack current = entityPlayer.inventory.getCurrentItem();
|
||||
if (side == 1 || side > 1 && (double)hitY > 0.5 || !entityPlayer.capabilities.isCreativeMode) {
|
||||
if (current != null && (current.getMaxStackSize() > 1 || current.getItem() == Item.getItemFromBlock(this))) {
|
||||
if (side == 1 || side > 1 && (double) hitY > 0.5
|
||||
|| !entityPlayer.capabilities.isCreativeMode) {
|
||||
if (current != null
|
||||
&& (current.getMaxStackSize() > 1
|
||||
|| current.getItem() == Item.getItemFromBlock(this))) {
|
||||
this.tryInsert(tileEntity, entityPlayer, allMode);
|
||||
}
|
||||
} else if (side == 0 || side > 1 && (double)hitY <= 0.5) {
|
||||
} else if (side == 0 || side > 1 && (double) hitY <= 0.5) {
|
||||
this.tryEject(tileEntity, entityPlayer, allMode);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void tryInsert(TileEntityCrate tileEntity, EntityPlayer player, boolean allMode, boolean doSearch) {
|
||||
boolean success = allMode ? this.insertAllItems(tileEntity, player) : this.insertCurrentItem(tileEntity, player);
|
||||
public void tryInsert(
|
||||
TileEntityCrate tileEntity, EntityPlayer player, boolean allMode, boolean doSearch
|
||||
) {
|
||||
boolean success = allMode ? this.insertAllItems(tileEntity, player)
|
||||
: this.insertCurrentItem(tileEntity, player);
|
||||
if (!success && doSearch) {
|
||||
PathfinderCrate pathfinder = new PathfinderCrate().init(tileEntity);
|
||||
for (TileEntity checkTile : pathfinder.iteratedNodes) {
|
||||
if (!(checkTile instanceof TileEntityCrate)) continue;
|
||||
AssemblyLine.blockCrate.tryInsert((TileEntityCrate)checkTile, player, allMode, false);
|
||||
if (!(checkTile instanceof TileEntityCrate))
|
||||
continue;
|
||||
AssemblyLine.blockCrate.tryInsert(
|
||||
(TileEntityCrate) checkTile, player, allMode, false
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void tryInsert(TileEntityCrate tileEntity, EntityPlayer player, boolean allMode) {
|
||||
public void
|
||||
tryInsert(TileEntityCrate tileEntity, EntityPlayer player, boolean allMode) {
|
||||
this.tryInsert(tileEntity, player, allMode, true);
|
||||
}
|
||||
|
||||
public void tryEject(TileEntityCrate tileEntity, EntityPlayer player, boolean allMode) {
|
||||
public void
|
||||
tryEject(TileEntityCrate tileEntity, EntityPlayer player, boolean allMode) {
|
||||
if (allMode && !player.isSneaking()) {
|
||||
this.ejectItems(tileEntity, player, tileEntity.getMaxLimit());
|
||||
} else if (player.isSneaking()) {
|
||||
|
@ -111,16 +134,27 @@ extends BlockALMachine {
|
|||
ItemStack currentStack = player.getCurrentEquippedItem();
|
||||
if (currentStack != null) {
|
||||
if (currentStack.isStackable()) {
|
||||
if (tileEntity.getStackInSlot(0) != null && !tileEntity.getStackInSlot(0).isItemEqual(currentStack)) {
|
||||
if (tileEntity.getStackInSlot(0) != null
|
||||
&& !tileEntity.getStackInSlot(0).isItemEqual(currentStack)) {
|
||||
return false;
|
||||
}
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, BlockCrate.putIn(tileEntity, currentStack));
|
||||
player.inventory.setInventorySlotContents(
|
||||
player.inventory.currentItem,
|
||||
BlockCrate.putIn(tileEntity, currentStack)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
if (currentStack.getItem() == Item.getItemFromBlock(AssemblyLine.blockCrate)) {
|
||||
ItemStack containedStack = ItemBlockCrate.getContainingItemStack(currentStack);
|
||||
if (currentStack.getItem()
|
||||
== Item.getItemFromBlock(AssemblyLine.blockCrate)) {
|
||||
ItemStack containedStack
|
||||
= ItemBlockCrate.getContainingItemStack(currentStack);
|
||||
ItemStack crateStack = tileEntity.getStackInSlot(0);
|
||||
if (containedStack != null && (crateStack == null || crateStack != null && containedStack.getItem() == crateStack.getItem() && containedStack.getItemDamage() == crateStack.getItemDamage())) {
|
||||
if (containedStack != null
|
||||
&& (crateStack == null
|
||||
|| crateStack != null
|
||||
&& containedStack.getItem() == crateStack.getItem()
|
||||
&& containedStack.getItemDamage()
|
||||
== crateStack.getItemDamage())) {
|
||||
ItemStack returned = BlockCrate.putIn(tileEntity, containedStack);
|
||||
ItemBlockCrate.setContainingItemStack(currentStack, returned);
|
||||
return true;
|
||||
|
@ -142,10 +176,14 @@ extends BlockALMachine {
|
|||
boolean success = false;
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); ++i) {
|
||||
ItemStack currentStack = player.inventory.getStackInSlot(i);
|
||||
if (currentStack == null || !requestStack.isItemEqual(currentStack)) continue;
|
||||
player.inventory.setInventorySlotContents(i, BlockCrate.putIn(tileEntity, currentStack));
|
||||
if (currentStack == null || !requestStack.isItemEqual(currentStack))
|
||||
continue;
|
||||
player.inventory.setInventorySlotContents(
|
||||
i, BlockCrate.putIn(tileEntity, currentStack)
|
||||
);
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
((EntityPlayerMP)player).sendContainerToPlayer(player.inventoryContainer);
|
||||
((EntityPlayerMP) player)
|
||||
.sendContainerToPlayer(player.inventoryContainer);
|
||||
}
|
||||
success = true;
|
||||
}
|
||||
|
@ -154,7 +192,8 @@ extends BlockALMachine {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean ejectItems(TileEntityCrate tileEntity, EntityPlayer player, int requestSize) {
|
||||
public boolean
|
||||
ejectItems(TileEntityCrate tileEntity, EntityPlayer player, int requestSize) {
|
||||
World world = tileEntity.getWorldObj();
|
||||
ItemStack containingStack = tileEntity.getStackInSlot(0);
|
||||
if (containingStack != null) {
|
||||
|
@ -163,9 +202,11 @@ extends BlockALMachine {
|
|||
ItemStack dropStack = containingStack.copy();
|
||||
dropStack.stackSize = amountToTake;
|
||||
if (!world.isRemote) {
|
||||
EntityItem entityItem = new EntityItem(world, player.posX, player.posY, player.posZ, dropStack);
|
||||
EntityItem entityItem = new EntityItem(
|
||||
world, player.posX, player.posY, player.posZ, dropStack
|
||||
);
|
||||
entityItem.delayBeforeCanPickup = 0;
|
||||
world.spawnEntityInWorld((Entity)entityItem);
|
||||
world.spawnEntityInWorld((Entity) entityItem);
|
||||
}
|
||||
containingStack.stackSize -= amountToTake;
|
||||
}
|
||||
|
@ -199,19 +240,39 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onUseWrench(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer par5EntityPlayer,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ
|
||||
) {
|
||||
TileEntityCrate tileEntity;
|
||||
ItemStack containingStack;
|
||||
if (!world.isRemote && world.getTileEntity(x, y, z) != null && (containingStack = (tileEntity = (TileEntityCrate)world.getTileEntity(x, y, z)).getStackInSlot(0)) != null && containingStack.stackSize > 0) {
|
||||
if (!world.isRemote && world.getTileEntity(x, y, z) != null
|
||||
&& (containingStack
|
||||
= (tileEntity = (TileEntityCrate) world.getTileEntity(x, y, z))
|
||||
.getStackInSlot(0))
|
||||
!= null
|
||||
&& containingStack.stackSize > 0) {
|
||||
float var6 = 0.7f;
|
||||
double var7 = (double)(world.rand.nextFloat() * var6) + (double)(1.0f - var6) * 0.5;
|
||||
double var9 = (double)(world.rand.nextFloat() * var6) + (double)(1.0f - var6) * 0.5;
|
||||
double var11 = (double)(world.rand.nextFloat() * var6) + (double)(1.0f - var6) * 0.5;
|
||||
ItemStack dropStack = new ItemStack((Block)this, 1, tileEntity.getTier());
|
||||
double var7
|
||||
= (double) (world.rand.nextFloat() * var6) + (double) (1.0f - var6) * 0.5;
|
||||
double var9
|
||||
= (double) (world.rand.nextFloat() * var6) + (double) (1.0f - var6) * 0.5;
|
||||
double var11
|
||||
= (double) (world.rand.nextFloat() * var6) + (double) (1.0f - var6) * 0.5;
|
||||
ItemStack dropStack = new ItemStack((Block) this, 1, tileEntity.getTier());
|
||||
ItemBlockCrate.setContainingItemStack(dropStack, containingStack);
|
||||
EntityItem var13 = new EntityItem(world, (double)x + var7, (double)y + var9, (double)z + var11, dropStack);
|
||||
EntityItem var13 = new EntityItem(
|
||||
world, (double) x + var7, (double) y + var9, (double) z + var11, dropStack
|
||||
);
|
||||
var13.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld((Entity)var13);
|
||||
world.spawnEntityInWorld((Entity) var13);
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 3);
|
||||
return true;
|
||||
|
@ -232,8 +293,7 @@ extends BlockALMachine {
|
|||
@Override
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List list) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
list.add(new ItemStack((Block)this, 1, i));
|
||||
list.add(new ItemStack((Block) this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package assemblyline.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import assemblyline.common.TabAssemblyLine;
|
||||
import assemblyline.common.block.BlockALMachine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -20,8 +21,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.implement.IRotatable;
|
||||
|
||||
public class BlockTurntable
|
||||
extends BlockALMachine {
|
||||
public class BlockTurntable extends BlockALMachine {
|
||||
private IIcon top;
|
||||
|
||||
public BlockTurntable() {
|
||||
|
@ -31,7 +31,7 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg) {
|
||||
super.registerBlockIcons(iconReg);
|
||||
this.top = iconReg.registerIcon("assemblyline:turntable");
|
||||
|
@ -43,7 +43,7 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
if (side == ForgeDirection.UP.ordinal()) {
|
||||
return this.top;
|
||||
|
@ -52,7 +52,7 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (side == ForgeDirection.UP.ordinal()) {
|
||||
return this.top;
|
||||
|
@ -60,23 +60,39 @@ extends BlockALMachine {
|
|||
return this.machine_icon;
|
||||
}
|
||||
|
||||
public static int determineOrientation(World world, int x, int y, int z, EntityPlayer entityPlayer) {
|
||||
public static int
|
||||
determineOrientation(World world, int x, int y, int z, EntityPlayer entityPlayer) {
|
||||
int var7;
|
||||
if (MathHelper.abs((float)((float)entityPlayer.posX - (float)x)) < 2.0f && MathHelper.abs((float)((float)entityPlayer.posZ - (float)z)) < 2.0f) {
|
||||
double var5 = entityPlayer.posY + 1.82 - (double)entityPlayer.yOffset;
|
||||
if (var5 - (double)y > 2.0) {
|
||||
if (MathHelper.abs((float) ((float) entityPlayer.posX - (float) x)) < 2.0f
|
||||
&& MathHelper.abs((float) ((float) entityPlayer.posZ - (float) z)) < 2.0f) {
|
||||
double var5 = entityPlayer.posY + 1.82 - (double) entityPlayer.yOffset;
|
||||
if (var5 - (double) y > 2.0) {
|
||||
return 1;
|
||||
}
|
||||
if ((double)y - var5 > 0.0) {
|
||||
if ((double) y - var5 > 0.0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return (var7 = MathHelper.floor_double((double)((double)(entityPlayer.rotationYaw * 4.0f / 360.0f) + 0.5)) & 3) == 0 ? 2 : (var7 == 1 ? 5 : (var7 == 2 ? 3 : (var7 == 3 ? 4 : 0)));
|
||||
return (var7 = MathHelper.floor_double((double
|
||||
) ((double) (entityPlayer.rotationYaw * 4.0f / 360.0f) + 0.5))
|
||||
& 3)
|
||||
== 0
|
||||
? 2
|
||||
: (var7 == 1 ? 5 : (var7 == 2 ? 3 : (var7 == 3 ? 4 : 0)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase par5EntityLiving, ItemStack stack) {
|
||||
int metadata = BlockTurntable.determineOrientation(world, x, y, z, (EntityPlayer)par5EntityLiving);
|
||||
public void onBlockPlacedBy(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityLivingBase par5EntityLiving,
|
||||
ItemStack stack
|
||||
) {
|
||||
int metadata = BlockTurntable.determineOrientation(
|
||||
world, x, y, z, (EntityPlayer) par5EntityLiving
|
||||
);
|
||||
world.setBlockMetadataWithNotify(x, y, z, metadata, 3);
|
||||
world.scheduleBlockUpdate(x, y, z, this, 20);
|
||||
}
|
||||
|
@ -92,15 +108,17 @@ extends BlockALMachine {
|
|||
Vector3 position = new Vector3(x, y, z);
|
||||
position.modifyPositionFromSide(ForgeDirection.UP);
|
||||
IRotatable rotatable = null;
|
||||
TileEntity tileEntity = position.getTileEntity((IBlockAccess)world);
|
||||
Block block = position.getBlock((IBlockAccess)world);
|
||||
TileEntity tileEntity = position.getTileEntity((IBlockAccess) world);
|
||||
Block block = position.getBlock((IBlockAccess) world);
|
||||
if (tileEntity instanceof IRotatable) {
|
||||
rotatable = (IRotatable)tileEntity;
|
||||
rotatable = (IRotatable) tileEntity;
|
||||
} else if (block instanceof IRotatable) {
|
||||
rotatable = (IRotatable)block;
|
||||
rotatable = (IRotatable) block;
|
||||
}
|
||||
if (rotatable != null) {
|
||||
ForgeDirection newDir = ((IRotatable)tileEntity).getDirection((IBlockAccess)world, x, y, z);
|
||||
ForgeDirection newDir
|
||||
= ((IRotatable) tileEntity)
|
||||
.getDirection((IBlockAccess) world, x, y, z);
|
||||
switch (newDir) {
|
||||
case EAST:
|
||||
newDir = ForgeDirection.SOUTH;
|
||||
|
@ -116,14 +134,21 @@ extends BlockALMachine {
|
|||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
rotatable.setDirection(world, x, y, z, newDir);
|
||||
world.markBlockForUpdate(position.intX(), position.intY(), position.intZ());
|
||||
world.playSoundEffect((double)x + 0.5, (double)y + 0.5, (double)z + 0.5, "tile.piston.in", 0.5f, world.rand.nextFloat() * 0.15f + 0.6f);
|
||||
world.markBlockForUpdate(
|
||||
position.intX(), position.intY(), position.intZ()
|
||||
);
|
||||
world.playSoundEffect(
|
||||
(double) x + 0.5,
|
||||
(double) y + 0.5,
|
||||
(double) z + 0.5,
|
||||
"tile.piston.in",
|
||||
0.5f,
|
||||
world.rand.nextFloat() * 0.15f + 0.6f
|
||||
);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
System.out.println("Failed to rotate:");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -135,4 +160,3 @@ extends BlockALMachine {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,7 @@ import net.minecraft.potion.Potion;
|
|||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemBlockCrate
|
||||
extends ItemBlock {
|
||||
public class ItemBlockCrate extends ItemBlock {
|
||||
public ItemBlockCrate(Block block) {
|
||||
super(block);
|
||||
this.setMaxStackSize(1);
|
||||
|
@ -26,7 +25,9 @@ extends ItemBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
|
||||
public void addInformation(
|
||||
ItemStack itemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4
|
||||
) {
|
||||
ItemStack containingStack = ItemBlockCrate.getContainingItemStack(itemStack);
|
||||
if (containingStack != null) {
|
||||
par3List.add(containingStack.getDisplayName());
|
||||
|
@ -37,17 +38,27 @@ extends ItemBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack itemStack, World par2World, Entity entity, int par4, boolean par5) {
|
||||
public void onUpdate(
|
||||
ItemStack itemStack, World par2World, Entity entity, int par4, boolean par5
|
||||
) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer)entity;
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
ItemStack containingStack = ItemBlockCrate.getContainingItemStack(itemStack);
|
||||
if (containingStack != null) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 5, (int)((float)containingStack.stackSize / (float)TileEntityCrate.getMaxLimit(itemStack.getItemDamage())) * 5));
|
||||
player.addPotionEffect(new PotionEffect(
|
||||
Potion.moveSlowdown.id,
|
||||
5,
|
||||
(int
|
||||
) ((float) containingStack.stackSize
|
||||
/ (float) TileEntityCrate.getMaxLimit(itemStack.getItemDamage()))
|
||||
* 5
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void setContainingItemStack(ItemStack itemStack, ItemStack containingStack) {
|
||||
public static void
|
||||
setContainingItemStack(ItemStack itemStack, ItemStack containingStack) {
|
||||
if (itemStack.stackTagCompound == null) {
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
@ -55,10 +66,10 @@ extends ItemBlock {
|
|||
NBTTagCompound itemTagCompound = new NBTTagCompound();
|
||||
containingStack.stackSize = Math.abs(containingStack.stackSize);
|
||||
containingStack.writeToNBT(itemTagCompound);
|
||||
itemStack.getTagCompound().setTag("Item", (NBTBase)itemTagCompound);
|
||||
itemStack.getTagCompound().setTag("Item", (NBTBase) itemTagCompound);
|
||||
itemStack.getTagCompound().setInteger("Count", containingStack.stackSize);
|
||||
} else {
|
||||
itemStack.getTagCompound().setTag("Item", (NBTBase)new NBTTagCompound());
|
||||
itemStack.getTagCompound().setTag("Item", (NBTBase) new NBTTagCompound());
|
||||
itemStack.getTagCompound().setInteger("Count", 0);
|
||||
}
|
||||
}
|
||||
|
@ -68,8 +79,10 @@ extends ItemBlock {
|
|||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
return null;
|
||||
}
|
||||
NBTTagCompound itemTagCompound = itemStack.getTagCompound().getCompoundTag("Item");
|
||||
ItemStack containingStack = ItemStack.loadItemStackFromNBT((NBTTagCompound)itemTagCompound);
|
||||
NBTTagCompound itemTagCompound
|
||||
= itemStack.getTagCompound().getCompoundTag("Item");
|
||||
ItemStack containingStack
|
||||
= ItemStack.loadItemStackFromNBT((NBTTagCompound) itemTagCompound);
|
||||
if (containingStack != null) {
|
||||
containingStack.stackSize = itemStack.getTagCompound().getInteger("Count");
|
||||
}
|
||||
|
@ -82,15 +95,30 @@ extends ItemBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
|
||||
if (super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata)) {
|
||||
public boolean placeBlockAt(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ,
|
||||
int metadata
|
||||
) {
|
||||
if (super.placeBlockAt(
|
||||
stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata
|
||||
)) {
|
||||
ItemStack containingItem = ItemBlockCrate.getContainingItemStack(stack);
|
||||
if (world.getTileEntity(x, y, z) != null && containingItem != null && containingItem.stackSize > 0) {
|
||||
TileEntityCrate tileEntity = (TileEntityCrate)world.getTileEntity(x, y, z);
|
||||
if (world.getTileEntity(x, y, z) != null && containingItem != null
|
||||
&& containingItem.stackSize > 0) {
|
||||
TileEntityCrate tileEntity
|
||||
= (TileEntityCrate) world.getTileEntity(x, y, z);
|
||||
tileEntity.setInventorySlotContents(0, containingItem);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,10 +15,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
|||
import universalelectricity.prefab.implement.ITier;
|
||||
import universalelectricity.prefab.tile.TileEntityAdvanced;
|
||||
|
||||
public class TileEntityCrate
|
||||
extends TileEntityAdvanced
|
||||
implements ITier,
|
||||
IInventory {
|
||||
public class TileEntityCrate extends TileEntityAdvanced implements ITier, IInventory {
|
||||
private ItemStack[] containingItems = new ItemStack[1];
|
||||
public long prevClickTime = -1000L;
|
||||
|
||||
|
@ -42,13 +39,14 @@ IInventory {
|
|||
}
|
||||
|
||||
/*@Override
|
||||
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream) {
|
||||
public void handlePacketData(INetworkManager network, int packetType,
|
||||
Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream) {
|
||||
if (this.field_70331_k.isRemote) {
|
||||
try {
|
||||
if (dataStream.readBoolean()) {
|
||||
if (this.containingItems[0] == null) {
|
||||
this.containingItems[0] = new ItemStack(dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
|
||||
} else {
|
||||
this.containingItems[0] = new ItemStack(dataStream.readInt(),
|
||||
dataStream.readInt(), dataStream.readInt()); } else {
|
||||
this.containingItems[0].field_77993_c = dataStream.readInt();
|
||||
this.containingItems[0].stackSize = dataStream.readInt();
|
||||
this.containingItems[0].setItemDamage(dataStream.readInt());
|
||||
|
@ -69,7 +67,11 @@ IInventory {
|
|||
NBTTagCompound nbt = pkt.func_148857_g();
|
||||
if (nbt.getBoolean("containsItems")) {
|
||||
if (containingItems[0] == null) {
|
||||
containingItems[0] = new ItemStack(Item.getItemById(nbt.getShort("id")), nbt.getByte("Count"), nbt.getShort("Damage"));
|
||||
containingItems[0] = new ItemStack(
|
||||
Item.getItemById(nbt.getShort("id")),
|
||||
nbt.getByte("Count"),
|
||||
nbt.getShort("Damage")
|
||||
);
|
||||
} else {
|
||||
containingItems[0].readFromNBT(nbt);
|
||||
}
|
||||
|
@ -85,12 +87,16 @@ IInventory {
|
|||
if (this.containingItems[0] != null) {
|
||||
nbt.setBoolean("containsItems", true);
|
||||
containingItems[0].writeToNBT(nbt);
|
||||
//return PacketManager.getPacket("AssemblyLine", this, new Object[]{true, this.containingItems[0].field_77993_c, this.containingItems[0].stackSize, this.containingItems[0].getItemDamage()});
|
||||
//return PacketManager.getPacket("AssemblyLine", this, new Object[]{true,
|
||||
//this.containingItems[0].field_77993_c, this.containingItems[0].stackSize,
|
||||
//this.containingItems[0].getItemDamage()});
|
||||
} else {
|
||||
nbt.setBoolean("containsItems", false);
|
||||
}
|
||||
//return PacketManager.getPacket("AssemblyLine", this, new Object[]{false});
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, getBlockMetadata(), nbt);
|
||||
return new S35PacketUpdateTileEntity(
|
||||
xCoord, yCoord, zCoord, getBlockMetadata(), nbt
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -145,16 +151,20 @@ IInventory {
|
|||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) {
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5, (double)this.yCoord + 0.5, (double)this.zCoord + 0.5) <= 64.0;
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this
|
||||
? false
|
||||
: par1EntityPlayer.getDistanceSq(
|
||||
(double) this.xCoord + 0.5,
|
||||
(double) this.yCoord + 0.5,
|
||||
(double) this.zCoord + 0.5
|
||||
) <= 64.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
@ -162,10 +172,12 @@ IInventory {
|
|||
NBTTagList var2 = nbt.getTagList("Items", 10);
|
||||
this.containingItems = new ItemStack[this.getSizeInventory()];
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
|
||||
NBTTagCompound var4 = (NBTTagCompound)var2.getCompoundTagAt(var3);
|
||||
NBTTagCompound var4 = (NBTTagCompound) var2.getCompoundTagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
if (var5 < 0 || var5 >= this.containingItems.length) continue;
|
||||
this.containingItems[var5] = ItemStack.loadItemStackFromNBT((NBTTagCompound)var4);
|
||||
if (var5 < 0 || var5 >= this.containingItems.length)
|
||||
continue;
|
||||
this.containingItems[var5]
|
||||
= ItemStack.loadItemStackFromNBT((NBTTagCompound) var4);
|
||||
}
|
||||
if (this.containingItems[0] != null) {
|
||||
this.containingItems[0].stackSize = nbt.getInteger("Count");
|
||||
|
@ -177,13 +189,14 @@ IInventory {
|
|||
super.writeToNBT(nbt);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int var3 = 0; var3 < this.containingItems.length; ++var3) {
|
||||
if (this.containingItems[var3] == null) continue;
|
||||
if (this.containingItems[var3] == null)
|
||||
continue;
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)var3);
|
||||
var4.setByte("Slot", (byte) var3);
|
||||
this.containingItems[var3].writeToNBT(var4);
|
||||
var2.appendTag((NBTBase)var4);
|
||||
var2.appendTag((NBTBase) var4);
|
||||
}
|
||||
nbt.setTag("Items", (NBTBase)var2);
|
||||
nbt.setTag("Items", (NBTBase) var2);
|
||||
if (this.containingItems[0] != null) {
|
||||
nbt.setInteger("Count", this.containingItems[0].stackSize);
|
||||
}
|
||||
|
@ -211,7 +224,9 @@ IInventory {
|
|||
|
||||
@Override
|
||||
public void setTier(int tier) {
|
||||
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, tier, 3);
|
||||
this.worldObj.setBlockMetadataWithNotify(
|
||||
this.xCoord, this.yCoord, this.zCoord, tier, 3
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -224,4 +239,3 @@ IInventory {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockBeltSorter
|
||||
extends BlockALMachine {
|
||||
public class BlockBeltSorter extends BlockALMachine {
|
||||
public BlockBeltSorter() {
|
||||
super(Material.iron);
|
||||
this.setCreativeTab(TabAssemblyLine.INSTANCE);
|
||||
|
@ -20,4 +19,3 @@ extends BlockALMachine {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,31 +11,58 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
import net.minecraft.world.World;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
|
||||
public class BlockManipulator
|
||||
extends BlockImprintable {
|
||||
public class BlockManipulator extends BlockImprintable {
|
||||
public BlockManipulator() {
|
||||
super("manipulator", UniversalElectricity.machine, TabAssemblyLine.INSTANCE);
|
||||
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.29f, 1.0f);
|
||||
}
|
||||
|
||||
public AxisAlignedBB func_71911_a_(World par1World, int par2, int par3, int par4) {
|
||||
return AxisAlignedBB.getBoundingBox((double)par2, (double)par3, (double)par4, (double)par2 + 1.0, (double)par3 + 1.0, (double)par4 + 1.0);
|
||||
return AxisAlignedBB.getBoundingBox(
|
||||
(double) par2,
|
||||
(double) par3,
|
||||
(double) par4,
|
||||
(double) par2 + 1.0,
|
||||
(double) par3 + 1.0,
|
||||
(double) par4 + 1.0
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onSneakMachineActivated(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer entityPlayer,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ
|
||||
) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityManipulator) {
|
||||
((TileEntityManipulator)tileEntity).selfPulse = !((TileEntityManipulator)tileEntity).selfPulse;
|
||||
((TileEntityManipulator) tileEntity).selfPulse
|
||||
= !((TileEntityManipulator) tileEntity).selfPulse;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onSneakUseWrench(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer par5EntityPlayer,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ
|
||||
) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityManipulator) {
|
||||
TileEntityManipulator manip = (TileEntityManipulator)tileEntity;
|
||||
TileEntityManipulator manip = (TileEntityManipulator) tileEntity;
|
||||
boolean manipMode = manip.isOutput();
|
||||
boolean inverted = manip.isInverted();
|
||||
if (manipMode && !inverted) {
|
||||
|
@ -59,7 +86,7 @@ extends BlockImprintable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public int getRenderType() {
|
||||
return BlockRenderingHandler.BLOCK_RENDER_ID;
|
||||
}
|
||||
|
@ -79,4 +106,3 @@ extends BlockImprintable {
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
|
||||
public class BlockRejector
|
||||
extends BlockImprintable {
|
||||
public class BlockRejector extends BlockImprintable {
|
||||
public BlockRejector() {
|
||||
super("rejector", UniversalElectricity.machine, TabAssemblyLine.INSTANCE);
|
||||
}
|
||||
|
@ -31,9 +30,8 @@ extends BlockImprintable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public int getRenderType() {
|
||||
return BlockRenderingHandler.BLOCK_RENDER_ID;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,22 +7,29 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import universalelectricity.prefab.tile.TileEntityElectricityRunnable;
|
||||
|
||||
public abstract class TileEntityAssemblyNetwork
|
||||
extends TileEntityElectricityRunnable {
|
||||
public abstract class TileEntityAssemblyNetwork extends TileEntityElectricityRunnable {
|
||||
public int powerTransferRange = 0;
|
||||
|
||||
public boolean isRunning() {
|
||||
return AssemblyLine.REQUIRE_NO_POWER || this.powerTransferRange > 0 || this.wattsReceived > this.getRequest().getWatts();
|
||||
return AssemblyLine.REQUIRE_NO_POWER || this.powerTransferRange > 0
|
||||
|| this.wattsReceived > this.getRequest().getWatts();
|
||||
}
|
||||
|
||||
public void updatePowerTransferRange() {
|
||||
int maximumTransferRange = 0;
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
ForgeDirection direction = ForgeDirection.getOrientation((int)i);
|
||||
TileEntity tileEntity = this.worldObj.getTileEntity(this.xCoord + direction.offsetX, this.yCoord + direction.offsetY, this.zCoord + direction.offsetZ);
|
||||
if (tileEntity == null || !(tileEntity instanceof TileEntityAssemblyNetwork)) continue;
|
||||
TileEntityAssemblyNetwork assemblyNetwork = (TileEntityAssemblyNetwork)tileEntity;
|
||||
if (assemblyNetwork.powerTransferRange <= maximumTransferRange) continue;
|
||||
ForgeDirection direction = ForgeDirection.getOrientation((int) i);
|
||||
TileEntity tileEntity = this.worldObj.getTileEntity(
|
||||
this.xCoord + direction.offsetX,
|
||||
this.yCoord + direction.offsetY,
|
||||
this.zCoord + direction.offsetZ
|
||||
);
|
||||
if (tileEntity == null || !(tileEntity instanceof TileEntityAssemblyNetwork))
|
||||
continue;
|
||||
TileEntityAssemblyNetwork assemblyNetwork
|
||||
= (TileEntityAssemblyNetwork) tileEntity;
|
||||
if (assemblyNetwork.powerTransferRange <= maximumTransferRange)
|
||||
continue;
|
||||
maximumTransferRange = assemblyNetwork.powerTransferRange;
|
||||
}
|
||||
this.powerTransferRange = Math.max(maximumTransferRange - 1, 0);
|
||||
|
@ -46,8 +53,7 @@ extends TileEntityElectricityRunnable {
|
|||
}
|
||||
}
|
||||
|
||||
protected void onUpdate() {
|
||||
}
|
||||
protected void onUpdate() {}
|
||||
|
||||
@Override
|
||||
public ElectricityPack getRequest() {
|
||||
|
@ -70,4 +76,3 @@ extends TileEntityElectricityRunnable {
|
|||
this.wattsReceived = nbt.getDouble("wattsReceived");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package assemblyline.common.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import assemblyline.api.IManipulator;
|
||||
import assemblyline.common.block.BlockCrate;
|
||||
import assemblyline.common.block.TileEntityCrate;
|
||||
import assemblyline.common.machine.imprinter.TileEntityFilterable;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
@ -22,10 +23,7 @@ import universalelectricity.prefab.implement.IRotatable;
|
|||
import universalelectricity.prefab.multiblock.TileEntityMulti;
|
||||
|
||||
public class TileEntityManipulator
|
||||
extends TileEntityFilterable
|
||||
implements IRotatable,
|
||||
IRedstoneReceptor,
|
||||
IManipulator {
|
||||
extends TileEntityFilterable implements IRotatable, IRedstoneReceptor, IManipulator {
|
||||
public boolean selfPulse = false;
|
||||
private boolean isOutput = false;
|
||||
private boolean isRedstonePowered = false;
|
||||
|
@ -75,20 +73,41 @@ IManipulator {
|
|||
outputDown.modifyPositionFromSide(ForgeDirection.DOWN);
|
||||
Vector3 outputPosition = new Vector3(this);
|
||||
outputPosition.modifyPositionFromSide(this.getDirection().getOpposite());
|
||||
if (outputPosition.getTileEntity((IBlockAccess)this.worldObj) instanceof TileEntityManipulator && ((TileEntityManipulator)outputPosition.getTileEntity((IBlockAccess)this.worldObj)).getDirection() == this.getDirection().getOpposite()) {
|
||||
if (outputPosition.getTileEntity((IBlockAccess) this.worldObj)
|
||||
instanceof TileEntityManipulator
|
||||
&& ((TileEntityManipulator
|
||||
) outputPosition.getTileEntity((IBlockAccess) this.worldObj))
|
||||
.getDirection()
|
||||
== this.getDirection().getOpposite()) {
|
||||
return;
|
||||
}
|
||||
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox((double)inputPosition.x, (double)inputPosition.y, (double)inputPosition.z, (double)(inputPosition.x + 1.0), (double)(inputPosition.y + 1.0), (double)(inputPosition.z + 1.0));
|
||||
List<EntityItem> itemsInBound = this.worldObj.getEntitiesWithinAABB(EntityItem.class, bounds);
|
||||
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(
|
||||
(double) inputPosition.x,
|
||||
(double) inputPosition.y,
|
||||
(double) inputPosition.z,
|
||||
(double) (inputPosition.x + 1.0),
|
||||
(double) (inputPosition.y + 1.0),
|
||||
(double) (inputPosition.z + 1.0)
|
||||
);
|
||||
List<EntityItem> itemsInBound
|
||||
= this.worldObj.getEntitiesWithinAABB(EntityItem.class, bounds);
|
||||
for (EntityItem entity : itemsInBound) {
|
||||
if (entity.isDead) continue;
|
||||
if (entity.isDead)
|
||||
continue;
|
||||
ItemStack remainingStack = entity.getEntityItem().copy();
|
||||
if (this.getFilter() != null && !this.isFiltering(remainingStack)) continue;
|
||||
if ((remainingStack = this.tryPlaceInPosition(remainingStack, outputUp, ForgeDirection.DOWN)) != null) {
|
||||
remainingStack = this.tryPlaceInPosition(remainingStack, outputDown, ForgeDirection.UP);
|
||||
if (this.getFilter() != null && !this.isFiltering(remainingStack))
|
||||
continue;
|
||||
if ((remainingStack
|
||||
= this.tryPlaceInPosition(remainingStack, outputUp, ForgeDirection.DOWN))
|
||||
!= null) {
|
||||
remainingStack = this.tryPlaceInPosition(
|
||||
remainingStack, outputDown, ForgeDirection.UP
|
||||
);
|
||||
}
|
||||
if (remainingStack != null) {
|
||||
remainingStack = this.tryPlaceInPosition(remainingStack, outputPosition, this.getDirection().getOpposite());
|
||||
remainingStack = this.tryPlaceInPosition(
|
||||
remainingStack, outputPosition, this.getDirection().getOpposite()
|
||||
);
|
||||
}
|
||||
if (remainingStack != null && remainingStack.stackSize > 0) {
|
||||
this.throwItem(outputPosition, remainingStack);
|
||||
|
@ -113,7 +132,9 @@ IManipulator {
|
|||
itemStack = this.tryGrabFromPosition(inputDown, ForgeDirection.UP);
|
||||
}
|
||||
if (itemStack == null) {
|
||||
itemStack = this.tryGrabFromPosition(inputPosition, this.getDirection().getOpposite());
|
||||
itemStack = this.tryGrabFromPosition(
|
||||
inputPosition, this.getDirection().getOpposite()
|
||||
);
|
||||
}
|
||||
if (itemStack != null && itemStack.stackSize > 0) {
|
||||
this.throwItem(outputPosition, itemStack);
|
||||
|
@ -122,55 +143,88 @@ IManipulator {
|
|||
|
||||
public void throwItem(Vector3 outputPosition, ItemStack items) {
|
||||
if (!this.worldObj.isRemote) {
|
||||
EntityItem entityItem = new EntityItem(this.worldObj, outputPosition.x + 0.5, outputPosition.y + 0.8, outputPosition.z + 0.5, items);
|
||||
EntityItem entityItem = new EntityItem(
|
||||
this.worldObj,
|
||||
outputPosition.x + 0.5,
|
||||
outputPosition.y + 0.8,
|
||||
outputPosition.z + 0.5,
|
||||
items
|
||||
);
|
||||
entityItem.motionX = 0.0;
|
||||
entityItem.motionZ = 0.0;
|
||||
entityItem.motionY /= 5.0;
|
||||
entityItem.delayBeforeCanPickup = 20;
|
||||
this.worldObj.spawnEntityInWorld((Entity)entityItem);
|
||||
this.worldObj.spawnEntityInWorld((Entity) entityItem);
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack tryPlaceInPosition(ItemStack itemStack, Vector3 position, ForgeDirection direction) {
|
||||
TileEntity tileEntity = position.getTileEntity((IBlockAccess)this.worldObj);
|
||||
private ItemStack
|
||||
tryPlaceInPosition(ItemStack itemStack, Vector3 position, ForgeDirection direction) {
|
||||
TileEntity tileEntity = position.getTileEntity((IBlockAccess) this.worldObj);
|
||||
if (tileEntity != null && itemStack != null) {
|
||||
if (tileEntity instanceof TileEntityMulti) {
|
||||
Vector3 mainBlockPosition = ((TileEntityMulti)tileEntity).mainBlockPosition;
|
||||
if (mainBlockPosition != null && !(mainBlockPosition.getTileEntity((IBlockAccess)this.worldObj) instanceof TileEntityMulti)) {
|
||||
return this.tryPlaceInPosition(itemStack, mainBlockPosition, direction);
|
||||
Vector3 mainBlockPosition
|
||||
= ((TileEntityMulti) tileEntity).mainBlockPosition;
|
||||
if (mainBlockPosition != null
|
||||
&& !(
|
||||
mainBlockPosition.getTileEntity((IBlockAccess) this.worldObj)
|
||||
instanceof TileEntityMulti
|
||||
)) {
|
||||
return this.tryPlaceInPosition(
|
||||
itemStack, mainBlockPosition, direction
|
||||
);
|
||||
}
|
||||
} else if (tileEntity instanceof TileEntityChest) {
|
||||
TileEntityChest[] chests = new TileEntityChest[]{(TileEntityChest)tileEntity, null};
|
||||
TileEntityChest[] chests
|
||||
= new TileEntityChest[] { (TileEntityChest) tileEntity, null };
|
||||
for (int i = 2; i < 6; ++i) {
|
||||
ForgeDirection searchDirection = ForgeDirection.getOrientation((int)i);
|
||||
ForgeDirection searchDirection
|
||||
= ForgeDirection.getOrientation((int) i);
|
||||
Vector3 searchPosition = position.clone();
|
||||
searchPosition.modifyPositionFromSide(searchDirection);
|
||||
if (searchPosition.getTileEntity((IBlockAccess)this.worldObj) == null || searchPosition.getTileEntity((IBlockAccess)this.worldObj).getClass() != chests[0].getClass()) continue;
|
||||
chests[1] = (TileEntityChest)searchPosition.getTileEntity((IBlockAccess)this.worldObj);
|
||||
if (searchPosition.getTileEntity((IBlockAccess) this.worldObj) == null
|
||||
|| searchPosition.getTileEntity((IBlockAccess) this.worldObj)
|
||||
.getClass()
|
||||
!= chests[0].getClass())
|
||||
continue;
|
||||
chests[1] = (TileEntityChest
|
||||
) searchPosition.getTileEntity((IBlockAccess) this.worldObj);
|
||||
break;
|
||||
}
|
||||
for (TileEntityChest chest : chests) {
|
||||
if (chest == null) continue;
|
||||
if (chest == null)
|
||||
continue;
|
||||
for (int i = 0; i < chest.getSizeInventory(); ++i) {
|
||||
if ((itemStack = this.addStackToInventory(i, (IInventory)chest, itemStack)) != null) continue;
|
||||
if ((itemStack
|
||||
= this.addStackToInventory(i, (IInventory) chest, itemStack))
|
||||
!= null)
|
||||
continue;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (tileEntity instanceof TileEntityCrate) {
|
||||
return BlockCrate.putIn((TileEntityCrate)tileEntity, itemStack);
|
||||
return BlockCrate.putIn((TileEntityCrate) tileEntity, itemStack);
|
||||
}
|
||||
if (tileEntity instanceof ISidedInventory) {
|
||||
int startIndex;
|
||||
ISidedInventory inventory = (ISidedInventory)tileEntity;
|
||||
for (int i : inventory.getAccessibleSlotsFromSide(direction.ordinal())) {
|
||||
if ((itemStack = this.addStackToInventory(i, (IInventory)inventory, itemStack)) != null) continue;
|
||||
ISidedInventory inventory = (ISidedInventory) tileEntity;
|
||||
for (int i :
|
||||
inventory.getAccessibleSlotsFromSide(direction.ordinal())) {
|
||||
if ((itemStack = this.addStackToInventory(
|
||||
i, (IInventory) inventory, itemStack
|
||||
))
|
||||
!= null)
|
||||
continue;
|
||||
return null;
|
||||
}
|
||||
} else if (tileEntity instanceof IInventory) {
|
||||
IInventory inventory = (IInventory)tileEntity;
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
|
||||
if ((itemStack = this.addStackToInventory(i, inventory, itemStack)) != null) continue;
|
||||
if ((itemStack
|
||||
= this.addStackToInventory(i, inventory, itemStack))
|
||||
!= null)
|
||||
continue;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +236,8 @@ IManipulator {
|
|||
return itemStack;
|
||||
}
|
||||
|
||||
public ItemStack addStackToInventory(int slotIndex, IInventory inventory, ItemStack itemStack) {
|
||||
public ItemStack
|
||||
addStackToInventory(int slotIndex, IInventory inventory, ItemStack itemStack) {
|
||||
if (inventory.getSizeInventory() > slotIndex) {
|
||||
ItemStack stackInInventory = inventory.getStackInSlot(slotIndex);
|
||||
if (stackInInventory == null) {
|
||||
|
@ -192,11 +247,22 @@ IManipulator {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
if (stackInInventory.isItemEqual(itemStack) && stackInInventory.isStackable()) {
|
||||
if (stackInInventory.isItemEqual(itemStack)
|
||||
&& stackInInventory.isStackable()) {
|
||||
stackInInventory = stackInInventory.copy();
|
||||
int stackLim = Math.min(inventory.getInventoryStackLimit(), itemStack.getMaxStackSize());
|
||||
int rejectedAmount = Math.max(stackInInventory.stackSize + itemStack.stackSize - stackLim, 0);
|
||||
stackInInventory.stackSize = Math.min(Math.max(stackInInventory.stackSize + itemStack.stackSize - rejectedAmount, 0), inventory.getInventoryStackLimit());
|
||||
int stackLim = Math.min(
|
||||
inventory.getInventoryStackLimit(), itemStack.getMaxStackSize()
|
||||
);
|
||||
int rejectedAmount = Math.max(
|
||||
stackInInventory.stackSize + itemStack.stackSize - stackLim, 0
|
||||
);
|
||||
stackInInventory.stackSize = Math.min(
|
||||
Math.max(
|
||||
stackInInventory.stackSize + itemStack.stackSize - rejectedAmount,
|
||||
0
|
||||
),
|
||||
inventory.getInventoryStackLimit()
|
||||
);
|
||||
itemStack.stackSize = rejectedAmount;
|
||||
inventory.setInventorySlotContents(slotIndex, stackInInventory);
|
||||
}
|
||||
|
@ -209,62 +275,82 @@ IManipulator {
|
|||
|
||||
private ItemStack tryGrabFromPosition(Vector3 position, ForgeDirection direction) {
|
||||
ItemStack returnStack;
|
||||
block6: {
|
||||
TileEntity tileEntity;
|
||||
block9: {
|
||||
int startIndex;
|
||||
block8: {
|
||||
block7: {
|
||||
returnStack = null;
|
||||
tileEntity = position.getTileEntity((IBlockAccess)this.worldObj);
|
||||
if (tileEntity == null) break block6;
|
||||
if (!(tileEntity instanceof TileEntityMulti)) break block7;
|
||||
Vector3 mainBlockPosition = ((TileEntityMulti)tileEntity).mainBlockPosition;
|
||||
if (mainBlockPosition != null && !(mainBlockPosition.getTileEntity((IBlockAccess)this.worldObj) instanceof TileEntityMulti)) {
|
||||
return this.tryGrabFromPosition(mainBlockPosition, direction);
|
||||
}
|
||||
break block6;
|
||||
}
|
||||
if (!(tileEntity instanceof TileEntityChest)) break block8;
|
||||
TileEntityChest[] chests = new TileEntityChest[]{(TileEntityChest)tileEntity, null};
|
||||
for (int i = 2; i < 6; ++i) {
|
||||
ForgeDirection searchDirection = ForgeDirection.getOrientation((int)i);
|
||||
Vector3 searchPosition = position.clone();
|
||||
searchPosition.modifyPositionFromSide(searchDirection);
|
||||
if (searchPosition.getTileEntity((IBlockAccess)this.worldObj) == null || searchPosition.getTileEntity((IBlockAccess)this.worldObj).getClass() != chests[0].getClass()) continue;
|
||||
chests[1] = (TileEntityChest)searchPosition.getTileEntity((IBlockAccess)this.worldObj);
|
||||
break;
|
||||
}
|
||||
for (TileEntityChest chest : chests) {
|
||||
if (chest == null) continue;
|
||||
for (int i = 0; i < chest.getSizeInventory(); ++i) {
|
||||
ItemStack itemStack = this.removeStackFromInventory(i, (IInventory)chest);
|
||||
if (itemStack == null) continue;
|
||||
returnStack = itemStack;
|
||||
break block6;
|
||||
}
|
||||
}
|
||||
break block6;
|
||||
}
|
||||
if (!(tileEntity instanceof ISidedInventory)) break block9;
|
||||
ISidedInventory inventory = (ISidedInventory)tileEntity;
|
||||
for (int i : inventory.getAccessibleSlotsFromSide(direction.ordinal())) {
|
||||
ItemStack itemStack = this.removeStackFromInventory(i, (IInventory)inventory);
|
||||
if (itemStack == null) continue;
|
||||
returnStack = itemStack;
|
||||
break block6;
|
||||
}
|
||||
block6: {
|
||||
TileEntity tileEntity;
|
||||
block9: {
|
||||
int startIndex;
|
||||
block8: {
|
||||
block7: {
|
||||
returnStack = null;
|
||||
tileEntity = position.getTileEntity((IBlockAccess) this.worldObj);
|
||||
if (tileEntity == null)
|
||||
break block6;
|
||||
if (!(tileEntity instanceof TileEntityMulti))
|
||||
break block7;
|
||||
Vector3 mainBlockPosition = ((TileEntityMulti) tileEntity).mainBlockPosition;
|
||||
if (mainBlockPosition != null
|
||||
&& !(
|
||||
mainBlockPosition.getTileEntity((IBlockAccess) this.worldObj)
|
||||
instanceof TileEntityMulti
|
||||
)) {
|
||||
return this.tryGrabFromPosition(mainBlockPosition, direction);
|
||||
}
|
||||
break block6;
|
||||
}
|
||||
if (!(tileEntity instanceof TileEntityChest))
|
||||
break block8;
|
||||
TileEntityChest[] chests
|
||||
= new TileEntityChest[] { (TileEntityChest) tileEntity, null };
|
||||
for (int i = 2; i < 6; ++i) {
|
||||
ForgeDirection searchDirection = ForgeDirection.getOrientation((int) i);
|
||||
Vector3 searchPosition = position.clone();
|
||||
searchPosition.modifyPositionFromSide(searchDirection);
|
||||
if (searchPosition.getTileEntity((IBlockAccess) this.worldObj) == null
|
||||
|| searchPosition.getTileEntity((IBlockAccess) this.worldObj).getClass()
|
||||
!= chests[0].getClass())
|
||||
continue;
|
||||
chests[1] = (TileEntityChest
|
||||
) searchPosition.getTileEntity((IBlockAccess) this.worldObj);
|
||||
break;
|
||||
}
|
||||
for (TileEntityChest chest : chests) {
|
||||
if (chest == null)
|
||||
continue;
|
||||
for (int i = 0; i < chest.getSizeInventory(); ++i) {
|
||||
ItemStack itemStack
|
||||
= this.removeStackFromInventory(i, (IInventory) chest);
|
||||
if (itemStack == null)
|
||||
continue;
|
||||
returnStack = itemStack;
|
||||
break block6;
|
||||
}
|
||||
if (!(tileEntity instanceof IInventory)) break block6;
|
||||
IInventory inventory = (IInventory)tileEntity;
|
||||
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
|
||||
ItemStack itemStack = this.removeStackFromInventory(i, inventory);
|
||||
if (itemStack == null) continue;
|
||||
returnStack = itemStack;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break block6;
|
||||
}
|
||||
if (!(tileEntity instanceof ISidedInventory))
|
||||
break block9;
|
||||
ISidedInventory inventory = (ISidedInventory) tileEntity;
|
||||
for (int i : inventory.getAccessibleSlotsFromSide(direction.ordinal())) {
|
||||
ItemStack itemStack
|
||||
= this.removeStackFromInventory(i, (IInventory) inventory);
|
||||
if (itemStack == null)
|
||||
continue;
|
||||
returnStack = itemStack;
|
||||
break block6;
|
||||
}
|
||||
break block6;
|
||||
}
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
break block6;
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
|
||||
ItemStack itemStack = this.removeStackFromInventory(i, inventory);
|
||||
if (itemStack == null)
|
||||
continue;
|
||||
returnStack = itemStack;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return returnStack;
|
||||
}
|
||||
|
||||
|
@ -309,4 +395,3 @@ IManipulator {
|
|||
return dir != this.getDirection();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package assemblyline.common.machine;
|
||||
|
||||
import assemblyline.common.machine.imprinter.TileEntityFilterable;
|
||||
import java.util.List;
|
||||
|
||||
import assemblyline.common.machine.imprinter.TileEntityFilterable;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -12,8 +13,7 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
public class TileEntityRejector
|
||||
extends TileEntityFilterable {
|
||||
public class TileEntityRejector extends TileEntityFilterable {
|
||||
public boolean firePiston = false;
|
||||
|
||||
@Override
|
||||
|
@ -29,20 +29,29 @@ extends TileEntityFilterable {
|
|||
this.firePiston = false;
|
||||
Vector3 searchPosition = new Vector3(this);
|
||||
searchPosition.modifyPositionFromSide(this.getDirection());
|
||||
TileEntity tileEntity = searchPosition.getTileEntity((IBlockAccess)this.worldObj);
|
||||
TileEntity tileEntity
|
||||
= searchPosition.getTileEntity((IBlockAccess) this.worldObj);
|
||||
try {
|
||||
boolean flag = false;
|
||||
if (this.isRunning()) {
|
||||
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox((double)searchPosition.x, (double)searchPosition.y, (double)searchPosition.z, (double)(searchPosition.x + 1.0), (double)(searchPosition.y + 1.0), (double)(searchPosition.z + 1.0));
|
||||
List<Entity> entitiesInFront = this.worldObj.getEntitiesWithinAABB(Entity.class, bounds);
|
||||
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(
|
||||
(double) searchPosition.x,
|
||||
(double) searchPosition.y,
|
||||
(double) searchPosition.z,
|
||||
(double) (searchPosition.x + 1.0),
|
||||
(double) (searchPosition.y + 1.0),
|
||||
(double) (searchPosition.z + 1.0)
|
||||
);
|
||||
List<Entity> entitiesInFront
|
||||
= this.worldObj.getEntitiesWithinAABB(Entity.class, bounds);
|
||||
for (Entity entity : entitiesInFront) {
|
||||
if (!this.canEntityBeThrow(entity)) continue;
|
||||
if (!this.canEntityBeThrow(entity))
|
||||
continue;
|
||||
this.throwItem(this.getDirection(), entity);
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -50,15 +59,15 @@ extends TileEntityFilterable {
|
|||
|
||||
public void throwItem(ForgeDirection side, Entity entity) {
|
||||
this.firePiston = true;
|
||||
entity.motionX = (double)side.offsetX * 0.2;
|
||||
entity.motionX = (double) side.offsetX * 0.2;
|
||||
entity.motionY += 0.10000000298023223;
|
||||
entity.motionZ = (double)side.offsetZ * 0.2;
|
||||
entity.motionZ = (double) side.offsetZ * 0.2;
|
||||
this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public boolean canEntityBeThrow(Entity entity) {
|
||||
if (entity instanceof EntityItem) {
|
||||
EntityItem entityItem = (EntityItem)entity;
|
||||
EntityItem entityItem = (EntityItem) entity;
|
||||
ItemStack itemStack = entityItem.getEntityItem();
|
||||
return this.isFiltering(itemStack);
|
||||
}
|
||||
|
@ -82,4 +91,3 @@ extends TileEntityFilterable {
|
|||
return dir != this.getDirection();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package assemblyline.common.machine.armbot;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import assemblyline.client.render.BlockRenderingHandler;
|
||||
import assemblyline.common.TabAssemblyLine;
|
||||
import assemblyline.common.block.BlockALMachine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -15,8 +16,7 @@ import universalelectricity.core.UniversalElectricity;
|
|||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.multiblock.IMultiBlock;
|
||||
|
||||
public class BlockArmbot
|
||||
extends BlockALMachine {
|
||||
public class BlockArmbot extends BlockALMachine {
|
||||
public BlockArmbot() {
|
||||
super(UniversalElectricity.machine);
|
||||
this.setBlockName("armbot");
|
||||
|
@ -27,15 +27,25 @@ extends BlockALMachine {
|
|||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity instanceof IMultiBlock) {
|
||||
((IMultiBlock)tileEntity).onCreate(new Vector3(x, y, z));
|
||||
((IMultiBlock) tileEntity).onCreate(new Vector3(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
|
||||
public boolean onMachineActivated(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer player,
|
||||
int par6,
|
||||
float par7,
|
||||
float par8,
|
||||
float par9
|
||||
) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity instanceof IMultiBlock) {
|
||||
return ((IMultiBlock)tileEntity).onActivated(player);
|
||||
return ((IMultiBlock) tileEntity).onActivated(player);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -44,7 +54,7 @@ extends BlockALMachine {
|
|||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity instanceof IMultiBlock) {
|
||||
((IMultiBlock)tileEntity).onDestroy(tileEntity);
|
||||
((IMultiBlock) tileEntity).onDestroy(tileEntity);
|
||||
}
|
||||
this.dropBlockAsItem(world, x, y, z, new ItemStack(this));
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
|
@ -60,7 +70,7 @@ extends BlockALMachine {
|
|||
return new TileEntityArmbot();
|
||||
}
|
||||
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BlockRenderingHandler.BLOCK_RENDER_ID;
|
||||
|
@ -76,4 +86,3 @@ extends BlockALMachine {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package assemblyline.common.machine.armbot;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import assemblyline.api.IArmbot;
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.machine.TileEntityAssemblyNetwork;
|
||||
|
@ -20,10 +24,6 @@ import dan200.computercraft.api.lua.LuaException;
|
|||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import dark.library.helpers.ItemFindingHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
|
@ -47,13 +47,8 @@ import universalelectricity.core.vector.Vector3;
|
|||
import universalelectricity.prefab.TranslationHelper;
|
||||
import universalelectricity.prefab.multiblock.IMultiBlock;
|
||||
|
||||
public class TileEntityArmbot
|
||||
extends TileEntityAssemblyNetwork
|
||||
implements IMultiBlock,
|
||||
IInventory,
|
||||
IElectricityStorage,
|
||||
IArmbot,
|
||||
IPeripheral {
|
||||
public class TileEntityArmbot extends TileEntityAssemblyNetwork
|
||||
implements IMultiBlock, IInventory, IElectricityStorage, IArmbot, IPeripheral {
|
||||
private final CommandManager commandManager = new CommandManager();
|
||||
private static final int PACKET_COMMANDS = 128;
|
||||
protected ItemStack disk = null;
|
||||
|
@ -78,17 +73,20 @@ IPeripheral {
|
|||
public void onUpdate() {
|
||||
Vector3 handPosition = this.getHandPosition();
|
||||
for (Entity entity : this.grabbedEntities) {
|
||||
if (entity == null) continue;
|
||||
if (entity == null)
|
||||
continue;
|
||||
entity.setPosition(handPosition.x, handPosition.y, handPosition.z);
|
||||
entity.motionX = 0.0;
|
||||
entity.motionY = 0.0;
|
||||
entity.motionZ = 0.0;
|
||||
if (!(entity instanceof EntityItem)) continue;
|
||||
((EntityItem)entity).delayBeforeCanPickup = 20;
|
||||
((EntityItem)entity).age = 0;
|
||||
if (!(entity instanceof EntityItem))
|
||||
continue;
|
||||
((EntityItem) entity).delayBeforeCanPickup = 20;
|
||||
((EntityItem) entity).age = 0;
|
||||
}
|
||||
if (this.isRunning()) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER && this.disk == null && this.computersAttached == 0) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER
|
||||
&& this.disk == null && this.computersAttached == 0) {
|
||||
this.commandManager.clear();
|
||||
if (this.grabbedEntities.size() > 0 || this.grabbedItems.size() > 0) {
|
||||
this.addCommand(CommandDrop.class);
|
||||
|
@ -109,12 +107,13 @@ IPeripheral {
|
|||
this.displayText = "";
|
||||
} else {
|
||||
try {
|
||||
Command curCommand = (Command)this.commandManager.getCommands().get(this.commandManager.getCurrentTask());
|
||||
Command curCommand = (Command) this.commandManager.getCommands().get(
|
||||
this.commandManager.getCurrentTask()
|
||||
);
|
||||
if (curCommand != null) {
|
||||
this.displayText = curCommand.toString();
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
// empty catch block
|
||||
}
|
||||
}
|
||||
|
@ -143,15 +142,34 @@ IPeripheral {
|
|||
while (this.renderYaw > 360.0f) {
|
||||
this.renderYaw -= 360.0f;
|
||||
}
|
||||
if (this.ticks % 5L == 0L && FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
||||
this.worldObj.playSound((double)this.xCoord, (double)this.yCoord, (double)this.zCoord, "assemblyline:conveyor", 0.8f, 1.7f, true);
|
||||
if (this.ticks % 5L == 0L
|
||||
&& FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
||||
this.worldObj.playSound(
|
||||
(double) this.xCoord,
|
||||
(double) this.yCoord,
|
||||
(double) this.zCoord,
|
||||
"assemblyline:conveyor",
|
||||
0.8f,
|
||||
1.7f,
|
||||
true
|
||||
);
|
||||
}
|
||||
float f = Math.abs(this.renderYaw - this.rotationYaw);
|
||||
this.getClass();
|
||||
if (f < 1.3f + 0.1f) {
|
||||
this.renderYaw = this.rotationYaw;
|
||||
}
|
||||
for (Entity e : (List<Entity>)this.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox((double)this.xCoord, (double)(this.yCoord + 2), (double)this.zCoord, (double)(this.xCoord + 1), (double)(this.yCoord + 3), (double)(this.zCoord + 1)))) {
|
||||
for (Entity e : (List<Entity>) this.worldObj.getEntitiesWithinAABB(
|
||||
Entity.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) this.xCoord,
|
||||
(double) (this.yCoord + 2),
|
||||
(double) this.zCoord,
|
||||
(double) (this.xCoord + 1),
|
||||
(double) (this.yCoord + 3),
|
||||
(double) (this.zCoord + 1)
|
||||
)
|
||||
)) {
|
||||
e.rotationYaw = this.renderYaw;
|
||||
}
|
||||
}
|
||||
|
@ -171,15 +189,34 @@ IPeripheral {
|
|||
while (this.renderPitch > 60.0f) {
|
||||
this.renderPitch -= 60.0f;
|
||||
}
|
||||
if (this.ticks % 4L == 0L && FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
||||
this.worldObj.playSound((double)this.xCoord, (double)this.yCoord, (double)this.zCoord, "assemblyline:conveyor", 2.0f, 2.5f, true);
|
||||
if (this.ticks % 4L == 0L
|
||||
&& FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
||||
this.worldObj.playSound(
|
||||
(double) this.xCoord,
|
||||
(double) this.yCoord,
|
||||
(double) this.zCoord,
|
||||
"assemblyline:conveyor",
|
||||
2.0f,
|
||||
2.5f,
|
||||
true
|
||||
);
|
||||
}
|
||||
float f = Math.abs(this.renderPitch - this.rotationPitch);
|
||||
this.getClass();
|
||||
if (f < 1.3f + 0.1f) {
|
||||
this.renderPitch = this.rotationPitch;
|
||||
}
|
||||
for (Entity e : (List<Entity>)this.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox((double)this.xCoord, (double)(this.yCoord + 2), (double)this.zCoord, (double)(this.xCoord + 1), (double)(this.yCoord + 3), (double)(this.zCoord + 1)))) {
|
||||
for (Entity e : (List<Entity>) this.worldObj.getEntitiesWithinAABB(
|
||||
Entity.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) this.xCoord,
|
||||
(double) (this.yCoord + 2),
|
||||
(double) this.zCoord,
|
||||
(double) (this.xCoord + 1),
|
||||
(double) (this.yCoord + 3),
|
||||
(double) (this.zCoord + 1)
|
||||
)
|
||||
)) {
|
||||
e.rotationPitch = this.renderPitch;
|
||||
}
|
||||
}
|
||||
|
@ -195,14 +232,19 @@ IPeripheral {
|
|||
while (this.rotationPitch > 60.0f) {
|
||||
this.rotationPitch -= 60.0f;
|
||||
}
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER && this.ticks % 20L == 0L) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER
|
||||
&& this.ticks % 20L == 0L) {
|
||||
this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public Command getCurrentCommand() {
|
||||
if (this.commandManager.hasTasks() && this.commandManager.getCurrentTask() >= 0 && this.commandManager.getCurrentTask() < this.commandManager.getCommands().size()) {
|
||||
return (Command)this.commandManager.getCommands().get(this.commandManager.getCurrentTask());
|
||||
if (this.commandManager.hasTasks() && this.commandManager.getCurrentTask() >= 0
|
||||
&& this.commandManager.getCurrentTask()
|
||||
< this.commandManager.getCommands().size()) {
|
||||
return (Command) this.commandManager.getCommands().get(
|
||||
this.commandManager.getCurrentTask()
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -231,7 +273,9 @@ IPeripheral {
|
|||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setTag("data", data);
|
||||
nbt.setInteger("transferRange", this.powerTransferRange);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, getBlockMetadata(), nbt);
|
||||
return new S35PacketUpdateTileEntity(
|
||||
xCoord, yCoord, zCoord, getBlockMetadata(), nbt
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -299,7 +343,13 @@ IPeripheral {
|
|||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) {
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5, (double)this.yCoord + 0.5, (double)this.zCoord + 0.5) <= 64.0;
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this
|
||||
? false
|
||||
: par1EntityPlayer.getDistanceSq(
|
||||
(double) this.xCoord + 0.5,
|
||||
(double) this.yCoord + 0.5,
|
||||
(double) this.zCoord + 0.5
|
||||
) <= 64.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -320,7 +370,9 @@ IPeripheral {
|
|||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
NBTTagCompound diskNBT = nbt.getCompoundTag("disk");
|
||||
this.disk = diskNBT != null ? ItemStack.loadItemStackFromNBT((NBTTagCompound)diskNBT) : null;
|
||||
this.disk = diskNBT != null
|
||||
? ItemStack.loadItemStackFromNBT((NBTTagCompound) diskNBT)
|
||||
: null;
|
||||
this.rotationYaw = nbt.getFloat("yaw");
|
||||
this.rotationPitch = nbt.getFloat("pitch");
|
||||
if (this.worldObj != null && this.worldObj.isRemote) {
|
||||
|
@ -330,17 +382,21 @@ IPeripheral {
|
|||
NBTTagList entities = nbt.getTagList("entities", 10);
|
||||
this.grabbedEntities.clear();
|
||||
for (int i = 0; i < entities.tagCount(); ++i) {
|
||||
NBTTagCompound entityTag = (NBTTagCompound)entities.getCompoundTagAt(i);
|
||||
if (entityTag == null) continue;
|
||||
Entity entity = EntityList.createEntityFromNBT((NBTTagCompound)entityTag, (World)this.worldObj);
|
||||
NBTTagCompound entityTag = (NBTTagCompound) entities.getCompoundTagAt(i);
|
||||
if (entityTag == null)
|
||||
continue;
|
||||
Entity entity = EntityList.createEntityFromNBT(
|
||||
(NBTTagCompound) entityTag, (World) this.worldObj
|
||||
);
|
||||
this.grabbedEntities.add(entity);
|
||||
}
|
||||
NBTTagList items = nbt.getTagList("items", 10);
|
||||
this.grabbedItems.clear();
|
||||
for (int i = 0; i < items.tagCount(); ++i) {
|
||||
NBTTagCompound itemTag = (NBTTagCompound)items.getCompoundTagAt(i);
|
||||
if (itemTag == null) continue;
|
||||
ItemStack item = ItemStack.loadItemStackFromNBT((NBTTagCompound)itemTag);
|
||||
NBTTagCompound itemTag = (NBTTagCompound) items.getCompoundTagAt(i);
|
||||
if (itemTag == null)
|
||||
continue;
|
||||
ItemStack item = ItemStack.loadItemStackFromNBT((NBTTagCompound) itemTag);
|
||||
this.grabbedItems.add(item);
|
||||
}
|
||||
}
|
||||
|
@ -352,28 +408,30 @@ IPeripheral {
|
|||
if (this.disk != null) {
|
||||
this.disk.writeToNBT(diskNBT);
|
||||
}
|
||||
nbt.setTag("disk", (NBTBase)diskNBT);
|
||||
nbt.setTag("disk", (NBTBase) diskNBT);
|
||||
nbt.setFloat("yaw", this.rotationYaw);
|
||||
nbt.setFloat("pitch", this.rotationPitch);
|
||||
nbt.setString("cmdText", this.displayText);
|
||||
nbt.setInteger("curTask", this.commandManager.getCurrentTask());
|
||||
NBTTagList entities = new NBTTagList();
|
||||
for (Entity entity : this.grabbedEntities) {
|
||||
if (entity == null) continue;
|
||||
if (entity == null)
|
||||
continue;
|
||||
NBTTagCompound entityNBT = new NBTTagCompound();
|
||||
entity.writeToNBT(entityNBT);
|
||||
entity.writeToNBTOptional(entityNBT);
|
||||
entities.appendTag((NBTBase)entityNBT);
|
||||
entities.appendTag((NBTBase) entityNBT);
|
||||
}
|
||||
nbt.setTag("entities", (NBTBase)entities);
|
||||
nbt.setTag("entities", (NBTBase) entities);
|
||||
NBTTagList items = new NBTTagList();
|
||||
for (ItemStack itemStack : this.grabbedItems) {
|
||||
if (itemStack == null) continue;
|
||||
if (itemStack == null)
|
||||
continue;
|
||||
NBTTagCompound entityNBT = new NBTTagCompound();
|
||||
itemStack.writeToNBT(entityNBT);
|
||||
items.appendTag((NBTBase)entityNBT);
|
||||
items.appendTag((NBTBase) entityNBT);
|
||||
}
|
||||
nbt.setTag("items", (NBTBase)items);
|
||||
nbt.setTag("items", (NBTBase) items);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -396,14 +454,17 @@ IPeripheral {
|
|||
ItemStack containingStack = this.getStackInSlot(0);
|
||||
if (containingStack != null) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
|
||||
EntityItem dropStack = new EntityItem(this.worldObj, player.posX, player.posY, player.posZ, containingStack);
|
||||
EntityItem dropStack = new EntityItem(
|
||||
this.worldObj, player.posX, player.posY, player.posZ, containingStack
|
||||
);
|
||||
dropStack.delayBeforeCanPickup = 0;
|
||||
this.worldObj.spawnEntityInWorld((Entity)dropStack);
|
||||
this.worldObj.spawnEntityInWorld((Entity) dropStack);
|
||||
}
|
||||
this.setInventorySlotContents(0, null);
|
||||
return true;
|
||||
}
|
||||
if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemDisk) {
|
||||
if (player.getCurrentEquippedItem() != null
|
||||
&& player.getCurrentEquippedItem().getItem() instanceof ItemDisk) {
|
||||
this.setInventorySlotContents(0, player.getCurrentEquippedItem());
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
return true;
|
||||
|
@ -418,10 +479,12 @@ IPeripheral {
|
|||
for (String commandString : commands) {
|
||||
String commandName = commandString.split(" ")[0];
|
||||
Class command = Command.getCommand(commandName);
|
||||
if (command == null) continue;
|
||||
if (command == null)
|
||||
continue;
|
||||
ArrayList<String> commandParameters = new ArrayList<String>();
|
||||
for (String param : commandString.split(" ")) {
|
||||
if (param.equals(commandName)) continue;
|
||||
if (param.equals(commandName))
|
||||
continue;
|
||||
commandParameters.add(param);
|
||||
}
|
||||
this.addCommand(command, commandParameters.toArray(new String[0]));
|
||||
|
@ -448,13 +511,19 @@ IPeripheral {
|
|||
|
||||
@Override
|
||||
public void onCreate(Vector3 placedPosition) {
|
||||
AssemblyLine.blockMulti.makeFakeBlock(this.worldObj, Vector3.add(placedPosition, new Vector3(0.0, 1.0, 0.0)), placedPosition);
|
||||
AssemblyLine.blockMulti.makeFakeBlock(
|
||||
this.worldObj,
|
||||
Vector3.add(placedPosition, new Vector3(0.0, 1.0, 0.0)),
|
||||
placedPosition
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy(TileEntity callingBlock) {
|
||||
this.worldObj.setBlock(this.xCoord, this.yCoord, this.zCoord, Blocks.air, 0, 3);
|
||||
this.worldObj.setBlock(this.xCoord, this.yCoord + 1, this.zCoord, Blocks.air, 0, 3);
|
||||
this.worldObj.setBlock(
|
||||
this.xCoord, this.yCoord + 1, this.zCoord, Blocks.air, 0, 3
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -464,21 +533,27 @@ IPeripheral {
|
|||
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return new String[]{"rotateBy", "rotateTo", "grab", "drop", "reset", "isWorking", "touchingEntity", "use", "fire", "return", "clear", "isHolding"};
|
||||
return new String[] { "rotateBy", "rotateTo", "grab", "drop",
|
||||
"reset", "isWorking", "touchingEntity", "use",
|
||||
"fire", "return", "clear", "isHolding" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] callMethod( IComputerAccess computer, ILuaContext context, int method, Object[] arguments ) throws LuaException, InterruptedException {
|
||||
public Object[] callMethod(
|
||||
IComputerAccess computer, ILuaContext context, int method, Object[] arguments
|
||||
) throws LuaException, InterruptedException {
|
||||
switch (method) {
|
||||
case 0: {
|
||||
if (arguments.length > 0) {
|
||||
try {
|
||||
double yaw = (Double)arguments[0];
|
||||
double pitch = (Double)arguments[1];
|
||||
this.addCommand(CommandRotateBy.class, new String[]{Double.toString(yaw), Double.toString(pitch)});
|
||||
double yaw = (Double) arguments[0];
|
||||
double pitch = (Double) arguments[1];
|
||||
this.addCommand(
|
||||
CommandRotateBy.class,
|
||||
new String[] { Double.toString(yaw), Double.toString(pitch) }
|
||||
);
|
||||
break;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
throw new IllegalArgumentException("expected number");
|
||||
}
|
||||
|
@ -488,12 +563,14 @@ IPeripheral {
|
|||
case 1: {
|
||||
if (arguments.length > 0) {
|
||||
try {
|
||||
double yaw = (Double)arguments[0];
|
||||
double pitch = (Double)arguments[1];
|
||||
this.addCommand(CommandRotateTo.class, new String[]{Double.toString(yaw), Double.toString(pitch)});
|
||||
double yaw = (Double) arguments[0];
|
||||
double pitch = (Double) arguments[1];
|
||||
this.addCommand(
|
||||
CommandRotateTo.class,
|
||||
new String[] { Double.toString(yaw), Double.toString(pitch) }
|
||||
);
|
||||
break;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
throw new IllegalArgumentException("expected number");
|
||||
}
|
||||
|
@ -514,27 +591,40 @@ IPeripheral {
|
|||
break;
|
||||
}
|
||||
case 5: {
|
||||
return new Object[]{this.commandManager.hasTasks()};
|
||||
return new Object[] { this.commandManager.hasTasks() };
|
||||
}
|
||||
case 6: {
|
||||
Vector3 serachPosition = this.getHandPosition();
|
||||
List found = this.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox((double)(serachPosition.x - 0.5), (double)(serachPosition.y - 0.5), (double)(serachPosition.z - 0.5), (double)(serachPosition.x + 0.5), (double)(serachPosition.y + 0.5), (double)(serachPosition.z + 0.5)));
|
||||
List found = this.worldObj.getEntitiesWithinAABB(
|
||||
Entity.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) (serachPosition.x - 0.5),
|
||||
(double) (serachPosition.y - 0.5),
|
||||
(double) (serachPosition.z - 0.5),
|
||||
(double) (serachPosition.x + 0.5),
|
||||
(double) (serachPosition.y + 0.5),
|
||||
(double) (serachPosition.z + 0.5)
|
||||
)
|
||||
);
|
||||
if (found != null && found.size() > 0) {
|
||||
for (int i = 0; i < found.size(); ++i) {
|
||||
if (found.get(i) == null || found.get(i) instanceof EntityPlayer || ((Entity)found.get((int)i)).ridingEntity != null) continue;
|
||||
return new Object[]{true};
|
||||
if (found.get(i) == null || found.get(i) instanceof EntityPlayer
|
||||
|| ((Entity) found.get((int) i)).ridingEntity != null)
|
||||
continue;
|
||||
return new Object[] { true };
|
||||
}
|
||||
}
|
||||
return new Object[]{false};
|
||||
return new Object[] { false };
|
||||
}
|
||||
case 7: {
|
||||
if (arguments.length > 0) {
|
||||
try {
|
||||
int times = (Integer)arguments[0];
|
||||
this.addCommand(CommandUse.class, new String[]{Integer.toString(times)});
|
||||
int times = (Integer) arguments[0];
|
||||
this.addCommand(
|
||||
CommandUse.class, new String[] { Integer.toString(times) }
|
||||
);
|
||||
break;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
throw new IllegalArgumentException("expected number");
|
||||
}
|
||||
|
@ -545,11 +635,12 @@ IPeripheral {
|
|||
case 8: {
|
||||
if (arguments.length > 0) {
|
||||
try {
|
||||
float strength = (float)((Double)arguments[0]).doubleValue();
|
||||
this.addCommand(CommandFire.class, new String[]{Float.toString(strength)});
|
||||
float strength = (float) ((Double) arguments[0]).doubleValue();
|
||||
this.addCommand(
|
||||
CommandFire.class, new String[] { Float.toString(strength) }
|
||||
);
|
||||
break;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
throw new IllegalArgumentException("expected number");
|
||||
}
|
||||
|
@ -566,7 +657,7 @@ IPeripheral {
|
|||
break;
|
||||
}
|
||||
case 11: {
|
||||
return new Object[]{this.grabbedEntities.size() > 0};
|
||||
return new Object[] { this.grabbedEntities.size() > 0 };
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -609,7 +700,7 @@ IPeripheral {
|
|||
@Override
|
||||
public void grabEntity(Entity entity) {
|
||||
if (entity instanceof EntityItem) {
|
||||
this.grabItem(((EntityItem)entity).getEntityItem());
|
||||
this.grabItem(((EntityItem) entity).getEntityItem());
|
||||
entity.setDead();
|
||||
} else {
|
||||
this.grabbedEntities.add(entity);
|
||||
|
@ -623,14 +714,16 @@ IPeripheral {
|
|||
|
||||
@Override
|
||||
public void dropEntity(Entity entity) {
|
||||
this.grabbedEntities.remove((Object)entity);
|
||||
this.grabbedEntities.remove((Object) entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropItem(ItemStack itemStack) {
|
||||
Vector3 handPosition = this.getHandPosition();
|
||||
this.worldObj.spawnEntityInWorld((Entity)new EntityItem(this.worldObj, handPosition.x, handPosition.y, handPosition.z, itemStack));
|
||||
this.grabbedItems.remove((Object)itemStack);
|
||||
this.worldObj.spawnEntityInWorld((Entity) new EntityItem(
|
||||
this.worldObj, handPosition.x, handPosition.y, handPosition.z, itemStack
|
||||
));
|
||||
this.grabbedItems.remove((Object) itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -638,18 +731,25 @@ IPeripheral {
|
|||
Vector3 handPosition = this.getHandPosition();
|
||||
Iterator it = this.grabbedItems.iterator();
|
||||
while (it.hasNext()) {
|
||||
ItemFindingHelper.dropItemStackExact(this.worldObj, handPosition.x, handPosition.y, handPosition.z, (ItemStack)it.next());
|
||||
ItemFindingHelper.dropItemStackExact(
|
||||
this.worldObj,
|
||||
handPosition.x,
|
||||
handPosition.y,
|
||||
handPosition.z,
|
||||
(ItemStack) it.next()
|
||||
);
|
||||
}
|
||||
this.grabbedEntities.clear();
|
||||
this.grabbedItems.clear();
|
||||
}
|
||||
|
||||
public boolean isProvidingPowerSide(ForgeDirection dir) {
|
||||
return this.isProvidingPower && dir.getOpposite() == this.getFacingDirectionFromAngle();
|
||||
return this.isProvidingPower
|
||||
&& dir.getOpposite() == this.getFacingDirectionFromAngle();
|
||||
}
|
||||
|
||||
public ForgeDirection getFacingDirectionFromAngle() {
|
||||
float angle = MathHelper.wrapAngleTo180_float((float)this.rotationYaw);
|
||||
float angle = MathHelper.wrapAngleTo180_float((float) this.rotationYaw);
|
||||
if (angle >= -45.0f && angle <= 45.0f) {
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
|
@ -681,4 +781,3 @@ IPeripheral {
|
|||
return super.equals(other);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package assemblyline.common.machine.belt;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import assemblyline.client.render.BlockRenderingHandler;
|
||||
import assemblyline.common.TabAssemblyLine;
|
||||
import assemblyline.common.block.BlockALMachine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -20,8 +21,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
|
||||
public class BlockConveyorBelt
|
||||
extends BlockALMachine {
|
||||
public class BlockConveyorBelt extends BlockALMachine {
|
||||
public BlockConveyorBelt() {
|
||||
super(UniversalElectricity.machine);
|
||||
this.setBlockName("conveyorBelt");
|
||||
|
@ -32,8 +32,10 @@ extends BlockALMachine {
|
|||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
if (world.getTileEntity(x, y, z) instanceof TileEntityConveyorBelt) {
|
||||
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt)world.getTileEntity(x, y, z);
|
||||
if (tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.UP || tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.DOWN) {
|
||||
TileEntityConveyorBelt tileEntity
|
||||
= (TileEntityConveyorBelt) world.getTileEntity(x, y, z);
|
||||
if (tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.UP
|
||||
|| tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.DOWN) {
|
||||
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.96f, 1.0f);
|
||||
return;
|
||||
}
|
||||
|
@ -46,49 +48,144 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
public AxisAlignedBB
|
||||
getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
TileEntity t = world.getTileEntity(x, y, z);
|
||||
if (t != null && t instanceof TileEntityConveyorBelt) {
|
||||
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt)t;
|
||||
if (tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.UP || tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.DOWN) {
|
||||
return AxisAlignedBB.getBoundingBox((double)x + this.minX, (double)y + this.minY, (double)z + this.minZ, (double)x + 1.0, (double)y + 1.0, (double)z + 1.0);
|
||||
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) t;
|
||||
if (tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.UP
|
||||
|| tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.DOWN) {
|
||||
return AxisAlignedBB.getBoundingBox(
|
||||
(double) x + this.minX,
|
||||
(double) y + this.minY,
|
||||
(double) z + this.minZ,
|
||||
(double) x + 1.0,
|
||||
(double) y + 1.0,
|
||||
(double) z + 1.0
|
||||
);
|
||||
}
|
||||
if (tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.TOP) {
|
||||
return AxisAlignedBB.getBoundingBox((double)x + this.minX, (double)y + (double)0.68f, (double)z + this.minZ, (double)x + this.maxX, (double)y + (double)0.98f, (double)z + this.maxZ);
|
||||
return AxisAlignedBB.getBoundingBox(
|
||||
(double) x + this.minX,
|
||||
(double) y + (double) 0.68f,
|
||||
(double) z + this.minZ,
|
||||
(double) x + this.maxX,
|
||||
(double) y + (double) 0.98f,
|
||||
(double) z + this.maxZ
|
||||
);
|
||||
}
|
||||
}
|
||||
return AxisAlignedBB.getBoundingBox((double)x + this.minX, (double)y + this.minY, (double)z + this.minZ, (double)x + this.maxX, (double)y + this.maxY, (double)z + this.maxZ);
|
||||
return AxisAlignedBB.getBoundingBox(
|
||||
(double) x + this.minX,
|
||||
(double) y + this.minY,
|
||||
(double) z + this.minZ,
|
||||
(double) x + this.maxX,
|
||||
(double) y + this.maxY,
|
||||
(double) z + this.maxZ
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) {
|
||||
public void addCollisionBoxesToList(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
AxisAlignedBB par5AxisAlignedBB,
|
||||
List par6List,
|
||||
Entity par7Entity
|
||||
) {
|
||||
AxisAlignedBB newBounds;
|
||||
TileEntity t = world.getTileEntity(x, y, z);
|
||||
if (t != null && t instanceof TileEntityConveyorBelt) {
|
||||
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt)t;
|
||||
if (tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.UP || tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.DOWN) {
|
||||
AxisAlignedBB boundBottom = AxisAlignedBB.getBoundingBox((double)x, (double)y, (double)z, (double)(x + 1), (double)y + 0.3, (double)(z + 1));
|
||||
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) t;
|
||||
if (tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.UP
|
||||
|| tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.DOWN) {
|
||||
AxisAlignedBB boundBottom = AxisAlignedBB.getBoundingBox(
|
||||
(double) x,
|
||||
(double) y,
|
||||
(double) z,
|
||||
(double) (x + 1),
|
||||
(double) y + 0.3,
|
||||
(double) (z + 1)
|
||||
);
|
||||
AxisAlignedBB boundTop = null;
|
||||
ForgeDirection direction = tileEntity.getDirection();
|
||||
if (tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.UP) {
|
||||
if (direction.offsetX > 0) {
|
||||
boundTop = AxisAlignedBB.getBoundingBox((double)((float)x + (float)direction.offsetX / 2.0f), (double)y, (double)z, (double)(x + 1), (double)y + 0.8, (double)(z + 1));
|
||||
boundTop = AxisAlignedBB.getBoundingBox(
|
||||
(double) ((float) x + (float) direction.offsetX / 2.0f),
|
||||
(double) y,
|
||||
(double) z,
|
||||
(double) (x + 1),
|
||||
(double) y + 0.8,
|
||||
(double) (z + 1)
|
||||
);
|
||||
} else if (direction.offsetX < 0) {
|
||||
boundTop = AxisAlignedBB.getBoundingBox((double)x, (double)y, (double)z, (double)((float)x + (float)direction.offsetX / -2.0f), (double)y + 0.8, (double)(z + 1));
|
||||
boundTop = AxisAlignedBB.getBoundingBox(
|
||||
(double) x,
|
||||
(double) y,
|
||||
(double) z,
|
||||
(double) ((float) x + (float) direction.offsetX / -2.0f),
|
||||
(double) y + 0.8,
|
||||
(double) (z + 1)
|
||||
);
|
||||
} else if (direction.offsetZ > 0) {
|
||||
boundTop = AxisAlignedBB.getBoundingBox((double)x, (double)y, (double)((float)z + (float)direction.offsetZ / 2.0f), (double)(x + 1), (double)y + 0.8, (double)(z + 1));
|
||||
boundTop = AxisAlignedBB.getBoundingBox(
|
||||
(double) x,
|
||||
(double) y,
|
||||
(double) ((float) z + (float) direction.offsetZ / 2.0f),
|
||||
(double) (x + 1),
|
||||
(double) y + 0.8,
|
||||
(double) (z + 1)
|
||||
);
|
||||
} else if (direction.offsetZ < 0) {
|
||||
boundTop = AxisAlignedBB.getBoundingBox((double)x, (double)y, (double)z, (double)(x + 1), (double)y + 0.8, (double)((float)z + (float)direction.offsetZ / -2.0f));
|
||||
boundTop = AxisAlignedBB.getBoundingBox(
|
||||
(double) x,
|
||||
(double) y,
|
||||
(double) z,
|
||||
(double) (x + 1),
|
||||
(double) y + 0.8,
|
||||
(double) ((float) z + (float) direction.offsetZ / -2.0f)
|
||||
);
|
||||
}
|
||||
} else if (tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.DOWN) {
|
||||
if (direction.offsetX > 0) {
|
||||
boundTop = AxisAlignedBB.getBoundingBox((double)x, (double)y, (double)z, (double)((float)x + (float)direction.offsetX / 2.0f), (double)y + 0.8, (double)(z + 1));
|
||||
boundTop = AxisAlignedBB.getBoundingBox(
|
||||
(double) x,
|
||||
(double) y,
|
||||
(double) z,
|
||||
(double) ((float) x + (float) direction.offsetX / 2.0f),
|
||||
(double) y + 0.8,
|
||||
(double) (z + 1)
|
||||
);
|
||||
} else if (direction.offsetX < 0) {
|
||||
boundTop = AxisAlignedBB.getBoundingBox((double)((float)x + (float)direction.offsetX / -2.0f), (double)y, (double)z, (double)(x + 1), (double)y + 0.8, (double)(z + 1));
|
||||
boundTop = AxisAlignedBB.getBoundingBox(
|
||||
(double) ((float) x + (float) direction.offsetX / -2.0f),
|
||||
(double) y,
|
||||
(double) z,
|
||||
(double) (x + 1),
|
||||
(double) y + 0.8,
|
||||
(double) (z + 1)
|
||||
);
|
||||
} else if (direction.offsetZ > 0) {
|
||||
boundTop = AxisAlignedBB.getBoundingBox((double)x, (double)y, (double)z, (double)(x + 1), (double)y + 0.8, (double)((float)z + (float)direction.offsetZ / 2.0f));
|
||||
boundTop = AxisAlignedBB.getBoundingBox(
|
||||
(double) x,
|
||||
(double) y,
|
||||
(double) z,
|
||||
(double) (x + 1),
|
||||
(double) y + 0.8,
|
||||
(double) ((float) z + (float) direction.offsetZ / 2.0f)
|
||||
);
|
||||
} else if (direction.offsetZ < 0) {
|
||||
boundTop = AxisAlignedBB.getBoundingBox((double)x, (double)y, (double)((float)z + (float)direction.offsetZ / -2.0f), (double)(x + 1), (double)y + 0.8, (double)(z + 1));
|
||||
boundTop = AxisAlignedBB.getBoundingBox(
|
||||
(double) x,
|
||||
(double) y,
|
||||
(double) ((float) z + (float) direction.offsetZ / -2.0f),
|
||||
(double) (x + 1),
|
||||
(double) y + 0.8,
|
||||
(double) (z + 1)
|
||||
);
|
||||
}
|
||||
}
|
||||
if (par5AxisAlignedBB.intersectsWith(boundBottom)) {
|
||||
|
@ -100,21 +197,45 @@ extends BlockALMachine {
|
|||
return;
|
||||
}
|
||||
if (tileEntity.getSlant() == TileEntityConveyorBelt.SlantType.TOP) {
|
||||
AxisAlignedBB newBounds2 = AxisAlignedBB.getBoundingBox((double)x, (double)y + 0.68, (double)z, (double)(x + 1), (double)y + 0.98, (double)(z + 1));
|
||||
AxisAlignedBB newBounds2 = AxisAlignedBB.getBoundingBox(
|
||||
(double) x,
|
||||
(double) y + 0.68,
|
||||
(double) z,
|
||||
(double) (x + 1),
|
||||
(double) y + 0.98,
|
||||
(double) (z + 1)
|
||||
);
|
||||
if (newBounds2 != null && par5AxisAlignedBB.intersectsWith(newBounds2)) {
|
||||
par6List.add(newBounds2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((newBounds = AxisAlignedBB.getBoundingBox((double)x, (double)y, (double)z, (double)(x + 1), (double)y + 0.3, (double)(z + 1))) != null && par5AxisAlignedBB.intersectsWith(newBounds)) {
|
||||
if ((newBounds = AxisAlignedBB.getBoundingBox(
|
||||
(double) x,
|
||||
(double) y,
|
||||
(double) z,
|
||||
(double) (x + 1),
|
||||
(double) y + 0.3,
|
||||
(double) (z + 1)
|
||||
)) != null
|
||||
&& par5AxisAlignedBB.intersectsWith(newBounds)) {
|
||||
par6List.add(newBounds);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase par5EntityLiving, ItemStack stack) {
|
||||
int angle = MathHelper.floor_double((double)((double)(par5EntityLiving.rotationYaw * 4.0f / 360.0f) + 0.5)) & 3;
|
||||
public void onBlockPlacedBy(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityLivingBase par5EntityLiving,
|
||||
ItemStack stack
|
||||
) {
|
||||
int angle = MathHelper.floor_double((double
|
||||
) ((double) (par5EntityLiving.rotationYaw * 4.0f / 360.0f) + 0.5))
|
||||
& 3;
|
||||
int change = 2;
|
||||
switch (angle) {
|
||||
case 0: {
|
||||
|
@ -137,7 +258,17 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onUseWrench(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer par5EntityPlayer,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ
|
||||
) {
|
||||
int original = world.getBlockMetadata(x, y, z);
|
||||
int change = 2;
|
||||
switch (original) {
|
||||
|
@ -162,8 +293,19 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt)world.getTileEntity(x, y, z);
|
||||
public boolean onSneakUseWrench(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer par5EntityPlayer,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ
|
||||
) {
|
||||
TileEntityConveyorBelt tileEntity
|
||||
= (TileEntityConveyorBelt) world.getTileEntity(x, y, z);
|
||||
int slantOrdinal = tileEntity.getSlant().ordinal() + 1;
|
||||
if (slantOrdinal >= TileEntityConveyorBelt.SlantType.values().length) {
|
||||
slantOrdinal = 0;
|
||||
|
@ -173,10 +315,12 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt)world.getTileEntity(x, y, z);
|
||||
public void
|
||||
onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
TileEntityConveyorBelt tileEntity
|
||||
= (TileEntityConveyorBelt) world.getTileEntity(x, y, z);
|
||||
tileEntity.updatePowerTransferRange();
|
||||
if (tileEntity.IgnoreList.contains((Object)entity)) {
|
||||
if (tileEntity.IgnoreList.contains((Object) entity)) {
|
||||
return;
|
||||
}
|
||||
if (tileEntity.isRunning() && !world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||
|
@ -190,32 +334,48 @@ extends BlockALMachine {
|
|||
acceleration *= 5.0f;
|
||||
maxSpeed *= 10.0f;
|
||||
}
|
||||
entity.addVelocity((double)((float)direction.offsetX * acceleration), 0.0, (double)((float)direction.offsetZ * acceleration));
|
||||
if (direction.offsetX != 0 && Math.abs(entity.motionX) > (double)maxSpeed) {
|
||||
entity.motionX = (float)direction.offsetX * maxSpeed;
|
||||
entity.addVelocity(
|
||||
(double) ((float) direction.offsetX * acceleration),
|
||||
0.0,
|
||||
(double) ((float) direction.offsetZ * acceleration)
|
||||
);
|
||||
if (direction.offsetX != 0 && Math.abs(entity.motionX) > (double) maxSpeed) {
|
||||
entity.motionX = (float) direction.offsetX * maxSpeed;
|
||||
entity.motionZ = 0.0;
|
||||
}
|
||||
if (direction.offsetZ != 0 && Math.abs(entity.motionZ) > (double)maxSpeed) {
|
||||
entity.motionZ = (float)direction.offsetZ * maxSpeed;
|
||||
if (direction.offsetZ != 0 && Math.abs(entity.motionZ) > (double) maxSpeed) {
|
||||
entity.motionZ = (float) direction.offsetZ * maxSpeed;
|
||||
entity.motionX = 0.0;
|
||||
}
|
||||
entity.motionY += (double)0.0125f;
|
||||
entity.motionY += (double) 0.0125f;
|
||||
if (entity instanceof EntityItem) {
|
||||
double difference;
|
||||
if (direction.offsetX != 0) {
|
||||
difference = (double)z + 0.5 - entity.posZ;
|
||||
difference = (double) z + 0.5 - entity.posZ;
|
||||
entity.motionZ += difference * 0.1;
|
||||
} else if (direction.offsetZ != 0) {
|
||||
difference = (double)x + 0.5 - entity.posX;
|
||||
difference = (double) x + 0.5 - entity.posX;
|
||||
entity.motionX += difference * 0.1;
|
||||
}
|
||||
++((EntityItem)entity).age;
|
||||
++((EntityItem) entity).age;
|
||||
boolean foundSneaking = false;
|
||||
for (EntityPlayer player : (List<EntityPlayer>) world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox((double)(x - 1), (double)(y - 1), (double)(z - 1), (double)(x + 1), (double)(y + 1), (double)(z + 1)))) {
|
||||
if (!player.isSneaking()) continue;
|
||||
for (EntityPlayer player :
|
||||
(List<EntityPlayer>) world.getEntitiesWithinAABB(
|
||||
EntityPlayer.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) (x - 1),
|
||||
(double) (y - 1),
|
||||
(double) (z - 1),
|
||||
(double) (x + 1),
|
||||
(double) (y + 1),
|
||||
(double) (z + 1)
|
||||
)
|
||||
)) {
|
||||
if (!player.isSneaking())
|
||||
continue;
|
||||
foundSneaking = true;
|
||||
}
|
||||
((EntityItem)entity).delayBeforeCanPickup = foundSneaking ? 0 : 20;
|
||||
((EntityItem) entity).delayBeforeCanPickup = foundSneaking ? 0 : 20;
|
||||
entity.onGround = false;
|
||||
}
|
||||
if (slantType == TileEntityConveyorBelt.SlantType.UP) {
|
||||
|
@ -234,7 +394,7 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public int getRenderType() {
|
||||
return BlockRenderingHandler.BLOCK_RENDER_ID;
|
||||
}
|
||||
|
@ -254,4 +414,3 @@ extends BlockALMachine {
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
package assemblyline.common.machine.belt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import assemblyline.api.IBelt;
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.machine.TileEntityAssemblyNetwork;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
|
@ -22,9 +21,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import universalelectricity.prefab.implement.IRotatable;
|
||||
|
||||
public class TileEntityConveyorBelt
|
||||
extends TileEntityAssemblyNetwork
|
||||
implements IBelt,
|
||||
IRotatable {
|
||||
extends TileEntityAssemblyNetwork implements IBelt, IRotatable {
|
||||
public static final int MAX_FRAME = 13;
|
||||
public static final int MAX_SLANT_FRAME = 23;
|
||||
public final float acceleration = 0.01f;
|
||||
|
@ -39,11 +36,18 @@ IRotatable {
|
|||
ForgeDirection direction;
|
||||
int maximumTransferRange = 0;
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
direction = ForgeDirection.getOrientation((int)i);
|
||||
TileEntity tileEntity = this.worldObj.getTileEntity(this.xCoord + direction.offsetX, this.yCoord + direction.offsetY, this.zCoord + direction.offsetZ);
|
||||
if (tileEntity == null || !(tileEntity instanceof TileEntityAssemblyNetwork)) continue;
|
||||
TileEntityAssemblyNetwork assemblyNetwork = (TileEntityAssemblyNetwork)tileEntity;
|
||||
if (assemblyNetwork.powerTransferRange <= maximumTransferRange) continue;
|
||||
direction = ForgeDirection.getOrientation((int) i);
|
||||
TileEntity tileEntity = this.worldObj.getTileEntity(
|
||||
this.xCoord + direction.offsetX,
|
||||
this.yCoord + direction.offsetY,
|
||||
this.zCoord + direction.offsetZ
|
||||
);
|
||||
if (tileEntity == null || !(tileEntity instanceof TileEntityAssemblyNetwork))
|
||||
continue;
|
||||
TileEntityAssemblyNetwork assemblyNetwork
|
||||
= (TileEntityAssemblyNetwork) tileEntity;
|
||||
if (assemblyNetwork.powerTransferRange <= maximumTransferRange)
|
||||
continue;
|
||||
maximumTransferRange = assemblyNetwork.powerTransferRange;
|
||||
}
|
||||
for (int d = 0; d <= 1; ++d) {
|
||||
|
@ -52,10 +56,18 @@ IRotatable {
|
|||
direction = direction.getOpposite();
|
||||
}
|
||||
for (int i = -1; i <= 1; ++i) {
|
||||
TileEntity tileEntity = this.worldObj.getTileEntity(this.xCoord + direction.offsetX, this.yCoord + i, this.zCoord + direction.offsetZ);
|
||||
if (tileEntity == null || !(tileEntity instanceof TileEntityAssemblyNetwork)) continue;
|
||||
TileEntityAssemblyNetwork assemblyNetwork = (TileEntityAssemblyNetwork)tileEntity;
|
||||
if (assemblyNetwork.powerTransferRange <= maximumTransferRange) continue;
|
||||
TileEntity tileEntity = this.worldObj.getTileEntity(
|
||||
this.xCoord + direction.offsetX,
|
||||
this.yCoord + i,
|
||||
this.zCoord + direction.offsetZ
|
||||
);
|
||||
if (tileEntity == null
|
||||
|| !(tileEntity instanceof TileEntityAssemblyNetwork))
|
||||
continue;
|
||||
TileEntityAssemblyNetwork assemblyNetwork
|
||||
= (TileEntityAssemblyNetwork) tileEntity;
|
||||
if (assemblyNetwork.powerTransferRange <= maximumTransferRange)
|
||||
continue;
|
||||
maximumTransferRange = assemblyNetwork.powerTransferRange;
|
||||
}
|
||||
}
|
||||
|
@ -64,18 +76,35 @@ IRotatable {
|
|||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER && this.ticks % 10L == 0L) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER
|
||||
&& this.ticks % 10L == 0L) {
|
||||
this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
ArrayList<Entity> newList = new ArrayList<Entity>();
|
||||
for (Entity ent : this.IgnoreList) {
|
||||
if (!this.getAffectedEntities().contains((Object)ent)) continue;
|
||||
if (!this.getAffectedEntities().contains((Object) ent))
|
||||
continue;
|
||||
newList.add(ent);
|
||||
}
|
||||
this.IgnoreList = newList;
|
||||
if (this.isRunning() && !this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord)) {
|
||||
if (this.ticks % 10L == 0L && this.worldObj.isRemote && this.worldObj.getBlock(this.xCoord - 1, this.yCoord, this.zCoord) != AssemblyLine.blockConveyorBelt && this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord - 1) != AssemblyLine.blockConveyorBelt) {
|
||||
this.worldObj.playSound((double)this.xCoord, (double)this.yCoord, (double)this.zCoord, "assemblyline:conveyor", 0.5f, 0.7f, true);
|
||||
if (this.isRunning()
|
||||
&& !this.worldObj.isBlockIndirectlyGettingPowered(
|
||||
this.xCoord, this.yCoord, this.zCoord
|
||||
)) {
|
||||
if (this.ticks % 10L == 0L && this.worldObj.isRemote
|
||||
&& this.worldObj.getBlock(this.xCoord - 1, this.yCoord, this.zCoord)
|
||||
!= AssemblyLine.blockConveyorBelt
|
||||
&& this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord - 1)
|
||||
!= AssemblyLine.blockConveyorBelt) {
|
||||
this.worldObj.playSound(
|
||||
(double) this.xCoord,
|
||||
(double) this.yCoord,
|
||||
(double) this.zCoord,
|
||||
"assemblyline:conveyor",
|
||||
0.5f,
|
||||
0.7f,
|
||||
true
|
||||
);
|
||||
}
|
||||
this.wheelRotation += 40.0f;
|
||||
if (this.wheelRotation > 360.0f) {
|
||||
|
@ -83,7 +112,7 @@ IRotatable {
|
|||
}
|
||||
float wheelRotPct = this.wheelRotation / 360.0f;
|
||||
if (this.getSlant() == SlantType.NONE || this.getSlant() == SlantType.TOP) {
|
||||
this.animFrame = (int)(wheelRotPct * 13.0f);
|
||||
this.animFrame = (int) (wheelRotPct * 13.0f);
|
||||
if (this.animFrame < 0) {
|
||||
this.animFrame = 0;
|
||||
}
|
||||
|
@ -91,7 +120,7 @@ IRotatable {
|
|||
this.animFrame = 13;
|
||||
}
|
||||
} else {
|
||||
this.animFrame = (int)(wheelRotPct * 23.0f);
|
||||
this.animFrame = (int) (wheelRotPct * 23.0f);
|
||||
if (this.animFrame < 0) {
|
||||
this.animFrame = 0;
|
||||
}
|
||||
|
@ -112,7 +141,9 @@ IRotatable {
|
|||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setDouble("wattsReceived", this.wattsReceived);
|
||||
nbt.setInteger("slantType", this.slantType.ordinal());
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, getBlockMetadata(), nbt);
|
||||
return new S35PacketUpdateTileEntity(
|
||||
xCoord, yCoord, zCoord, getBlockMetadata(), nbt
|
||||
);
|
||||
}
|
||||
|
||||
public SlantType getSlant() {
|
||||
|
@ -130,11 +161,19 @@ IRotatable {
|
|||
public boolean getIsFirstBelt() {
|
||||
ForgeDirection front = this.getDirection();
|
||||
ForgeDirection back = this.getDirection().getOpposite();
|
||||
TileEntity fBelt = this.worldObj.getTileEntity(this.xCoord + front.offsetX, this.yCoord + front.offsetY, this.zCoord + front.offsetZ);
|
||||
TileEntity BBelt = this.worldObj.getTileEntity(this.xCoord + back.offsetX, this.yCoord + back.offsetY, this.zCoord + back.offsetZ);
|
||||
TileEntity fBelt = this.worldObj.getTileEntity(
|
||||
this.xCoord + front.offsetX,
|
||||
this.yCoord + front.offsetY,
|
||||
this.zCoord + front.offsetZ
|
||||
);
|
||||
TileEntity BBelt = this.worldObj.getTileEntity(
|
||||
this.xCoord + back.offsetX,
|
||||
this.yCoord + back.offsetY,
|
||||
this.zCoord + back.offsetZ
|
||||
);
|
||||
if (fBelt instanceof TileEntityConveyorBelt) {
|
||||
ForgeDirection TD;
|
||||
ForgeDirection fD = ((TileEntityConveyorBelt)fBelt).getDirection();
|
||||
ForgeDirection fD = ((TileEntityConveyorBelt) fBelt).getDirection();
|
||||
return fD == (TD = this.getDirection());
|
||||
}
|
||||
return false;
|
||||
|
@ -143,11 +182,20 @@ IRotatable {
|
|||
public boolean getIsMiddleBelt() {
|
||||
ForgeDirection front = this.getDirection();
|
||||
ForgeDirection back = this.getDirection().getOpposite();
|
||||
TileEntity fBelt = this.worldObj.getTileEntity(this.xCoord + front.offsetX, this.yCoord + front.offsetY, this.zCoord + front.offsetZ);
|
||||
TileEntity BBelt = this.worldObj.getTileEntity(this.xCoord + back.offsetX, this.yCoord + back.offsetY, this.zCoord + back.offsetZ);
|
||||
if (fBelt instanceof TileEntityConveyorBelt && BBelt instanceof TileEntityConveyorBelt) {
|
||||
ForgeDirection fD = ((TileEntityConveyorBelt)fBelt).getDirection();
|
||||
ForgeDirection BD = ((TileEntityConveyorBelt)BBelt).getDirection();
|
||||
TileEntity fBelt = this.worldObj.getTileEntity(
|
||||
this.xCoord + front.offsetX,
|
||||
this.yCoord + front.offsetY,
|
||||
this.zCoord + front.offsetZ
|
||||
);
|
||||
TileEntity BBelt = this.worldObj.getTileEntity(
|
||||
this.xCoord + back.offsetX,
|
||||
this.yCoord + back.offsetY,
|
||||
this.zCoord + back.offsetZ
|
||||
);
|
||||
if (fBelt instanceof TileEntityConveyorBelt
|
||||
&& BBelt instanceof TileEntityConveyorBelt) {
|
||||
ForgeDirection fD = ((TileEntityConveyorBelt) fBelt).getDirection();
|
||||
ForgeDirection BD = ((TileEntityConveyorBelt) BBelt).getDirection();
|
||||
ForgeDirection TD = this.getDirection();
|
||||
return fD == TD && BD == TD;
|
||||
}
|
||||
|
@ -157,11 +205,19 @@ IRotatable {
|
|||
public boolean getIsLastBelt() {
|
||||
ForgeDirection front = this.getDirection();
|
||||
ForgeDirection back = this.getDirection().getOpposite();
|
||||
TileEntity fBelt = this.worldObj.getTileEntity(this.xCoord + front.offsetX, this.yCoord + front.offsetY, this.zCoord + front.offsetZ);
|
||||
TileEntity BBelt = this.worldObj.getTileEntity(this.xCoord + back.offsetX, this.yCoord + back.offsetY, this.zCoord + back.offsetZ);
|
||||
TileEntity fBelt = this.worldObj.getTileEntity(
|
||||
this.xCoord + front.offsetX,
|
||||
this.yCoord + front.offsetY,
|
||||
this.zCoord + front.offsetZ
|
||||
);
|
||||
TileEntity BBelt = this.worldObj.getTileEntity(
|
||||
this.xCoord + back.offsetX,
|
||||
this.yCoord + back.offsetY,
|
||||
this.zCoord + back.offsetZ
|
||||
);
|
||||
if (BBelt instanceof TileEntityConveyorBelt) {
|
||||
ForgeDirection TD;
|
||||
ForgeDirection BD = ((TileEntityConveyorBelt)BBelt).getDirection();
|
||||
ForgeDirection BD = ((TileEntityConveyorBelt) BBelt).getDirection();
|
||||
return BD == (TD = this.getDirection());
|
||||
}
|
||||
return false;
|
||||
|
@ -177,39 +233,57 @@ IRotatable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setDirection(World world, int x, int y, int z, ForgeDirection facingDirection) {
|
||||
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, facingDirection.ordinal(), 3);
|
||||
public void
|
||||
setDirection(World world, int x, int y, int z, ForgeDirection facingDirection) {
|
||||
this.worldObj.setBlockMetadataWithNotify(
|
||||
this.xCoord, this.yCoord, this.zCoord, facingDirection.ordinal(), 3
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getDirection(IBlockAccess world, int x, int y, int z) {
|
||||
return ForgeDirection.getOrientation((int)this.getBlockMetadata());
|
||||
return ForgeDirection.getOrientation((int) this.getBlockMetadata());
|
||||
}
|
||||
|
||||
public ForgeDirection getDirection() {
|
||||
return this.getDirection((IBlockAccess)this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
||||
return this.getDirection(
|
||||
(IBlockAccess) this.worldObj, this.xCoord, this.yCoord, this.zCoord
|
||||
);
|
||||
}
|
||||
|
||||
public void setDirection(ForgeDirection facingDirection) {
|
||||
this.setDirection(this.worldObj, this.xCoord, this.yCoord, this.zCoord, facingDirection);
|
||||
this.setDirection(
|
||||
this.worldObj, this.xCoord, this.yCoord, this.zCoord, facingDirection
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getAffectedEntities() {
|
||||
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox((double)this.xCoord, (double)this.yCoord, (double)this.zCoord, (double)(this.xCoord + 1), (double)(this.yCoord + 1), (double)(this.zCoord + 1));
|
||||
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(
|
||||
(double) this.xCoord,
|
||||
(double) this.yCoord,
|
||||
(double) this.zCoord,
|
||||
(double) (this.xCoord + 1),
|
||||
(double) (this.yCoord + 1),
|
||||
(double) (this.zCoord + 1)
|
||||
);
|
||||
return this.worldObj.getEntitiesWithinAABB(Entity.class, bounds);
|
||||
}
|
||||
|
||||
public int getAnimationFrame() {
|
||||
if (!this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord)) {
|
||||
if (!this.worldObj.isBlockIndirectlyGettingPowered(
|
||||
this.xCoord, this.yCoord, this.zCoord
|
||||
)) {
|
||||
TileEntity te = null;
|
||||
te = this.worldObj.getTileEntity(this.xCoord - 1, this.yCoord, this.zCoord);
|
||||
if (te != null && te instanceof TileEntityConveyorBelt && ((TileEntityConveyorBelt)te).getSlant() == this.slantType) {
|
||||
return ((TileEntityConveyorBelt)te).getAnimationFrame();
|
||||
if (te != null && te instanceof TileEntityConveyorBelt
|
||||
&& ((TileEntityConveyorBelt) te).getSlant() == this.slantType) {
|
||||
return ((TileEntityConveyorBelt) te).getAnimationFrame();
|
||||
}
|
||||
te = this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord - 1);
|
||||
if (te != null && te instanceof TileEntityConveyorBelt && ((TileEntityConveyorBelt)te).getSlant() == this.slantType) {
|
||||
return ((TileEntityConveyorBelt)te).getAnimationFrame();
|
||||
if (te != null && te instanceof TileEntityConveyorBelt
|
||||
&& ((TileEntityConveyorBelt) te).getSlant() == this.slantType) {
|
||||
return ((TileEntityConveyorBelt) te).getAnimationFrame();
|
||||
}
|
||||
}
|
||||
return this.animFrame;
|
||||
|
@ -220,22 +294,27 @@ IRotatable {
|
|||
super.readFromNBT(nbt);
|
||||
this.slantType = SlantType.values()[nbt.getByte("slant")];
|
||||
if (this.worldObj != null) {
|
||||
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, nbt.getInteger("rotation"), 3);
|
||||
this.worldObj.setBlockMetadataWithNotify(
|
||||
this.xCoord, this.yCoord, this.zCoord, nbt.getInteger("rotation"), 3
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setByte("slant", (byte)this.slantType.ordinal());
|
||||
nbt.setByte("slant", (byte) this.slantType.ordinal());
|
||||
if (this.worldObj != null) {
|
||||
nbt.setInteger("rotation", this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord));
|
||||
nbt.setInteger(
|
||||
"rotation",
|
||||
this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void IgnoreEntity(Entity entity) {
|
||||
if (!this.IgnoreList.contains((Object)entity)) {
|
||||
if (!this.IgnoreList.contains((Object) entity)) {
|
||||
this.IgnoreList.add(entity);
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +329,5 @@ IRotatable {
|
|||
UP,
|
||||
DOWN,
|
||||
TOP;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
package assemblyline.common.machine.belt;
|
||||
|
||||
public class TileEntityCoveredBelt
|
||||
extends TileEntityConveyorBelt {
|
||||
}
|
||||
|
||||
public class TileEntityCoveredBelt extends TileEntityConveyorBelt {}
|
||||
|
|
|
@ -2,10 +2,10 @@ package assemblyline.common.machine.belt;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityElevatorBelt
|
||||
extends TileEntityConveyorBelt {
|
||||
public class TileEntityElevatorBelt extends TileEntityConveyorBelt {
|
||||
public List conveyList = new ArrayList();
|
||||
|
||||
public void doBeltAction() {
|
||||
|
@ -13,11 +13,10 @@ extends TileEntityConveyorBelt {
|
|||
}
|
||||
|
||||
public boolean isBellowABelt() {
|
||||
TileEntity ent = this.worldObj.getTileEntity(this.xCoord, this.xCoord - 1, this.zCoord);
|
||||
TileEntity ent
|
||||
= this.worldObj.getTileEntity(this.xCoord, this.xCoord - 1, this.zCoord);
|
||||
return ent instanceof TileEntityElevatorBelt;
|
||||
}
|
||||
|
||||
public void conveyItemsVertical(boolean extendLife, boolean preventPickUp) {
|
||||
}
|
||||
public void conveyItemsVertical(boolean extendLife, boolean preventPickUp) {}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package assemblyline.common.machine.command;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import assemblyline.common.machine.armbot.TileEntityArmbot;
|
||||
import assemblyline.common.machine.command.CommandBreak;
|
||||
import assemblyline.common.machine.command.CommandDrop;
|
||||
|
@ -15,7 +17,6 @@ import assemblyline.common.machine.command.CommandReturn;
|
|||
import assemblyline.common.machine.command.CommandRotateBy;
|
||||
import assemblyline.common.machine.command.CommandRotateTo;
|
||||
import assemblyline.common.machine.command.CommandUse;
|
||||
import java.util.HashMap;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -34,11 +35,11 @@ public abstract class Command {
|
|||
}
|
||||
|
||||
public static Class getCommand(String command) {
|
||||
return (Class)COMMANDS.get(command.toLowerCase());
|
||||
return (Class) COMMANDS.get(command.toLowerCase());
|
||||
}
|
||||
|
||||
public static String getCommandName(Class command) {
|
||||
return (String)REVERSE_LOOKUP.get(command);
|
||||
return (String) REVERSE_LOOKUP.get(command);
|
||||
}
|
||||
|
||||
protected boolean doTask() {
|
||||
|
@ -46,11 +47,9 @@ public abstract class Command {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void onTaskStart() {
|
||||
}
|
||||
public void onTaskStart() {}
|
||||
|
||||
public void onTaskEnd() {
|
||||
}
|
||||
public void onTaskEnd() {}
|
||||
|
||||
public int getTickInterval() {
|
||||
return 1;
|
||||
|
@ -75,8 +74,7 @@ public abstract class Command {
|
|||
if (this.getArg(i) != null) {
|
||||
try {
|
||||
return Integer.parseInt(this.getArg(i));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
} catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
}
|
||||
|
@ -87,8 +85,7 @@ public abstract class Command {
|
|||
if (this.getArg(i) != null) {
|
||||
try {
|
||||
return Double.parseDouble(this.getArg(i));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
} catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
}
|
||||
|
@ -99,8 +96,7 @@ public abstract class Command {
|
|||
if (this.getArg(i) != null) {
|
||||
try {
|
||||
return Float.valueOf(Float.parseFloat(this.getArg(i)));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
} catch (Exception exception) {
|
||||
// empty catch block
|
||||
}
|
||||
}
|
||||
|
@ -135,4 +131,3 @@ public abstract class Command {
|
|||
Command.registerCommand("harvest", CommandHarvest.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package assemblyline.common.machine.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import assemblyline.common.machine.command.Command;
|
||||
import assemblyline.common.machine.command.CommandRotateTo;
|
||||
import dark.library.helpers.ItemFindingHelper;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
|
@ -12,8 +13,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
public class CommandBreak
|
||||
extends Command {
|
||||
public class CommandBreak extends Command {
|
||||
private CommandRotateTo rotateToCommand;
|
||||
int BREAK_TIME = 30;
|
||||
boolean keep = false;
|
||||
|
@ -24,13 +24,38 @@ extends Command {
|
|||
Vector3 serachPosition = this.tileEntity.getHandPosition();
|
||||
Block block = serachPosition.getBlock(this.world);
|
||||
if (block != null && this.BREAK_TIME <= this.ticks) {
|
||||
ArrayList items = block.getDrops(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), serachPosition.getBlockMetadata((IBlockAccess)this.world), 0);
|
||||
ArrayList items = block.getDrops(
|
||||
this.world,
|
||||
serachPosition.intX(),
|
||||
serachPosition.intY(),
|
||||
serachPosition.intZ(),
|
||||
serachPosition.getBlockMetadata((IBlockAccess) this.world),
|
||||
0
|
||||
);
|
||||
if (!this.keep || items.size() > 1) {
|
||||
ItemFindingHelper.dropBlockAsItem(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ());
|
||||
ItemFindingHelper.dropBlockAsItem(
|
||||
this.world,
|
||||
serachPosition.intX(),
|
||||
serachPosition.intY(),
|
||||
serachPosition.intZ()
|
||||
);
|
||||
} else {
|
||||
this.tileEntity.grabEntity((Entity)new EntityItem(this.world, (double)serachPosition.intX() + 0.5, (double)serachPosition.intY() + 0.5, (double)serachPosition.intZ() + 0.5, (ItemStack)items.get(0)));
|
||||
this.tileEntity.grabEntity((Entity) new EntityItem(
|
||||
this.world,
|
||||
(double) serachPosition.intX() + 0.5,
|
||||
(double) serachPosition.intY() + 0.5,
|
||||
(double) serachPosition.intZ() + 0.5,
|
||||
(ItemStack) items.get(0)
|
||||
));
|
||||
}
|
||||
this.world.setBlock(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), Blocks.air, 0, 3);
|
||||
this.world.setBlock(
|
||||
serachPosition.intX(),
|
||||
serachPosition.intY(),
|
||||
serachPosition.intZ(),
|
||||
Blocks.air,
|
||||
0,
|
||||
3
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -41,4 +66,3 @@ extends Command {
|
|||
return "BREAK";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,13 +2,24 @@ package assemblyline.common.machine.command;
|
|||
|
||||
import assemblyline.common.machine.command.Command;
|
||||
|
||||
public class CommandDrop
|
||||
extends Command {
|
||||
public class CommandDrop extends Command {
|
||||
@Override
|
||||
protected boolean doTask() {
|
||||
super.doTask();
|
||||
this.tileEntity.dropAll();
|
||||
this.world.playSound((double)this.tileEntity.xCoord, (double)this.tileEntity.yCoord, (double)this.tileEntity.zCoord, "random.pop", 0.2f, ((this.tileEntity.getWorldObj().rand.nextFloat() - this.tileEntity.getWorldObj().rand.nextFloat()) * 0.7f + 1.0f) * 1.0f, true);
|
||||
this.world.playSound(
|
||||
(double) this.tileEntity.xCoord,
|
||||
(double) this.tileEntity.yCoord,
|
||||
(double) this.tileEntity.zCoord,
|
||||
"random.pop",
|
||||
0.2f,
|
||||
((this.tileEntity.getWorldObj().rand.nextFloat()
|
||||
- this.tileEntity.getWorldObj().rand.nextFloat())
|
||||
* 0.7f
|
||||
+ 1.0f)
|
||||
* 1.0f,
|
||||
true
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -17,4 +28,3 @@ extends Command {
|
|||
return "DROP";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package assemblyline.common.machine.command;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import assemblyline.common.machine.command.Command;
|
||||
import assemblyline.common.machine.command.CommandDrop;
|
||||
import java.util.Random;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
|
@ -12,8 +13,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
public class CommandFire
|
||||
extends Command {
|
||||
public class CommandFire extends Command {
|
||||
private static final float MIN_ACTUAL_PITCH = -80.0f;
|
||||
private static final float MAX_ACTUAL_PITCH = 80.0f;
|
||||
private float actualYaw;
|
||||
|
@ -40,9 +40,9 @@ extends Command {
|
|||
double z = Math.cos(yaw) * Math.cos(pitch);
|
||||
this.finalVelocity = new Vector3(x, y, z);
|
||||
Random random = new Random(System.currentTimeMillis());
|
||||
this.finalVelocity.x *= (double)(0.995f + random.nextFloat() * 0.01f);
|
||||
this.finalVelocity.y *= (double)(0.995f + random.nextFloat() * 0.01f);
|
||||
this.finalVelocity.z *= (double)(0.995f + random.nextFloat() * 0.01f);
|
||||
this.finalVelocity.x *= (double) (0.995f + random.nextFloat() * 0.01f);
|
||||
this.finalVelocity.y *= (double) (0.995f + random.nextFloat() * 0.01f);
|
||||
this.finalVelocity.z *= (double) (0.995f + random.nextFloat() * 0.01f);
|
||||
this.finalVelocity.multiply(this.velocity);
|
||||
}
|
||||
|
||||
|
@ -52,10 +52,19 @@ extends Command {
|
|||
if (this.finalVelocity == null) {
|
||||
this.finalVelocity = new Vector3(0.0, 0.0, 0.0);
|
||||
}
|
||||
if (this.tileEntity.getGrabbedEntities().size() > 0 && (held = (Entity)this.tileEntity.getGrabbedEntities().get(0)) != null) {
|
||||
this.world.playSound((double)this.tileEntity.xCoord, (double)this.tileEntity.yCoord, (double)this.tileEntity.zCoord, "random.bow", this.velocity, 2.0f - this.velocity / 4.0f, true);
|
||||
if (this.tileEntity.getGrabbedEntities().size() > 0
|
||||
&& (held = (Entity) this.tileEntity.getGrabbedEntities().get(0)) != null) {
|
||||
this.world.playSound(
|
||||
(double) this.tileEntity.xCoord,
|
||||
(double) this.tileEntity.yCoord,
|
||||
(double) this.tileEntity.zCoord,
|
||||
"random.bow",
|
||||
this.velocity,
|
||||
2.0f - this.velocity / 4.0f,
|
||||
true
|
||||
);
|
||||
if (held instanceof EntityItem) {
|
||||
EntityItem item = (EntityItem)held;
|
||||
EntityItem item = (EntityItem) held;
|
||||
ItemStack stack = item.getEntityItem();
|
||||
ItemStack thrown = stack.copy();
|
||||
thrown.stackSize = 1;
|
||||
|
@ -63,30 +72,45 @@ extends Command {
|
|||
--stack.stackSize;
|
||||
item.setEntityItemStack(stack);
|
||||
} else {
|
||||
this.commandManager.getNewCommand(this.tileEntity, CommandDrop.class, new String[0]).doTask();
|
||||
this.commandManager
|
||||
.getNewCommand(this.tileEntity, CommandDrop.class, new String[0])
|
||||
.doTask();
|
||||
if (!this.world.isRemote) {
|
||||
this.world.removeEntity(held);
|
||||
}
|
||||
}
|
||||
if (item.getEntityItem().getItem() == Items.arrow) {
|
||||
EntityArrow arrow = new EntityArrow(this.world, this.tileEntity.getHandPosition().x, this.tileEntity.getHandPosition().y, this.tileEntity.getHandPosition().z);
|
||||
EntityArrow arrow = new EntityArrow(
|
||||
this.world,
|
||||
this.tileEntity.getHandPosition().x,
|
||||
this.tileEntity.getHandPosition().y,
|
||||
this.tileEntity.getHandPosition().z
|
||||
);
|
||||
arrow.motionX = this.finalVelocity.x;
|
||||
arrow.motionY = this.finalVelocity.y;
|
||||
arrow.motionZ = this.finalVelocity.z;
|
||||
if (!this.world.isRemote) {
|
||||
this.world.spawnEntityInWorld((Entity)arrow);
|
||||
this.world.spawnEntityInWorld((Entity) arrow);
|
||||
}
|
||||
} else {
|
||||
EntityItem item2 = new EntityItem(this.world, this.tileEntity.getHandPosition().x, this.tileEntity.getHandPosition().y, this.tileEntity.getHandPosition().z, thrown);
|
||||
EntityItem item2 = new EntityItem(
|
||||
this.world,
|
||||
this.tileEntity.getHandPosition().x,
|
||||
this.tileEntity.getHandPosition().y,
|
||||
this.tileEntity.getHandPosition().z,
|
||||
thrown
|
||||
);
|
||||
item2.motionX = this.finalVelocity.x;
|
||||
item2.motionY = this.finalVelocity.y;
|
||||
item2.motionZ = this.finalVelocity.z;
|
||||
if (!this.world.isRemote) {
|
||||
this.world.spawnEntityInWorld((Entity)item2);
|
||||
this.world.spawnEntityInWorld((Entity) item2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.commandManager.getNewCommand(this.tileEntity, CommandDrop.class, new String[0]).doTask();
|
||||
this.commandManager
|
||||
.getNewCommand(this.tileEntity, CommandDrop.class, new String[0])
|
||||
.doTask();
|
||||
held.motionX = this.finalVelocity.x;
|
||||
held.motionY = this.finalVelocity.y;
|
||||
held.motionZ = this.finalVelocity.z;
|
||||
|
@ -125,4 +149,3 @@ extends Command {
|
|||
return "FIRE " + Float.toString(this.velocity);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package assemblyline.common.machine.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import assemblyline.common.machine.belt.TileEntityConveyorBelt;
|
||||
import assemblyline.common.machine.command.Command;
|
||||
import assemblyline.common.machine.command.GrabDictionary;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityAgeable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -14,8 +15,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
public class CommandGrab
|
||||
extends Command {
|
||||
public class CommandGrab extends Command {
|
||||
public static final float radius = 0.5f;
|
||||
public boolean child = false;
|
||||
private TileEntityConveyorBelt belt;
|
||||
|
@ -25,15 +25,21 @@ extends Command {
|
|||
public void onTaskStart() {
|
||||
super.onTaskStart();
|
||||
this.entityToInclude = Entity.class;
|
||||
if (this.getArgs() != null && this.getArgs().length > 0 && this.getArgs()[0] != null) {
|
||||
if (this.getArg(0).equalsIgnoreCase("baby") || this.getArg(0).equalsIgnoreCase("child")) {
|
||||
if (this.getArgs() != null && this.getArgs().length > 0
|
||||
&& this.getArgs()[0] != null) {
|
||||
if (this.getArg(0).equalsIgnoreCase("baby")
|
||||
|| this.getArg(0).equalsIgnoreCase("child")) {
|
||||
this.child = true;
|
||||
if (this.getArgs().length > 1 && this.getArgs()[1] != null) {
|
||||
this.entityToInclude = GrabDictionary.get(this.getArg(1)).getEntityClass();
|
||||
this.entityToInclude
|
||||
= GrabDictionary.get(this.getArg(1)).getEntityClass();
|
||||
}
|
||||
} else {
|
||||
this.entityToInclude = GrabDictionary.get(this.getArg(0)).getEntityClass();
|
||||
if (this.getArgs().length > 1 && this.getArgs()[1] != null && (this.getArg(1).equalsIgnoreCase("baby") || this.getArg(0).equalsIgnoreCase("child"))) {
|
||||
this.entityToInclude
|
||||
= GrabDictionary.get(this.getArg(0)).getEntityClass();
|
||||
if (this.getArgs().length > 1 && this.getArgs()[1] != null
|
||||
&& (this.getArg(1).equalsIgnoreCase("baby")
|
||||
|| this.getArg(0).equalsIgnoreCase("child"))) {
|
||||
this.child = true;
|
||||
}
|
||||
}
|
||||
|
@ -47,22 +53,50 @@ extends Command {
|
|||
return false;
|
||||
}
|
||||
Vector3 serachPosition = this.tileEntity.getHandPosition();
|
||||
List found = this.world.getEntitiesWithinAABB(this.entityToInclude, AxisAlignedBB.getBoundingBox((double)(serachPosition.x - 0.5), (double)(serachPosition.y - 0.5), (double)(serachPosition.z - 0.5), (double)(serachPosition.x + 0.5), (double)(serachPosition.y + 0.5), (double)(serachPosition.z + 0.5)));
|
||||
TileEntity ent = serachPosition.getTileEntity((IBlockAccess)this.world);
|
||||
List found = this.world.getEntitiesWithinAABB(
|
||||
this.entityToInclude,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) (serachPosition.x - 0.5),
|
||||
(double) (serachPosition.y - 0.5),
|
||||
(double) (serachPosition.z - 0.5),
|
||||
(double) (serachPosition.x + 0.5),
|
||||
(double) (serachPosition.y + 0.5),
|
||||
(double) (serachPosition.z + 0.5)
|
||||
)
|
||||
);
|
||||
TileEntity ent = serachPosition.getTileEntity((IBlockAccess) this.world);
|
||||
Vector3 searchPostion2 = Vector3.add(serachPosition, new Vector3(0.0, -1.0, 0.0));
|
||||
TileEntity ent2 = searchPostion2.getTileEntity((IBlockAccess)this.world);
|
||||
TileEntity ent2 = searchPostion2.getTileEntity((IBlockAccess) this.world);
|
||||
if (ent instanceof TileEntityConveyorBelt) {
|
||||
this.belt = (TileEntityConveyorBelt)ent;
|
||||
this.belt = (TileEntityConveyorBelt) ent;
|
||||
} else if (ent2 instanceof TileEntityConveyorBelt) {
|
||||
this.belt = (TileEntityConveyorBelt)ent2;
|
||||
this.belt = (TileEntityConveyorBelt) ent2;
|
||||
}
|
||||
if (found != null && found.size() > 0) {
|
||||
for (int i = 0; i < found.size(); ++i) {
|
||||
if (found.get(i) == null || found.get(i) instanceof EntityArrow || found.get(i) instanceof EntityPlayer || ((Entity)found.get((int)i)).ridingEntity != null || found.get(i) instanceof EntityAgeable && (!(found.get(i) instanceof EntityAgeable) || this.child != ((EntityAgeable)found.get(i)).isChild())) continue;
|
||||
this.tileEntity.grabEntity((Entity)found.get(i));
|
||||
this.world.playSound((double)this.tileEntity.xCoord, (double)this.tileEntity.yCoord, (double)this.tileEntity.zCoord, "random.pop", 0.2f, ((this.tileEntity.getWorldObj().rand.nextFloat() - this.tileEntity.getWorldObj().rand.nextFloat()) * 0.7f + 1.0f) * 1.0f, true);
|
||||
if (found.get(i) == null || found.get(i) instanceof EntityArrow
|
||||
|| found.get(i) instanceof EntityPlayer
|
||||
|| ((Entity) found.get((int) i)).ridingEntity != null
|
||||
|| found.get(i) instanceof EntityAgeable
|
||||
&& (!(found.get(i) instanceof EntityAgeable)
|
||||
|| this.child != ((EntityAgeable) found.get(i)).isChild()))
|
||||
continue;
|
||||
this.tileEntity.grabEntity((Entity) found.get(i));
|
||||
this.world.playSound(
|
||||
(double) this.tileEntity.xCoord,
|
||||
(double) this.tileEntity.yCoord,
|
||||
(double) this.tileEntity.zCoord,
|
||||
"random.pop",
|
||||
0.2f,
|
||||
((this.tileEntity.getWorldObj().rand.nextFloat()
|
||||
- this.tileEntity.getWorldObj().rand.nextFloat())
|
||||
* 0.7f
|
||||
+ 1.0f)
|
||||
* 1.0f,
|
||||
true
|
||||
);
|
||||
if (this.belt != null) {
|
||||
this.belt.IgnoreEntity((Entity)found.get(i));
|
||||
this.belt.IgnoreEntity((Entity) found.get(i));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -74,14 +108,20 @@ extends Command {
|
|||
public void readFromNBT(NBTTagCompound taskCompound) {
|
||||
super.readFromNBT(taskCompound);
|
||||
this.child = taskCompound.getBoolean("child");
|
||||
this.entityToInclude = GrabDictionary.get(taskCompound.getString("name")).getEntityClass();
|
||||
this.entityToInclude
|
||||
= GrabDictionary.get(taskCompound.getString("name")).getEntityClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound taskCompound) {
|
||||
super.writeToNBT(taskCompound);
|
||||
taskCompound.setBoolean("child", this.child);
|
||||
taskCompound.setString("name", this.entityToInclude != null ? GrabDictionary.get(this.entityToInclude).getName() : "");
|
||||
taskCompound.setString(
|
||||
"name",
|
||||
this.entityToInclude != null
|
||||
? GrabDictionary.get(this.entityToInclude).getName()
|
||||
: ""
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -97,4 +137,3 @@ extends Command {
|
|||
return "GRAB " + baby + entity;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ package assemblyline.common.machine.command;
|
|||
import assemblyline.common.machine.command.CommandBreak;
|
||||
import assemblyline.common.machine.command.CommandRotateTo;
|
||||
|
||||
public class CommandHarvest
|
||||
extends CommandBreak {
|
||||
public class CommandHarvest extends CommandBreak {
|
||||
private CommandRotateTo rotateToCommand;
|
||||
|
||||
@Override
|
||||
|
@ -17,4 +16,3 @@ extends CommandBreak {
|
|||
return "HARVEST";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ package assemblyline.common.machine.command;
|
|||
import assemblyline.common.machine.command.Command;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class CommandIdle
|
||||
extends Command {
|
||||
public class CommandIdle extends Command {
|
||||
public int idleTime = 80;
|
||||
private int totalIdleTime = 80;
|
||||
|
||||
|
@ -44,4 +43,3 @@ extends Command {
|
|||
return "IDLE " + Integer.toString(this.totalIdleTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package assemblyline.common.machine.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import assemblyline.common.machine.armbot.TileEntityArmbot;
|
||||
import assemblyline.common.machine.command.Command;
|
||||
import assemblyline.common.machine.command.CommandRepeat;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
@ -25,7 +26,7 @@ public class CommandManager {
|
|||
this.currentTask = 0;
|
||||
this.lastTask = -1;
|
||||
}
|
||||
Command task = (Command)this.tasks.get(this.currentTask);
|
||||
Command task = (Command) this.tasks.get(this.currentTask);
|
||||
if (this.currentTask != this.lastTask) {
|
||||
this.lastTask = this.currentTask;
|
||||
task.onTaskStart();
|
||||
|
@ -34,38 +35,46 @@ public class CommandManager {
|
|||
int tempCurrentTask = this.currentTask++;
|
||||
task.onTaskEnd();
|
||||
if (!(task instanceof CommandRepeat)) {
|
||||
this.tasks.set(tempCurrentTask, this.getNewCommand(task.tileEntity, task.getClass(), task.getArgs()));
|
||||
this.tasks.set(
|
||||
tempCurrentTask,
|
||||
this.getNewCommand(
|
||||
task.tileEntity, task.getClass(), task.getArgs()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
FMLLog.severe((String)"Failed to execute task in Assembly Line.", (Object[])new Object[0]);
|
||||
} catch (Exception e) {
|
||||
FMLLog.severe(
|
||||
(String) "Failed to execute task in Assembly Line.",
|
||||
(Object[]) new Object[0]
|
||||
);
|
||||
e.printStackTrace();
|
||||
}
|
||||
++this.ticks;
|
||||
}
|
||||
|
||||
public Command getNewCommand(TileEntityArmbot tileEntity, Class commandClass, String[] parameters) {
|
||||
public Command
|
||||
getNewCommand(TileEntityArmbot tileEntity, Class commandClass, String[] parameters) {
|
||||
try {
|
||||
Command newCommand = (Command)commandClass.newInstance();
|
||||
Command newCommand = (Command) commandClass.newInstance();
|
||||
newCommand.world = tileEntity.getWorldObj();
|
||||
newCommand.tileEntity = tileEntity;
|
||||
newCommand.commandManager = this;
|
||||
newCommand.setParameters(parameters);
|
||||
return newCommand;
|
||||
}
|
||||
catch (Exception e) {
|
||||
FMLLog.severe((String)"Failed to add command", (Object[])new Object[0]);
|
||||
} catch (Exception e) {
|
||||
FMLLog.severe((String) "Failed to add command", (Object[]) new Object[0]);
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addCommand(TileEntityArmbot tileEntity, Class commandClass, String[] parameters) {
|
||||
public void
|
||||
addCommand(TileEntityArmbot tileEntity, Class commandClass, String[] parameters) {
|
||||
Command newCommand = this.getNewCommand(tileEntity, commandClass, parameters);
|
||||
if (newCommand != null) {
|
||||
this.tasks.add(newCommand);
|
||||
|
@ -106,21 +115,22 @@ public class CommandManager {
|
|||
if (nbt.getInteger("numTasks") > 0) {
|
||||
NBTTagList taskList = nbt.getTagList("commands", 10);
|
||||
for (int i = 0; i < taskList.tagCount(); ++i) {
|
||||
NBTTagCompound cmdTag = (NBTTagCompound)taskList.getCompoundTagAt(i);
|
||||
NBTTagCompound cmdTag = (NBTTagCompound) taskList.getCompoundTagAt(i);
|
||||
try {
|
||||
Class<?> cmdClass = Class.forName(cmdTag.getString("commandClass"));
|
||||
ArrayList<String> pars = new ArrayList<String>();
|
||||
if (cmdTag.getInteger("numParameters") > 0) {
|
||||
NBTTagList parameters = cmdTag.getTagList("parameters", 8);
|
||||
for (int ii = 0; ii < parameters.tagCount(); ++ii) {
|
||||
pars.add(parameters.getStringTagAt((int)ii));
|
||||
pars.add(parameters.getStringTagAt((int) ii));
|
||||
}
|
||||
}
|
||||
Command cmd = this.getNewCommand(tileEntity, cmdClass, pars.toArray(new String[0]));
|
||||
cmd.readFromNBT((NBTTagCompound)cmdTag.getTag("customData"));
|
||||
Command cmd = this.getNewCommand(
|
||||
tileEntity, cmdClass, pars.toArray(new String[0])
|
||||
);
|
||||
cmd.readFromNBT((NBTTagCompound) cmdTag.getTag("customData"));
|
||||
continue;
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
} catch (ClassNotFoundException e) {
|
||||
System.out.println("Error loading CommandManger: ");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -134,29 +144,31 @@ public class CommandManager {
|
|||
NBTTagList taskList = new NBTTagList();
|
||||
for (int i = 0; i < this.tasks.size(); ++i) {
|
||||
NBTTagCompound taskCompound = new NBTTagCompound();
|
||||
String cmdName = ((Command)this.tasks.get(i)).getClass().getName();
|
||||
String cmdName = ((Command) this.tasks.get(i)).getClass().getName();
|
||||
if (cmdName != null && !cmdName.isEmpty()) {
|
||||
taskCompound.setString("commandClass", cmdName);
|
||||
}
|
||||
if (((Command)this.tasks.get(i)).getArgs().length > 0) {
|
||||
if (((Command) this.tasks.get(i)).getArgs().length > 0) {
|
||||
NBTTagList parameters = new NBTTagList();
|
||||
for (String par : ((Command)this.tasks.get(i)).getArgs()) {
|
||||
if (par == null || par.isEmpty()) continue;
|
||||
parameters.appendTag((NBTBase)new NBTTagString(par));
|
||||
for (String par : ((Command) this.tasks.get(i)).getArgs()) {
|
||||
if (par == null || par.isEmpty())
|
||||
continue;
|
||||
parameters.appendTag((NBTBase) new NBTTagString(par));
|
||||
}
|
||||
taskCompound.setTag("parameters", (NBTBase)parameters);
|
||||
taskCompound.setTag("parameters", (NBTBase) parameters);
|
||||
}
|
||||
taskCompound.setInteger("numParameters", ((Command)this.tasks.get(i)).getArgs().length);
|
||||
taskCompound.setInteger(
|
||||
"numParameters", ((Command) this.tasks.get(i)).getArgs().length
|
||||
);
|
||||
NBTTagCompound customData = new NBTTagCompound();
|
||||
((Command)this.tasks.get(i)).writeToNBT(customData);
|
||||
((Command) this.tasks.get(i)).writeToNBT(customData);
|
||||
taskCompound.setTag("customData", customData);
|
||||
taskList.appendTag((NBTBase)taskCompound);
|
||||
taskList.appendTag((NBTBase) taskCompound);
|
||||
}
|
||||
nbt.setTag("commands", (NBTBase)taskList);
|
||||
nbt.setTag("commands", (NBTBase) taskList);
|
||||
}
|
||||
nbt.setInteger("curTask", this.currentTask);
|
||||
nbt.setInteger("lastTask", this.lastTask);
|
||||
nbt.setInteger("ticks", this.ticks);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@ import net.minecraftforge.common.IPlantable;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
public class CommandPlace
|
||||
extends Command {
|
||||
public class CommandPlace extends Command {
|
||||
int PLACE_TIME = 30;
|
||||
|
||||
@Override
|
||||
|
@ -24,25 +23,88 @@ extends Command {
|
|||
protected boolean doTask() {
|
||||
super.doTask();
|
||||
Vector3 serachPosition = this.tileEntity.getHandPosition();
|
||||
Block block = serachPosition.getBlock((IBlockAccess)this.world);
|
||||
Block block = serachPosition.getBlock((IBlockAccess) this.world);
|
||||
if (block == null && this.ticks >= this.PLACE_TIME) {
|
||||
for (Entity entity : this.tileEntity.getGrabbedEntities()) {
|
||||
ItemStack itemStack;
|
||||
if (!(entity instanceof EntityItem) || (itemStack = ((EntityItem)entity).getEntityItem()) == null) continue;
|
||||
if (!(entity instanceof EntityItem)
|
||||
|| (itemStack = ((EntityItem) entity).getEntityItem()) == null)
|
||||
continue;
|
||||
if (itemStack.getItem() instanceof ItemBlock) {
|
||||
((ItemBlock)itemStack.getItem()).placeBlockAt(itemStack, null, this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), 0, 0.5f, 0.5f, 0.5f, itemStack.getItemDamage());
|
||||
((ItemBlock) itemStack.getItem())
|
||||
.placeBlockAt(
|
||||
itemStack,
|
||||
null,
|
||||
this.world,
|
||||
serachPosition.intX(),
|
||||
serachPosition.intY(),
|
||||
serachPosition.intZ(),
|
||||
0,
|
||||
0.5f,
|
||||
0.5f,
|
||||
0.5f,
|
||||
itemStack.getItemDamage()
|
||||
);
|
||||
this.tileEntity.dropEntity(entity);
|
||||
return false;
|
||||
}
|
||||
if (!(itemStack.getItem() instanceof IPlantable)) continue;
|
||||
IPlantable plantable = (IPlantable)itemStack.getItem();
|
||||
Block blockBelow = Vector3.add(serachPosition, new Vector3(0.0, -1.0, 0.0)).getBlock((IBlockAccess)this.world);
|
||||
if (blockBelow == null || !blockBelow.canSustainPlant(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), ForgeDirection.UP, plantable)) continue;
|
||||
Block plantBlock = plantable.getPlant(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ());
|
||||
int blockMetadata = plantable.getPlantMetadata(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ());
|
||||
if (!this.world.setBlock(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), plantBlock, blockMetadata, 3) || this.world.getBlock(serachPosition.intX(), serachPosition.intY(), serachPosition.intZ()) != plantBlock) continue;
|
||||
plantBlock.onBlockPlacedBy(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), null, itemStack);
|
||||
plantBlock.onPostBlockPlaced(this.world, serachPosition.intX(), serachPosition.intY(), serachPosition.intZ(), blockMetadata);
|
||||
if (!(itemStack.getItem() instanceof IPlantable))
|
||||
continue;
|
||||
IPlantable plantable = (IPlantable) itemStack.getItem();
|
||||
Block blockBelow
|
||||
= Vector3.add(serachPosition, new Vector3(0.0, -1.0, 0.0))
|
||||
.getBlock((IBlockAccess) this.world);
|
||||
if (blockBelow == null
|
||||
|| !blockBelow.canSustainPlant(
|
||||
this.world,
|
||||
serachPosition.intX(),
|
||||
serachPosition.intY(),
|
||||
serachPosition.intZ(),
|
||||
ForgeDirection.UP,
|
||||
plantable
|
||||
))
|
||||
continue;
|
||||
Block plantBlock = plantable.getPlant(
|
||||
this.world,
|
||||
serachPosition.intX(),
|
||||
serachPosition.intY(),
|
||||
serachPosition.intZ()
|
||||
);
|
||||
int blockMetadata = plantable.getPlantMetadata(
|
||||
this.world,
|
||||
serachPosition.intX(),
|
||||
serachPosition.intY(),
|
||||
serachPosition.intZ()
|
||||
);
|
||||
if (!this.world.setBlock(
|
||||
serachPosition.intX(),
|
||||
serachPosition.intY(),
|
||||
serachPosition.intZ(),
|
||||
plantBlock,
|
||||
blockMetadata,
|
||||
3
|
||||
)
|
||||
|| this.world.getBlock(
|
||||
serachPosition.intX(),
|
||||
serachPosition.intY(),
|
||||
serachPosition.intZ()
|
||||
) != plantBlock)
|
||||
continue;
|
||||
plantBlock.onBlockPlacedBy(
|
||||
this.world,
|
||||
serachPosition.intX(),
|
||||
serachPosition.intY(),
|
||||
serachPosition.intZ(),
|
||||
null,
|
||||
itemStack
|
||||
);
|
||||
plantBlock.onPostBlockPlaced(
|
||||
this.world,
|
||||
serachPosition.intX(),
|
||||
serachPosition.intY(),
|
||||
serachPosition.intZ(),
|
||||
blockMetadata
|
||||
);
|
||||
this.tileEntity.dropEntity(entity);
|
||||
return false;
|
||||
}
|
||||
|
@ -55,4 +117,3 @@ extends Command {
|
|||
return "PLACE";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package assemblyline.common.machine.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import assemblyline.common.machine.command.Command;
|
||||
import dark.library.helpers.ItemFindingHelper;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -12,8 +13,7 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
public class CommandPowerTo
|
||||
extends Command {
|
||||
public class CommandPowerTo extends Command {
|
||||
private int duration;
|
||||
private int ticksRan;
|
||||
|
||||
|
@ -41,13 +41,20 @@ extends Command {
|
|||
this.world.spawnParticle("smoke", loc.x, loc.y, loc.z, 0.0, 0.0, 0.0);
|
||||
this.world.spawnParticle("flame", loc.x, loc.y, loc.z, 0.0, 0.0, 0.0);
|
||||
}
|
||||
Block block = this.world.getBlock(this.tileEntity.getHandPosition().intX(), this.tileEntity.getHandPosition().intY(), this.tileEntity.getHandPosition().intZ());
|
||||
TileEntity targetTile = this.tileEntity.getHandPosition().getTileEntity((IBlockAccess)this.world);
|
||||
Block block = this.world.getBlock(
|
||||
this.tileEntity.getHandPosition().intX(),
|
||||
this.tileEntity.getHandPosition().intY(),
|
||||
this.tileEntity.getHandPosition().intZ()
|
||||
);
|
||||
TileEntity targetTile
|
||||
= this.tileEntity.getHandPosition().getTileEntity((IBlockAccess) this.world);
|
||||
if (this.tileEntity.getGrabbedItems().size() > 0) {
|
||||
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
stacks.add(new ItemStack(Blocks.redstone_torch, 1, 0));
|
||||
stacks.add(new ItemStack(Blocks.unlit_redstone_torch, 1, 0));
|
||||
if (ItemFindingHelper.filterItems(this.tileEntity.getGrabbedItems(), stacks).size() > 0) {
|
||||
if (ItemFindingHelper.filterItems(this.tileEntity.getGrabbedItems(), stacks)
|
||||
.size()
|
||||
> 0) {
|
||||
this.powerBlock(true);
|
||||
}
|
||||
}
|
||||
|
@ -57,10 +64,17 @@ extends Command {
|
|||
|
||||
public void powerBlock(boolean on) {
|
||||
this.tileEntity.isProvidingPower = on;
|
||||
Block block = this.tileEntity.getWorldObj().getBlock(this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord);
|
||||
Block block = this.tileEntity.getWorldObj().getBlock(
|
||||
this.tileEntity.xCoord, this.tileEntity.yCoord, this.tileEntity.zCoord
|
||||
);
|
||||
for (int i = 2; i < 6; ++i) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation((int)i);
|
||||
this.world.notifyBlockOfNeighborChange(this.tileEntity.xCoord + dir.offsetX, this.tileEntity.yCoord + dir.offsetY, this.tileEntity.zCoord + dir.offsetZ, block);
|
||||
ForgeDirection dir = ForgeDirection.getOrientation((int) i);
|
||||
this.world.notifyBlockOfNeighborChange(
|
||||
this.tileEntity.xCoord + dir.offsetX,
|
||||
this.tileEntity.yCoord + dir.offsetY,
|
||||
this.tileEntity.zCoord + dir.offsetZ,
|
||||
block
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,4 +97,3 @@ extends Command {
|
|||
taskCompound.setInteger("useCurTimes", this.ticksRan);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ package assemblyline.common.machine.command;
|
|||
import assemblyline.common.machine.command.Command;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class CommandRepeat
|
||||
extends Command {
|
||||
public class CommandRepeat extends Command {
|
||||
private int tasksToRepeat;
|
||||
private int numReps;
|
||||
private int curReps;
|
||||
|
@ -28,7 +27,9 @@ extends Command {
|
|||
if (this.curReps < this.numReps || this.numReps == -1) {
|
||||
++this.curReps;
|
||||
if (this.tasksToRepeat > 0) {
|
||||
this.commandManager.setCurrentTask(this.commandManager.getCurrentTask() - this.tasksToRepeat - 1);
|
||||
this.commandManager.setCurrentTask(
|
||||
this.commandManager.getCurrentTask() - this.tasksToRepeat - 1
|
||||
);
|
||||
return;
|
||||
}
|
||||
this.commandManager.setCurrentTask(-2);
|
||||
|
@ -61,10 +62,13 @@ extends Command {
|
|||
if (this.tasksToRepeat > 0) {
|
||||
cmdToTest = this.commandManager.getCurrentTask() - this.tasksToRepeat;
|
||||
}
|
||||
if (this.commandManager.hasTasks() && this.commandManager.getCurrentTask() >= 0 && this.commandManager.getCurrentTask() < this.commandManager.getCommands().size()) {
|
||||
return ((Command)this.commandManager.getCommands().get(cmdToTest)).toString();
|
||||
if (this.commandManager.hasTasks() && this.commandManager.getCurrentTask() >= 0
|
||||
&& this.commandManager.getCurrentTask()
|
||||
< this.commandManager.getCommands().size()) {
|
||||
return ((Command) this.commandManager.getCommands().get(cmdToTest))
|
||||
.toString();
|
||||
}
|
||||
return "REPEAT " + Integer.toString(this.tasksToRepeat) + " " + (this.numReps > 0 ? Integer.toString(this.numReps) : "");
|
||||
return "REPEAT " + Integer.toString(this.tasksToRepeat) + " "
|
||||
+ (this.numReps > 0 ? Integer.toString(this.numReps) : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,15 +3,16 @@ package assemblyline.common.machine.command;
|
|||
import assemblyline.common.machine.command.Command;
|
||||
import assemblyline.common.machine.command.CommandRotateTo;
|
||||
|
||||
public class CommandReturn
|
||||
extends Command {
|
||||
public class CommandReturn extends Command {
|
||||
public static final float IDLE_ROTATION_PITCH = 0.0f;
|
||||
public static final float IDLE_ROTATION_YAW = 0.0f;
|
||||
private CommandRotateTo rotateToCommand;
|
||||
|
||||
@Override
|
||||
public void onTaskStart() {
|
||||
this.rotateToCommand = (CommandRotateTo)this.commandManager.getNewCommand(this.tileEntity, CommandRotateTo.class, new String[]{"0", "0"});
|
||||
this.rotateToCommand = (CommandRotateTo) this.commandManager.getNewCommand(
|
||||
this.tileEntity, CommandRotateTo.class, new String[] { "0", "0" }
|
||||
);
|
||||
this.rotateToCommand.onTaskStart();
|
||||
}
|
||||
|
||||
|
@ -33,4 +34,3 @@ extends Command {
|
|||
return "RETURN";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ package assemblyline.common.machine.command;
|
|||
import assemblyline.common.machine.command.Command;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class CommandRotateBy
|
||||
extends Command {
|
||||
public class CommandRotateBy extends Command {
|
||||
float targetRotationYaw = 0.0f;
|
||||
float targetRotationPitch = 0.0f;
|
||||
float deltaPitch = 0.0f;
|
||||
|
@ -16,13 +15,15 @@ extends Command {
|
|||
super.onTaskStart();
|
||||
this.ticks = 0;
|
||||
if (this.getArg(0) != null) {
|
||||
this.targetRotationYaw = this.tileEntity.rotationYaw + this.getFloatArg(0).floatValue();
|
||||
this.targetRotationYaw
|
||||
= this.tileEntity.rotationYaw + this.getFloatArg(0).floatValue();
|
||||
this.deltaYaw = this.getFloatArg(0).floatValue();
|
||||
} else {
|
||||
this.targetRotationYaw = this.tileEntity.rotationYaw + 90.0f;
|
||||
}
|
||||
if (this.getArg(1) != null) {
|
||||
this.targetRotationPitch = this.tileEntity.rotationPitch + this.getFloatArg(1).floatValue();
|
||||
this.targetRotationPitch
|
||||
= this.tileEntity.rotationPitch + this.getFloatArg(1).floatValue();
|
||||
this.deltaPitch = this.getFloatArg(1).floatValue();
|
||||
} else {
|
||||
this.targetRotationPitch = this.tileEntity.rotationPitch;
|
||||
|
@ -57,7 +58,8 @@ extends Command {
|
|||
if (Math.abs(this.tileEntity.rotationPitch - this.targetRotationPitch) > 0.001f) {
|
||||
this.tileEntity.rotationPitch = this.targetRotationPitch;
|
||||
}
|
||||
if (Math.abs(this.tileEntity.renderPitch - this.tileEntity.rotationPitch) > 0.001f) {
|
||||
if (Math.abs(this.tileEntity.renderPitch - this.tileEntity.rotationPitch)
|
||||
> 0.001f) {
|
||||
return true;
|
||||
}
|
||||
return Math.abs(this.tileEntity.renderYaw - this.tileEntity.rotationYaw) > 0.001f;
|
||||
|
@ -79,7 +81,7 @@ extends Command {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ROTATE " + Float.toString(this.deltaYaw) + " " + Float.toString(this.deltaPitch);
|
||||
return "ROTATE " + Float.toString(this.deltaYaw) + " "
|
||||
+ Float.toString(this.deltaPitch);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ package assemblyline.common.machine.command;
|
|||
import assemblyline.common.machine.command.Command;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class CommandRotateTo
|
||||
extends Command {
|
||||
public class CommandRotateTo extends Command {
|
||||
float targetRotationYaw = 0.0f;
|
||||
float targetRotationPitch = 0.0f;
|
||||
int totalTicks = 0;
|
||||
|
@ -14,8 +13,10 @@ extends Command {
|
|||
super.onTaskStart();
|
||||
this.ticks = 0;
|
||||
this.totalTicks = 0;
|
||||
this.targetRotationYaw = this.getArg(0) != null ? this.getFloatArg(0).floatValue() : 0.0f;
|
||||
this.targetRotationPitch = this.getArg(1) != null ? this.getFloatArg(1).floatValue() : 0.0f;
|
||||
this.targetRotationYaw
|
||||
= this.getArg(0) != null ? this.getFloatArg(0).floatValue() : 0.0f;
|
||||
this.targetRotationPitch
|
||||
= this.getArg(1) != null ? this.getFloatArg(1).floatValue() : 0.0f;
|
||||
while (this.targetRotationYaw < 0.0f) {
|
||||
this.targetRotationYaw += 360.0f;
|
||||
}
|
||||
|
@ -30,10 +31,10 @@ extends Command {
|
|||
}
|
||||
float f = Math.abs(this.targetRotationYaw - this.tileEntity.renderYaw);
|
||||
this.tileEntity.getClass();
|
||||
int totalTicksYaw = (int)(f / 1.3f);
|
||||
int totalTicksYaw = (int) (f / 1.3f);
|
||||
float f2 = Math.abs(this.targetRotationPitch - this.tileEntity.renderPitch);
|
||||
this.tileEntity.getClass();
|
||||
int totalTicksPitch = (int)(f2 / 1.3f);
|
||||
int totalTicksPitch = (int) (f2 / 1.3f);
|
||||
this.totalTicks = Math.max(totalTicksYaw, totalTicksPitch);
|
||||
}
|
||||
|
||||
|
@ -42,7 +43,8 @@ extends Command {
|
|||
super.doTask();
|
||||
this.tileEntity.rotationYaw = this.targetRotationYaw;
|
||||
this.tileEntity.rotationPitch = this.targetRotationPitch;
|
||||
if (Math.abs(this.tileEntity.renderPitch - this.tileEntity.rotationPitch) > 0.001f) {
|
||||
if (Math.abs(this.tileEntity.renderPitch - this.tileEntity.rotationPitch)
|
||||
> 0.001f) {
|
||||
return true;
|
||||
}
|
||||
return Math.abs(this.tileEntity.renderYaw - this.tileEntity.rotationYaw) > 0.001f;
|
||||
|
@ -50,7 +52,8 @@ extends Command {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ROTATETO " + Float.toString(this.targetRotationYaw) + " " + Float.toString(this.targetRotationPitch);
|
||||
return "ROTATETO " + Float.toString(this.targetRotationYaw) + " "
|
||||
+ Float.toString(this.targetRotationPitch);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -67,4 +70,3 @@ extends Command {
|
|||
taskCompound.setFloat("rotYaw", this.targetRotationYaw);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class CommandUse
|
||||
extends Command {
|
||||
public class CommandUse extends Command {
|
||||
private int times;
|
||||
private int curTimes;
|
||||
|
||||
|
@ -27,19 +26,33 @@ extends Command {
|
|||
|
||||
@Override
|
||||
protected boolean doTask() {
|
||||
Block block = this.world.getBlock(this.tileEntity.getHandPosition().intX(), this.tileEntity.getHandPosition().intY(), this.tileEntity.getHandPosition().intZ());
|
||||
TileEntity targetTile = this.tileEntity.getHandPosition().getTileEntity((IBlockAccess)this.world);
|
||||
Block block = this.world.getBlock(
|
||||
this.tileEntity.getHandPosition().intX(),
|
||||
this.tileEntity.getHandPosition().intY(),
|
||||
this.tileEntity.getHandPosition().intZ()
|
||||
);
|
||||
TileEntity targetTile
|
||||
= this.tileEntity.getHandPosition().getTileEntity((IBlockAccess) this.world);
|
||||
if (targetTile != null) {
|
||||
if (targetTile instanceof IArmbotUseable) {
|
||||
((IArmbotUseable)targetTile).onUse(this.tileEntity, this.getArgs());
|
||||
((IArmbotUseable) targetTile).onUse(this.tileEntity, this.getArgs());
|
||||
} else if (targetTile instanceof ISidedInventory && this.tileEntity.getGrabbedEntities().size() > 0) {
|
||||
// empty if block
|
||||
}
|
||||
} else if (block != null) {
|
||||
try {
|
||||
boolean f = block.onBlockActivated(this.world, this.tileEntity.getHandPosition().intX(), this.tileEntity.getHandPosition().intY(), this.tileEntity.getHandPosition().intZ(), null, 0, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
catch (Exception e) {
|
||||
boolean f = block.onBlockActivated(
|
||||
this.world,
|
||||
this.tileEntity.getHandPosition().intX(),
|
||||
this.tileEntity.getHandPosition().intY(),
|
||||
this.tileEntity.getHandPosition().intZ(),
|
||||
null,
|
||||
0,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f
|
||||
);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -66,4 +79,3 @@ extends Command {
|
|||
taskCompound.setInteger("useCurTimes", this.curTimes);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package assemblyline.common.machine.command;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityBoat;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
|
@ -35,16 +36,18 @@ public class GrabDictionary {
|
|||
|
||||
public static GrabDictionary get(Object ob) {
|
||||
if (ob instanceof String) {
|
||||
String name = (String)ob;
|
||||
String name = (String) ob;
|
||||
for (GrabDictionary ref : grabList) {
|
||||
if (!ref.getName().equalsIgnoreCase(name)) continue;
|
||||
if (!ref.getName().equalsIgnoreCase(name))
|
||||
continue;
|
||||
return ref;
|
||||
}
|
||||
}
|
||||
if (ob instanceof Class) {
|
||||
Class cc = (Class)ob;
|
||||
Class cc = (Class) ob;
|
||||
for (GrabDictionary ref : grabList) {
|
||||
if (ref.getEntityClass() != cc) continue;
|
||||
if (ref.getEntityClass() != cc)
|
||||
continue;
|
||||
return ref;
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +72,8 @@ public class GrabDictionary {
|
|||
GrabDictionary newGrab = new GrabDictionary(name, eClass);
|
||||
if (!grabList.contains(newGrab)) {
|
||||
for (GrabDictionary ref : grabList) {
|
||||
if (!ref.getName().equalsIgnoreCase(name)) continue;
|
||||
if (!ref.getName().equalsIgnoreCase(name))
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
GrabDictionary.getList().add(newGrab);
|
||||
|
@ -99,4 +103,3 @@ public class GrabDictionary {
|
|||
GrabDictionary.registerGrabableEntity("cart", EntityMinecart.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
|
||||
public class BlockCraneController
|
||||
extends BlockALMachine {
|
||||
public class BlockCraneController extends BlockALMachine {
|
||||
public BlockCraneController() {
|
||||
super(UniversalElectricity.machine);
|
||||
this.setBlockName("craneController");
|
||||
|
@ -29,29 +28,39 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||
int rot = (int)Math.min((entity.rotationYaw + 315.0f) % 360.0f / 90.0f, 3.0f);
|
||||
public void onBlockPlacedBy(
|
||||
World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack
|
||||
) {
|
||||
int rot = (int) Math.min((entity.rotationYaw + 315.0f) % 360.0f / 90.0f, 3.0f);
|
||||
switch (rot) {
|
||||
case 0: {
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.WEST.ordinal(), 3);
|
||||
world.setBlockMetadataWithNotify(
|
||||
x, y, z, ForgeDirection.WEST.ordinal(), 3
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.NORTH.ordinal(), 3);
|
||||
world.setBlockMetadataWithNotify(
|
||||
x, y, z, ForgeDirection.NORTH.ordinal(), 3
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.EAST.ordinal(), 3);
|
||||
world.setBlockMetadataWithNotify(
|
||||
x, y, z, ForgeDirection.EAST.ordinal(), 3
|
||||
);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
world.setBlockMetadataWithNotify(x, y, z, ForgeDirection.SOUTH.ordinal(), 3);
|
||||
world.setBlockMetadataWithNotify(
|
||||
x, y, z, ForgeDirection.SOUTH.ordinal(), 3
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public int getRenderType() {
|
||||
return BlockRenderingHandler.BLOCK_RENDER_ID;
|
||||
}
|
||||
|
@ -61,4 +70,3 @@ extends BlockALMachine {
|
|||
return new TileEntityCraneController();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
|
||||
public class BlockCraneFrame
|
||||
extends BlockALMachine {
|
||||
public class BlockCraneFrame extends BlockALMachine {
|
||||
public BlockCraneFrame() {
|
||||
super(UniversalElectricity.machine);
|
||||
this.setBlockName("craneFrame");
|
||||
|
@ -20,22 +19,78 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
public AxisAlignedBB
|
||||
getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
TileEntity tE = world.getTileEntity(x, y, z);
|
||||
if (tE != null && tE instanceof TileEntityCraneRail) {
|
||||
AxisAlignedBB middle = AxisAlignedBB.getBoundingBox((double)0.25, (double)0.25, (double)0.25, (double)0.75, (double)0.75, (double)0.75);
|
||||
AxisAlignedBB up = AxisAlignedBB.getBoundingBox((double)0.25, (double)0.75, (double)0.25, (double)0.75, (double)1.0, (double)0.75);
|
||||
AxisAlignedBB down = AxisAlignedBB.getBoundingBox((double)0.25, (double)0.0, (double)0.25, (double)0.75, (double)0.25, (double)0.75);
|
||||
AxisAlignedBB left = AxisAlignedBB.getBoundingBox((double)0.0, (double)0.25, (double)0.25, (double)0.25, (double)0.75, (double)0.75);
|
||||
AxisAlignedBB right = AxisAlignedBB.getBoundingBox((double)0.75, (double)0.25, (double)0.25, (double)1.0, (double)0.75, (double)0.75);
|
||||
AxisAlignedBB front = AxisAlignedBB.getBoundingBox((double)0.25, (double)0.25, (double)0.0, (double)0.75, (double)0.75, (double)0.25);
|
||||
AxisAlignedBB back = AxisAlignedBB.getBoundingBox((double)0.25, (double)0.25, (double)0.75, (double)0.75, (double)0.75, (double)1.0);
|
||||
boolean connectUp = CraneHelper.canFrameConnectTo(tE, x, y + 1, z, ForgeDirection.DOWN);
|
||||
boolean connectDown = CraneHelper.canFrameConnectTo(tE, x, y - 1, z, ForgeDirection.UP);
|
||||
boolean connectLeft = CraneHelper.canFrameConnectTo(tE, x - 1, y, z, ForgeDirection.EAST);
|
||||
boolean connectRight = CraneHelper.canFrameConnectTo(tE, x + 1, y, z, ForgeDirection.WEST);
|
||||
boolean connectFront = CraneHelper.canFrameConnectTo(tE, x, y, z - 1, ForgeDirection.SOUTH);
|
||||
boolean connectBack = CraneHelper.canFrameConnectTo(tE, x, y, z + 1, ForgeDirection.NORTH);
|
||||
AxisAlignedBB middle = AxisAlignedBB.getBoundingBox(
|
||||
(double) 0.25,
|
||||
(double) 0.25,
|
||||
(double) 0.25,
|
||||
(double) 0.75,
|
||||
(double) 0.75,
|
||||
(double) 0.75
|
||||
);
|
||||
AxisAlignedBB up = AxisAlignedBB.getBoundingBox(
|
||||
(double) 0.25,
|
||||
(double) 0.75,
|
||||
(double) 0.25,
|
||||
(double) 0.75,
|
||||
(double) 1.0,
|
||||
(double) 0.75
|
||||
);
|
||||
AxisAlignedBB down = AxisAlignedBB.getBoundingBox(
|
||||
(double) 0.25,
|
||||
(double) 0.0,
|
||||
(double) 0.25,
|
||||
(double) 0.75,
|
||||
(double) 0.25,
|
||||
(double) 0.75
|
||||
);
|
||||
AxisAlignedBB left = AxisAlignedBB.getBoundingBox(
|
||||
(double) 0.0,
|
||||
(double) 0.25,
|
||||
(double) 0.25,
|
||||
(double) 0.25,
|
||||
(double) 0.75,
|
||||
(double) 0.75
|
||||
);
|
||||
AxisAlignedBB right = AxisAlignedBB.getBoundingBox(
|
||||
(double) 0.75,
|
||||
(double) 0.25,
|
||||
(double) 0.25,
|
||||
(double) 1.0,
|
||||
(double) 0.75,
|
||||
(double) 0.75
|
||||
);
|
||||
AxisAlignedBB front = AxisAlignedBB.getBoundingBox(
|
||||
(double) 0.25,
|
||||
(double) 0.25,
|
||||
(double) 0.0,
|
||||
(double) 0.75,
|
||||
(double) 0.75,
|
||||
(double) 0.25
|
||||
);
|
||||
AxisAlignedBB back = AxisAlignedBB.getBoundingBox(
|
||||
(double) 0.25,
|
||||
(double) 0.25,
|
||||
(double) 0.75,
|
||||
(double) 0.75,
|
||||
(double) 0.75,
|
||||
(double) 1.0
|
||||
);
|
||||
boolean connectUp
|
||||
= CraneHelper.canFrameConnectTo(tE, x, y + 1, z, ForgeDirection.DOWN);
|
||||
boolean connectDown
|
||||
= CraneHelper.canFrameConnectTo(tE, x, y - 1, z, ForgeDirection.UP);
|
||||
boolean connectLeft
|
||||
= CraneHelper.canFrameConnectTo(tE, x - 1, y, z, ForgeDirection.EAST);
|
||||
boolean connectRight
|
||||
= CraneHelper.canFrameConnectTo(tE, x + 1, y, z, ForgeDirection.WEST);
|
||||
boolean connectFront
|
||||
= CraneHelper.canFrameConnectTo(tE, x, y, z - 1, ForgeDirection.SOUTH);
|
||||
boolean connectBack
|
||||
= CraneHelper.canFrameConnectTo(tE, x, y, z + 1, ForgeDirection.NORTH);
|
||||
if (connectUp) {
|
||||
middle.maxY = up.maxY;
|
||||
}
|
||||
|
@ -54,8 +109,15 @@ extends BlockALMachine {
|
|||
if (connectBack) {
|
||||
middle.maxZ = back.maxZ;
|
||||
}
|
||||
this.setBlockBounds((float)middle.minX, (float)middle.minY, (float)middle.minZ, (float)middle.maxX, (float)middle.maxY, (float)middle.maxZ);
|
||||
middle.offset((double)x, (double)y, (double)z);
|
||||
this.setBlockBounds(
|
||||
(float) middle.minX,
|
||||
(float) middle.minY,
|
||||
(float) middle.minZ,
|
||||
(float) middle.maxX,
|
||||
(float) middle.maxY,
|
||||
(float) middle.maxZ
|
||||
);
|
||||
middle.offset((double) x, (double) y, (double) z);
|
||||
return middle;
|
||||
}
|
||||
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
|
||||
|
@ -65,19 +127,74 @@ extends BlockALMachine {
|
|||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity tE = world.getTileEntity(x, y, z);
|
||||
if (tE != null && tE instanceof TileEntityCraneRail) {
|
||||
AxisAlignedBB middle = AxisAlignedBB.getBoundingBox((double)0.25, (double)0.25, (double)0.25, (double)0.75, (double)0.75, (double)0.75);
|
||||
AxisAlignedBB up = AxisAlignedBB.getBoundingBox((double)0.25, (double)0.75, (double)0.25, (double)0.75, (double)1.0, (double)0.75);
|
||||
AxisAlignedBB down = AxisAlignedBB.getBoundingBox((double)0.25, (double)0.0, (double)0.25, (double)0.75, (double)0.25, (double)0.75);
|
||||
AxisAlignedBB left = AxisAlignedBB.getBoundingBox((double)0.0, (double)0.25, (double)0.25, (double)0.25, (double)0.75, (double)0.75);
|
||||
AxisAlignedBB right = AxisAlignedBB.getBoundingBox((double)0.75, (double)0.25, (double)0.25, (double)1.0, (double)0.75, (double)0.75);
|
||||
AxisAlignedBB front = AxisAlignedBB.getBoundingBox((double)0.25, (double)0.25, (double)0.0, (double)0.75, (double)0.75, (double)0.25);
|
||||
AxisAlignedBB back = AxisAlignedBB.getBoundingBox((double)0.25, (double)0.25, (double)0.75, (double)0.75, (double)0.75, (double)1.0);
|
||||
boolean connectUp = CraneHelper.canFrameConnectTo(tE, x, y + 1, z, ForgeDirection.DOWN);
|
||||
boolean connectDown = CraneHelper.canFrameConnectTo(tE, x, y - 1, z, ForgeDirection.UP);
|
||||
boolean connectLeft = CraneHelper.canFrameConnectTo(tE, x - 1, y, z, ForgeDirection.EAST);
|
||||
boolean connectRight = CraneHelper.canFrameConnectTo(tE, x + 1, y, z, ForgeDirection.WEST);
|
||||
boolean connectFront = CraneHelper.canFrameConnectTo(tE, x, y, z - 1, ForgeDirection.SOUTH);
|
||||
boolean connectBack = CraneHelper.canFrameConnectTo(tE, x, y, z + 1, ForgeDirection.NORTH);
|
||||
AxisAlignedBB middle = AxisAlignedBB.getBoundingBox(
|
||||
(double) 0.25,
|
||||
(double) 0.25,
|
||||
(double) 0.25,
|
||||
(double) 0.75,
|
||||
(double) 0.75,
|
||||
(double) 0.75
|
||||
);
|
||||
AxisAlignedBB up = AxisAlignedBB.getBoundingBox(
|
||||
(double) 0.25,
|
||||
(double) 0.75,
|
||||
(double) 0.25,
|
||||
(double) 0.75,
|
||||
(double) 1.0,
|
||||
(double) 0.75
|
||||
);
|
||||
AxisAlignedBB down = AxisAlignedBB.getBoundingBox(
|
||||
(double) 0.25,
|
||||
(double) 0.0,
|
||||
(double) 0.25,
|
||||
(double) 0.75,
|
||||
(double) 0.25,
|
||||
(double) 0.75
|
||||
);
|
||||
AxisAlignedBB left = AxisAlignedBB.getBoundingBox(
|
||||
(double) 0.0,
|
||||
(double) 0.25,
|
||||
(double) 0.25,
|
||||
(double) 0.25,
|
||||
(double) 0.75,
|
||||
(double) 0.75
|
||||
);
|
||||
AxisAlignedBB right = AxisAlignedBB.getBoundingBox(
|
||||
(double) 0.75,
|
||||
(double) 0.25,
|
||||
(double) 0.25,
|
||||
(double) 1.0,
|
||||
(double) 0.75,
|
||||
(double) 0.75
|
||||
);
|
||||
AxisAlignedBB front = AxisAlignedBB.getBoundingBox(
|
||||
(double) 0.25,
|
||||
(double) 0.25,
|
||||
(double) 0.0,
|
||||
(double) 0.75,
|
||||
(double) 0.75,
|
||||
(double) 0.25
|
||||
);
|
||||
AxisAlignedBB back = AxisAlignedBB.getBoundingBox(
|
||||
(double) 0.25,
|
||||
(double) 0.25,
|
||||
(double) 0.75,
|
||||
(double) 0.75,
|
||||
(double) 0.75,
|
||||
(double) 1.0
|
||||
);
|
||||
boolean connectUp
|
||||
= CraneHelper.canFrameConnectTo(tE, x, y + 1, z, ForgeDirection.DOWN);
|
||||
boolean connectDown
|
||||
= CraneHelper.canFrameConnectTo(tE, x, y - 1, z, ForgeDirection.UP);
|
||||
boolean connectLeft
|
||||
= CraneHelper.canFrameConnectTo(tE, x - 1, y, z, ForgeDirection.EAST);
|
||||
boolean connectRight
|
||||
= CraneHelper.canFrameConnectTo(tE, x + 1, y, z, ForgeDirection.WEST);
|
||||
boolean connectFront
|
||||
= CraneHelper.canFrameConnectTo(tE, x, y, z - 1, ForgeDirection.SOUTH);
|
||||
boolean connectBack
|
||||
= CraneHelper.canFrameConnectTo(tE, x, y, z + 1, ForgeDirection.NORTH);
|
||||
if (connectUp) {
|
||||
middle.maxY = up.maxY;
|
||||
}
|
||||
|
@ -96,7 +213,14 @@ extends BlockALMachine {
|
|||
if (connectBack) {
|
||||
middle.maxZ = back.maxZ;
|
||||
}
|
||||
this.setBlockBounds((float)middle.minX, (float)middle.minY, (float)middle.minZ, (float)middle.maxX, (float)middle.maxY, (float)middle.maxZ);
|
||||
this.setBlockBounds(
|
||||
(float) middle.minX,
|
||||
(float) middle.minY,
|
||||
(float) middle.minZ,
|
||||
(float) middle.maxX,
|
||||
(float) middle.maxY,
|
||||
(float) middle.maxZ
|
||||
);
|
||||
return;
|
||||
}
|
||||
this.setBlockBounds(0.25f, 0.25f, 0.25f, 0.75f, 0.75f, 0.75f);
|
||||
|
@ -118,9 +242,8 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public int getRenderType() {
|
||||
return BlockRenderingHandler.BLOCK_RENDER_ID;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,16 +10,22 @@ public class CraneHelper {
|
|||
public static final int MAX_SIZE = 64;
|
||||
|
||||
public static boolean isCraneBlock(World world, int x, int y, int z) {
|
||||
return world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof ICraneConnectable;
|
||||
return world.getTileEntity(x, y, z) != null
|
||||
&& world.getTileEntity(x, y, z) instanceof ICraneConnectable;
|
||||
}
|
||||
|
||||
public static boolean isCraneStructureBlock(World world, int x, int y, int z) {
|
||||
return world.getTileEntity(x, y, z) != null && world.getTileEntity(x, y, z) instanceof ICraneStructure;
|
||||
return world.getTileEntity(x, y, z) != null
|
||||
&& world.getTileEntity(x, y, z) instanceof ICraneStructure;
|
||||
}
|
||||
|
||||
public static boolean canFrameConnectTo(TileEntity tileEntity, int x, int y, int z, ForgeDirection side) {
|
||||
if (tileEntity.getWorldObj().getTileEntity(x, y, z) != null && tileEntity.getWorldObj().getTileEntity(x, y, z) instanceof ICraneConnectable) {
|
||||
return ((ICraneConnectable)tileEntity.getWorldObj().getTileEntity(x, y, z)).canFrameConnectTo(side);
|
||||
public static boolean
|
||||
canFrameConnectTo(TileEntity tileEntity, int x, int y, int z, ForgeDirection side) {
|
||||
if (tileEntity.getWorldObj().getTileEntity(x, y, z) != null
|
||||
&& tileEntity.getWorldObj().getTileEntity(x, y, z)
|
||||
instanceof ICraneConnectable) {
|
||||
return ((ICraneConnectable) tileEntity.getWorldObj().getTileEntity(x, y, z))
|
||||
.canFrameConnectTo(side);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -56,4 +62,3 @@ public class CraneHelper {
|
|||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityCraneController
|
||||
extends TileEntityAssemblyNetwork
|
||||
implements ICraneConnectable {
|
||||
extends TileEntityAssemblyNetwork implements ICraneConnectable {
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
int depth = 0;
|
||||
|
@ -35,7 +34,8 @@ implements ICraneConnectable {
|
|||
this.findCraneHeight();
|
||||
this.findCraneWidth();
|
||||
this.findCraneDepth();
|
||||
if (Math.abs(this.height) > 1 && Math.abs(this.width) > 1 && Math.abs(this.depth) > 1) {
|
||||
if (Math.abs(this.height) > 1 && Math.abs(this.width) > 1
|
||||
&& Math.abs(this.depth) > 1) {
|
||||
this.isCraneValid = this.isFrameValid();
|
||||
}
|
||||
}
|
||||
|
@ -44,24 +44,46 @@ implements ICraneConnectable {
|
|||
int z;
|
||||
int x;
|
||||
for (x = Math.min(0, this.width); x <= Math.max(0, this.width); ++x) {
|
||||
if (CraneHelper.isCraneStructureBlock(this.worldObj, this.xCoord + x, this.yCoord + this.height, this.zCoord)) continue;
|
||||
if (CraneHelper.isCraneStructureBlock(
|
||||
this.worldObj, this.xCoord + x, this.yCoord + this.height, this.zCoord
|
||||
))
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
for (x = Math.min(0, this.width); x <= Math.max(0, this.width); ++x) {
|
||||
if (CraneHelper.isCraneStructureBlock(this.worldObj, this.xCoord + x, this.yCoord + this.height, this.zCoord + this.depth)) continue;
|
||||
if (CraneHelper.isCraneStructureBlock(
|
||||
this.worldObj,
|
||||
this.xCoord + x,
|
||||
this.yCoord + this.height,
|
||||
this.zCoord + this.depth
|
||||
))
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
for (z = Math.min(0, this.depth); z <= Math.max(0, this.depth); ++z) {
|
||||
if (CraneHelper.isCraneStructureBlock(this.worldObj, this.xCoord, this.yCoord + this.height, this.zCoord + z)) continue;
|
||||
if (CraneHelper.isCraneStructureBlock(
|
||||
this.worldObj, this.xCoord, this.yCoord + this.height, this.zCoord + z
|
||||
))
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
for (z = Math.min(0, this.depth); z <= Math.max(0, this.depth); ++z) {
|
||||
if (CraneHelper.isCraneStructureBlock(this.worldObj, this.xCoord + this.width, this.yCoord + this.height, this.zCoord + z)) continue;
|
||||
if (CraneHelper.isCraneStructureBlock(
|
||||
this.worldObj,
|
||||
this.xCoord + this.width,
|
||||
this.yCoord + this.height,
|
||||
this.zCoord + z
|
||||
))
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
for (x = Math.min(this.width + 1, 1); x <= Math.max(-1, this.width - 1); ++x) {
|
||||
for (int z2 = Math.min(this.depth + 1, 1); z2 <= Math.max(-1, this.depth - 1); ++z2) {
|
||||
if (this.worldObj.isAirBlock(this.xCoord + x, this.yCoord + this.height, this.zCoord + z2)) continue;
|
||||
for (int z2 = Math.min(this.depth + 1, 1); z2 <= Math.max(-1, this.depth - 1);
|
||||
++z2) {
|
||||
if (this.worldObj.isAirBlock(
|
||||
this.xCoord + x, this.yCoord + this.height, this.zCoord + z2
|
||||
))
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -74,8 +96,12 @@ implements ICraneConnectable {
|
|||
return;
|
||||
}
|
||||
int x = 0;
|
||||
ForgeDirection facing = ForgeDirection.getOrientation((int)this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord));
|
||||
while (Math.abs(x) <= 64 && CraneHelper.isCraneStructureBlock(this.worldObj, this.xCoord + x, this.yCoord + this.height, this.zCoord)) {
|
||||
ForgeDirection facing = ForgeDirection.getOrientation((int
|
||||
) this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord));
|
||||
while (Math.abs(x) <= 64
|
||||
&& CraneHelper.isCraneStructureBlock(
|
||||
this.worldObj, this.xCoord + x, this.yCoord + this.height, this.zCoord
|
||||
)) {
|
||||
if (facing == ForgeDirection.NORTH || facing == ForgeDirection.EAST) {
|
||||
++x;
|
||||
continue;
|
||||
|
@ -93,8 +119,11 @@ implements ICraneConnectable {
|
|||
|
||||
private void findCraneHeight() {
|
||||
int y;
|
||||
for (y = 1; this.yCoord + y < 256 && y <= 64 && CraneHelper.isCraneStructureBlock(this.worldObj, this.xCoord, this.yCoord + y, this.zCoord); ++y) {
|
||||
}
|
||||
for (y = 1; this.yCoord + y < 256 && y <= 64
|
||||
&& CraneHelper.isCraneStructureBlock(
|
||||
this.worldObj, this.xCoord, this.yCoord + y, this.zCoord
|
||||
);
|
||||
++y) {}
|
||||
this.height = y - 1;
|
||||
}
|
||||
|
||||
|
@ -104,8 +133,12 @@ implements ICraneConnectable {
|
|||
return;
|
||||
}
|
||||
int z = 0;
|
||||
ForgeDirection facing = ForgeDirection.getOrientation((int)this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord));
|
||||
while (Math.abs(z) <= 64 && CraneHelper.isCraneStructureBlock(this.worldObj, this.xCoord, this.yCoord + this.height, this.zCoord + z)) {
|
||||
ForgeDirection facing = ForgeDirection.getOrientation((int
|
||||
) this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord));
|
||||
while (Math.abs(z) <= 64
|
||||
&& CraneHelper.isCraneStructureBlock(
|
||||
this.worldObj, this.xCoord, this.yCoord + this.height, this.zCoord + z
|
||||
)) {
|
||||
if (facing == ForgeDirection.SOUTH || facing == ForgeDirection.EAST) {
|
||||
++z;
|
||||
continue;
|
||||
|
@ -123,7 +156,8 @@ implements ICraneConnectable {
|
|||
|
||||
@Override
|
||||
public boolean canFrameConnectTo(ForgeDirection side) {
|
||||
ForgeDirection facing = ForgeDirection.getOrientation((int)this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord));
|
||||
ForgeDirection facing = ForgeDirection.getOrientation((int
|
||||
) this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord));
|
||||
if (side == facing) {
|
||||
return true;
|
||||
}
|
||||
|
@ -156,4 +190,3 @@ implements ICraneConnectable {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@ import assemblyline.common.machine.TileEntityAssemblyNetwork;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityCraneRail
|
||||
extends TileEntityAssemblyNetwork
|
||||
implements ICraneStructure {
|
||||
extends TileEntityAssemblyNetwork implements ICraneStructure {
|
||||
@Override
|
||||
public boolean canFrameConnectTo(ForgeDirection side) {
|
||||
return true;
|
||||
|
@ -17,4 +16,3 @@ implements ICraneStructure {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
|
||||
public class BlockDetector
|
||||
extends BlockImprintable {
|
||||
public class BlockDetector extends BlockImprintable {
|
||||
IIcon eye_red;
|
||||
IIcon eye_green;
|
||||
|
||||
|
@ -30,8 +29,12 @@ extends BlockImprintable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||
int angle = MathHelper.floor_double((double)((double)(entity.rotationYaw * 4.0f / 360.0f) + 0.5)) & 3;
|
||||
public void onBlockPlacedBy(
|
||||
World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack
|
||||
) {
|
||||
int angle = MathHelper.floor_double((double
|
||||
) ((double) (entity.rotationYaw * 4.0f / 360.0f) + 0.5))
|
||||
& 3;
|
||||
int change = 2;
|
||||
switch (angle) {
|
||||
case 0: {
|
||||
|
@ -60,7 +63,7 @@ extends BlockImprintable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg) {
|
||||
super.registerBlockIcons(iconReg);
|
||||
this.eye_green = iconReg.registerIcon("assemblyline:detector_green");
|
||||
|
@ -70,8 +73,12 @@ extends BlockImprintable {
|
|||
@Override
|
||||
public IIcon getIcon(IBlockAccess iBlockAccess, int x, int y, int z, int side) {
|
||||
TileEntity tileEntity = iBlockAccess.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityDetector && side == ForgeDirection.getOrientation((int)iBlockAccess.getBlockMetadata(x, y, z)).ordinal()) {
|
||||
if (((TileEntityDetector)tileEntity).isInverted()) {
|
||||
if (tileEntity instanceof TileEntityDetector
|
||||
&& side
|
||||
== ForgeDirection
|
||||
.getOrientation((int) iBlockAccess.getBlockMetadata(x, y, z))
|
||||
.ordinal()) {
|
||||
if (((TileEntityDetector) tileEntity).isInverted()) {
|
||||
return this.eye_red;
|
||||
}
|
||||
return this.eye_green;
|
||||
|
@ -88,7 +95,17 @@ extends BlockImprintable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onUseWrench(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer par5EntityPlayer,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ
|
||||
) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, side, 3);
|
||||
return true;
|
||||
}
|
||||
|
@ -111,11 +128,13 @@ extends BlockImprintable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockSolid(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
public boolean
|
||||
isBlockSolid(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) {
|
||||
public boolean
|
||||
isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -125,16 +144,19 @@ extends BlockImprintable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int direction) {
|
||||
public int
|
||||
isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int direction) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityDetector) {
|
||||
return ((TileEntityDetector)tileEntity).isPoweringTo(ForgeDirection.getOrientation((int)direction));
|
||||
return ((TileEntityDetector) tileEntity)
|
||||
.isPoweringTo(ForgeDirection.getOrientation((int) direction));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int direction) {
|
||||
public int
|
||||
isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int direction) {
|
||||
return this.isProvidingStrongPower(world, x, y, z, direction);
|
||||
}
|
||||
|
||||
|
@ -143,4 +165,3 @@ extends BlockImprintable {
|
|||
return new TileEntityDetector();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,32 +1,43 @@
|
|||
package assemblyline.common.machine.detector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.machine.imprinter.TileEntityFilterable;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityDetector
|
||||
extends TileEntityFilterable {
|
||||
public class TileEntityDetector extends TileEntityFilterable {
|
||||
private boolean powering = false;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (!this.worldObj.isRemote && this.ticks % 10L == 0L) {
|
||||
int metadata = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord);
|
||||
AxisAlignedBB testArea = AxisAlignedBB.getBoundingBox((double)this.xCoord, (double)this.yCoord, (double)this.zCoord, (double)(this.xCoord + 1), (double)(this.yCoord + 1), (double)(this.zCoord + 1));
|
||||
ForgeDirection dir = ForgeDirection.getOrientation((int)metadata);
|
||||
testArea.offset((double)dir.offsetX, (double)dir.offsetY, (double)dir.offsetZ);
|
||||
ArrayList entities = (ArrayList)this.worldObj.getEntitiesWithinAABB(EntityItem.class, testArea);
|
||||
int metadata
|
||||
= this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord);
|
||||
AxisAlignedBB testArea = AxisAlignedBB.getBoundingBox(
|
||||
(double) this.xCoord,
|
||||
(double) this.yCoord,
|
||||
(double) this.zCoord,
|
||||
(double) (this.xCoord + 1),
|
||||
(double) (this.yCoord + 1),
|
||||
(double) (this.zCoord + 1)
|
||||
);
|
||||
ForgeDirection dir = ForgeDirection.getOrientation((int) metadata);
|
||||
testArea.offset(
|
||||
(double) dir.offsetX, (double) dir.offsetY, (double) dir.offsetZ
|
||||
);
|
||||
ArrayList entities = (ArrayList
|
||||
) this.worldObj.getEntitiesWithinAABB(EntityItem.class, testArea);
|
||||
boolean powerCheck = false;
|
||||
if (entities.size() > 0) {
|
||||
if (this.getFilter() != null) {
|
||||
for (int i = 0; i < entities.size(); ++i) {
|
||||
EntityItem e = (EntityItem)entities.get(i);
|
||||
EntityItem e = (EntityItem) entities.get(i);
|
||||
ItemStack itemStack = e.getEntityItem();
|
||||
powerCheck = this.isFiltering(itemStack);
|
||||
}
|
||||
|
@ -38,11 +49,17 @@ extends TileEntityFilterable {
|
|||
}
|
||||
if (powerCheck != this.powering) {
|
||||
this.powering = powerCheck;
|
||||
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, AssemblyLine.blockDetector);
|
||||
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord + 1, this.zCoord, AssemblyLine.blockDetector);
|
||||
this.worldObj.notifyBlocksOfNeighborChange(
|
||||
this.xCoord, this.yCoord, this.zCoord, AssemblyLine.blockDetector
|
||||
);
|
||||
this.worldObj.notifyBlocksOfNeighborChange(
|
||||
this.xCoord, this.yCoord + 1, this.zCoord, AssemblyLine.blockDetector
|
||||
);
|
||||
for (int x = this.xCoord - 1; x <= this.xCoord + 1; ++x) {
|
||||
for (int z = this.zCoord - 1; z <= this.zCoord + 1; ++z) {
|
||||
this.worldObj.notifyBlocksOfNeighborChange(x, this.yCoord + 1, z, AssemblyLine.blockDetector);
|
||||
this.worldObj.notifyBlocksOfNeighborChange(
|
||||
x, this.yCoord + 1, z, AssemblyLine.blockDetector
|
||||
);
|
||||
}
|
||||
}
|
||||
this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
|
@ -52,8 +69,12 @@ extends TileEntityFilterable {
|
|||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, AssemblyLine.blockDetector);
|
||||
this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord + 1, this.zCoord, AssemblyLine.blockDetector);
|
||||
this.worldObj.notifyBlocksOfNeighborChange(
|
||||
this.xCoord, this.yCoord, this.zCoord, AssemblyLine.blockDetector
|
||||
);
|
||||
this.worldObj.notifyBlocksOfNeighborChange(
|
||||
this.xCoord, this.yCoord + 1, this.zCoord, AssemblyLine.blockDetector
|
||||
);
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
|
@ -82,4 +103,3 @@ extends TileEntityFilterable {
|
|||
return direction != this.getDirection();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,7 @@ import net.minecraft.util.IIcon;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockEncoder
|
||||
extends BlockALMachine {
|
||||
public class BlockEncoder extends BlockALMachine {
|
||||
IIcon encoder_side;
|
||||
IIcon encoder_top;
|
||||
IIcon encoder_bottom;
|
||||
|
@ -26,7 +25,7 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg) {
|
||||
this.encoder_side = iconReg.registerIcon("assemblyline:encoder_side");
|
||||
this.encoder_top = iconReg.registerIcon("assemblyline:encoder_top");
|
||||
|
@ -50,9 +49,19 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
|
||||
public boolean onMachineActivated(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer entityPlayer,
|
||||
int par6,
|
||||
float par7,
|
||||
float par8,
|
||||
float par9
|
||||
) {
|
||||
if (!world.isRemote) {
|
||||
entityPlayer.openGui((Object)AssemblyLine.instance, 2, world, x, y, z);
|
||||
entityPlayer.openGui((Object) AssemblyLine.instance, 2, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -61,4 +70,3 @@ extends BlockALMachine {
|
|||
return new TileEntityEncoder();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,7 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerEncoder
|
||||
extends Container {
|
||||
public class ContainerEncoder extends Container {
|
||||
public static final int Y_OFFSET = 0;
|
||||
private ItemStack[] containingItems = new ItemStack[1];
|
||||
private InventoryPlayer inventoryPlayer;
|
||||
|
@ -20,14 +19,23 @@ extends Container {
|
|||
int var3;
|
||||
this.inventoryPlayer = inventoryPlayer;
|
||||
this.tileEntity = encoder;
|
||||
this.addSlotToContainer(new SlotCustom((IInventory)encoder, 0, 80, 24, new ItemStack(AssemblyLine.itemDisk)));
|
||||
this.addSlotToContainer(new SlotCustom(
|
||||
(IInventory) encoder, 0, 80, 24, new ItemStack(AssemblyLine.itemDisk)
|
||||
));
|
||||
for (var3 = 0; var3 < 3; ++var3) {
|
||||
for (int var4 = 0; var4 < 9; ++var4) {
|
||||
this.addSlotToContainer(new Slot((IInventory)inventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 155 + var3 * 18 + 0));
|
||||
this.addSlotToContainer(new Slot(
|
||||
(IInventory) inventoryPlayer,
|
||||
var4 + var3 * 9 + 9,
|
||||
8 + var4 * 18,
|
||||
155 + var3 * 18 + 0
|
||||
));
|
||||
}
|
||||
}
|
||||
for (var3 = 0; var3 < 9; ++var3) {
|
||||
this.addSlotToContainer(new Slot((IInventory)inventoryPlayer, var3, 8 + var3 * 18, 213));
|
||||
this.addSlotToContainer(
|
||||
new Slot((IInventory) inventoryPlayer, var3, 8 + var3 * 18, 213)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,15 +45,19 @@ extends Container {
|
|||
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
|
||||
ItemStack copyStack = null;
|
||||
Slot slotObj = (Slot)this.inventorySlots.get(slot);
|
||||
Slot slotObj = (Slot) this.inventorySlots.get(slot);
|
||||
if (slotObj != null && slotObj.getHasStack()) {
|
||||
ItemStack slotStack = slotObj.getStack();
|
||||
copyStack = slotStack.copy();
|
||||
if (slot >= 1 ? this.getSlot(0).isItemValid(slotStack) && !this.mergeItemStack(slotStack, 0, 1, false) : !this.mergeItemStack(slotStack, this.containingItems.length, 37, false)) {
|
||||
if (slot >= 1 ? this.getSlot(0).isItemValid(slotStack)
|
||||
&& !this.mergeItemStack(slotStack, 0, 1, false)
|
||||
: !this.mergeItemStack(
|
||||
slotStack, this.containingItems.length, 37, false
|
||||
)) {
|
||||
return null;
|
||||
}
|
||||
if (slotStack.stackSize == 0) {
|
||||
slotObj.putStack((ItemStack)null);
|
||||
slotObj.putStack((ItemStack) null);
|
||||
} else {
|
||||
slotObj.onSlotChanged();
|
||||
}
|
||||
|
@ -57,4 +69,3 @@ extends Container {
|
|||
return copyStack;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,4 +3,3 @@ package assemblyline.common.machine.encoder;
|
|||
public interface IInventoryWatcher {
|
||||
public void inventoryChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package assemblyline.common.machine.encoder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import assemblyline.common.TabAssemblyLine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -13,8 +14,7 @@ import net.minecraft.nbt.NBTBase;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class ItemDisk
|
||||
extends Item {
|
||||
public class ItemDisk extends Item {
|
||||
public ItemDisk() {
|
||||
super();
|
||||
this.setUnlocalizedName("disk");
|
||||
|
@ -23,7 +23,7 @@ extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
this.itemIcon = par1IconRegister.registerIcon("assemblyline:disk");
|
||||
}
|
||||
|
@ -34,7 +34,9 @@ extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer par2EntityPlayer, List list, boolean par4) {
|
||||
public void addInformation(
|
||||
ItemStack itemStack, EntityPlayer par2EntityPlayer, List list, boolean par4
|
||||
) {
|
||||
ArrayList commands = ItemDisk.getCommands(itemStack);
|
||||
if (commands.size() > 0) {
|
||||
if (commands.size() == 1) {
|
||||
|
@ -53,12 +55,13 @@ extends Item {
|
|||
}
|
||||
NBTTagList nbt = new NBTTagList();
|
||||
for (int i = 0; i < commands.size(); ++i) {
|
||||
if (commands.get(i) == null) continue;
|
||||
if (commands.get(i) == null)
|
||||
continue;
|
||||
NBTTagCompound newCompound = new NBTTagCompound();
|
||||
newCompound.setString("command", (String)commands.get(i));
|
||||
nbt.appendTag((NBTBase)newCompound);
|
||||
newCompound.setString("command", (String) commands.get(i));
|
||||
nbt.appendTag((NBTBase) newCompound);
|
||||
}
|
||||
itemStack.getTagCompound().setTag("Commands", (NBTBase)nbt);
|
||||
itemStack.getTagCompound().setTag("Commands", (NBTBase) nbt);
|
||||
}
|
||||
|
||||
public static ArrayList getCommands(ItemStack itemStack) {
|
||||
|
@ -76,4 +79,3 @@ extends Item {
|
|||
return commands;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotDisk
|
||||
extends Slot {
|
||||
public class SlotDisk extends Slot {
|
||||
public SlotDisk(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
@ -15,4 +14,3 @@ extends Slot {
|
|||
return itemStack.getItem() == AssemblyLine.itemDisk;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotDiskResult
|
||||
extends Slot {
|
||||
public class SlotDiskResult extends Slot {
|
||||
public SlotDiskResult(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
@ -18,11 +17,10 @@ extends Slot {
|
|||
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack) {
|
||||
super.onPickupFromSlot(par1EntityPlayer, par2ItemStack);
|
||||
if (this.inventory.getStackInSlot(0) != null) {
|
||||
--this.inventory.getStackInSlot((int)0).stackSize;
|
||||
if (this.inventory.getStackInSlot((int)0).stackSize <= 0) {
|
||||
--this.inventory.getStackInSlot((int) 0).stackSize;
|
||||
if (this.inventory.getStackInSlot((int) 0).stackSize <= 0) {
|
||||
this.inventory.setInventorySlotContents(0, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package assemblyline.common.machine.encoder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import assemblyline.common.machine.command.Command;
|
||||
import assemblyline.common.machine.encoder.IInventoryWatcher;
|
||||
import assemblyline.common.machine.encoder.ItemDisk;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -14,9 +15,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import universalelectricity.prefab.tile.TileEntityAdvanced;
|
||||
|
||||
public class TileEntityEncoder
|
||||
extends TileEntityAdvanced
|
||||
implements ISidedInventory {
|
||||
public class TileEntityEncoder extends TileEntityAdvanced implements ISidedInventory {
|
||||
private ItemStack disk;
|
||||
private IInventoryWatcher watcher;
|
||||
|
||||
|
@ -78,16 +77,20 @@ implements ISidedInventory {
|
|||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq((double)this.xCoord + 0.5, (double)this.yCoord + 0.5, (double)this.zCoord + 0.5) <= 64.0;
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this
|
||||
? false
|
||||
: player.getDistanceSq(
|
||||
(double) this.xCoord + 0.5,
|
||||
(double) this.yCoord + 0.5,
|
||||
(double) this.zCoord + 0.5
|
||||
) <= 64.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
public void closeInventory() {}
|
||||
|
||||
public void setWatcher(IInventoryWatcher watcher) {
|
||||
this.watcher = watcher;
|
||||
|
@ -112,12 +115,13 @@ implements ISidedInventory {
|
|||
super.readFromNBT(nbt);
|
||||
NBTTagCompound diskNBT = nbt.getCompoundTag("disk");
|
||||
if (diskNBT != null) {
|
||||
this.disk = ItemStack.loadItemStackFromNBT((NBTTagCompound)diskNBT);
|
||||
this.disk = ItemStack.loadItemStackFromNBT((NBTTagCompound) diskNBT);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleMessage(NBTTagCompound nbt) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER && this.disk != null) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER
|
||||
&& this.disk != null) {
|
||||
ArrayList<String> tempCmds = ItemDisk.getCommands(this.disk);
|
||||
if (nbt.getBoolean("create")) {
|
||||
String newCommand = nbt.getString("newCommand");
|
||||
|
@ -157,7 +161,6 @@ implements ISidedInventory {
|
|||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return side == ForgeDirection.UP.ordinal() ? new int[] {0} : new int[0];
|
||||
return side == ForgeDirection.UP.ordinal() ? new int[] { 0 } : new int[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,7 @@ import net.minecraft.util.MathHelper;
|
|||
import net.minecraft.world.World;
|
||||
import universalelectricity.prefab.implement.IRedstoneReceptor;
|
||||
|
||||
public abstract class BlockImprintable
|
||||
extends BlockALMachine {
|
||||
public abstract class BlockImprintable extends BlockALMachine {
|
||||
public BlockImprintable(String name, Material material, CreativeTabs creativeTab) {
|
||||
super(material);
|
||||
this.setBlockName(name);
|
||||
|
@ -24,22 +23,37 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
|
||||
public boolean onMachineActivated(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer player,
|
||||
int par6,
|
||||
float par7,
|
||||
float par8,
|
||||
float par9
|
||||
) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity instanceof IFilterable) {
|
||||
ItemStack containingStack = ((IFilterable)tileEntity).getFilter();
|
||||
ItemStack containingStack = ((IFilterable) tileEntity).getFilter();
|
||||
if (containingStack != null) {
|
||||
if (!world.isRemote) {
|
||||
EntityItem dropStack = new EntityItem(world, player.posX, player.posY, player.posZ, containingStack);
|
||||
EntityItem dropStack = new EntityItem(
|
||||
world, player.posX, player.posY, player.posZ, containingStack
|
||||
);
|
||||
dropStack.delayBeforeCanPickup = 0;
|
||||
world.spawnEntityInWorld((Entity)dropStack);
|
||||
world.spawnEntityInWorld((Entity) dropStack);
|
||||
}
|
||||
((IFilterable)tileEntity).setFilter(null);
|
||||
((IFilterable) tileEntity).setFilter(null);
|
||||
return true;
|
||||
}
|
||||
if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemImprinter) {
|
||||
((IFilterable)tileEntity).setFilter(player.getCurrentEquippedItem());
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
if (player.getCurrentEquippedItem() != null
|
||||
&& player.getCurrentEquippedItem().getItem() instanceof ItemImprinter) {
|
||||
((IFilterable) tileEntity).setFilter(player.getCurrentEquippedItem());
|
||||
player.inventory.setInventorySlotContents(
|
||||
player.inventory.currentItem, null
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -47,10 +61,20 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onSneakUseWrench(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer par5EntityPlayer,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ
|
||||
) {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityFilterable) {
|
||||
((TileEntityFilterable)tileEntity).toggleInversion();
|
||||
((TileEntityFilterable) tileEntity).toggleInversion();
|
||||
world.markBlockRangeForRenderUpdate(x, y, z, x, y, z);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
|
@ -58,7 +82,17 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onSneakMachineActivated(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer player,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ
|
||||
) {
|
||||
return this.onMachineActivated(world, x, y, z, player, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
|
@ -66,14 +100,24 @@ extends BlockALMachine {
|
|||
public void onNeighborBlockChange(World par1World, int x, int y, int z, Block side) {
|
||||
super.onNeighborBlockChange(par1World, x, y, z, side);
|
||||
TileEntity tileEntity = par1World.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof IRedstoneReceptor && par1World.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||
((IRedstoneReceptor)par1World.getTileEntity(x, y, z)).onPowerOn();
|
||||
if (tileEntity instanceof IRedstoneReceptor
|
||||
&& par1World.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||
((IRedstoneReceptor) par1World.getTileEntity(x, y, z)).onPowerOn();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase par5EntityLiving, ItemStack stack) {
|
||||
int angle = MathHelper.floor_double((double)((double)(par5EntityLiving.rotationYaw * 4.0f / 360.0f) + 0.5)) & 3;
|
||||
public void onBlockPlacedBy(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityLivingBase par5EntityLiving,
|
||||
ItemStack stack
|
||||
) {
|
||||
int angle = MathHelper.floor_double((double
|
||||
) ((double) (par5EntityLiving.rotationYaw * 4.0f / 360.0f) + 0.5))
|
||||
& 3;
|
||||
int change = 2;
|
||||
switch (angle) {
|
||||
case 0: {
|
||||
|
@ -96,7 +140,17 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onUseWrench(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer par5EntityPlayer,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ
|
||||
) {
|
||||
int original = world.getBlockMetadata(x, y, z);
|
||||
int change = 2;
|
||||
switch (original) {
|
||||
|
@ -120,4 +174,3 @@ extends BlockALMachine {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package assemblyline.common.machine.imprinter;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import assemblyline.common.AssemblyLine;
|
||||
import assemblyline.common.TabAssemblyLine;
|
||||
import assemblyline.common.block.BlockALMachine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -20,8 +20,7 @@ import net.minecraft.util.IIcon;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockImprinter
|
||||
extends BlockALMachine {
|
||||
public class BlockImprinter extends BlockALMachine {
|
||||
IIcon imprinter_side;
|
||||
IIcon imprinter_top;
|
||||
IIcon imprinter_bottom;
|
||||
|
@ -33,7 +32,7 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg) {
|
||||
this.imprinter_side = iconReg.registerIcon("assemblyline:imprinter_side");
|
||||
this.imprinter_top = iconReg.registerIcon("assemblyline:imprinter_top");
|
||||
|
@ -41,7 +40,7 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return this.getIcon(side, 0);
|
||||
}
|
||||
|
@ -58,21 +57,33 @@ extends BlockALMachine {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
|
||||
public boolean onMachineActivated(
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer entityPlayer,
|
||||
int par6,
|
||||
float par7,
|
||||
float par8,
|
||||
float par9
|
||||
) {
|
||||
if (!world.isRemote) {
|
||||
entityPlayer.openGui((Object)AssemblyLine.instance, 1, world, x, y, z);
|
||||
entityPlayer.openGui((Object) AssemblyLine.instance, 1, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropEntireInventory(World par1World, int x, int y, int z, Block par5, int par6) {
|
||||
public void
|
||||
dropEntireInventory(World par1World, int x, int y, int z, Block par5, int par6) {
|
||||
TileEntity tileEntity = par1World.getTileEntity(x, y, z);
|
||||
if (tileEntity != null && tileEntity instanceof TileEntityImprinter) {
|
||||
TileEntityImprinter inventory = (TileEntityImprinter)tileEntity;
|
||||
TileEntityImprinter inventory = (TileEntityImprinter) tileEntity;
|
||||
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
|
||||
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||
if (itemStack == null) continue;
|
||||
if (itemStack == null)
|
||||
continue;
|
||||
Random random = new Random();
|
||||
float var8 = random.nextFloat() * 0.8f + 0.1f;
|
||||
float var9 = random.nextFloat() * 0.8f + 0.1f;
|
||||
|
@ -83,26 +94,48 @@ extends BlockALMachine {
|
|||
var11 = itemStack.stackSize;
|
||||
}
|
||||
itemStack.stackSize -= var11;
|
||||
if (i == inventory.imprinterMatrix.length + 9 - 1) continue;
|
||||
EntityItem entityItem = new EntityItem(par1World, (double)((float)x + var8), (double)((float)y + var9), (double)((float)z + var10), new ItemStack(itemStack.getItem(), var11, itemStack.getItemDamage()));
|
||||
if (i == inventory.imprinterMatrix.length + 9 - 1)
|
||||
continue;
|
||||
EntityItem entityItem = new EntityItem(
|
||||
par1World,
|
||||
(double) ((float) x + var8),
|
||||
(double) ((float) y + var9),
|
||||
(double) ((float) z + var10),
|
||||
new ItemStack(
|
||||
itemStack.getItem(), var11, itemStack.getItemDamage()
|
||||
)
|
||||
);
|
||||
if (itemStack.hasTagCompound()) {
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound)itemStack.getTagCompound().copy());
|
||||
entityItem.getEntityItem().setTagCompound(
|
||||
(NBTTagCompound) itemStack.getTagCompound().copy()
|
||||
);
|
||||
}
|
||||
float var13 = 0.05f;
|
||||
entityItem.motionX = (float)random.nextGaussian() * var13;
|
||||
entityItem.motionY = (float)random.nextGaussian() * var13 + 0.2f;
|
||||
entityItem.motionZ = (float)random.nextGaussian() * var13;
|
||||
par1World.spawnEntityInWorld((Entity)entityItem);
|
||||
entityItem.motionX = (float) random.nextGaussian() * var13;
|
||||
entityItem.motionY = (float) random.nextGaussian() * var13 + 0.2f;
|
||||
entityItem.motionZ = (float) random.nextGaussian() * var13;
|
||||
par1World.spawnEntityInWorld((Entity) entityItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onUseWrench(
|
||||
World par1World,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
EntityPlayer par5EntityPlayer,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ
|
||||
) {
|
||||
TileEntity tileEntity = par1World.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileEntityImprinter) {
|
||||
((TileEntityImprinter)tileEntity).searchInventories = !((TileEntityImprinter)tileEntity).searchInventories;
|
||||
((TileEntityImprinter) tileEntity).searchInventories
|
||||
= !((TileEntityImprinter) tileEntity).searchInventories;
|
||||
par1World.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
@ -114,4 +147,3 @@ extends BlockALMachine {
|
|||
return new TileEntityImprinter();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,37 +13,63 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerImprinter
|
||||
extends Container
|
||||
implements ISlotWatcher {
|
||||
public class ContainerImprinter extends Container implements ISlotWatcher {
|
||||
public InventoryPlayer inventoryPlayer;
|
||||
public TileEntityImprinter tileEntity;
|
||||
|
||||
public ContainerImprinter(InventoryPlayer inventoryPlayer, TileEntityImprinter tileEntity) {
|
||||
public ContainerImprinter(
|
||||
InventoryPlayer inventoryPlayer, TileEntityImprinter tileEntity
|
||||
) {
|
||||
int var3;
|
||||
this.tileEntity = tileEntity;
|
||||
this.tileEntity.container = this;
|
||||
this.inventoryPlayer = inventoryPlayer;
|
||||
for (int x = 0; x < 3; ++x) {
|
||||
for (int y = 0; y < 3; ++y) {
|
||||
this.addSlotToContainer(new WatchedSlot((IInventory)this.tileEntity, y + x * 3, 9 + y * 18, 16 + x * 18, this));
|
||||
this.addSlotToContainer(new WatchedSlot(
|
||||
(IInventory) this.tileEntity, y + x * 3, 9 + y * 18, 16 + x * 18, this
|
||||
));
|
||||
}
|
||||
}
|
||||
this.addSlotToContainer(new SlotCustom((IInventory)this.tileEntity, 9, 68, 34, new ItemStack(AssemblyLine.itemImprint)));
|
||||
this.addSlotToContainer(new WatchedSlot((IInventory)this.tileEntity, 10, 92, 34, this));
|
||||
this.addSlotToContainer(new SlotCraftingResult(this, (IInventory)this.tileEntity, 11, 148, 34));
|
||||
this.addSlotToContainer(new SlotCustom(
|
||||
(IInventory) this.tileEntity,
|
||||
9,
|
||||
68,
|
||||
34,
|
||||
new ItemStack(AssemblyLine.itemImprint)
|
||||
));
|
||||
this.addSlotToContainer(
|
||||
new WatchedSlot((IInventory) this.tileEntity, 10, 92, 34, this)
|
||||
);
|
||||
this.addSlotToContainer(
|
||||
new SlotCraftingResult(this, (IInventory) this.tileEntity, 11, 148, 34)
|
||||
);
|
||||
for (int ii = 0; ii < 2; ++ii) {
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new WatchedSlot((IInventory)this.tileEntity, i + ii * 9 + 12, 8 + i * 18, 80 + ii * 18, this));
|
||||
this.addSlotToContainer(new WatchedSlot(
|
||||
(IInventory) this.tileEntity,
|
||||
i + ii * 9 + 12,
|
||||
8 + i * 18,
|
||||
80 + ii * 18,
|
||||
this
|
||||
));
|
||||
}
|
||||
}
|
||||
for (var3 = 0; var3 < 3; ++var3) {
|
||||
for (int var4 = 0; var4 < 9; ++var4) {
|
||||
this.addSlotToContainer(new WatchedSlot((IInventory)inventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 120 + var3 * 18, this));
|
||||
this.addSlotToContainer(new WatchedSlot(
|
||||
(IInventory) inventoryPlayer,
|
||||
var4 + var3 * 9 + 9,
|
||||
8 + var4 * 18,
|
||||
120 + var3 * 18,
|
||||
this
|
||||
));
|
||||
}
|
||||
}
|
||||
for (var3 = 0; var3 < 9; ++var3) {
|
||||
this.addSlotToContainer(new WatchedSlot((IInventory)inventoryPlayer, var3, 8 + var3 * 18, 178, this));
|
||||
this.addSlotToContainer(new WatchedSlot(
|
||||
(IInventory) inventoryPlayer, var3, 8 + var3 * 18, 178, this
|
||||
));
|
||||
}
|
||||
this.tileEntity.openInventory();
|
||||
}
|
||||
|
@ -59,7 +85,7 @@ implements ISlotWatcher {
|
|||
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
|
||||
ItemStack copyStack = null;
|
||||
Slot slotObj = (Slot)this.inventorySlots.get(slot);
|
||||
Slot slotObj = (Slot) this.inventorySlots.get(slot);
|
||||
if (slotObj != null && slotObj.getHasStack()) {
|
||||
ItemStack slotStack = slotObj.getStack();
|
||||
copyStack = slotStack.copy();
|
||||
|
@ -71,10 +97,17 @@ implements ISlotWatcher {
|
|||
if (!this.mergeItemStack(slotStack, 9, 9 + 1, true)) {
|
||||
return null;
|
||||
}
|
||||
} else if (!this.mergeItemStack(slotStack, 12, this.tileEntity.getSizeInventory(), false)) {
|
||||
} else if (!this.mergeItemStack(
|
||||
slotStack, 12, this.tileEntity.getSizeInventory(), false
|
||||
)) {
|
||||
return null;
|
||||
}
|
||||
} else if (!this.mergeItemStack(slotStack, this.tileEntity.getSizeInventory(), this.tileEntity.getSizeInventory() + 36, false)) {
|
||||
} else if (!this.mergeItemStack(
|
||||
slotStack,
|
||||
this.tileEntity.getSizeInventory(),
|
||||
this.tileEntity.getSizeInventory() + 36,
|
||||
false
|
||||
)) {
|
||||
return null;
|
||||
}
|
||||
if (slotStack.stackSize == 0) {
|
||||
|
@ -97,4 +130,3 @@ implements ISlotWatcher {
|
|||
this.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,4 +3,3 @@ package assemblyline.common.machine.imprinter;
|
|||
public interface ISlotWatcher {
|
||||
public void slotContentsChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package assemblyline.common.machine.imprinter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import assemblyline.common.TabAssemblyLine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
|
@ -17,8 +18,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
public class ItemImprinter
|
||||
extends Item {
|
||||
public class ItemImprinter extends Item {
|
||||
public ItemImprinter() {
|
||||
super();
|
||||
this.setUnlocalizedName("imprint");
|
||||
|
@ -27,7 +27,7 @@ extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
this.itemIcon = par1IconRegister.registerIcon("assemblyline:imprint");
|
||||
}
|
||||
|
@ -38,9 +38,11 @@ extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
if (entity != null && !(entity instanceof IProjectile) && !(entity instanceof EntityPlayer)) {
|
||||
String stringName = EntityList.getEntityString((Entity)entity);
|
||||
public boolean
|
||||
onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
if (entity != null && !(entity instanceof IProjectile)
|
||||
&& !(entity instanceof EntityPlayer)) {
|
||||
String stringName = EntityList.getEntityString((Entity) entity);
|
||||
player.addChatMessage(new ChatComponentText("Target: " + stringName));
|
||||
return true;
|
||||
}
|
||||
|
@ -48,7 +50,9 @@ extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer par2EntityPlayer, List list, boolean par4) {
|
||||
public void addInformation(
|
||||
ItemStack itemStack, EntityPlayer par2EntityPlayer, List list, boolean par4
|
||||
) {
|
||||
List<ItemStack> filterItems = ItemImprinter.getFilters(itemStack);
|
||||
if (filterItems.size() > 0) {
|
||||
for (ItemStack filterItem : filterItems) {
|
||||
|
@ -65,13 +69,14 @@ extends Item {
|
|||
}
|
||||
NBTTagList nbt = new NBTTagList();
|
||||
for (int i = 0; i < filterStacks.size(); ++i) {
|
||||
if (filterStacks.get(i) == null) continue;
|
||||
if (filterStacks.get(i) == null)
|
||||
continue;
|
||||
NBTTagCompound newCompound = new NBTTagCompound();
|
||||
newCompound.setByte("Slot", (byte)i);
|
||||
((ItemStack)filterStacks.get(i)).writeToNBT(newCompound);
|
||||
nbt.appendTag((NBTBase)newCompound);
|
||||
newCompound.setByte("Slot", (byte) i);
|
||||
((ItemStack) filterStacks.get(i)).writeToNBT(newCompound);
|
||||
nbt.appendTag((NBTBase) newCompound);
|
||||
}
|
||||
itemStack.getTagCompound().setTag("Items", (NBTBase)nbt);
|
||||
itemStack.getTagCompound().setTag("Items", (NBTBase) nbt);
|
||||
}
|
||||
|
||||
public static ArrayList getFilters(ItemStack itemStack) {
|
||||
|
@ -82,11 +87,10 @@ extends Item {
|
|||
NBTTagCompound nbt = itemStack.getTagCompound();
|
||||
NBTTagList tagList = nbt.getTagList("Items", 10);
|
||||
for (int i = 0; i < tagList.tagCount(); ++i) {
|
||||
NBTTagCompound var4 = (NBTTagCompound)tagList.getCompoundTagAt(i);
|
||||
NBTTagCompound var4 = (NBTTagCompound) tagList.getCompoundTagAt(i);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
filterStacks.add(ItemStack.loadItemStackFromNBT((NBTTagCompound)var4));
|
||||
filterStacks.add(ItemStack.loadItemStackFromNBT((NBTTagCompound) var4));
|
||||
}
|
||||
return filterStacks;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,11 +6,12 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotCraftingResult
|
||||
extends WatchedSlot {
|
||||
public class SlotCraftingResult extends WatchedSlot {
|
||||
private ContainerImprinter container;
|
||||
|
||||
public SlotCraftingResult(ContainerImprinter container, IInventory inventory, int par2, int par3, int par4) {
|
||||
public SlotCraftingResult(
|
||||
ContainerImprinter container, IInventory inventory, int par2, int par3, int par4
|
||||
) {
|
||||
super(inventory, par2, par3, par4, container);
|
||||
this.container = container;
|
||||
}
|
||||
|
@ -28,4 +29,3 @@ extends WatchedSlot {
|
|||
super.onPickupFromSlot(entityPlayer, itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,11 +4,12 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotCustom
|
||||
extends Slot {
|
||||
public class SlotCustom extends Slot {
|
||||
private ItemStack itemStack;
|
||||
|
||||
public SlotCustom(IInventory par1iInventory, int par2, int par3, int par4, ItemStack itemStack) {
|
||||
public SlotCustom(
|
||||
IInventory par1iInventory, int par2, int par3, int par4, ItemStack itemStack
|
||||
) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
@ -17,4 +18,3 @@ extends Slot {
|
|||
return itemStack.isItemEqual(this.itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotImprintResult
|
||||
extends Slot {
|
||||
public class SlotImprintResult extends Slot {
|
||||
public SlotImprintResult(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
@ -18,11 +17,10 @@ extends Slot {
|
|||
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack) {
|
||||
super.onPickupFromSlot(par1EntityPlayer, par2ItemStack);
|
||||
if (this.inventory.getStackInSlot(0) != null) {
|
||||
--this.inventory.getStackInSlot((int)0).stackSize;
|
||||
if (this.inventory.getStackInSlot((int)0).stackSize <= 0) {
|
||||
--this.inventory.getStackInSlot((int) 0).stackSize;
|
||||
if (this.inventory.getStackInSlot((int) 0).stackSize <= 0) {
|
||||
this.inventory.setInventorySlotContents(0, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package assemblyline.common.machine.imprinter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import assemblyline.api.IFilterable;
|
||||
import assemblyline.common.machine.TileEntityAssemblyNetwork;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -17,17 +18,18 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import universalelectricity.prefab.implement.IRotatable;
|
||||
|
||||
public abstract class TileEntityFilterable
|
||||
extends TileEntityAssemblyNetwork
|
||||
implements IRotatable,
|
||||
IFilterable {
|
||||
extends TileEntityAssemblyNetwork implements IRotatable, IFilterable {
|
||||
private ItemStack filterItem;
|
||||
private boolean inverted;
|
||||
|
||||
public boolean isFiltering(ItemStack itemStack) {
|
||||
ArrayList checkStacks;
|
||||
if (this.getFilter() != null && itemStack != null && (checkStacks = ItemImprinter.getFilters(this.getFilter())) != null) {
|
||||
if (this.getFilter() != null && itemStack != null
|
||||
&& (checkStacks = ItemImprinter.getFilters(this.getFilter())) != null) {
|
||||
for (int i = 0; i < checkStacks.size(); ++i) {
|
||||
if (checkStacks.get(i) == null || !((ItemStack)checkStacks.get(i)).isItemEqual(itemStack)) continue;
|
||||
if (checkStacks.get(i) == null
|
||||
|| !((ItemStack) checkStacks.get(i)).isItemEqual(itemStack))
|
||||
continue;
|
||||
return !this.inverted;
|
||||
}
|
||||
}
|
||||
|
@ -64,27 +66,36 @@ IFilterable {
|
|||
|
||||
@Override
|
||||
public ForgeDirection getDirection(IBlockAccess world, int x, int y, int z) {
|
||||
return ForgeDirection.getOrientation((int)this.getBlockMetadata());
|
||||
return ForgeDirection.getOrientation((int) this.getBlockMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection(World world, int x, int y, int z, ForgeDirection facingDirection) {
|
||||
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, facingDirection.ordinal(), 3);
|
||||
public void
|
||||
setDirection(World world, int x, int y, int z, ForgeDirection facingDirection) {
|
||||
this.worldObj.setBlockMetadataWithNotify(
|
||||
this.xCoord, this.yCoord, this.zCoord, facingDirection.ordinal(), 3
|
||||
);
|
||||
}
|
||||
|
||||
public void setDirection(ForgeDirection facingDirection) {
|
||||
this.setDirection(this.worldObj, this.xCoord, this.yCoord, this.zCoord, facingDirection);
|
||||
this.setDirection(
|
||||
this.worldObj, this.xCoord, this.yCoord, this.zCoord, facingDirection
|
||||
);
|
||||
}
|
||||
|
||||
public ForgeDirection getDirection() {
|
||||
return this.getDirection((IBlockAccess)this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
||||
return this.getDirection(
|
||||
(IBlockAccess) this.worldObj, this.xCoord, this.yCoord, this.zCoord
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
this.writeToNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, getBlockMetadata(), tag);
|
||||
return new S35PacketUpdateTileEntity(
|
||||
xCoord, yCoord, zCoord, getBlockMetadata(), tag
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,7 +112,7 @@ IFilterable {
|
|||
if (this.getFilter() != null) {
|
||||
this.getFilter().writeToNBT(filter);
|
||||
}
|
||||
nbt.setTag("filter", (NBTBase)filter);
|
||||
nbt.setTag("filter", (NBTBase) filter);
|
||||
nbt.setBoolean("inverted", this.inverted);
|
||||
}
|
||||
|
||||
|
@ -110,7 +121,6 @@ IFilterable {
|
|||
super.readFromNBT(nbt);
|
||||
this.inverted = nbt.getBoolean("inverted");
|
||||
NBTTagCompound filter = nbt.getCompoundTag("filter");
|
||||
this.filterItem = ItemStack.loadItemStackFromNBT((NBTTagCompound)filter);
|
||||
this.filterItem = ItemStack.loadItemStackFromNBT((NBTTagCompound) filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
package assemblyline.common.machine.imprinter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import assemblyline.api.IArmbot;
|
||||
import assemblyline.api.IArmbotUseable;
|
||||
import assemblyline.common.Pair;
|
||||
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
@ -40,8 +39,7 @@ import universalelectricity.prefab.multiblock.TileEntityMulti;
|
|||
import universalelectricity.prefab.tile.TileEntityAdvanced;
|
||||
|
||||
public class TileEntityImprinter
|
||||
extends TileEntityAdvanced
|
||||
implements ISidedInventory, IArmbotUseable {
|
||||
extends TileEntityAdvanced implements ISidedInventory, IArmbotUseable {
|
||||
public static final int IMPRINTER_MATRIX_START = 9;
|
||||
public static final int INVENTORY_START = 12;
|
||||
public ItemStack[] craftingMatrix = new ItemStack[9];
|
||||
|
@ -58,7 +56,8 @@ implements ISidedInventory, IArmbotUseable {
|
|||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return this.craftingMatrix.length + this.imprinterMatrix.length + this.containingItems.length;
|
||||
return this.craftingMatrix.length + this.imprinterMatrix.length
|
||||
+ this.containingItems.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,13 +76,13 @@ implements ISidedInventory, IArmbotUseable {
|
|||
@Override
|
||||
public ItemStack decrStackSize(int i, int amount) {
|
||||
if (this.getStackInSlot(i) != null) {
|
||||
if (this.getStackInSlot((int)i).stackSize <= amount) {
|
||||
if (this.getStackInSlot((int) i).stackSize <= amount) {
|
||||
ItemStack var3 = this.getStackInSlot(i);
|
||||
this.setInventorySlotContents(i, null);
|
||||
return var3;
|
||||
}
|
||||
ItemStack var3 = this.getStackInSlot(i).splitStack(amount);
|
||||
if (this.getStackInSlot((int)i).stackSize == 0) {
|
||||
if (this.getStackInSlot((int) i).stackSize == 0) {
|
||||
this.setInventorySlotContents(i, null);
|
||||
}
|
||||
return var3;
|
||||
|
@ -129,7 +128,8 @@ implements ISidedInventory, IArmbotUseable {
|
|||
|
||||
public InventoryCrafting getCraftingMatrix() {
|
||||
if (this.container != null) {
|
||||
InventoryCrafting inventoryCrafting = new InventoryCrafting((Container)this.container, 3, 3);
|
||||
InventoryCrafting inventoryCrafting
|
||||
= new InventoryCrafting((Container) this.container, 3, 3);
|
||||
for (int i = 0; i < this.craftingMatrix.length; ++i) {
|
||||
inventoryCrafting.setInventorySlotContents(i, this.craftingMatrix[i]);
|
||||
}
|
||||
|
@ -146,7 +146,8 @@ implements ISidedInventory, IArmbotUseable {
|
|||
|
||||
public boolean isMatrixEmpty() {
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
if (this.craftingMatrix[i] == null) continue;
|
||||
if (this.craftingMatrix[i] == null)
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -156,13 +157,16 @@ implements ISidedInventory, IArmbotUseable {
|
|||
public void markDirty() {
|
||||
if (!this.worldObj.isRemote) {
|
||||
this.isImprinting = false;
|
||||
if (this.isMatrixEmpty() && this.imprinterMatrix[0] != null && this.imprinterMatrix[1] != null && this.imprinterMatrix[0].getItem() instanceof ItemImprinter) {
|
||||
if (this.isMatrixEmpty() && this.imprinterMatrix[0] != null
|
||||
&& this.imprinterMatrix[1] != null
|
||||
&& this.imprinterMatrix[0].getItem() instanceof ItemImprinter) {
|
||||
ItemStack outputStack = this.imprinterMatrix[0].copy();
|
||||
outputStack.stackSize = 1;
|
||||
ArrayList<ItemStack> filters = ItemImprinter.getFilters(outputStack);
|
||||
boolean filteringItemExists = false;
|
||||
for (ItemStack filteredStack : filters) {
|
||||
if (!filteredStack.isItemEqual(this.imprinterMatrix[1])) continue;
|
||||
if (!filteredStack.isItemEqual(this.imprinterMatrix[1]))
|
||||
continue;
|
||||
filters.remove(filteredStack);
|
||||
filteringItemExists = true;
|
||||
break;
|
||||
|
@ -180,20 +184,29 @@ implements ISidedInventory, IArmbotUseable {
|
|||
this.imprinterMatrix[2] = null;
|
||||
boolean didCraft = false;
|
||||
InventoryCrafting inventoryCrafting = this.getCraftingMatrix();
|
||||
if (inventoryCrafting != null && (matrixOutput = CraftingManager.getInstance().findMatchingRecipe(inventoryCrafting, this.worldObj)) != null) {
|
||||
if (inventoryCrafting != null
|
||||
&& (matrixOutput = CraftingManager.getInstance().findMatchingRecipe(
|
||||
inventoryCrafting, this.worldObj
|
||||
))
|
||||
!= null) {
|
||||
System.out.println("Using crafting grid");
|
||||
this.imprinterMatrix[2] = matrixOutput;
|
||||
didCraft = true;
|
||||
}
|
||||
if (this.imprinterMatrix[0] != null && !didCraft && this.imprinterMatrix[0].getItem() instanceof ItemImprinter) {
|
||||
if (this.imprinterMatrix[0] != null && !didCraft
|
||||
&& this.imprinterMatrix[0].getItem() instanceof ItemImprinter) {
|
||||
System.out.println("Using imprint as grid");
|
||||
ArrayList<ItemStack> filters = ItemImprinter.getFilters(this.imprinterMatrix[0]);
|
||||
ArrayList<ItemStack> filters
|
||||
= ItemImprinter.getFilters(this.imprinterMatrix[0]);
|
||||
for (ItemStack outputStack : filters) {
|
||||
Pair idealRecipe;
|
||||
if (outputStack == null || (idealRecipe = this.getIdealRecipe(outputStack)) == null) continue;
|
||||
ItemStack recipeOutput = (ItemStack)idealRecipe.getKey();
|
||||
if (outputStack == null
|
||||
|| (idealRecipe = this.getIdealRecipe(outputStack)) == null)
|
||||
continue;
|
||||
ItemStack recipeOutput = (ItemStack) idealRecipe.getKey();
|
||||
System.out.println("Ideal R: " + recipeOutput.toString());
|
||||
if (!(recipeOutput != null & recipeOutput.stackSize > 0)) continue;
|
||||
if (!(recipeOutput != null & recipeOutput.stackSize > 0))
|
||||
continue;
|
||||
this.imprinterMatrix[2] = recipeOutput;
|
||||
didCraft = true;
|
||||
break;
|
||||
|
@ -207,93 +220,148 @@ implements ISidedInventory, IArmbotUseable {
|
|||
}
|
||||
|
||||
public void onPickUpFromResult(EntityPlayer entityPlayer, ItemStack itemStack) {
|
||||
block9: {
|
||||
block11: {
|
||||
block10: {
|
||||
if (itemStack == null) break block9;
|
||||
if (!this.isImprinting) break block10;
|
||||
this.imprinterMatrix[0] = null;
|
||||
break block9;
|
||||
}
|
||||
if (this.getIdealRecipe(itemStack) == null) break block11;
|
||||
ItemStack[] requiredItems = (ItemStack[])((ItemStack[])this.getIdealRecipe(itemStack).getValue()).clone();
|
||||
if (requiredItems == null) break block9;
|
||||
block2: for (ItemStack searchStack : requiredItems) {
|
||||
if (searchStack == null) continue;
|
||||
block3: for (IInventory inventory : this.getAvaliableInventories()) {
|
||||
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
|
||||
ItemStack checkStack = inventory.getStackInSlot(i);
|
||||
if (checkStack == null || !searchStack.isItemEqual(checkStack) && (searchStack.getItem() != checkStack.getItem() || searchStack.getItemDamage() >= 0)) continue;
|
||||
inventory.decrStackSize(i, 1);
|
||||
break block3;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < this.containingItems.length; ++i) {
|
||||
ItemStack checkStack = this.containingItems[i];
|
||||
if (checkStack == null || !searchStack.isItemEqual(checkStack) && (searchStack.getItem() != checkStack.getItem() || searchStack.getItemDamage() >= 0)) continue;
|
||||
this.decrStackSize(i + 12, 1);
|
||||
continue block2;
|
||||
}
|
||||
}
|
||||
break block9;
|
||||
}
|
||||
try {
|
||||
InventoryCrafting inventoryCrafting = this.getCraftingMatrix();
|
||||
MinecraftForge.EVENT_BUS.post(new ItemCraftedEvent(entityPlayer, itemStack, inventoryCrafting));
|
||||
for (int var3 = 0; var3 < inventoryCrafting.getSizeInventory(); ++var3) {
|
||||
ItemStack var4 = inventoryCrafting.getStackInSlot(var3);
|
||||
if (var4 == null) continue;
|
||||
inventoryCrafting.decrStackSize(var3, 1);
|
||||
if (!var4.getItem().hasContainerItem()) continue;
|
||||
ItemStack var5 = var4.getItem().getContainerItem(var4);
|
||||
if (var5.isItemStackDamageable() && var5.getItemDamage() > var5.getMaxDamage()) {
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(entityPlayer, var5));
|
||||
var5 = null;
|
||||
}
|
||||
if (var5 == null || var4.getItem().doesContainerItemLeaveCraftingGrid(var4) && entityPlayer.inventory.addItemStackToInventory(var5)) continue;
|
||||
if (inventoryCrafting.getStackInSlot(var3) == null) {
|
||||
inventoryCrafting.setInventorySlotContents(var3, var5);
|
||||
block9: {
|
||||
block11: {
|
||||
block10: {
|
||||
if (itemStack == null)
|
||||
break block9;
|
||||
if (!this.isImprinting)
|
||||
break block10;
|
||||
this.imprinterMatrix[0] = null;
|
||||
break block9;
|
||||
}
|
||||
if (this.getIdealRecipe(itemStack) == null)
|
||||
break block11;
|
||||
ItemStack[] requiredItems
|
||||
= (ItemStack[]) ((ItemStack[]) this.getIdealRecipe(itemStack).getValue())
|
||||
.clone();
|
||||
if (requiredItems == null)
|
||||
break block9;
|
||||
block2:
|
||||
for (ItemStack searchStack : requiredItems) {
|
||||
if (searchStack == null)
|
||||
continue;
|
||||
block3:
|
||||
for (IInventory inventory : this.getAvaliableInventories()) {
|
||||
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
|
||||
ItemStack checkStack = inventory.getStackInSlot(i);
|
||||
if (checkStack == null
|
||||
|| !searchStack.isItemEqual(checkStack)
|
||||
&& (searchStack.getItem() != checkStack.getItem()
|
||||
|| searchStack.getItemDamage() >= 0))
|
||||
continue;
|
||||
}
|
||||
//entityPlayer.func_71021_b(var5);
|
||||
//TODO: WTF
|
||||
entityPlayer.dropPlayerItemWithRandomChoice(var5, false);
|
||||
inventory.decrStackSize(i, 1);
|
||||
break block3;
|
||||
}
|
||||
this.replaceCraftingMatrix(inventoryCrafting);
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.out.println("Imprinter: Failed to craft item: " + itemStack.getDisplayName());
|
||||
e.printStackTrace();
|
||||
for (int i = 0; i < this.containingItems.length; ++i) {
|
||||
ItemStack checkStack = this.containingItems[i];
|
||||
if (checkStack == null
|
||||
|| !searchStack.isItemEqual(checkStack)
|
||||
&& (searchStack.getItem() != checkStack.getItem()
|
||||
|| searchStack.getItemDamage() >= 0))
|
||||
continue;
|
||||
this.decrStackSize(i + 12, 1);
|
||||
continue block2;
|
||||
}
|
||||
}
|
||||
break block9;
|
||||
}
|
||||
try {
|
||||
InventoryCrafting inventoryCrafting = this.getCraftingMatrix();
|
||||
MinecraftForge.EVENT_BUS.post(
|
||||
new ItemCraftedEvent(entityPlayer, itemStack, inventoryCrafting)
|
||||
);
|
||||
for (int var3 = 0; var3 < inventoryCrafting.getSizeInventory(); ++var3) {
|
||||
ItemStack var4 = inventoryCrafting.getStackInSlot(var3);
|
||||
if (var4 == null)
|
||||
continue;
|
||||
inventoryCrafting.decrStackSize(var3, 1);
|
||||
if (!var4.getItem().hasContainerItem())
|
||||
continue;
|
||||
ItemStack var5 = var4.getItem().getContainerItem(var4);
|
||||
if (var5.isItemStackDamageable()
|
||||
&& var5.getItemDamage() > var5.getMaxDamage()) {
|
||||
MinecraftForge.EVENT_BUS.post(
|
||||
new PlayerDestroyItemEvent(entityPlayer, var5)
|
||||
);
|
||||
var5 = null;
|
||||
}
|
||||
if (var5 == null
|
||||
|| var4.getItem().doesContainerItemLeaveCraftingGrid(var4)
|
||||
&& entityPlayer.inventory.addItemStackToInventory(var5))
|
||||
continue;
|
||||
if (inventoryCrafting.getStackInSlot(var3) == null) {
|
||||
inventoryCrafting.setInventorySlotContents(var3, var5);
|
||||
continue;
|
||||
}
|
||||
//entityPlayer.func_71021_b(var5);
|
||||
//TODO: WTF
|
||||
entityPlayer.dropPlayerItemWithRandomChoice(var5, false);
|
||||
}
|
||||
this.replaceCraftingMatrix(inventoryCrafting);
|
||||
} catch (Exception e) {
|
||||
System.out.println(
|
||||
"Imprinter: Failed to craft item: " + itemStack.getDisplayName()
|
||||
);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Pair getIdealRecipe(ItemStack outputItem) {
|
||||
for (Object object : CraftingManager.getInstance().getRecipeList()) {
|
||||
ArrayList hasResources;
|
||||
Object oreRecipeInput;
|
||||
if (!(object instanceof IRecipe) || ((IRecipe)object).getRecipeOutput() == null || !outputItem.isItemEqual(((IRecipe)object).getRecipeOutput())) continue;
|
||||
if (!(object instanceof IRecipe)
|
||||
|| ((IRecipe) object).getRecipeOutput() == null
|
||||
|| !outputItem.isItemEqual(((IRecipe) object).getRecipeOutput()))
|
||||
continue;
|
||||
if (object instanceof ShapedRecipes) {
|
||||
if (this.hasResource((Object[])((ShapedRecipes)object).recipeItems) == null) continue;
|
||||
return new Pair(((IRecipe)object).getRecipeOutput().copy(), ((ShapedRecipes)object).recipeItems);
|
||||
if (this.hasResource((Object[]) ((ShapedRecipes) object).recipeItems)
|
||||
== null)
|
||||
continue;
|
||||
return new Pair(
|
||||
((IRecipe) object).getRecipeOutput().copy(),
|
||||
((ShapedRecipes) object).recipeItems
|
||||
);
|
||||
}
|
||||
if (object instanceof ShapelessRecipes) {
|
||||
if (this.hasResource((Object[])((ShapelessRecipes)object).recipeItems.toArray(new ItemStack[1])) == null) continue;
|
||||
return new Pair(((IRecipe)object).getRecipeOutput().copy(), ((ShapelessRecipes)object).recipeItems.toArray(new ItemStack[1]));
|
||||
if (this.hasResource((Object[]) ((ShapelessRecipes) object)
|
||||
.recipeItems.toArray(new ItemStack[1]))
|
||||
== null)
|
||||
continue;
|
||||
return new Pair(
|
||||
((IRecipe) object).getRecipeOutput().copy(),
|
||||
((ShapelessRecipes) object).recipeItems.toArray(new ItemStack[1])
|
||||
);
|
||||
}
|
||||
if (object instanceof ShapedOreRecipe) {
|
||||
ShapedOreRecipe oreRecipe = (ShapedOreRecipe)object;
|
||||
oreRecipeInput = (Object[])ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, oreRecipe, new String[]{"input"});
|
||||
hasResources = this.hasResource((Object[])oreRecipeInput);
|
||||
if (hasResources == null) continue;
|
||||
return new Pair(((IRecipe)object).getRecipeOutput().copy(), hasResources.toArray(new ItemStack[1]));
|
||||
ShapedOreRecipe oreRecipe = (ShapedOreRecipe) object;
|
||||
oreRecipeInput = (Object[]) ReflectionHelper.getPrivateValue(
|
||||
ShapedOreRecipe.class, oreRecipe, new String[] { "input" }
|
||||
);
|
||||
hasResources = this.hasResource((Object[]) oreRecipeInput);
|
||||
if (hasResources == null)
|
||||
continue;
|
||||
return new Pair(
|
||||
((IRecipe) object).getRecipeOutput().copy(),
|
||||
hasResources.toArray(new ItemStack[1])
|
||||
);
|
||||
}
|
||||
if (!(object instanceof ShapelessOreRecipe)) continue;
|
||||
ShapelessOreRecipe oreRecipe = (ShapelessOreRecipe)object;
|
||||
oreRecipeInput = (ArrayList)ReflectionHelper.getPrivateValue(ShapelessOreRecipe.class, oreRecipe, new String[]{"input"});
|
||||
hasResources = this.hasResource(((ArrayList)oreRecipeInput).toArray());
|
||||
if (hasResources == null) continue;
|
||||
return new Pair(((IRecipe)object).getRecipeOutput().copy(), hasResources.toArray(new ItemStack[1]));
|
||||
if (!(object instanceof ShapelessOreRecipe))
|
||||
continue;
|
||||
ShapelessOreRecipe oreRecipe = (ShapelessOreRecipe) object;
|
||||
oreRecipeInput = (ArrayList) ReflectionHelper.getPrivateValue(
|
||||
ShapelessOreRecipe.class, oreRecipe, new String[] { "input" }
|
||||
);
|
||||
hasResources = this.hasResource(((ArrayList) oreRecipeInput).toArray());
|
||||
if (hasResources == null)
|
||||
continue;
|
||||
return new Pair(
|
||||
((IRecipe) object).getRecipeOutput().copy(),
|
||||
hasResources.toArray(new ItemStack[1])
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -306,39 +374,51 @@ implements ISidedInventory, IArmbotUseable {
|
|||
dummyImprinter.readFromNBT(cloneData);
|
||||
ArrayList<ItemStack> actualResources = new ArrayList<ItemStack>();
|
||||
int itemMatch = 0;
|
||||
block2: for (Object obj : recipeItems) {
|
||||
block2:
|
||||
for (Object obj : recipeItems) {
|
||||
if (obj instanceof ItemStack) {
|
||||
ItemStack recipeItem = (ItemStack)obj;
|
||||
ItemStack recipeItem = (ItemStack) obj;
|
||||
actualResources.add(recipeItem.copy());
|
||||
if (recipeItem == null || !this.doesItemExist(recipeItem, dummyImprinter)) continue;
|
||||
if (recipeItem == null
|
||||
|| !this.doesItemExist(recipeItem, dummyImprinter))
|
||||
continue;
|
||||
++itemMatch;
|
||||
continue;
|
||||
}
|
||||
if (!(obj instanceof ArrayList)) continue;
|
||||
ArrayList ingredientsList = (ArrayList)obj;
|
||||
if (!(obj instanceof ArrayList))
|
||||
continue;
|
||||
ArrayList ingredientsList = (ArrayList) obj;
|
||||
Object[] ingredientsArray = ingredientsList.toArray();
|
||||
for (int x = 0; x < ingredientsArray.length; ++x) {
|
||||
if (ingredientsArray[x] == null || !(ingredientsArray[x] instanceof ItemStack)) continue;
|
||||
ItemStack recipeItem = (ItemStack)ingredientsArray[x];
|
||||
if (ingredientsArray[x] == null
|
||||
|| !(ingredientsArray[x] instanceof ItemStack))
|
||||
continue;
|
||||
ItemStack recipeItem = (ItemStack) ingredientsArray[x];
|
||||
actualResources.add(recipeItem.copy());
|
||||
if (recipeItem == null || !this.doesItemExist(recipeItem, dummyImprinter)) continue;
|
||||
if (recipeItem == null
|
||||
|| !this.doesItemExist(recipeItem, dummyImprinter))
|
||||
continue;
|
||||
++itemMatch;
|
||||
continue block2;
|
||||
}
|
||||
}
|
||||
return itemMatch >= actualResources.size() ? actualResources : null;
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
System.out.println("Failed to find recipes in the imprinter.");
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean doesItemExist(ItemStack recipeItem, TileEntityImprinter dummyImprinter) {
|
||||
private boolean
|
||||
doesItemExist(ItemStack recipeItem, TileEntityImprinter dummyImprinter) {
|
||||
for (int i = 0; i < dummyImprinter.containingItems.length; ++i) {
|
||||
ItemStack checkStack = dummyImprinter.containingItems[i];
|
||||
if (checkStack == null || !recipeItem.isItemEqual(checkStack) && (recipeItem.getItem() != checkStack.getItem() || recipeItem.getItemDamage() >= 0)) continue;
|
||||
if (checkStack == null
|
||||
|| !recipeItem.isItemEqual(checkStack)
|
||||
&& (recipeItem.getItem() != checkStack.getItem()
|
||||
|| recipeItem.getItemDamage() >= 0))
|
||||
continue;
|
||||
dummyImprinter.decrStackSize(i + 12, 1);
|
||||
return true;
|
||||
}
|
||||
|
@ -348,27 +428,45 @@ implements ISidedInventory, IArmbotUseable {
|
|||
private List<IInventory> getAvaliableInventories() {
|
||||
ArrayList<IInventory> inventories = new ArrayList<>();
|
||||
if (this.searchInventories) {
|
||||
block0: for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
|
||||
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(this.worldObj, new Vector3(this), direction);
|
||||
if (tileEntity == null) continue;
|
||||
block0:
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
|
||||
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(
|
||||
this.worldObj, new Vector3(this), direction
|
||||
);
|
||||
if (tileEntity == null)
|
||||
continue;
|
||||
if (tileEntity instanceof TileEntityMulti) {
|
||||
Vector3 mainBlockPosition = ((TileEntityMulti)tileEntity).mainBlockPosition;
|
||||
if (mainBlockPosition == null || !(mainBlockPosition.getTileEntity(this.worldObj) instanceof IInventory)) continue;
|
||||
inventories.add(((IInventory)mainBlockPosition.getTileEntity(this.worldObj)));
|
||||
Vector3 mainBlockPosition
|
||||
= ((TileEntityMulti) tileEntity).mainBlockPosition;
|
||||
if (mainBlockPosition == null
|
||||
|| !(
|
||||
mainBlockPosition.getTileEntity(this.worldObj)
|
||||
instanceof IInventory
|
||||
))
|
||||
continue;
|
||||
inventories.add(((IInventory
|
||||
) mainBlockPosition.getTileEntity(this.worldObj)));
|
||||
continue;
|
||||
}
|
||||
if (tileEntity instanceof TileEntityChest) {
|
||||
inventories.add(((TileEntityChest)tileEntity));
|
||||
inventories.add(((TileEntityChest) tileEntity));
|
||||
for (int i = 2; i < 6; ++i) {
|
||||
TileEntity chest = VectorHelper.getTileEntityFromSide(this.worldObj, new Vector3(tileEntity), ForgeDirection.getOrientation(2));
|
||||
if (chest == null || chest.getClass() != tileEntity.getClass()) continue;
|
||||
inventories.add(((TileEntityChest)chest));
|
||||
TileEntity chest = VectorHelper.getTileEntityFromSide(
|
||||
this.worldObj,
|
||||
new Vector3(tileEntity),
|
||||
ForgeDirection.getOrientation(2)
|
||||
);
|
||||
if (chest == null || chest.getClass() != tileEntity.getClass())
|
||||
continue;
|
||||
inventories.add(((TileEntityChest) chest));
|
||||
continue block0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!(tileEntity instanceof IInventory) || tileEntity instanceof TileEntityImprinter) continue;
|
||||
inventories.add(((IInventory)tileEntity));
|
||||
if (!(tileEntity instanceof IInventory)
|
||||
|| tileEntity instanceof TileEntityImprinter)
|
||||
continue;
|
||||
inventories.add(((IInventory) tileEntity));
|
||||
}
|
||||
}
|
||||
return inventories;
|
||||
|
@ -378,7 +476,9 @@ implements ISidedInventory, IArmbotUseable {
|
|||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setBoolean("searchInventories", this.searchInventories);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, getBlockMetadata(), nbt);
|
||||
return new S35PacketUpdateTileEntity(
|
||||
xCoord, yCoord, zCoord, getBlockMetadata(), nbt
|
||||
);
|
||||
}
|
||||
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
|
@ -396,10 +496,13 @@ implements ISidedInventory, IArmbotUseable {
|
|||
this.imprinterMatrix = new ItemStack[3];
|
||||
this.containingItems = new ItemStack[18];
|
||||
for (int i = 0; i < var2.tagCount(); ++i) {
|
||||
NBTTagCompound var4 = (NBTTagCompound)var2.getCompoundTagAt(i);
|
||||
NBTTagCompound var4 = (NBTTagCompound) var2.getCompoundTagAt(i);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
if (var5 < 0 || var5 >= this.getSizeInventory()) continue;
|
||||
this.setInventorySlotContents(var5, ItemStack.loadItemStackFromNBT((NBTTagCompound)var4));
|
||||
if (var5 < 0 || var5 >= this.getSizeInventory())
|
||||
continue;
|
||||
this.setInventorySlotContents(
|
||||
var5, ItemStack.loadItemStackFromNBT((NBTTagCompound) var4)
|
||||
);
|
||||
}
|
||||
this.searchInventories = nbt.getBoolean("searchInventories");
|
||||
}
|
||||
|
@ -409,13 +512,14 @@ implements ISidedInventory, IArmbotUseable {
|
|||
super.writeToNBT(nbt);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
for (int i = 0; i < this.getSizeInventory(); ++i) {
|
||||
if (this.getStackInSlot(i) == null) continue;
|
||||
if (this.getStackInSlot(i) == null)
|
||||
continue;
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)i);
|
||||
var4.setByte("Slot", (byte) i);
|
||||
this.getStackInSlot(i).writeToNBT(var4);
|
||||
var2.appendTag((NBTBase)var4);
|
||||
var2.appendTag((NBTBase) var4);
|
||||
}
|
||||
nbt.setTag("Items", (NBTBase)var2);
|
||||
nbt.setTag("Items", (NBTBase) var2);
|
||||
nbt.setBoolean("searchInventories", this.searchInventories);
|
||||
}
|
||||
|
||||
|
@ -447,7 +551,13 @@ implements ISidedInventory, IArmbotUseable {
|
|||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : entityplayer.getDistanceSq((double)this.xCoord + 0.5, (double)this.yCoord + 0.5, (double)this.zCoord + 0.5) <= 64.0;
|
||||
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this
|
||||
? false
|
||||
: entityplayer.getDistanceSq(
|
||||
(double) this.xCoord + 0.5,
|
||||
(double) this.yCoord + 0.5,
|
||||
(double) this.zCoord + 0.5
|
||||
) <= 64.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -485,4 +595,3 @@ implements ISidedInventory, IArmbotUseable {
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,11 +3,16 @@ package assemblyline.common.machine.imprinter;
|
|||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class WatchedSlot
|
||||
extends Slot {
|
||||
public class WatchedSlot extends Slot {
|
||||
private ISlotWatcher slotWatcher;
|
||||
|
||||
public WatchedSlot(IInventory inventory, int id, int xPosition, int yPosition, ISlotWatcher slotWatcher) {
|
||||
public WatchedSlot(
|
||||
IInventory inventory,
|
||||
int id,
|
||||
int xPosition,
|
||||
int yPosition,
|
||||
ISlotWatcher slotWatcher
|
||||
) {
|
||||
super(inventory, id, xPosition, yPosition);
|
||||
this.slotWatcher = slotWatcher;
|
||||
}
|
||||
|
@ -18,4 +23,3 @@ extends Slot {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
public class MessageEncoder implements IMessage {
|
||||
|
||||
public NBTTagCompound nbt;
|
||||
public Vector3 tileLocation;
|
||||
|
||||
|
@ -26,27 +25,26 @@ public class MessageEncoder implements IMessage {
|
|||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf bytes) {
|
||||
DataInputStream stream = new DataInputStream(new ByteBufInputStream(bytes));
|
||||
try {
|
||||
NBTTagCompound recTag = CompressedStreamTools.read(stream);
|
||||
tileLocation = Vector3.readFromNBT(recTag.getCompoundTag("tilePos"));
|
||||
nbt = recTag.getCompoundTag("data");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf bytes) {
|
||||
NBTTagCompound sendTag = new NBTTagCompound();
|
||||
sendTag.setTag("tilePos", tileLocation.writeToNBT(new NBTTagCompound()));
|
||||
sendTag.setTag("data", nbt);
|
||||
DataOutputStream stream = new DataOutputStream(new ByteBufOutputStream(bytes));
|
||||
try {
|
||||
CompressedStreamTools.write(sendTag, stream);
|
||||
DataInputStream stream = new DataInputStream(new ByteBufInputStream(bytes));
|
||||
try {
|
||||
NBTTagCompound recTag = CompressedStreamTools.read(stream);
|
||||
tileLocation = Vector3.readFromNBT(recTag.getCompoundTag("tilePos"));
|
||||
nbt = recTag.getCompoundTag("data");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf bytes) {
|
||||
NBTTagCompound sendTag = new NBTTagCompound();
|
||||
sendTag.setTag("tilePos", tileLocation.writeToNBT(new NBTTagCompound()));
|
||||
sendTag.setTag("data", nbt);
|
||||
DataOutputStream stream = new DataOutputStream(new ByteBufOutputStream(bytes));
|
||||
try {
|
||||
CompressedStreamTools.write(sendTag, stream);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,16 +8,16 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class MessageEncoderHandler implements IMessageHandler<MessageEncoder, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(MessageEncoder msg, MessageContext ctx) {
|
||||
if (ctx.side == Side.SERVER) {
|
||||
TileEntity tile = msg.tileLocation.getTileEntity(ctx.getServerHandler().playerEntity.worldObj);
|
||||
TileEntity tile = msg.tileLocation.getTileEntity(
|
||||
ctx.getServerHandler().playerEntity.worldObj
|
||||
);
|
||||
if (tile instanceof TileEntityEncoder) {
|
||||
((TileEntityEncoder)tile).handleMessage(msg.nbt);
|
||||
((TileEntityEncoder) tile).handleMessage(msg.nbt);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package dark.library.helpers;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
|
@ -12,19 +13,36 @@ import universalelectricity.core.vector.Vector3;
|
|||
|
||||
public class ItemFindingHelper {
|
||||
public static List findAllItemIn(World world, Vector3 start, Vector3 end) {
|
||||
return world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox((double)start.x, (double)start.y, (double)start.z, (double)end.x, (double)end.y, (double)end.z));
|
||||
return world.getEntitiesWithinAABB(
|
||||
EntityItem.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) start.x,
|
||||
(double) start.y,
|
||||
(double) start.z,
|
||||
(double) end.x,
|
||||
(double) end.y,
|
||||
(double) end.z
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static List findSelectItems(World world, Vector3 start, Vector3 end, List disiredItems) {
|
||||
public static List
|
||||
findSelectItems(World world, Vector3 start, Vector3 end, List disiredItems) {
|
||||
List entityItems = ItemFindingHelper.findAllItemIn(world, start, end);
|
||||
return ItemFindingHelper.filterEntityItemsList(entityItems, disiredItems);
|
||||
}
|
||||
|
||||
public static List<EntityItem> filterEntityItemsList(List<EntityItem> entityItems, List<ItemStack> disiredItems) {
|
||||
public static List<EntityItem>
|
||||
filterEntityItemsList(List<EntityItem> entityItems, List<ItemStack> disiredItems) {
|
||||
ArrayList<EntityItem> newItemList = new ArrayList<EntityItem>();
|
||||
block0: for (EntityItem entityItem : entityItems) {
|
||||
block0:
|
||||
for (EntityItem entityItem : entityItems) {
|
||||
for (ItemStack itemStack : disiredItems) {
|
||||
if (entityItem.getEntityItem().getItem() != itemStack.getItem() || entityItem.getEntityItem().getItemDamage() != itemStack.getItemDamage() || newItemList.contains((Object)entityItem)) continue;
|
||||
if (entityItem.getEntityItem().getItem() != itemStack.getItem()
|
||||
|| entityItem.getEntityItem().getItemDamage()
|
||||
!= itemStack.getItemDamage()
|
||||
|| newItemList.contains((Object) entityItem))
|
||||
continue;
|
||||
newItemList.add(entityItem);
|
||||
continue block0;
|
||||
}
|
||||
|
@ -35,17 +53,23 @@ public class ItemFindingHelper {
|
|||
public static List<EntityItem> filterOutEntityItems(List<Entity> entities) {
|
||||
ArrayList<EntityItem> newEntityList = new ArrayList<EntityItem>();
|
||||
for (Entity entity : entities) {
|
||||
if (!(entity instanceof EntityItem)) continue;
|
||||
newEntityList.add((EntityItem)entity);
|
||||
if (!(entity instanceof EntityItem))
|
||||
continue;
|
||||
newEntityList.add((EntityItem) entity);
|
||||
}
|
||||
return newEntityList;
|
||||
}
|
||||
|
||||
public static List<ItemStack> filterItems(List<ItemStack> totalItems, List<ItemStack> desiredItems) {
|
||||
public static List<ItemStack>
|
||||
filterItems(List<ItemStack> totalItems, List<ItemStack> desiredItems) {
|
||||
ArrayList<ItemStack> newItemList = new ArrayList<ItemStack>();
|
||||
block0: for (ItemStack entityItem : totalItems) {
|
||||
block0:
|
||||
for (ItemStack entityItem : totalItems) {
|
||||
for (ItemStack itemStack : desiredItems) {
|
||||
if (entityItem.getItem() != itemStack.getItem() || entityItem.getItemDamage() != itemStack.getItemDamage() || newItemList.contains((Object)entityItem)) continue;
|
||||
if (entityItem.getItem() != itemStack.getItem()
|
||||
|| entityItem.getItemDamage() != itemStack.getItemDamage()
|
||||
|| newItemList.contains((Object) entityItem))
|
||||
continue;
|
||||
newItemList.add(entityItem);
|
||||
continue block0;
|
||||
}
|
||||
|
@ -53,11 +77,12 @@ public class ItemFindingHelper {
|
|||
return newItemList;
|
||||
}
|
||||
|
||||
public static boolean dropItemStackExact(World world, double x, double y, double z, ItemStack stack) {
|
||||
public static boolean
|
||||
dropItemStackExact(World world, double x, double y, double z, ItemStack stack) {
|
||||
if (!world.isRemote && stack != null) {
|
||||
EntityItem entity = new EntityItem(world, x, y, z, stack);
|
||||
entity.delayBeforeCanPickup = 10;
|
||||
return world.spawnEntityInWorld((Entity)entity);
|
||||
return world.spawnEntityInWorld((Entity) entity);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -68,9 +93,10 @@ public class ItemFindingHelper {
|
|||
Block block = world.getBlock(x, y, z);
|
||||
ArrayList<ItemStack> items = block.getDrops(world, x, y, z, meta, 0);
|
||||
for (ItemStack item : items) {
|
||||
ItemFindingHelper.dropItemStackExact(world, (double)x + 0.5, (double)y + 0.5, (double)z + 0.5, item);
|
||||
ItemFindingHelper.dropItemStackExact(
|
||||
world, (double) x + 0.5, (double) y + 0.5, (double) z + 0.5, item
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue