Merge remote-tracking branch 'remotes/origin/1.12' into 1.13-prep

# Conflicts:
#	build.gradle
#	src/main/java/techreborn/TechReborn.java
#	src/main/java/techreborn/blocks/BlockNuke.java
#	src/main/java/techreborn/blocks/BlockOre.java
#	src/main/java/techreborn/blocks/BlockRubberLog.java
#	src/main/java/techreborn/blocks/generator/BlockSolarPanel.java
#	src/main/java/techreborn/client/RegisterItemJsons.java
#	src/main/java/techreborn/client/container/builder/BuiltContainer.java
#	src/main/java/techreborn/client/container/builder/ContainerBuilder.java
#	src/main/java/techreborn/client/container/builder/ContainerPlayerInventoryBuilder.java
#	src/main/java/techreborn/client/container/builder/ContainerTileInventoryBuilder.java
#	src/main/java/techreborn/client/container/builder/slot/FilteredSlot.java
#	src/main/java/techreborn/client/container/builder/slot/SpriteSlot.java
#	src/main/java/techreborn/client/container/builder/slot/UpgradeSlot.java
#	src/main/java/techreborn/client/gui/GuiAESU.java
#	src/main/java/techreborn/client/gui/GuiAlloySmelter.java
#	src/main/java/techreborn/client/gui/GuiAssemblingMachine.java
#	src/main/java/techreborn/client/gui/GuiBase.java
#	src/main/java/techreborn/client/gui/GuiBlastFurnace.java
#	src/main/java/techreborn/client/gui/GuiChemicalReactor.java
#	src/main/java/techreborn/client/gui/GuiCompressor.java
#	src/main/java/techreborn/client/gui/GuiDieselGenerator.java
#	src/main/java/techreborn/client/gui/GuiDigitalChest.java
#	src/main/java/techreborn/client/gui/GuiDistillationTower.java
#	src/main/java/techreborn/client/gui/GuiElectricFurnace.java
#	src/main/java/techreborn/client/gui/GuiExtractor.java
#	src/main/java/techreborn/client/gui/GuiFluidReplicator.java
#	src/main/java/techreborn/client/gui/GuiFusionReactor.java
#	src/main/java/techreborn/client/gui/GuiGasTurbine.java
#	src/main/java/techreborn/client/gui/GuiGenerator.java
#	src/main/java/techreborn/client/gui/GuiGrinder.java
#	src/main/java/techreborn/client/gui/GuiImplosionCompressor.java
#	src/main/java/techreborn/client/gui/GuiIndustrialElectrolyzer.java
#	src/main/java/techreborn/client/gui/GuiIndustrialGrinder.java
#	src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java
#	src/main/java/techreborn/client/gui/GuiIronFurnace.java
#	src/main/java/techreborn/client/gui/GuiManual.java
#	src/main/java/techreborn/client/gui/GuiQuantumChest.java
#	src/main/java/techreborn/client/gui/GuiRecycler.java
#	src/main/java/techreborn/client/gui/GuiScrapboxinator.java
#	src/main/java/techreborn/client/gui/GuiSemifluidGenerator.java
#	src/main/java/techreborn/client/gui/GuiThermalGenerator.java
#	src/main/java/techreborn/client/gui/GuiVacuumFreezer.java
#	src/main/java/techreborn/client/gui/TRBuilder.java
#	src/main/java/techreborn/client/gui/slot/GuiFluidConfiguration.java
#	src/main/java/techreborn/client/gui/slot/GuiSlotConfiguration.java
#	src/main/java/techreborn/client/gui/slot/elements/CheckBoxElement.java
#	src/main/java/techreborn/client/gui/slot/elements/ConfigSlotElement.java
#	src/main/java/techreborn/client/gui/slot/elements/ElementBase.java
#	src/main/java/techreborn/client/gui/slot/elements/FluidConfigPopupElement.java
#	src/main/java/techreborn/client/gui/slot/elements/ISprite.java
#	src/main/java/techreborn/client/gui/slot/elements/OffsetSprite.java
#	src/main/java/techreborn/client/gui/slot/elements/SlotConfigPopupElement.java
#	src/main/java/techreborn/client/gui/slot/elements/Sprite.java
#	src/main/java/techreborn/compat/CompatManager.java
#	src/main/java/techreborn/compat/ICompatModule.java
#	src/main/java/techreborn/compat/jei/BaseRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/BuiltContainerTransferInfo.java
#	src/main/java/techreborn/compat/jei/RecipeUtil.java
#	src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java
#	src/main/java/techreborn/compat/jei/alloySmelter/AlloySmelterRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/assemblingMachine/AssemblingMachineRecipeCategory.java
#	src/main/java/techreborn/compat/jei/assemblingMachine/AssemblingMachineRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/blastFurnace/BlastFurnaceRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/centrifuge/CentrifugeRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/chemicalReactor/ChemicalReactorRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/compressor/CompressorRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/distillationTower/DistillationTowerRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/extractor/ExtractorRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/fluidReplicator/FluidReplicatorRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/fusionReactor/FusionReactorRecipeCategory.java
#	src/main/java/techreborn/compat/jei/fusionReactor/FusionReactorRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/generators/fluid/FluidGeneratorRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/grinder/GrinderRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/implosionCompressor/ImplosionCompressorRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/industrialGrinder/IndustrialGrinderRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/industrialSawmill/IndustrialSawmillRecipeWrapper.java
#	src/main/java/techreborn/compat/jei/rollingMachine/RollingMachineRecipeCategory.java
#	src/main/java/techreborn/compat/jei/scrapbox/ScrapboxRecipeCategory.java
#	src/main/java/techreborn/compat/jei/vacuumFreezer/VacuumFreezerRecipeWrapper.java
#	src/main/java/techreborn/events/BlockBreakHandler.java
#	src/main/java/techreborn/events/StackToolTipEvent.java
#	src/main/java/techreborn/init/IC2Duplicates.java
#	src/main/java/techreborn/init/ModItems.java
#	src/main/java/techreborn/init/ModRecipes.java
#	src/main/java/techreborn/init/OreDict.java
#	src/main/java/techreborn/init/recipes/AlloySmelterRecipes.java
#	src/main/java/techreborn/init/recipes/ChemicalReactorRecipes.java
#	src/main/java/techreborn/init/recipes/CraftingTableRecipes.java
#	src/main/java/techreborn/init/recipes/FusionReactorRecipes.java
#	src/main/java/techreborn/init/recipes/IndustrialCentrifugeRecipes.java
#	src/main/java/techreborn/init/recipes/IndustrialSawmillRecipes.java
#	src/main/java/techreborn/init/recipes/RollingMachineRecipes.java
#	src/main/java/techreborn/init/recipes/ScrapboxRecipes.java
#	src/main/java/techreborn/items/ItemDestructopack.java
#	src/main/java/techreborn/items/ItemFrequencyTransmitter.java
#	src/main/java/techreborn/items/ItemManual.java
#	src/main/java/techreborn/items/ItemMissingRecipe.java
#	src/main/java/techreborn/items/ItemScrapBox.java
#	src/main/java/techreborn/items/ItemTechManual.java
#	src/main/java/techreborn/items/ItemUUmatter.java
#	src/main/java/techreborn/items/ItemUpgrade.java
#	src/main/java/techreborn/items/ItemUpgrades.java
#	src/main/java/techreborn/items/armor/ItemCloakingDevice.java
#	src/main/java/techreborn/items/ingredients/ItemDusts.java
#	src/main/java/techreborn/items/ingredients/ItemDustsSmall.java
#	src/main/java/techreborn/items/ingredients/ItemGems.java
#	src/main/java/techreborn/items/ingredients/ItemIngots.java
#	src/main/java/techreborn/items/ingredients/ItemNuggets.java
#	src/main/java/techreborn/items/ingredients/ItemParts.java
#	src/main/java/techreborn/items/ingredients/ItemPlates.java
#	src/main/java/techreborn/items/ingredients/ItemUUmatter.java
#	src/main/java/techreborn/items/tool/ItemDebugTool.java
#	src/main/java/techreborn/items/tool/ItemTreeTap.java
#	src/main/java/techreborn/items/tool/basic/ItemElectricTreetap.java
#	src/main/java/techreborn/items/tools/ItemTechManual.java
#	src/main/java/techreborn/items/tools/ItemTreeTap.java
#	src/main/java/techreborn/items/tools/ItemWrench.java
#	src/main/java/techreborn/lib/ModInfo.java
#	src/main/java/techreborn/proxies/ClientProxy.java
#	src/main/java/techreborn/tiles/TileChargeOMat.java
#	src/main/java/techreborn/tiles/TileChunkLoader.java
#	src/main/java/techreborn/tiles/TileDigitalChest.java
#	src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java
#	src/main/java/techreborn/tiles/TileMatterFabricator.java
#	src/main/java/techreborn/tiles/TileQuantumChest.java
#	src/main/java/techreborn/tiles/TileQuantumTank.java
#	src/main/java/techreborn/tiles/cable/TileCable.java
#	src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java
#	src/main/java/techreborn/tiles/generator/TileCreativeSolarPanel.java
#	src/main/java/techreborn/tiles/generator/TilePlasmaGenerator.java
#	src/main/java/techreborn/tiles/generator/advanced/TileDieselGenerator.java
#	src/main/java/techreborn/tiles/generator/advanced/TileGasTurbine.java
#	src/main/java/techreborn/tiles/generator/advanced/TileSemiFluidGenerator.java
#	src/main/java/techreborn/tiles/generator/advanced/TileThermalGenerator.java
#	src/main/java/techreborn/tiles/generator/basic/TileSolidFuelGenerator.java
#	src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java
#	src/main/java/techreborn/tiles/machine/multiblock/TileDistillationTower.java
#	src/main/java/techreborn/tiles/machine/multiblock/TileFluidReplicator.java
#	src/main/java/techreborn/tiles/machine/multiblock/TileImplosionCompressor.java
#	src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java
#	src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialGrinder.java
#	src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialSawmill.java
#	src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java
#	src/main/java/techreborn/tiles/machine/tier1/TileAlloySmelter.java
#	src/main/java/techreborn/tiles/machine/tier1/TileAssemblingMachine.java
#	src/main/java/techreborn/tiles/machine/tier1/TileAutoCraftingTable.java
#	src/main/java/techreborn/tiles/machine/tier1/TileChemicalReactor.java
#	src/main/java/techreborn/tiles/machine/tier1/TileCompressor.java
#	src/main/java/techreborn/tiles/machine/tier1/TileElectricFurnace.java
#	src/main/java/techreborn/tiles/machine/tier1/TileExtractor.java
#	src/main/java/techreborn/tiles/machine/tier1/TileGrinder.java
#	src/main/java/techreborn/tiles/machine/tier1/TileIndustrialElectrolyzer.java
#	src/main/java/techreborn/tiles/machine/tier1/TileRecycler.java
#	src/main/java/techreborn/tiles/machine/tier1/TileRollingMachine.java
#	src/main/java/techreborn/tiles/machine/tier1/TileScrapboxinator.java
#	src/main/java/techreborn/tiles/storage/TileAdjustableSU.java
#	src/main/java/techreborn/tiles/storage/TileEnergyStorage.java
#	src/main/java/techreborn/tiles/storage/TileHighVoltageSU.java
#	src/main/java/techreborn/tiles/storage/TileLowVoltageSU.java
#	src/main/java/techreborn/tiles/storage/TileMediumVoltageSU.java
#	src/main/java/techreborn/tiles/storage/idsu/TileInterdimensionalSU.java
#	src/main/java/techreborn/tiles/storage/lesu/TileLapotronicSU.java
#	src/main/java/techreborn/utils/StackWIPHandler.java
#	src/main/java/techreborn/world/TechRebornRetroGen.java
#	src/main/resources/assets/techreborn/textures/items/armor/lithium_batpack.png
This commit is contained in:
modmuss50 2018-12-26 16:08:04 +00:00
commit 4440c2f305
148 changed files with 1016 additions and 5344 deletions

View file

@ -1,32 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import techreborn.client.container.builder.BuiltContainer;
public interface IContainerProvider {
BuiltContainer createContainer(EntityPlayer player);
}

View file

@ -1,36 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import techreborn.client.container.builder.BuiltContainer;
/**
* Created by Mark on 12/04/2017.
*/
public interface IRightClickHandler {
public boolean handleRightClick(int slotID, EntityPlayer player, BuiltContainer container);
}

View file

@ -1,307 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.client.container.builder;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.Range;
import org.apache.commons.lang3.tuple.MutableTriple;
import org.apache.commons.lang3.tuple.Pair;
import reborncore.common.tile.TileMachineBase;
import reborncore.common.util.ItemUtils;
import techreborn.client.container.IRightClickHandler;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.IntConsumer;
import java.util.function.IntSupplier;
import java.util.function.Predicate;
public class BuiltContainer extends Container {
private final String name;
private final Predicate<EntityPlayer> canInteract;
private final List<Range<Integer>> playerSlotRanges;
private final List<Range<Integer>> tileSlotRanges;
private final ArrayList<MutableTriple<IntSupplier, IntConsumer, Short>> shortValues;
private final ArrayList<MutableTriple<IntSupplier, IntConsumer, Integer>> integerValues;
private List<Consumer<InventoryCrafting>> craftEvents;
private Integer[] integerParts;
private final TileMachineBase tile;
public BuiltContainer(final String name, final Predicate<EntityPlayer> canInteract,
final List<Range<Integer>> playerSlotRange,
final List<Range<Integer>> tileSlotRange, TileMachineBase tile) {
this.name = name;
this.canInteract = canInteract;
this.playerSlotRanges = playerSlotRange;
this.tileSlotRanges = tileSlotRange;
this.shortValues = new ArrayList<>();
this.integerValues = new ArrayList<>();
this.tile = tile;
}
public void addShortSync(final List<Pair<IntSupplier, IntConsumer>> syncables) {
for (final Pair<IntSupplier, IntConsumer> syncable : syncables)
this.shortValues.add(MutableTriple.of(syncable.getLeft(), syncable.getRight(), (short) 0));
this.shortValues.trimToSize();
}
public void addIntegerSync(final List<Pair<IntSupplier, IntConsumer>> syncables) {
for (final Pair<IntSupplier, IntConsumer> syncable : syncables)
this.integerValues.add(MutableTriple.of(syncable.getLeft(), syncable.getRight(), 0));
this.integerValues.trimToSize();
this.integerParts = new Integer[this.integerValues.size()];
}
public void addCraftEvents(final List<Consumer<InventoryCrafting>> craftEvents) {
this.craftEvents = craftEvents;
}
public void addSlot(final Slot slot) {
this.addSlotToContainer(slot);
}
@Override
public boolean canInteractWith(final EntityPlayer playerIn) {
if(this.tile != null) {
return playerIn.getDistanceSq((double) tile.getPos().getX() + 0.5D, (double) tile.getPos().getY() + 0.5D, (double) tile.getPos().getZ() + 0.5D) <= 64.0D;
} else {
return this.canInteract.test(playerIn); // <
}
}
@Override
public final void onCraftMatrixChanged(final IInventory inv) {
if (!this.craftEvents.isEmpty())
this.craftEvents.forEach(consumer -> consumer.accept((InventoryCrafting) inv));
}
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
if (dragType == 1 && slotId > 0 && slotId < 1000) {
Slot slot = this.inventorySlots.get(slotId);
if (slot instanceof IRightClickHandler) {
if (((IRightClickHandler) slot).handleRightClick(slot.getSlotIndex(), player, this)) {
return ItemStack.EMPTY;
}
}
}
return super.slotClick(slotId, dragType, clickTypeIn, player);
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (final IContainerListener listener : this.listeners) {
int i = 0;
if (!this.shortValues.isEmpty())
for (final MutableTriple<IntSupplier, IntConsumer, Short> value : this.shortValues) {
final short supplied = (short) value.getLeft().getAsInt();
if (supplied != value.getRight()) {
listener.sendWindowProperty(this, i, supplied);
value.setRight(supplied);
}
i++;
}
if (!this.integerValues.isEmpty())
for (final MutableTriple<IntSupplier, IntConsumer, Integer> value : this.integerValues) {
final int supplied = value.getLeft().getAsInt();
if (supplied != value.getRight()) {
listener.sendWindowProperty(this, i, supplied >> 16);
listener.sendWindowProperty(this, i + 1, (short) (supplied & 0xFFFF));
value.setRight(supplied);
}
i += 2;
}
}
}
@Override
public void addListener(final IContainerListener listener) {
super.addListener(listener);
int i = 0;
if (!this.shortValues.isEmpty())
for (final MutableTriple<IntSupplier, IntConsumer, Short> value : this.shortValues) {
final short supplied = (short) value.getLeft().getAsInt();
listener.sendWindowProperty(this, i, supplied);
value.setRight(supplied);
i++;
}
if (!this.integerValues.isEmpty())
for (final MutableTriple<IntSupplier, IntConsumer, Integer> value : this.integerValues) {
final int supplied = value.getLeft().getAsInt();
listener.sendWindowProperty(this, i, supplied >> 16);
listener.sendWindowProperty(this, i + 1, (short) (supplied & 0xFFFF));
value.setRight(supplied);
i += 2;
}
}
@SideOnly(Side.CLIENT)
@Override
public void updateProgressBar(final int id, final int value) {
if (id < this.shortValues.size()) {
this.shortValues.get(id).getMiddle().accept((short) value);
this.shortValues.get(id).setRight((short) value);
} else if (id - this.shortValues.size() < this.integerValues.size() * 2) {
if ((id - this.shortValues.size()) % 2 == 0)
this.integerParts[(id - this.shortValues.size()) / 2] = value;
else {
this.integerValues.get((id - this.shortValues.size()) / 2).getMiddle().accept(
(this.integerParts[(id - this.shortValues.size()) / 2] & 0xFFFF) << 16 | value & 0xFFFF);
}
}
}
@Override
public ItemStack transferStackInSlot(final EntityPlayer player, final int index) {
ItemStack originalStack = ItemStack.EMPTY;
final Slot slot = this.inventorySlots.get(index);
if (slot != null && slot.getHasStack()) {
final ItemStack stackInSlot = slot.getStack();
originalStack = stackInSlot.copy();
boolean shifted = false;
for (final Range<Integer> range : this.playerSlotRanges)
if (range.contains(index)) {
if (this.shiftToTile(stackInSlot))
shifted = true;
break;
}
if (!shifted)
for (final Range<Integer> range : this.tileSlotRanges)
if (range.contains(index)) {
if (this.shiftToPlayer(stackInSlot))
shifted = true;
break;
}
slot.onSlotChange(stackInSlot, originalStack);
if (stackInSlot.getCount() <= 0)
slot.putStack(ItemStack.EMPTY);
else
slot.onSlotChanged();
if (stackInSlot.getCount() == originalStack.getCount())
return ItemStack.EMPTY;
slot.onTake(player, stackInSlot);
}
return originalStack;
}
protected boolean shiftItemStack(final ItemStack stackToShift, final int start, final int end) {
boolean changed = false;
if (stackToShift.isStackable()) {
for (int slotIndex = start; stackToShift.getCount() > 0 && slotIndex < end; slotIndex++) {
final Slot slot = this.inventorySlots.get(slotIndex);
final ItemStack stackInSlot = slot.getStack();
if (!stackInSlot.isEmpty() && ItemUtils.isItemEqual(stackInSlot, stackToShift, true, true)
&& slot.isItemValid(stackToShift)) {
final int resultingStackSize = stackInSlot.getCount() + stackToShift.getCount();
final int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit());
if (resultingStackSize <= max) {
stackToShift.setCount(0);
stackInSlot.setCount(resultingStackSize);
slot.onSlotChanged();
changed = true;
} else if (stackInSlot.getCount() < max) {
stackToShift.shrink(max - stackInSlot.getCount());
stackInSlot.setCount(max);
slot.onSlotChanged();
changed = true;
}
}
}
}
if (stackToShift.getCount() > 0) {
for (int slotIndex = start; stackToShift.getCount() > 0 && slotIndex < end; slotIndex++) {
final Slot slot = this.inventorySlots.get(slotIndex);
ItemStack stackInSlot = slot.getStack();
if (stackInSlot.isEmpty() && slot.isItemValid(stackToShift)) {
final int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit());
stackInSlot = stackToShift.copy();
stackInSlot.setCount(Math.min(stackToShift.getCount(), max));
stackToShift.shrink(stackInSlot.getCount());
slot.putStack(stackInSlot);
slot.onSlotChanged();
changed = true;
}
}
}
return changed;
}
private boolean shiftToTile(final ItemStack stackToShift) {
for (final Range<Integer> range : this.tileSlotRanges)
if (this.shiftItemStack(stackToShift, range.getMinimum(), range.getMaximum() + 1))
return true;
return false;
}
private boolean shiftToPlayer(final ItemStack stackToShift) {
for (final Range<Integer> range : this.playerSlotRanges)
if (this.shiftItemStack(stackToShift, range.getMinimum(), range.getMaximum() + 1))
return true;
return false;
}
public String getName() {
return this.name;
}
}

View file

@ -1,107 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.client.container.builder;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import org.apache.commons.lang3.Range;
import org.apache.commons.lang3.tuple.Pair;
import reborncore.common.tile.TileMachineBase;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.IntConsumer;
import java.util.function.IntSupplier;
import java.util.function.Predicate;
public class ContainerBuilder {
private final String name;
private Predicate<EntityPlayer> canInteract = player -> true;
final List<Slot> slots;
final List<Range<Integer>> playerInventoryRanges, tileInventoryRanges;
final List<Pair<IntSupplier, IntConsumer>> shortValues;
final List<Pair<IntSupplier, IntConsumer>> integerValues;
final List<Consumer<InventoryCrafting>> craftEvents;
public ContainerBuilder(final String name) {
this.name = name;
this.slots = new ArrayList<>();
this.playerInventoryRanges = new ArrayList<>();
this.tileInventoryRanges = new ArrayList<>();
this.shortValues = new ArrayList<>();
this.integerValues = new ArrayList<>();
this.craftEvents = new ArrayList<>();
}
public ContainerBuilder interact(final Predicate<EntityPlayer> canInteract) {
this.canInteract = canInteract;
return this;
}
public ContainerPlayerInventoryBuilder player(final InventoryPlayer player) {
return new ContainerPlayerInventoryBuilder(this, player);
}
public ContainerTileInventoryBuilder tile(final TileMachineBase tile) {
return new ContainerTileInventoryBuilder(this, tile);
}
void addPlayerInventoryRange(final Range<Integer> range) {
this.playerInventoryRanges.add(range);
}
void addTileInventoryRange(final Range<Integer> range) {
this.tileInventoryRanges.add(range);
}
public BuiltContainer create(final TileMachineBase tile) {
final BuiltContainer built = new BuiltContainer(this.name, this.canInteract,
this.playerInventoryRanges,
this.tileInventoryRanges, tile);
if (!this.shortValues.isEmpty())
built.addShortSync(this.shortValues);
if (!this.integerValues.isEmpty())
built.addIntegerSync(this.integerValues);
if (!this.craftEvents.isEmpty())
built.addCraftEvents(this.craftEvents);
this.slots.forEach(built::addSlot);
this.slots.clear();
return built;
}
}

View file

@ -1,130 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.client.container.builder;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.inventory.Slot;
import net.minecraftforge.items.wrapper.InvWrapper;
import org.apache.commons.lang3.Range;
import techreborn.client.IconSupplier;
import techreborn.client.container.builder.slot.SpriteSlot;
public final class ContainerPlayerInventoryBuilder {
private final InventoryPlayer player;
private final ContainerBuilder parent;
private Range<Integer> main;
private Range<Integer> hotbar;
private Range<Integer> armor;
ContainerPlayerInventoryBuilder(final ContainerBuilder parent, final InventoryPlayer player) {
this.player = player;
this.parent = parent;
}
public ContainerPlayerInventoryBuilder inventory(final int xStart, final int yStart) {
final int startIndex = this.parent.slots.size();
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 9; ++j)
this.parent.slots.add(new Slot(this.player, j + i * 9 + 9, xStart + j * 18, yStart + i * 18));
this.main = Range.between(startIndex, this.parent.slots.size() - 1);
return this;
}
public ContainerPlayerInventoryBuilder hotbar(final int xStart, final int yStart) {
final int startIndex = this.parent.slots.size();
for (int i = 0; i < 9; ++i)
this.parent.slots.add(new Slot(this.player, i, xStart + i * 18, yStart));
this.hotbar = Range.between(startIndex, this.parent.slots.size() - 1);
return this;
}
public ContainerPlayerInventoryBuilder inventory() {
return this.inventory(8, 94);
}
public ContainerPlayerInventoryBuilder hotbar() {
return this.hotbar(8, 152);
}
public ContainerPlayerArmorInventoryBuilder armor() {
return new ContainerPlayerArmorInventoryBuilder(this);
}
public ContainerBuilder addInventory() {
if (this.hotbar != null)
this.parent.addPlayerInventoryRange(this.hotbar);
if (this.main != null)
this.parent.addPlayerInventoryRange(this.main);
if (this.armor != null)
this.parent.addTileInventoryRange(this.armor);
return this.parent;
}
public static final class ContainerPlayerArmorInventoryBuilder {
private final ContainerPlayerInventoryBuilder parent;
private final int startIndex;
public ContainerPlayerArmorInventoryBuilder(final ContainerPlayerInventoryBuilder parent) {
this.parent = parent;
this.startIndex = parent.parent.slots.size();
}
private ContainerPlayerArmorInventoryBuilder armor(final int index, final int xStart, final int yStart,
final EntityEquipmentSlot slotType, final String sprite) {
this.parent.parent.slots.add(new SpriteSlot(new InvWrapper(this.parent.player), index, xStart, yStart, sprite, 1)
.setFilter(stack -> stack.getItem().isValidArmor(stack, slotType, this.parent.player.player)));
return this;
}
public ContainerPlayerArmorInventoryBuilder helmet(final int xStart, final int yStart) {
return this.armor(this.parent.player.getSizeInventory() - 2, xStart, yStart, EntityEquipmentSlot.HEAD, IconSupplier.armour_head_name);
}
public ContainerPlayerArmorInventoryBuilder chestplate(final int xStart, final int yStart) {
return this.armor(this.parent.player.getSizeInventory() - 3, xStart, yStart, EntityEquipmentSlot.CHEST, IconSupplier.armour_chest_name);
}
public ContainerPlayerArmorInventoryBuilder leggings(final int xStart, final int yStart) {
return this.armor(this.parent.player.getSizeInventory() - 4, xStart, yStart, EntityEquipmentSlot.LEGS, IconSupplier.armour_legs_name);
}
public ContainerPlayerArmorInventoryBuilder boots(final int xStart, final int yStart) {
return this.armor(this.parent.player.getSizeInventory() - 5, xStart, yStart, EntityEquipmentSlot.FEET, IconSupplier.armour_feet_name);
}
public ContainerPlayerArmorInventoryBuilder complete(final int xStart, final int yStart) {
return this.helmet(xStart, yStart).chestplate(xStart, yStart + 18).leggings(xStart, yStart + 18 + 18)
.boots(xStart, yStart + 18 + 18 + 18);
}
public ContainerPlayerInventoryBuilder addArmor() {
this.parent.armor = Range.between(this.startIndex, this.parent.parent.slots.size() - 1);
return this.parent;
}
}
}

View file

@ -1,173 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.client.container.builder;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import org.apache.commons.lang3.Range;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.tuple.Pair;
import reborncore.api.recipe.IRecipeCrafterProvider;
import reborncore.api.tile.IUpgradeable;
import reborncore.client.gui.slots.BaseSlot;
import reborncore.client.gui.slots.SlotFake;
import reborncore.client.gui.slots.SlotOutput;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.tile.TileMachineBase;
import techreborn.TechReborn;
import techreborn.client.container.builder.slot.FilteredSlot;
import techreborn.client.container.builder.slot.FurnaceFuelSlot;
import techreborn.client.container.builder.slot.UpgradeSlot;
import java.util.function.Consumer;
import java.util.function.IntConsumer;
import java.util.function.IntSupplier;
import java.util.function.Predicate;
public class ContainerTileInventoryBuilder {
private final TileMachineBase tile;
private final ContainerBuilder parent;
private final int rangeStart;
ContainerTileInventoryBuilder(final ContainerBuilder parent, final TileMachineBase tile) {
this.tile = tile;
this.parent = parent;
this.rangeStart = parent.slots.size();
//Ensure that the tile has an inv
Validate.isTrue(tile.getInventoryForTile().isPresent());
if (tile.canBeUpgraded()) {
upgradeSlots(tile);
}
}
public ContainerTileInventoryBuilder slot(final int index, final int x, final int y) {
this.parent.slots.add(new BaseSlot(this.tile.getInventoryForTile().get(), index, x, y));
return this;
}
public ContainerTileInventoryBuilder outputSlot(final int index, final int x, final int y) {
this.parent.slots.add(new SlotOutput(this.tile.getInventoryForTile().get(), index, x, y));
return this;
}
public ContainerTileInventoryBuilder fakeSlot(final int index, final int x, final int y) {
this.parent.slots.add(new SlotFake(this.tile.getInventoryForTile().get(), index, x, y, false, false, Integer.MAX_VALUE));
return this;
}
public ContainerTileInventoryBuilder filterSlot(final int index, final int x, final int y,
final Predicate<ItemStack> filter) {
this.parent.slots.add(new FilteredSlot(this.tile.getInventoryForTile().get(), index, x, y).setFilter(filter));
return this;
}
public ContainerTileInventoryBuilder energySlot(final int index, final int x, final int y) {
this.parent.slots.add(new FilteredSlot(this.tile.getInventoryForTile().get(), index, x, y)
.setFilter(stack -> stack.hasCapability(CapabilityEnergy.ENERGY, EnumFacing.UP)));
return this;
}
public ContainerTileInventoryBuilder fluidSlot(final int index, final int x, final int y) {
this.parent.slots.add(new FilteredSlot(this.tile.getInventoryForTile().get(), index, x, y).setFilter(
stack -> stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, EnumFacing.UP)));
return this;
}
public ContainerTileInventoryBuilder fuelSlot(final int index, final int x, final int y) {
this.parent.slots.add(new FurnaceFuelSlot(this.tile.getInventoryForTile().get(), index, x, y));
return this;
}
private ContainerTileInventoryBuilder upgradeSlots(IUpgradeable upgradeable) {
if (upgradeable.canBeUpgraded()) {
for (int i = 0; i < upgradeable.getUpgradeSlotCount(); i++) {
this.parent.slots.add(new UpgradeSlot(upgradeable.getUpgradeInvetory(), i, -19, i * 18 + 12));
}
}
return this;
}
/**
* @param supplier The supplier must supply a variable holding inside a Short, it
* will be truncated by force.
* @param setter The setter to call when the variable has been updated.
* @return ContainerTileInventoryBuilder Inventory which will do the sync
*/
public ContainerTileInventoryBuilder syncShortValue(final IntSupplier supplier, final IntConsumer setter) {
this.parent.shortValues.add(Pair.of(supplier, setter));
return this;
}
/**
* @param supplier The supplier it can supply a variable holding in an Integer it
* will be split inside multiples shorts.
* @param setter The setter to call when the variable has been updated.
* @return ContainerTileInventoryBuilder Inventory which will do the sync
*/
public ContainerTileInventoryBuilder syncIntegerValue(final IntSupplier supplier, final IntConsumer setter) {
this.parent.integerValues.add(Pair.of(supplier, setter));
return this;
}
public ContainerTileInventoryBuilder syncEnergyValue() {
if (this.tile instanceof TilePowerAcceptor)
return this.syncIntegerValue(() -> (int) ((TilePowerAcceptor) this.tile).getEnergy(),
((TilePowerAcceptor) this.tile)::setEnergy)
.syncIntegerValue(() -> (int) ((TilePowerAcceptor) this.tile).extraPowerStoage,
((TilePowerAcceptor) this.tile)::setExtraPowerStoage)
.syncIntegerValue(() -> (int) ((TilePowerAcceptor) this.tile).getPowerChange(),
((TilePowerAcceptor) this.tile)::setPowerChange);
TechReborn.LOGGER.error(this.tile + " is not an instance of TilePowerAcceptor! Energy cannot be synced.");
return this;
}
public ContainerTileInventoryBuilder syncCrafterValue() {
if (this.tile instanceof IRecipeCrafterProvider)
return this
.syncIntegerValue(() -> ((IRecipeCrafterProvider) this.tile).getRecipeCrafter().currentTickTime,
(currentTickTime) -> ((IRecipeCrafterProvider) this.tile)
.getRecipeCrafter().currentTickTime = currentTickTime)
.syncIntegerValue(() -> ((IRecipeCrafterProvider) this.tile).getRecipeCrafter().currentNeededTicks,
(currentNeededTicks) -> ((IRecipeCrafterProvider) this.tile)
.getRecipeCrafter().currentNeededTicks = currentNeededTicks);
TechReborn.LOGGER
.error(this.tile + " is not an instance of IRecipeCrafterProvider! Craft progress cannot be synced.");
return this;
}
public ContainerTileInventoryBuilder onCraft(final Consumer<InventoryCrafting> onCraft) {
this.parent.craftEvents.add(onCraft);
return this;
}
public ContainerBuilder addInventory() {
this.parent.tileInventoryRanges.add(Range.between(this.rangeStart, this.parent.slots.size() - 1));
return this.parent;
}
}

View file

@ -1,65 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.client.container.builder.slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import reborncore.client.gui.slots.BaseSlot;
import java.util.function.Predicate;
public class FilteredSlot extends BaseSlot {
private Predicate<ItemStack> filter;
private int stackLimit = 64;
public FilteredSlot(final IItemHandler inventory, final int index, final int xPosition, final int yPosition) {
super(inventory, index, xPosition, yPosition);
}
public FilteredSlot(final IItemHandler inventory, final int index, final int xPosition, final int yPosition, int stackLimit) {
super(inventory, index, xPosition, yPosition);
this.stackLimit = stackLimit;
}
public FilteredSlot setFilter(final Predicate<ItemStack> filter) {
this.filter = filter;
return this;
}
@Override
public boolean isItemValid(final ItemStack stack) {
try {
return this.filter.test(stack);
} catch (NullPointerException e) {
return true;
}
}
@Override
public int getSlotStackLimit() {
return stackLimit;
}
}

View file

@ -1,59 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.client.container.builder.slot;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandler;
import javax.annotation.Nullable;
public class SpriteSlot extends FilteredSlot {
private final String spriteName;
int stacksize;
public SpriteSlot(final IItemHandler inventory, final int index, final int xPosition, final int yPosition, final String sprite, final int stacksize) {
super(inventory, index, xPosition, yPosition);
this.spriteName = sprite;
this.stacksize = stacksize;
}
public SpriteSlot(final IItemHandler inventory, final int index, final int xPosition, final int yPosition, final String sprite) {
this(inventory, index, xPosition, yPosition, sprite, 64);
}
@Override
public int getSlotStackLimit() {
return this.stacksize;
}
@Override
@Nullable
@SideOnly(Side.CLIENT)
public String getSlotTexture() {
return this.spriteName;
}
}

View file

@ -1,47 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2018 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.client.container.builder.slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import reborncore.api.tile.IUpgrade;
import reborncore.client.gui.slots.BaseSlot;
public class UpgradeSlot extends BaseSlot {
public UpgradeSlot(final IItemHandler inventory, final int index, final int xPosition, final int yPosition) {
super(inventory, index, xPosition, yPosition);
}
@Override
public boolean isItemValid(final ItemStack stack) {
return stack.getItem() instanceof IUpgrade;
}
@Override
public int getSlotStackLimit() {
return 1;
}
}