use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.
the class AreaShowManager method tickEnd.
@SubscribeEvent
public void tickEnd(TickEvent.ClientTickEvent event) {
EntityPlayer player = PneumaticCraft.proxy.getPlayer();
if (player != null) {
if (player.worldObj != world) {
world = player.worldObj;
showHandlers.clear();
} else {
if (event.phase == TickEvent.Phase.END) {
Iterator<ChunkPosition> iterator = showHandlers.keySet().iterator();
while (iterator.hasNext()) {
ChunkPosition pos = iterator.next();
if (PneumaticCraftUtils.distBetween(pos, player.posX, player.posY, player.posZ) < 32 && world.isAirBlock(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ))
iterator.remove();
}
}
}
}
}
use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.
the class GuiAmadronAddTrade method actionPerformed.
@Override
public void actionPerformed(GuiButton button) {
EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
ContainerAmadronAddTrade container = (ContainerAmadronAddTrade) inventorySlots;
if (button.id < 6 && button.id >= 0) {
isSettingInput = button.id < 3;
if (button.id % 3 == 0) {
searchGui = new GuiSearcher(player);
searchGui.setSearchStack(container.getStack(isSettingInput ? 0 : 1));
FMLClientHandler.instance().showGuiScreen(searchGui);
} else if (button.id % 3 == 1) {
invSearchGui = new GuiInventorySearcher(player);
invSearchGui.setSearchStack(container.getStack(isSettingInput ? 0 : 1));
FMLClientHandler.instance().showGuiScreen(invSearchGui);
} else if (button.id % 3 == 2) {
fluidGui = new GuiLogisticsLiquidFilter(this);
fluidGui.setFilter(isSettingInput ? inputFluid.getFluid() : outputFluid.getFluid());
FMLClientHandler.instance().showGuiScreen(fluidGui);
}
} else if (button.id == 8) {
Object input;
if (container.getStack(0) != null) {
input = container.getStack(0).copy();
((ItemStack) input).stackSize = inputNumber.getValue();
} else {
input = new FluidStack(inputFluid.getFluid(), inputNumber.getValue());
}
Object output;
if (container.getStack(1) != null) {
output = container.getStack(1).copy();
((ItemStack) output).stackSize = outputNumber.getValue();
} else {
output = new FluidStack(outputFluid.getFluid(), outputNumber.getValue());
}
AmadronOfferCustom trade = new AmadronOfferCustom(input, output, player);
ChunkPosition pos = getInputPosition();
int dimensionId = getInputDimension();
trade.setProvidingPosition(pos, dimensionId);
pos = getOutputPosition();
dimensionId = getOutputDimension();
trade.setReturningPosition(pos, dimensionId);
NetworkHandler.sendToServer(new PacketAmadronTradeAdd(trade.invert()));
player.closeScreen();
}
super.actionPerformed(button);
}
use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.
the class GuiProgWidgetArea method initGui.
@Override
public void initGui() {
super.initGui();
addLabel("Point 1", guiLeft + 50, guiTop + 10);
addLabel("Point 2", guiLeft + 177, guiTop + 10);
addLabel("Area Type:", guiLeft + 4, guiTop + 50);
boolean advancedMode = Config.getProgrammerDifficulty() == 2;
GuiButtonSpecial gpsButton1 = new GuiButtonSpecial(0, guiLeft + (advancedMode ? 6 : 55), guiTop + 20, 20, 20, "");
GuiButtonSpecial gpsButton2 = new GuiButtonSpecial(1, guiLeft + (advancedMode ? 133 : 182), guiTop + 20, 20, 20, "");
gpsButton1.setTooltipText(I18n.format("gui.progWidget.area.selectGPS1"));
gpsButton2.setTooltipText(I18n.format("gui.progWidget.area.selectGPS2"));
gpsButton1.setRenderStacks(new ItemStack(Itemss.GPSTool));
gpsButton2.setRenderStacks(new ItemStack(Itemss.GPSTool));
buttonList.add(gpsButton1);
buttonList.add(gpsButton2);
variableField1 = new WidgetComboBox(fontRendererObj, guiLeft + 28, guiTop + 25, 88, fontRendererObj.FONT_HEIGHT + 1);
variableField2 = new WidgetComboBox(fontRendererObj, guiLeft + 155, guiTop + 25, 88, fontRendererObj.FONT_HEIGHT + 1);
Set<String> variables = guiProgrammer.te.getAllVariables();
variableField1.setElements(variables);
variableField2.setElements(variables);
variableField1.setText(widget.getCoord1Variable());
variableField2.setText(widget.getCoord2Variable());
typeInfoField = new WidgetTextFieldNumber(fontRendererObj, guiLeft + 160, guiTop + 110, 20, fontRendererObj.FONT_HEIGHT + 1);
typeInfoField.setValue(widget.typeInfo);
typeInfoField.setTooltip(I18n.format("gui.progWidget.area.extraInfo.tooltip"));
addWidget(typeInfoField);
addWidget(new WidgetLabel(guiLeft + 160, guiTop + 100, I18n.format("gui.progWidget.area.extraInfo")));
if (advancedMode) {
addWidget(variableField1);
addWidget(variableField2);
}
List<GuiRadioButton> radioButtons = new ArrayList<GuiRadioButton>();
ProgWidgetArea.EnumAreaType[] areaTypes = ProgWidgetArea.EnumAreaType.values();
for (int i = 0; i < areaTypes.length; i++) {
GuiRadioButton radioButton = new GuiRadioButton(i, guiLeft + 7 + i / 7 * 80, guiTop + 60 + i % 7 * 12, 0xFF000000, areaTypes[i].toString());
radioButton.checked = areaTypes[i] == widget.type;
addWidget(radioButton);
radioButtons.add(radioButton);
radioButton.otherChoices = radioButtons;
}
if (invSearchGui != null) {
ChunkPosition pos = invSearchGui.getSearchStack() != null ? ItemGPSTool.getGPSLocation(invSearchGui.getSearchStack()) : null;
if (pos != null) {
if (pointSearched == 0) {
widget.x1 = pos.chunkPosX;
widget.y1 = pos.chunkPosY;
widget.z1 = pos.chunkPosZ;
} else {
widget.x2 = pos.chunkPosX;
widget.y2 = pos.chunkPosY;
widget.z2 = pos.chunkPosZ;
}
} else {
if (pointSearched == 0) {
widget.x1 = widget.y1 = widget.z1 = 0;
} else {
widget.x2 = widget.y2 = widget.z2 = 0;
}
}
}
}
use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.
the class GuiProgWidgetCoordinate method keyTyped.
@Override
public void keyTyped(char chr, int keyCode) {
if (keyCode == 1) {
widget.setCoordinate(new ChunkPosition(coordFields[0].getValue(), coordFields[1].getValue(), coordFields[2].getValue()));
widget.setVariable(variableField.getText());
}
super.keyTyped(chr, keyCode);
}
use of net.minecraft.world.ChunkPosition in project PneumaticCraft by MineMaarten.
the class GuiRemoteButton method onGuiClosed.
@Override
public void onGuiClosed() {
super.onGuiClosed();
widget.settingCoordinate = new ChunkPosition(xValueField.getValue(), yValueField.getValue(), zValueField.getValue());
widget.setWidth(widthField.getValue());
widget.setHeight(heightField.getValue());
}
Aggregations