Add creative versions of the Quantum tank and chest, they provide unlimited amount of the specified item/fluid
This commit is contained in:
parent
84aeeb978c
commit
4e352c0953
12 changed files with 303 additions and 1 deletions
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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.blocks.tier3;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import prospector.shootingstar.ShootingStar;
|
||||
import prospector.shootingstar.model.ModelCompound;
|
||||
import reborncore.api.tile.IMachineGuiHandler;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileCreativeQuantumChest;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
public class BlockCreativeQuantumChest extends BlockMachineBase {
|
||||
|
||||
public BlockCreativeQuantumChest() {
|
||||
super();
|
||||
this.setUnlocalizedName("techreborn.creativeQuantumChest");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier3_machines"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World world, final int meta) {
|
||||
return new TileCreativeQuantumChest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMachineGuiHandler getGui() {
|
||||
return EGui.QUANTUM_CHEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAdvanced() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
|
||||
//lets not drop max int items into the world, that sounds like a bad idea
|
||||
worldIn.removeTileEntity(pos);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* 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.blocks.tier3;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import prospector.shootingstar.ShootingStar;
|
||||
import prospector.shootingstar.model.ModelCompound;
|
||||
import reborncore.api.tile.IMachineGuiHandler;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.TileCreativeQuantumTank;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
public class BlockCreativeQuantumTank extends BlockMachineBase {
|
||||
|
||||
public BlockCreativeQuantumTank() {
|
||||
super();
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier3_machines"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World world, final int meta) {
|
||||
return new TileCreativeQuantumTank();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMachineGuiHandler getGui() {
|
||||
return EGui.QUANTUM_TANK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAdvanced() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -124,7 +124,9 @@ public class GuiBase extends GuiContainer {
|
|||
public void initGui() {
|
||||
super.initGui();
|
||||
GuiSlotConfiguration.init(this);
|
||||
GuiFluidConfiguration.init(this);
|
||||
if(getMachine().getTank() != null && getMachine().showTankConfig()){
|
||||
GuiFluidConfiguration.init(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -60,7 +60,9 @@ public class ModBlocks {
|
|||
|
||||
public static Block THERMAL_GENERATOR;
|
||||
public static Block QUANTUM_TANK;
|
||||
public static Block CREATIVE_QUANTUM_TANK;
|
||||
public static Block QUANTUM_CHEST;
|
||||
public static Block CREATIVE_QUANTUM_CHEST;
|
||||
public static Block DIGITAL_CHEST;
|
||||
public static Block INDUSTRIAL_CENTRIFUGE;
|
||||
public static Block ROLLING_MACHINE;
|
||||
|
@ -151,9 +153,15 @@ public class ModBlocks {
|
|||
QUANTUM_TANK = new BlockQuantumTank();
|
||||
registerBlock(QUANTUM_TANK, ItemBlockQuantumTank.class, "quantum_tank");
|
||||
|
||||
CREATIVE_QUANTUM_TANK = new BlockCreativeQuantumTank();
|
||||
registerBlock(CREATIVE_QUANTUM_TANK, ItemBlockQuantumTank.class, "creative_quantum_tank");
|
||||
|
||||
QUANTUM_CHEST = new BlockQuantumChest();
|
||||
registerBlock(QUANTUM_CHEST, ItemBlockQuantumChest.class, "quantum_chest");
|
||||
|
||||
CREATIVE_QUANTUM_CHEST = new BlockCreativeQuantumChest();
|
||||
registerBlock(CREATIVE_QUANTUM_CHEST, ItemBlockQuantumChest.class, "creative_quantum_chest");
|
||||
|
||||
DIGITAL_CHEST = new BlockDigitalChest();
|
||||
registerBlock(DIGITAL_CHEST, ItemBlockDigitalChest.class, "digital_chest");
|
||||
|
||||
|
|
|
@ -60,7 +60,9 @@ public enum ModTileEntities {
|
|||
|
||||
THERMAL_GEN(TileThermalGenerator.class, "thermal_generator", "TileThermalGeneratorTR"),
|
||||
QUANTUM_TANK(TileQuantumTank.class, "quantum_tank", "TileQuantumTankTR"),
|
||||
CREATIVE_QUANTUM_TANK(TileCreativeQuantumTank.class, "creative_quantum_tank"),
|
||||
QUANTUM_CHEST(TileQuantumChest.class, "quantum_chest", "TileQuantumChestTR"),
|
||||
CREATIVE_QUANTUM_CHEST(TileCreativeQuantumChest.class, "creative_quantum_chest"),
|
||||
DIGITAL_CHEST(TileDigitalChest.class, "digital_chest", "TileDigitalChestTR"),
|
||||
INDUSTRIAL_CENTRIFUGE(TileIndustrialCentrifuge.class, "industrial_centrifuge", "TileIndustrialCentrifugeTR"),
|
||||
ROLLING_MACHINE(TileRollingMachine.class, "rolling_machine", "TileRollingMachineTR"),
|
||||
|
|
47
src/main/java/techreborn/tiles/TileCreativeQuantumChest.java
Normal file
47
src/main/java/techreborn/tiles/TileCreativeQuantumChest.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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.tiles;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class TileCreativeQuantumChest extends TileQuantumChest {
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
ItemStack stack = getStackInSlot(1);
|
||||
if (!stack.isEmpty() && storedItem.isEmpty()) {
|
||||
stack.setCount(stack.getMaxStackSize());
|
||||
storedItem = stack.copy();
|
||||
}
|
||||
|
||||
storedItem.setCount(maxCapacity - storedItem.getMaxStackSize());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int slotTransferSpeed() {
|
||||
return 1;
|
||||
}
|
||||
}
|
22
src/main/java/techreborn/tiles/TileCreativeQuantumTank.java
Normal file
22
src/main/java/techreborn/tiles/TileCreativeQuantumTank.java
Normal file
|
@ -0,0 +1,22 @@
|
|||
package techreborn.tiles;
|
||||
|
||||
public class TileCreativeQuantumTank extends TileQuantumTank {
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (!tank.isEmpty() && !tank.isFull()) {
|
||||
tank.setFluidAmount(Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int slotTransferSpeed() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fluidTransferAmount() {
|
||||
return 10000;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue