This commit is contained in:
modmuss50 2019-06-13 13:14:11 +01:00
parent 4479116d1c
commit f8f20ce6ba
81 changed files with 280 additions and 434 deletions

View file

@ -73,11 +73,11 @@ license {
group = 'TechReborn'
dependencies {
minecraft "com.mojang:minecraft:1.14.2 Pre-Release 1"
mappings "net.fabricmc:yarn:1.14.2 Pre-Release 1+build.1"
modCompile "net.fabricmc:fabric-loader:0.4.7+build.147"
minecraft "com.mojang:minecraft:1.14.2"
mappings "net.fabricmc:yarn:1.14.2+build.7"
modCompile "net.fabricmc:fabric-loader:0.4.8+build.155"
modCompile "net.fabricmc.fabric-api:fabric-api:0.3.0+build.183"
modCompile "net.fabricmc.fabric-api:fabric-api:0.3.0+build.184"
modCompile "io.github.prospector.modmenu:ModMenu:1.5.4-85"
@ -85,7 +85,7 @@ dependencies {
// transitive = false
// }
compile 'RebornCore:RebornCore-1.14:4.0.0.14'
compile 'RebornCore:RebornCore-1.14.2:4.0.0.14'
compileOnly "com.google.code.findbugs:jsr305:+"
}

View file

@ -1,56 +0,0 @@
package techreborn.build;
import org.gradle.api.DefaultTask;
import org.gradle.api.tasks.TaskAction;
import techreborn.build.model.ModelBuilder;
import java.io.File;
public class GenerateResourcesTask extends DefaultTask {
private File outputDir;
@TaskAction
public void run(){
System.out.println("Generating Resources for " + getProject().getName());
new ModelBuilder(outputDir)
.model("techreborn:grinder")
.machine(texture -> {
texture.top_on = "techreborn:block/machines/tier1_machines/grinder_top_on";
texture.front_on = "techreborn:block/machines/tier1_machines/grinder_front_on";
texture.side_on = "techreborn:block/machines/tier1_machines/machine_side";
texture.top_off = "techreborn:block/machines/tier1_machines/grinder_top_off";
texture.front_off = "techreborn:block/machines/tier1_machines/grinder_front_off";
texture.side_off = "techreborn:block/machines/tier1_machines/machine_side";
})
.build()
.model("techreborn:alloy_smelter")
.machine(texture -> {
texture.top_on = "techreborn:blocks/machines/tier1_machines/machine_top";
texture.front_on = "techreborn:blocks/machines/tier1_machines/electric_alloy_smelter_front_on";
texture.side_on = "techreborn:blocks/machines/tier1_machines/machine_side";
texture.bottom_on = "techreborn:blocks/machines/tier1_machines/machine_bottom";
texture.front_off = "techreborn:blocks/machines/tier1_machines/electric_alloy_smelter_front_off";
//TODO possibly not have to do this
texture.top_off = texture.top_on;
texture.side_off = texture.side_on;
texture.bottom_off = texture.bottom_on;
})
.build()
//Generates the json files
.generate();
}
public File getOutputDir() {
return outputDir;
}
public void setOutputDir(File outputDir) {
this.outputDir = outputDir;
}
}

View file

@ -1,48 +0,0 @@
package techreborn.build.model;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
public class MachineModelBuilder {
private ModelBuilder.Model model;
Consumer<MachineTextures> textureConsumer;
MachineModelBuilder(ModelBuilder.Model model, Consumer<MachineTextures> textureConsumer) {
this.model = model;
this.textureConsumer = textureConsumer;
}
public List<ModelBuilder.Component> getComponents(){
//Loads the textures in
MachineTextures textures = new MachineTextures(this);
textureConsumer.accept(textures);
return Collections.emptyList();
}
public static class MachineTextures {
MachineModelBuilder modelBuilder;
public String top_off;
public String top_on;
public String front_off;
public String front_on;
public String side_off;
public String side_on;
public String bottom_off;
public String bottom_on;
public MachineTextures(MachineModelBuilder modelBuilder) {
this.modelBuilder = modelBuilder;
}
}
}

View file

@ -1,52 +0,0 @@
package techreborn.build.model;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
public class ModelBuilder {
File outputDir;
private List<Model> models = new ArrayList<>();
public ModelBuilder(File outputDir) {
this.outputDir = outputDir;
}
public ModelBuilder generate(){
//TODO write out all the files
return this;
}
public Model model(String name){
Model model = new Model(name, this);
models.add(model);
return model;
}
public static class Model {
String name;
ModelBuilder modelBuilder;
List<Component> components = new ArrayList<>();
private Model(String name, ModelBuilder modelBuilder) {
this.name = name;
this.modelBuilder = modelBuilder;
}
public Model machine(Consumer<MachineModelBuilder.MachineTextures> textureConsumer){
components.addAll(new MachineModelBuilder(this, textureConsumer).getComponents());
return this;
}
public ModelBuilder build(){
return modelBuilder;
}
}
public static abstract class Component {
}
}

View file

@ -26,6 +26,7 @@ package techreborn;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.block.DispenserBlock;
import net.minecraft.item.ItemGroup;
import net.minecraft.util.Identifier;
@ -119,6 +120,7 @@ public class TechReborn implements ModInitializer {
LOGGER.info("TechReborn setup done!");
}
}

View file

@ -64,10 +64,10 @@ public class FluidReplicatorRecipeCrafter extends RecipeCrafter {
return false;
}
ItemStack inputStack = inventory.getInvStack(inputSlots[0]);
if (!inputStack.isEqualIgnoreTags(TRContent.Parts.UU_MATTER.getStack())) {
if (!inputStack.isItemEqualIgnoreDamage(TRContent.Parts.UU_MATTER.getStack())) {
return false;
}
if (inputStack.getAmount() < recipe.getInput()) {
if (inputStack.getCount() < recipe.getInput()) {
return false;
}

View file

@ -113,14 +113,14 @@ public class BlockAlarm extends BaseTileBlock {
// Block
@Override
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
ACTIVE = BooleanProperty.create("active");
ACTIVE = BooleanProperty.of("active");
builder.add(FACING, ACTIVE);
}
@Nullable
@Override
public BlockState getPlacementState(ItemPlacementContext context) {
for (Direction enumfacing : context.getPlacementFacings()) {
for (Direction enumfacing : context.getPlacementDirections()) {
BlockState iblockstate = this.getDefaultState().with(FACING, enumfacing.getOpposite());
if (iblockstate.canPlaceAt(context.getWorld(), context.getBlockPos())) {
return iblockstate;

View file

@ -49,7 +49,7 @@ import techreborn.entities.EntityNukePrimed;
* Created by Mark on 13/03/2016.
*/
public class BlockNuke extends BaseBlock {
public static BooleanProperty OVERLAY = BooleanProperty.create("overlay");
public static BooleanProperty OVERLAY = BooleanProperty.of("overlay");
public BlockNuke() {
super(Block.Settings.of(Material.TNT));

View file

@ -63,8 +63,8 @@ import java.util.function.Consumer;
*/
public class BlockRubberLog extends LogBlock {
public static DirectionProperty SAP_SIDE = Properties.FACING_HORIZONTAL;
public static BooleanProperty HAS_SAP = BooleanProperty.create("hassap");
public static DirectionProperty SAP_SIDE = Properties.HORIZONTAL_FACING;
public static BooleanProperty HAS_SAP = BooleanProperty.of("hassap");
public BlockRubberLog() {
super(MaterialColor.SPRUCE, FabricBlockSettings.of(Material.WOOD, MaterialColor.BROWN).strength(2.0F, 2f).sounds(BlockSoundGroup.WOOD).ticksRandomly().build());
@ -142,7 +142,7 @@ public class BlockRubberLog extends LogBlock {
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, playerIn);
} else {
playerIn.getStackInHand(Hand.MAIN_HAND).applyDamage(1, playerIn, playerEntity -> {});
playerIn.getStackInHand(Hand.MAIN_HAND).damage(1, playerIn, playerEntity -> {});
}
if (!playerIn.inventory.insertStack(TRContent.Parts.SAP.getStack())) {
WorldUtils.dropItem(TRContent.Parts.SAP.getStack(), worldIn, pos.offset(hitResult.getSide()));

View file

@ -55,12 +55,12 @@ import javax.annotation.Nullable;
@RebornRegister(TechReborn.MOD_ID)
public class BlockCable extends BlockWithEntity {
public static final BooleanProperty EAST = BooleanProperty.create("east");
public static final BooleanProperty WEST = BooleanProperty.create("west");
public static final BooleanProperty NORTH = BooleanProperty.create("north");
public static final BooleanProperty SOUTH = BooleanProperty.create("south");
public static final BooleanProperty UP = BooleanProperty.create("up");
public static final BooleanProperty DOWN = BooleanProperty.create("down");
public static final BooleanProperty EAST = BooleanProperty.of("east");
public static final BooleanProperty WEST = BooleanProperty.of("west");
public static final BooleanProperty NORTH = BooleanProperty.of("north");
public static final BooleanProperty SOUTH = BooleanProperty.of("south");
public static final BooleanProperty UP = BooleanProperty.of("up");
public static final BooleanProperty DOWN = BooleanProperty.of("down");
@ConfigRegistry(config = "misc", category = "cable", key = "uninsulatedElectrocutionDamage", comment = "When true an uninsulated cable will cause damage to entities")
public static boolean uninsulatedElectrocutionDamage = true;

View file

@ -67,7 +67,7 @@ public class BlockFusionControlComputer extends BlockMachineBase {
if(worldIn.isAir(coil) && !tileFusionControlComputer.isCoil(coil)){
worldIn.setBlockState(coil, TRContent.Machine.FUSION_COIL.block.getDefaultState());
if(!playerIn.isCreative()){
playerIn.getStackInHand(hand).subtractAmount(1);
playerIn.getStackInHand(hand).decrement(1);
}
placed = true;
}

View file

@ -117,14 +117,14 @@ public class BlockLamp extends BaseTileBlock {
// Block
@Override
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
ACTIVE = BooleanProperty.create("active");
ACTIVE = BooleanProperty.of("active");
builder.add(FACING, ACTIVE);
}
@Nullable
@Override
public BlockState getPlacementState(ItemPlacementContext context) {
for (Direction enumfacing : context.getPlacementFacings()) {
for (Direction enumfacing : context.getPlacementDirections()) {
BlockState iblockstate = this.getDefaultState().with(FACING, enumfacing.getOpposite());
if (iblockstate.canPlaceAt(context.getWorld(), context.getBlockPos())) {
return iblockstate;

View file

@ -48,7 +48,7 @@ public class BlockDistillationTower extends BlockMachineBase {
@Override
public IMachineGuiHandler getGui() {
return EGui.EnvTypeILLATION_TOWER;
return EGui.DISTILLATION_TOWER;
}
@Override

View file

@ -50,7 +50,7 @@ public enum EGui implements IMachineGuiHandler {
DESTRUCTOPACK(false),
DIESEL_GENERATOR(true),
DIGITAL_CHEST(true),
EnvTypeILLATION_TOWER(true),
DISTILLATION_TOWER(true),
ELECTRIC_FURNACE(true),
EXTRACTOR(true),
FUSION_CONTROLLER(true),

View file

@ -164,7 +164,7 @@ public class GuiHandler {
return new GuiAutoCrafting(player, (TileAutoCraftingTable) tile);
case PLASMA_GENERATOR:
return new GuiPlasmaGenerator(player, (TilePlasmaGenerator) tile);
case EnvTypeILLATION_TOWER:
case DISTILLATION_TOWER:
return new GuiDistillationTower(player, (TileDistillationTower) tile);
case FLUID_REPLICATOR:
return new GuiFluidReplicator(player, (TileFluidReplicator) tile);

View file

@ -53,11 +53,11 @@ public class GuiDigitalChest extends GuiBase {
if (!tile.storedItem.isEmpty() && tile.inventory.getInvStack(1) != null) {
builder.drawBigBlueBar(this, 31, 43,
tile.storedItem.getAmount() + tile.inventory.getInvStack(1).getAmount(),
tile.storedItem.getCount() + tile.inventory.getInvStack(1).getCount(),
tile.maxCapacity, mouseX - left, mouseY - top, "Stored", layer);
}
if (tile.storedItem.isEmpty() && tile.inventory.getInvStack(1) != null) {
builder.drawBigBlueBar(this, 31, 43, tile.inventory.getInvStack(1).getAmount(),
builder.drawBigBlueBar(this, 31, 43, tile.inventory.getInvStack(1).getCount(),
tile.maxCapacity, mouseX - left, mouseY - top, "Stored", layer);
}
}

View file

@ -52,10 +52,10 @@ public class GuiQuantumChest extends GuiBase {
final Layer layer = Layer.FOREGROUND;
if (!this.quantumChest.storedItem.isEmpty() && !this.quantumChest.inventory.getInvStack(1).isEmpty()) {
this.builder.drawBigBlueBar(this, 31, 43, this.quantumChest.storedItem.getAmount() + this.quantumChest.inventory.getInvStack(1).getAmount(), this.quantumChest.maxCapacity, mouseX - this.left, mouseY - this.top, "Stored", layer);
this.builder.drawBigBlueBar(this, 31, 43, this.quantumChest.storedItem.getCount() + this.quantumChest.inventory.getInvStack(1).getCount(), this.quantumChest.maxCapacity, mouseX - this.left, mouseY - this.top, "Stored", layer);
}
if (this.quantumChest.storedItem.isEmpty() && !this.quantumChest.inventory.getInvStack(1).isEmpty()) {
this.builder.drawBigBlueBar(this, 31, 43, this.quantumChest.inventory.getInvStack(1).getAmount(), this.quantumChest.maxCapacity, mouseX - this.left, mouseY - this.top, "Stored", layer);
this.builder.drawBigBlueBar(this, 31, 43, this.quantumChest.inventory.getInvStack(1).getCount(), this.quantumChest.maxCapacity, mouseX - this.left, mouseY - this.top, "Stored", layer);
}
}
}

View file

@ -27,7 +27,7 @@ package techreborn.entities;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MovementType;
import net.minecraft.entity.PrimedTntEntity;
import net.minecraft.entity.TntEntity;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@ -41,7 +41,7 @@ import techreborn.TechReborn;
* Created by Mark on 13/03/2016.
*/
@RebornRegister(TechReborn.MOD_ID)
public class EntityNukePrimed extends PrimedTntEntity {
public class EntityNukePrimed extends TntEntity {
@ConfigRegistry(config = "misc", category = "nuke", key = "fusetime", comment = "Nuke fuse time (ticks)")
public static int fuseTime = 400;

View file

@ -80,29 +80,29 @@ public class ModRegistry {
}
public static void registerBlocks() {
Arrays.stream(Ores.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().itemGroup(TechReborn.ITEMGROUP)));
Arrays.stream(StorageBlocks.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().itemGroup(TechReborn.ITEMGROUP)));
Arrays.stream(Ores.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().group(TechReborn.ITEMGROUP)));
Arrays.stream(StorageBlocks.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().group(TechReborn.ITEMGROUP)));
Arrays.stream(MachineBlocks.values()).forEach(value -> {
RebornRegistry.registerBlock(value.frame, new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(value.casing, new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(value.frame, new Item.Settings().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(value.casing, new Item.Settings().group(TechReborn.ITEMGROUP));
});
Arrays.stream(TRContent.SolarPanels.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().itemGroup(TechReborn.ITEMGROUP)));
Arrays.stream(Cables.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().itemGroup(TechReborn.ITEMGROUP)));
Arrays.stream(Machine.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().itemGroup(TechReborn.ITEMGROUP)));
Arrays.stream(TRContent.SolarPanels.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().group(TechReborn.ITEMGROUP)));
Arrays.stream(Cables.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().group(TechReborn.ITEMGROUP)));
Arrays.stream(Machine.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().group(TechReborn.ITEMGROUP)));
// Misc. blocks
RebornRegistry.registerBlock(TRContent.COMPUTER_CUBE = InitUtils.setup(new BlockComputerCube(), "computer_cube"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.NUKE = InitUtils.setup(new BlockNuke(), "nuke"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.REFINED_IRON_FENCE = InitUtils.setup(new BlockRefinedIronFence(), "refined_iron_fence"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.REINFORCED_GLASS = InitUtils.setup(new BlockReinforcedGlass(), "reinforced_glass"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.RUBBER_LEAVES = InitUtils.setup(new BlockRubberLeaves(), "rubber_leaves"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.RUBBER_LOG = InitUtils.setup(new BlockRubberLog(), "rubber_log"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.RUBBER_PLANKS = InitUtils.setup(new BlockRubberPlank(), "rubber_planks"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.COMPUTER_CUBE = InitUtils.setup(new BlockComputerCube(), "computer_cube"), new Item.Settings().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.NUKE = InitUtils.setup(new BlockNuke(), "nuke"), new Item.Settings().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.REFINED_IRON_FENCE = InitUtils.setup(new BlockRefinedIronFence(), "refined_iron_fence"), new Item.Settings().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.REINFORCED_GLASS = InitUtils.setup(new BlockReinforcedGlass(), "reinforced_glass"), new Item.Settings().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.RUBBER_LEAVES = InitUtils.setup(new BlockRubberLeaves(), "rubber_leaves"), new Item.Settings().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.RUBBER_LOG = InitUtils.setup(new BlockRubberLog(), "rubber_log"), new Item.Settings().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.RUBBER_PLANKS = InitUtils.setup(new BlockRubberPlank(), "rubber_planks"), new Item.Settings().group(TechReborn.ITEMGROUP));
// RebornRegistry.registerBlock(TRContent.RUBBER_SAPLING = InitUtils.setup(new BlockRubberSapling(), "rubber_sapling"),
// ItemBlockRubberSapling.class,
// "rubber_sapling");
RebornRegistry.registerBlock(TRContent.RUBBER_PLANK_SLAB = InitUtils.setup(new BlockRubberPlankSlab(), "rubber_plank_slab"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.RUBBER_PLANK_STAIR = InitUtils.setup(new BlockRubberPlankStair(), "rubber_plank_stair"), new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.RUBBER_PLANK_SLAB = InitUtils.setup(new BlockRubberPlankSlab(), "rubber_plank_slab"), new Item.Settings().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.RUBBER_PLANK_STAIR = InitUtils.setup(new BlockRubberPlankStair(), "rubber_plank_stair"), new Item.Settings().group(TechReborn.ITEMGROUP));
TechReborn.LOGGER.debug("TechReborns Blocks Loaded");
}

View file

@ -95,7 +95,7 @@ public class StackToolTipHandler implements ItemTooltipCallback {
}
}
} catch (NullPointerException e) {
TechReborn.LOGGER.debug("Failed to load info for " + stack.getDisplayName());
TechReborn.LOGGER.debug("Failed to load info for " + stack.getCustomName());
}
}
}

View file

@ -80,7 +80,7 @@ public class ModRecipes {
ScrapboxRecipes.init();
ChemicalReactorRecipes.init();
FusionReactorRecipes.init();
EnvTypeillationTowerRecipes.init();
DistillationTowerRecipes.init();
AlloySmelterRecipes.init();
FluidReplicatorRecipes.init();

View file

@ -334,7 +334,7 @@ public class TRContent {
AUTO_CRAFTING_TABLE(new BlockAutoCraftingTable()),
CHEMICAL_REACTOR(new BlockChemicalReactor()),
COMPRESSOR(new BlockCompressor()),
EnvTypeILLATION_TOWER(new BlockDistillationTower()),
DISTILLATION_TOWER(new BlockDistillationTower()),
EXTRACTOR(new BlockExtractor()),
FLUID_REPLICATOR(new BlockFluidReplicator()),
GRINDER(new BlockGrinder()),
@ -424,7 +424,7 @@ public class TRContent {
private Dusts() {
name = this.toString().toLowerCase();
item = new Item(new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
InitUtils.setup(item, name + "_dust");
}
@ -455,7 +455,7 @@ public class TRContent {
private SmallDusts() {
name = this.toString().toLowerCase();
item = new Item(new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
InitUtils.setup(item, name + "_small_dust");
}
@ -481,7 +481,7 @@ public class TRContent {
private Gems() {
name = this.toString().toLowerCase();
item = new Item(new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
InitUtils.setup(item, name + "_gem");
}
@ -508,7 +508,7 @@ public class TRContent {
private Ingots() {
name = this.toString().toLowerCase();
item = new Item(new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
InitUtils.setup(item, name + "_ingot");
}
@ -535,7 +535,7 @@ public class TRContent {
private Nuggets() {
name = this.toString().toLowerCase();
item = new Item(new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
InitUtils.setup(item, name + "_nugget");
}
@ -602,7 +602,7 @@ public class TRContent {
private Parts() {
name = this.toString().toLowerCase();
item = new Item(new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
InitUtils.setup(item, name);
}
@ -631,7 +631,7 @@ public class TRContent {
private Plates() {
name = this.toString().toLowerCase();
item = new Item(new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
item = new Item(new Item.Settings().group(TechReborn.ITEMGROUP));
InitUtils.setup(item, name + "_plate");
}

View file

@ -92,7 +92,7 @@ public class TRTileEntities {
public static final BlockEntityType<TileAdjustableSU> ADJUSTABLE_SU = register(TileAdjustableSU.class, "adjustable_su");
public static final BlockEntityType<TileLapotronicSU> LAPOTRONIC_SU = register(TileLapotronicSU.class, "lapotronic_su");
public static final BlockEntityType<TileLSUStorage> LSU_STORAGE = register(TileLSUStorage.class, "lsu_storage");
public static final BlockEntityType<TileDistillationTower> EnvTypeILLATION_TOWER = register(TileDistillationTower.class, "distillation_tower");
public static final BlockEntityType<TileDistillationTower> DISTILLATION_TOWER = register(TileDistillationTower.class, "distillation_tower");
public static final BlockEntityType<TileVacuumFreezer> VACUUM_FREEZER = register(TileVacuumFreezer.class, "vacuum_freezer");
public static final BlockEntityType<TileFusionControlComputer> FUSION_CONTROL_COMPUTER = register(TileFusionControlComputer.class, "fusion_control_computer");
public static final BlockEntityType<TileLightningRod> LIGHTNING_ROD = register(TileLightningRod.class, "lightning_rod");

View file

@ -79,7 +79,7 @@ public enum TRToolTier implements ToolMaterial {
}
@Override
public float getBlockBreakingSpeed() {
public float getMiningSpeed() {
return efficiency;
}

View file

@ -61,18 +61,18 @@ public class DistillationTowerRecipes extends RecipeMethods {
output3 = outputs[2];
output4 = outputs[3];
} else {
throw new InvalidParameterException("Invalid number of EnvTypeillation tower outputs: " + outputs);
throw new InvalidParameterException("Invalid number of Distillation tower outputs: " + outputs);
}
int cellCount = 0;
for (ItemStack stack : outputs) {
if (stack.getItem() instanceof DynamicCell) {
cellCount += stack.getAmount();
cellCount += stack.getCount();
}
}
if (input.getItem() instanceof DynamicCell) {
int inputCount = input.getAmount();
int inputCount = input.getCount();
if (cellCount < inputCount) {
if (output2 == null) {
output2 = DynamicCell.getEmptyCell(inputCount - cellCount);
@ -90,11 +90,11 @@ public class DistillationTowerRecipes extends RecipeMethods {
ItemStack cells = null;
if (cellCount > 0) {
if (cellCount > 64) {
throw new InvalidParameterException("Invalid EnvTypeillation tower outputs: " + outputs + "(Recipe requires > 64 cells)");
throw new InvalidParameterException("Invalid Distillation tower outputs: " + outputs + "(Recipe requires > 64 cells)");
}
cells = DynamicCell.getEmptyCell(cellCount);
}
// RecipeHandler.addRecipe(Reference.EnvTypeILLATION_TOWER_RECIPE, new EnvTypeillationTowerRecipe(input, cells, output1, output2, output3, output4, ticks, euPerTick, oreDict));
// RecipeHandler.addRecipe(Reference.DistiLLATION_TOWER_RECIPE, new DistillationTowerRecipe(input, cells, output1, output2, output3, output4, ticks, euPerTick, oreDict));
}
static void register(ItemStack input, int ticks, int euPerTick, ItemStack... outputs) {

View file

@ -139,14 +139,14 @@ public class IndustrialCentrifugeRecipes extends RecipeMethods {
int cellCount = 0;
for (ItemStack stack : outputs) {
if (stack.getItem() instanceof DynamicCell) {
cellCount += stack.getAmount();
cellCount += stack.getCount();
}
}
if (input instanceof ItemStack) {
if (((ItemStack) input).getItem() instanceof DynamicCell) {
int inputCount = ((ItemStack) input).getAmount();
int inputCount = ((ItemStack) input).getCount();
if (cellCount < inputCount) {
if (output2 == null) {
output2 = DynamicCell.getEmptyCell(inputCount - cellCount);

View file

@ -35,6 +35,6 @@ import techreborn.TechReborn;
public class ItemBlockRubberSapling extends BlockItem {
public ItemBlockRubberSapling(Block block) {
super(block, new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
super(block, new Item.Settings().group(TechReborn.ITEMGROUP));
}
}

View file

@ -47,11 +47,11 @@ public class DynamicCell extends Item {
public static final int CAPACITY = 1000;
public DynamicCell() {
super(new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
super(new Item.Settings().group(TechReborn.ITEMGROUP));
}
@Override
public void onEntityTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
//Clearing tag because ItemUtils.isItemEqual doesn't handle tags ForgeCaps and display
//And breaks ability to use in recipes
//TODO: Property ItemUtils.isItemEquals tags equality handling?
@ -68,15 +68,15 @@ public class DynamicCell extends Item {
public boolean tryAddCellToInventory(PlayerEntity player, ItemStack stack, Fluid fluid) {
if (player.inventory.insertStack(DynamicCell.getCellWithFluid(fluid))) {
stack.subtractAmount(1);
stack.decrement(1);
return true;
}
return false;
}
@Override
public void appendItemsForGroup(ItemGroup tab, DefaultedList<ItemStack> subItems) {
if (!isInItemGroup(tab)) {
public void appendStacks(ItemGroup tab, DefaultedList<ItemStack> subItems) {
if (!isIn(tab)) {
return;
}
subItems.add(getEmptyCell(1));
@ -103,7 +103,7 @@ public class DynamicCell extends Item {
Validate.notNull(fluid);
ItemStack stack = new ItemStack(TRContent.CELL);
//getFluidHandler(stack).fill(new FluidStack(fluid, CAPACITY), true);
stack.setAmount(stackSize);
stack.setCount(stackSize);
return stack;
}

View file

@ -38,7 +38,7 @@ import techreborn.client.EGui;
public class ItemDestructopack extends Item {
public ItemDestructopack() {
super(new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
super(new Item.Settings().group(TechReborn.ITEMGROUP));
}
@Override

View file

@ -58,8 +58,8 @@ import java.util.List;
public class ItemFrequencyTransmitter extends Item {
public ItemFrequencyTransmitter() {
super(new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
this.addProperty(new Identifier("techreborn", "coords"), new ItemPropertyGetter() {
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
this.addPropertyGetter(new Identifier("techreborn", "coords"), new ItemPropertyGetter() {
@Override
@Environment(EnvType.CLIENT)
public float call(ItemStack stack, @Nullable World worldIn, @Nullable LivingEntity entityIn) {
@ -76,7 +76,7 @@ public class ItemFrequencyTransmitter extends Item {
public ActionResult useOnBlock(ItemUsageContext context) {
World world = context.getWorld();
BlockPos pos = context.getBlockPos();
ItemStack stack = context.getItemStack();
ItemStack stack = context.getStack();
stack.setTag(new CompoundTag());
stack.getTag().putInt("x", pos.getX());
@ -117,7 +117,7 @@ public class ItemFrequencyTransmitter extends Item {
@Environment(EnvType.CLIENT)
@Override
public void buildTooltip(ItemStack stack, @Nullable World worldIn, List<Component> tooltip, TooltipContext flagIn) {
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Component> tooltip, TooltipContext flagIn) {
if (stack.hasTag() && stack.getTag() != null && stack.getTag().containsKey("x") && stack.getTag().containsKey("y") && stack.getTag().containsKey("z") && stack.getTag().containsKey("dim")) {
int x = stack.getTag().getInt("x");
int y = stack.getTag().getInt("y");

View file

@ -39,7 +39,7 @@ public class ItemManual extends Item {
public static boolean allowRefund = true;
public ItemManual() {
super(new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
}
@Override

View file

@ -41,7 +41,7 @@ import java.util.List;
public class ItemScrapBox extends Item {
public ItemScrapBox() {
super(new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
super(new Item.Settings().group(TechReborn.ITEMGROUP));
}
@Override
@ -52,7 +52,7 @@ public class ItemScrapBox extends Item {
int random = world.random.nextInt(scrapboxRecipeList.size());
ItemStack out = scrapboxRecipeList.get(random).getOutputs().get(0);
WorldUtils.dropItem(out, world, player.getBlockPos());
stack.subtractAmount(1);
stack.decrement(1);
}
return new TypedActionResult<>(ActionResult.SUCCESS, stack);
}

View file

@ -40,7 +40,7 @@ public class ItemUpgrade extends Item implements IUpgrade {
public final IUpgrade behavior;
public ItemUpgrade(String name, IUpgrade process) {
super(new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(16));
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(16));
this.name = name;
this.behavior = process;
}

View file

@ -58,7 +58,7 @@ public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo
}
@Override
public void onEntityTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (entityIn instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) entityIn;
ItemPowerManager capEnergy = new ItemPowerManager(stack);
@ -79,8 +79,8 @@ public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isInItemGroup(group)) {
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isIn(group)) {
return;
}
ItemStack uncharged = new ItemStack(TRContent.CLOAKING_DEVICE);

View file

@ -48,13 +48,13 @@ public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo,
public int transferLimit = 100_000;
public ItemLapotronicOrbpack() {
super(ArmorMaterials.DIAMOND, EquipmentSlot.CHEST, new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
super(ArmorMaterials.DIAMOND, EquipmentSlot.CHEST, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
}
// Item
@Override
public void appendItemsForGroup(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isInItemGroup(group)) {
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isIn(group)) {
return;
}
ItemStack uncharged = new ItemStack(TRContent.LAPOTRONIC_ORBPACK);
@ -66,7 +66,7 @@ public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo,
}
@Override
public void onEntityTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (entityIn instanceof PlayerEntity) {
ItemLithiumIonBatpack.EnvTypeributePowerToInventory(worldIn, (PlayerEntity) entityIn, stack,
(int) transferLimit);

View file

@ -49,7 +49,7 @@ public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo,
public int transferLimit = 2_000;
public ItemLithiumIonBatpack() {
super(ArmorMaterials.DIAMOND, EquipmentSlot.CHEST, new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
super(ArmorMaterials.DIAMOND, EquipmentSlot.CHEST, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
}
public static void EnvTypeributePowerToInventory(World world, PlayerEntity player, ItemStack itemStack, int maxSend) {
@ -69,7 +69,7 @@ public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo,
// Item
@Override
public void onEntityTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (entityIn instanceof PlayerEntity) {
EnvTypeributePowerToInventory(worldIn, (PlayerEntity) entityIn, stack, (int) transferLimit);
}
@ -92,8 +92,8 @@ public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo,
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isInItemGroup(group)) {
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isIn(group)) {
return;
}
ItemStack uncharged = new ItemStack(TRContent.LITHIUM_ION_BATPACK);

View file

@ -46,7 +46,7 @@ public class ItemTRArmour extends ArmorItem implements ItemDurabilityExtensions
}
public ItemTRArmour(ArmorMaterial material, EquipmentSlot slot, String repairOreDict) {
super(material, slot, (new Item.Settings()).itemGroup(TechReborn.ITEMGROUP).stackSize(1));
super(material, slot, (new Item.Settings()).group(TechReborn.ITEMGROUP).maxCount(1));
this.repairOreDict = repairOreDict;
if (slot == EquipmentSlot.HEAD)
//setTranslationKey(material.name().toLowerCase() + "Helmet");

View file

@ -47,10 +47,10 @@ public class ItemBattery extends Item implements IEnergyItemInfo, ItemDurability
int maxTransfer = 0;
public ItemBattery(int maxEnergy, int maxTransfer) {
super(new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1).durabilityIfNotSet(1));
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamageIfAbsent(1));
this.maxEnergy = maxEnergy;
this.maxTransfer = maxTransfer;
this.addProperty(new Identifier("techreborn:empty"), new ItemPropertyGetter() {
this.addPropertyGetter(new Identifier("techreborn:empty"), new ItemPropertyGetter() {
@Override
@Environment(EnvType.CLIENT)
public float call(ItemStack stack, @Nullable World worldIn, @Nullable LivingEntity entityIn) {

View file

@ -42,8 +42,8 @@ public class ItemEnergyCrystal extends ItemBattery {
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isInItemGroup(group)) {
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isIn(group)) {
return;
}
ItemStack uncharged = new ItemStack(TRContent.ENERGY_CRYSTAL);

View file

@ -42,8 +42,8 @@ public class ItemLapotronCrystal extends ItemBattery {
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isInItemGroup(group)) {
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isIn(group)) {
return;
}
ItemStack uncharged = new ItemStack(TRContent.LAPOTRON_CRYSTAL);

View file

@ -42,8 +42,8 @@ public class ItemLapotronicOrb extends ItemBattery {
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isInItemGroup(group)) {
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isIn(group)) {
return;
}
ItemStack uncharged = new ItemStack(TRContent.LAPOTRONIC_ORB);

View file

@ -41,8 +41,8 @@ public class ItemLithiumIonBattery extends ItemBattery {
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isInItemGroup(group)) {
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isIn(group)) {
return;
}
ItemStack uncharged = new ItemStack(TRContent.LITHIUM_ION_BATTERY);

View file

@ -41,8 +41,8 @@ public class ItemRedCellBattery extends ItemBattery {
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isInItemGroup(group)) {
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isIn(group)) {
return;
}
ItemStack uncharged = new ItemStack(TRContent.RED_CELL_BATTERY);

View file

@ -56,10 +56,10 @@ public class ItemChainsaw extends AxeItem implements IEnergyItemInfo, ItemDurabi
public boolean isBreaking = false;
public ItemChainsaw(ToolMaterials material, int energyCapacity, float unpoweredSpeed) {
super(material, (int) material.getAttackDamage(), unpoweredSpeed, new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
super(material, (int) material.getAttackDamage(), unpoweredSpeed, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
this.maxCharge = energyCapacity;
this.addProperty(new Identifier("techreborn", "animated"), new ItemPropertyGetter() {
this.addPropertyGetter(new Identifier("techreborn", "animated"), new ItemPropertyGetter() {
@Override
@Environment(EnvType.CLIENT)
public float call(ItemStack stack, @Nullable World worldIn, @Nullable LivingEntity entityIn) {
@ -74,18 +74,18 @@ public class ItemChainsaw extends AxeItem implements IEnergyItemInfo, ItemDurabi
// ItemAxe
@Override
public float getBlockBreakingSpeed(ItemStack stack, BlockState state) {
public float getMiningSpeed(ItemStack stack, BlockState state) {
if (new ItemPowerManager(stack).getEnergyStored() >= cost
&& (state.getMaterial() == Material.WOOD)) {
return this.poweredSpeed;
} else {
return super.getBlockBreakingSpeed(stack, state);
return super.getMiningSpeed(stack, state);
}
}
// ItemTool
@Override
public boolean onBlockBroken(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
Random rand = new Random();
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
ItemPowerManager capEnergy = new ItemPowerManager(stack);
@ -97,7 +97,7 @@ public class ItemChainsaw extends AxeItem implements IEnergyItemInfo, ItemDurabi
}
@Override
public boolean onEntityDamaged(ItemStack itemstack, LivingEntity entityliving, LivingEntity entityliving1) {
public boolean postHit(ItemStack itemstack, LivingEntity entityliving, LivingEntity entityliving1) {
return true;
}

View file

@ -47,7 +47,7 @@ import java.util.Map.Entry;
public class ItemDebugTool extends Item {
public ItemDebugTool() {
super(new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
super(new Item.Settings().group(TechReborn.ITEMGROUP));
}
@Override

View file

@ -49,28 +49,28 @@ public class ItemDrill extends PickaxeItem implements IEnergyItemInfo, ItemDurab
public int transferLimit = 100;
public ItemDrill(ToolMaterial material, int energyCapacity, float unpoweredSpeed, float efficiencyOnProperMaterial) {
super(material, (int) material.getAttackDamage(), unpoweredSpeed, new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
super(material, (int) material.getAttackDamage(), unpoweredSpeed, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
this.maxCharge = energyCapacity;
this.unpoweredSpeed = unpoweredSpeed;
}
// ItemPickaxe
@Override
public float getBlockBreakingSpeed(ItemStack stack, BlockState state) {
public float getMiningSpeed(ItemStack stack, BlockState state) {
if (new ItemPowerManager(stack).getEnergyStored() < cost) {
return unpoweredSpeed;
}
if (Items.WOODEN_PICKAXE.getBlockBreakingSpeed(stack, state) > 1.0F
|| Items.WOODEN_SHOVEL.getBlockBreakingSpeed(stack, state) > 1.0F) {
return blockBreakingSpeed;
if (Items.WOODEN_PICKAXE.getMiningSpeed(stack, state) > 1.0F
|| Items.WOODEN_SHOVEL.getMiningSpeed(stack, state) > 1.0F) {
return miningSpeed;
} else {
return super.getBlockBreakingSpeed(stack, state);
return super.getMiningSpeed(stack, state);
}
}
// ItemTool
@Override
public boolean onBlockBroken(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
Random rand = new Random();
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
ItemPowerManager capEnergy = new ItemPowerManager(stack);
@ -82,7 +82,7 @@ public class ItemDrill extends PickaxeItem implements IEnergyItemInfo, ItemDurab
}
@Override
public boolean onEntityDamaged(ItemStack itemstack, LivingEntity entityliving, LivingEntity entityliving1) {
public boolean postHit(ItemStack itemstack, LivingEntity entityliving, LivingEntity entityliving1) {
return true;
}

View file

@ -54,16 +54,16 @@ public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo, Item
public int transferLimit = 100;
public ItemJackhammer(ToolMaterials material, int energyCapacity) {
super(material, (int) material.getAttackDamage(), 1f, new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
super(material, (int) material.getAttackDamage(), 1f, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
this.maxCharge = energyCapacity;
}
// ItemPickaxe
@Override
public float getBlockBreakingSpeed(ItemStack stack, BlockState state) {
public float getMiningSpeed(ItemStack stack, BlockState state) {
if ((TagUtils.isOre(state, "stone") || state.getBlock() == Blocks.STONE)
&& new ItemPowerManager(stack).getEnergyStored() >= cost) {
return blockBreakingSpeed;
return miningSpeed;
} else {
return 0.5F;
}
@ -71,7 +71,7 @@ public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo, Item
// ItemTool
@Override
public boolean onBlockBroken(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
Random rand = new Random();
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
ItemPowerManager capEnergy = new ItemPowerManager(stack);
@ -83,7 +83,7 @@ public class ItemJackhammer extends PickaxeItem implements IEnergyItemInfo, Item
}
@Override
public boolean onEntityDamaged(ItemStack itemstack, LivingEntity entityliving, LivingEntity entityliving1) {
public boolean postHit(ItemStack itemstack, LivingEntity entityliving, LivingEntity entityliving1) {
return true;
}

View file

@ -30,6 +30,6 @@ import techreborn.TechReborn;
public class ItemTreeTap extends Item {
public ItemTreeTap() {
super(new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1).durabilityIfNotSet(20));
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamageIfAbsent(20));
}
}

View file

@ -40,13 +40,13 @@ import techreborn.TechReborn;
public class ItemWrench extends Item implements IToolHandler {
public ItemWrench() {
super(new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
}
@Override
public boolean handleTool(ItemStack stack, BlockPos pos, World world, PlayerEntity player, Direction side, boolean damage) {
if (damage) {
stack.applyDamage(1, player.world.random, (ServerPlayerEntity) player);
stack.damage(1, player.world.random, (ServerPlayerEntity) player);
}
return true;
}

View file

@ -48,8 +48,8 @@ public class ItemAdvancedChainsaw extends ItemChainsaw {
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isInItemGroup(par2ItemGroup)) {
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isIn(par2ItemGroup)) {
return;
}
ItemStack stack = new ItemStack(TRContent.ADVANCED_CHAINSAW);

View file

@ -48,8 +48,8 @@ public class ItemAdvancedDrill extends ItemDrill {
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isInItemGroup(par2ItemGroup)) {
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isIn(par2ItemGroup)) {
return;
}
ItemStack stack = new ItemStack(TRContent.ADVANCED_DRILL);

View file

@ -46,8 +46,8 @@ public class ItemAdvancedJackhammer extends ItemJackhammer {
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isInItemGroup(par2ItemGroup)) {
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isIn(par2ItemGroup)) {
return;
}
ItemStack stack = new ItemStack(TRContent.ADVANCED_JACKHAMMER);

View file

@ -55,7 +55,7 @@ public class ItemRockCutter extends PickaxeItem implements IEnergyItemInfo, Item
// 400k FE with 1k FE\t charge rate
public ItemRockCutter() {
super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
}
// ItemPickaxe
@ -68,17 +68,17 @@ public class ItemRockCutter extends PickaxeItem implements IEnergyItemInfo, Item
}
@Override
public float getBlockBreakingSpeed(ItemStack stack, BlockState state) {
public float getMiningSpeed(ItemStack stack, BlockState state) {
if (new ItemPowerManager(stack).getEnergyStored() < cost) {
return 2F;
} else {
return Items.DIAMOND_PICKAXE.getBlockBreakingSpeed(stack, state);
return Items.DIAMOND_PICKAXE.getMiningSpeed(stack, state);
}
}
// ItemTool
@Override
public boolean onBlockBroken(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
Random rand = new Random();
if (rand.nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
ItemPowerManager capEnergy = new ItemPowerManager(stack);
@ -104,7 +104,7 @@ public class ItemRockCutter extends PickaxeItem implements IEnergyItemInfo, Item
}
@Override
public void onCrafted(ItemStack stack, World worldIn, PlayerEntity playerIn) {
public void onCraft(ItemStack stack, World worldIn, PlayerEntity playerIn) {
if (!stack.hasEnchantments()) {
stack.addEnchantment(Enchantments.SILK_TOUCH, 1);
}
@ -127,8 +127,8 @@ public class ItemRockCutter extends PickaxeItem implements IEnergyItemInfo, Item
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isInItemGroup(par2ItemGroup)) {
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isIn(par2ItemGroup)) {
return;
}
ItemStack uncharged = new ItemStack(this);

View file

@ -46,8 +46,8 @@ public class ItemBasicChainsaw extends ItemChainsaw {
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isInItemGroup(par2ItemGroup)) {
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isIn(par2ItemGroup)) {
return;
}
ItemStack stack = new ItemStack(TRContent.BASIC_CHAINSAW);

View file

@ -46,8 +46,8 @@ public class ItemBasicDrill extends ItemDrill {
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isInItemGroup(par2ItemGroup)) {
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isIn(par2ItemGroup)) {
return;
}
ItemStack stack = new ItemStack(TRContent.BASIC_DRILL);

View file

@ -44,8 +44,8 @@ public class ItemBasicJackhammer extends ItemJackhammer {
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isInItemGroup(par2ItemGroup)) {
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isIn(par2ItemGroup)) {
return;
}
ItemStack stack = new ItemStack(TRContent.BASIC_JACKHAMMER);

View file

@ -51,13 +51,13 @@ public class ItemElectricTreetap extends Item implements IEnergyItemInfo, ItemDu
public int cost = 20;
public ItemElectricTreetap() {
super(new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
}
// Item
@Override
public ActionResult useOnBlock(ItemUsageContext context) {
ItemPowerManager capEnergy = new ItemPowerManager(context.getItemStack());
ItemPowerManager capEnergy = new ItemPowerManager(context.getStack());
if(TechRebornAPI.ic2Helper != null && capEnergy.getEnergyStored() >= cost){
if(TechRebornAPI.ic2Helper.extractSap(context, null) && !context.getWorld().isClient){
capEnergy.extractEnergy(cost, false);
@ -86,8 +86,8 @@ public class ItemElectricTreetap extends Item implements IEnergyItemInfo, ItemDu
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isInItemGroup(par2ItemGroup)) {
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isIn(par2ItemGroup)) {
return;
}
ItemStack uncharged = new ItemStack(TRContent.ELECTRIC_TREE_TAP);

View file

@ -77,8 +77,8 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isInItemGroup(par2ItemGroup)) {
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isIn(par2ItemGroup)) {
return;
}
ItemStack stack = new ItemStack(TRContent.INDUSTRIAL_CHAINSAW);
@ -91,11 +91,11 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
}
@Override
public boolean onBlockBroken(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
List<BlockPos> wood = new ArrayList<>();
findWood(worldIn, pos, wood, new ArrayList<>());
wood.forEach(pos1 -> breakBlock(pos1, stack, worldIn, entityLiving, pos));
return super.onBlockBroken(stack, worldIn, blockIn, pos, entityLiving);
return super.postMine(stack, worldIn, blockIn, pos, entityLiving);
}
private void findWood(World world, BlockPos pos, List<BlockPos> wood, List<BlockPos> leaves){
@ -160,7 +160,7 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
}
@Override
public void onUsingTick(World world, LivingEntity entity, ItemStack stack, int i) {
public void usageTick(World world, LivingEntity entity, ItemStack stack, int i) {
if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) {
if(entity.world.isClient){
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent(
@ -174,7 +174,7 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
@Environment(EnvType.CLIENT)
@Override
public void buildTooltip(ItemStack stack, @Nullable World worldIn, List<Component> tooltip, TooltipContext flagIn) {
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Component> tooltip, TooltipContext flagIn) {
if (!ItemUtils.isActive(stack)) {
tooltip.add(new TextComponent(ChatFormat.YELLOW + "Shear: " + ChatFormat.RED + I18n.translate("techreborn.message.nanosaberInactive")));
} else {

View file

@ -160,7 +160,7 @@ public class ItemIndustrialDrill extends ItemDrill {
// ItemDrill
@Override
public boolean onBlockBroken(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
PlayerEntity playerIn = null;
if ((entityLiving instanceof PlayerEntity)) {
playerIn = (PlayerEntity) entityLiving;
@ -170,7 +170,7 @@ public class ItemIndustrialDrill extends ItemDrill {
breakBlock(additionalPos, worldIn, playerIn, stack);
}
}
return super.onBlockBroken(stack, worldIn, blockIn, pos, entityLiving);
return super.postMine(stack, worldIn, blockIn, pos, entityLiving);
}
@Override
@ -210,7 +210,7 @@ public class ItemIndustrialDrill extends ItemDrill {
}
@Override
public void onUsingTick(World world, LivingEntity entity, ItemStack stack, int i) {
public void usageTick(World world, LivingEntity entity, ItemStack stack, int i) {
if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) {
if(entity.world.isClient){
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent(
@ -224,7 +224,7 @@ public class ItemIndustrialDrill extends ItemDrill {
@Environment(EnvType.CLIENT)
@Override
public void buildTooltip(ItemStack stack, @Nullable World worldIn, List<Component> tooltip, TooltipContext flagIn) {
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Component> tooltip, TooltipContext flagIn) {
if (!ItemUtils.isActive(stack)) {
tooltip.add(new TextComponent(ChatFormat.YELLOW + "Shear: " + ChatFormat.RED + I18n.translate("techreborn.message.nanosaberInactive")));
} else {
@ -241,8 +241,8 @@ public class ItemIndustrialDrill extends ItemDrill {
// Item
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isInItemGroup(par2ItemGroup)) {
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isIn(par2ItemGroup)) {
return;
}
ItemStack stack = new ItemStack(TRContent.INDUSTRIAL_DRILL);

View file

@ -46,9 +46,9 @@ public class ItemIndustrialJackhammer extends ItemJackhammer {
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(
public void appendStacks(
ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isInItemGroup(par2ItemGroup)) {
if (!isIn(par2ItemGroup)) {
return;
}
ItemStack stack = new ItemStack(TRContent.INDUSTRIAL_JACKHAMMER);

View file

@ -66,8 +66,8 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
// 4M FE max charge with 1k charge rate
public ItemNanosaber() {
super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
this.addProperty(new Identifier("techreborn:active"), new ItemPropertyGetter() {
super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
this.addPropertyGetter(new Identifier("techreborn:active"), new ItemPropertyGetter() {
@Override
@Environment(EnvType.CLIENT)
public float call(ItemStack stack,
@ -89,7 +89,7 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
// ItemSword
@Override
public boolean onEntityDamaged(ItemStack stack, LivingEntity entityHit, LivingEntity entityHitter) {
public boolean postHit(ItemStack stack, LivingEntity entityHit, LivingEntity entityHitter) {
ItemPowerManager capEnergy = new ItemPowerManager(stack);
if (capEnergy.getEnergyStored() >= cost) {
capEnergy.extractEnergy(cost, false);
@ -156,7 +156,7 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
}
@Override
public void onEntityTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (ItemUtils.isActive(stack) && new ItemPowerManager(stack).getEnergyStored() < cost) {
if(worldIn.isClient){
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponent(
@ -190,9 +190,9 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(
public void appendStacks(
ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isInItemGroup(par2ItemGroup)) {
if (!isIn(par2ItemGroup)) {
return;
}
ItemStack inactiveUncharged = new ItemStack(this);
@ -218,7 +218,7 @@ public class ItemNanosaber extends SwordItem implements IEnergyItemInfo, ItemDur
@Environment(EnvType.CLIENT)
@Override
public void buildTooltip(ItemStack stack, @Nullable World worldIn, List<Component> tooltip, TooltipContext flagIn) {
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Component> tooltip, TooltipContext flagIn) {
if (!ItemUtils.isActive(stack)) {
tooltip.add(new TranslatableComponent("techreborn.message.nanosaberInactive").applyFormat(ChatFormat.GRAY));
} else {

View file

@ -62,7 +62,7 @@ public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo, ItemDu
// 4M FE max charge with 1k charge rate
public ItemOmniTool() {
super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
}
// ItemPickaxe
@ -75,7 +75,7 @@ public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo, ItemDu
// ItemTool
@Override
public boolean onBlockBroken(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
ItemPowerManager capEnergy = new ItemPowerManager(stack);
capEnergy.extractEnergy(cost, false);
@ -106,7 +106,7 @@ public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo, ItemDu
// }
@Override
public boolean onEntityDamaged(ItemStack stack, LivingEntity entityliving, LivingEntity attacker) {
public boolean postHit(ItemStack stack, LivingEntity entityliving, LivingEntity attacker) {
ItemPowerManager capEnergy = new ItemPowerManager(stack);
if (capEnergy.getEnergyStored() >= hitCost) {
capEnergy.extractEnergy(hitCost, false);
@ -129,7 +129,7 @@ public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo, ItemDu
}
@Override
public void buildTooltip(ItemStack stack, @Nullable World worldIn, List<Component> tooltip, TooltipContext flagIn) {
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Component> tooltip, TooltipContext flagIn) {
tooltip.add(new TextComponent("WIP Coming Soon").applyFormat(ChatFormat.RED));
// TODO
// Remember to remove WIP override and imports once complete
@ -152,9 +152,9 @@ public class ItemOmniTool extends PickaxeItem implements IEnergyItemInfo, ItemDu
@Environment(EnvType.CLIENT)
@Override
public void appendItemsForGroup(
public void appendStacks(
ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isInItemGroup(par2ItemGroup)) {
if (!isIn(par2ItemGroup)) {
return;
}
ItemStack uncharged = new ItemStack(TRContent.OMNI_TOOL);

View file

@ -40,7 +40,7 @@ public class ItemTRAxe extends AxeItem {
}
public ItemTRAxe(ToolMaterial material, String repairOreDict) {
super(material, material.getAttackDamage() + 5.75F, (material.getAttackDamage() + 6.75F) * -0.344444F, new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
super(material, material.getAttackDamage() + 5.75F, (material.getAttackDamage() + 6.75F) * -0.344444F, new Item.Settings().group(TechReborn.ITEMGROUP));
this.repairOreDict = repairOreDict;
}

View file

@ -40,7 +40,7 @@ public class ItemTRHoe extends HoeItem {
}
public ItemTRHoe(ToolMaterial material, String repairOreDict) {
super(material, 1F, new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
super(material, 1F, new Item.Settings().group(TechReborn.ITEMGROUP));
this.repairOreDict = repairOreDict;
}

View file

@ -40,7 +40,7 @@ public class ItemTRPickaxe extends PickaxeItem {
}
public ItemTRPickaxe(ToolMaterial material, String repairOreDict) {
super(material, 1, (material.getAttackDamage() + 6.75F) * -0.344444F, new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
super(material, 1, (material.getAttackDamage() + 6.75F) * -0.344444F, new Item.Settings().group(TechReborn.ITEMGROUP));
this.repairOreDict = repairOreDict;
}

View file

@ -40,7 +40,7 @@ public class ItemTRSpade extends ShovelItem {
}
public ItemTRSpade(ToolMaterial material, String repairOreDict) {
super(material, material.getAttackDamage() + 5.75F, (material.getAttackDamage() + 6.75F) * -0.344444F, new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
super(material, material.getAttackDamage() + 5.75F, (material.getAttackDamage() + 6.75F) * -0.344444F, new Item.Settings().group(TechReborn.ITEMGROUP));
this.repairOreDict = repairOreDict;
}

View file

@ -40,7 +40,7 @@ public class ItemTRSword extends SwordItem {
}
public ItemTRSword(ToolMaterial material, String repairOreDict) {
super(material, 1, (material.getAttackDamage() + 6.75F) * -0.344444F, new Item.Settings().itemGroup(TechReborn.ITEMGROUP));
super(material, 1, (material.getAttackDamage() + 6.75F) * -0.344444F, new Item.Settings().group(TechReborn.ITEMGROUP));
this.repairOreDict = repairOreDict;
}

View file

@ -65,7 +65,7 @@ public class TileTechStorageBase extends TileMachineBase
}
if (!storedItem.isEmpty()) {
storedItem.setAmount(Math.min(tagCompound.getInt("storedQuantity"), this.maxCapacity));
storedItem.setCount(Math.min(tagCompound.getInt("storedQuantity"), this.maxCapacity));
}
inventory.read(tagCompound);
@ -74,11 +74,11 @@ public class TileTechStorageBase extends TileMachineBase
public CompoundTag writeWithoutCoords(CompoundTag tagCompound) {
if (!storedItem.isEmpty()) {
ItemStack temp = storedItem.copy();
if (storedItem.getAmount() > storedItem.getMaxAmount()) {
temp.setAmount(storedItem.getMaxAmount());
if (storedItem.getCount() > storedItem.getMaxCount()) {
temp.setCount(storedItem.getMaxCount());
}
tagCompound.put("storedStack", temp.toTag(new CompoundTag()));
tagCompound.putInt("storedQuantity", Math.min(storedItem.getAmount(), maxCapacity));
tagCompound.putInt("storedQuantity", Math.min(storedItem.getCount(), maxCapacity));
} else {
tagCompound.putInt("storedQuantity", 0);
}
@ -92,7 +92,7 @@ public class TileTechStorageBase extends TileMachineBase
writeWithoutCoords(tileEntity);
dropStack.setTag(new CompoundTag());
dropStack.getTag().put("tileEntity", tileEntity);
storedItem.setAmount(0);
storedItem.setCount(0);
inventory.setStackInSlot(1, ItemStack.EMPTY);
syncWithAll();
@ -100,7 +100,7 @@ public class TileTechStorageBase extends TileMachineBase
}
public int getStoredCount() {
return storedItem.getAmount();
return storedItem.getCount();
}
public List<ItemStack> getContentDrops() {
@ -110,15 +110,15 @@ public class TileTechStorageBase extends TileMachineBase
if (!inventory.getInvStack(1).isEmpty()) {
stacks.add(inventory.getInvStack(1));
}
int size = storedItem.getMaxAmount();
int size = storedItem.getMaxCount();
for (int i = 0; i < getStoredCount() / size; i++) {
ItemStack droped = storedItem.copy();
droped.setAmount(size);
droped.setCount(size);
stacks.add(droped);
}
if (getStoredCount() % size != 0) {
ItemStack droped = storedItem.copy();
droped.setAmount(getStoredCount() % size);
droped.setCount(getStoredCount() % size);
stacks.add(droped);
}
}
@ -136,7 +136,7 @@ public class TileTechStorageBase extends TileMachineBase
outputStack = inventory.getInvStack(1);
}
if (!inventory.getInvStack(0).isEmpty()
&& (storedItem.getAmount() + outputStack.getAmount()) < maxCapacity) {
&& (storedItem.getCount() + outputStack.getCount()) < maxCapacity) {
ItemStack inputStack = inventory.getInvStack(0);
if (getStoredItemType().isEmpty()
|| (storedItem.isEmpty() && ItemUtils.isItemEqual(inputStack, outputStack, true, true))) {
@ -144,13 +144,13 @@ public class TileTechStorageBase extends TileMachineBase
storedItem = inputStack;
inventory.setStackInSlot(0, ItemStack.EMPTY);
} else if (ItemUtils.isItemEqual(getStoredItemType(), inputStack, true, true)) {
int reminder = maxCapacity - storedItem.getAmount() - outputStack.getAmount();
if (inputStack.getAmount() <= reminder) {
setStoredItemCount(inputStack.getAmount());
int reminder = maxCapacity - storedItem.getCount() - outputStack.getCount();
if (inputStack.getCount() <= reminder) {
setStoredItemCount(inputStack.getCount());
inventory.setStackInSlot(0, ItemStack.EMPTY);
} else {
setStoredItemCount(maxCapacity - outputStack.getAmount());
inventory.getInvStack(0).subtractAmount(reminder);
setStoredItemCount(maxCapacity - outputStack.getCount());
inventory.getInvStack(0).decrement(reminder);
}
}
markDirty();
@ -161,8 +161,8 @@ public class TileTechStorageBase extends TileMachineBase
if (outputStack.isEmpty()) {
ItemStack delivered = storedItem.copy();
delivered.setAmount(Math.min(storedItem.getAmount(), delivered.getMaxAmount()));
storedItem.subtractAmount(delivered.getAmount());
delivered.setCount(Math.min(storedItem.getCount(), delivered.getMaxCount()));
storedItem.decrement(delivered.getCount());
if (storedItem.isEmpty()) {
storedItem = ItemStack.EMPTY;
@ -172,12 +172,12 @@ public class TileTechStorageBase extends TileMachineBase
markDirty();
syncWithAll();
} else if (ItemUtils.isItemEqual(storedItem, outputStack, true, true)
&& outputStack.getAmount() < outputStack.getMaxAmount()) {
&& outputStack.getCount() < outputStack.getMaxCount()) {
int wanted = Math.min(storedItem.getAmount(),
outputStack.getMaxAmount() - outputStack.getAmount());
outputStack.setAmount(outputStack.getAmount() + wanted);
storedItem.subtractAmount(wanted);
int wanted = Math.min(storedItem.getCount(),
outputStack.getMaxCount() - outputStack.getCount());
outputStack.setCount(outputStack.getCount() + wanted);
storedItem.decrement(wanted);
if (storedItem.isEmpty()) {
storedItem = ItemStack.EMPTY;
@ -226,12 +226,12 @@ public class TileTechStorageBase extends TileMachineBase
int size = 0;
String name = "of nothing";
if (!storedItem.isEmpty()) {
name = storedItem.getDisplayName().getString();
size += storedItem.getAmount();
name = storedItem.getCustomName().getString();
size += storedItem.getCount();
}
if (!inventory.getInvStack(1).isEmpty()) {
name = inventory.getInvStack(1).getDisplayName().getString();
size += inventory.getInvStack(1).getAmount();
name = inventory.getInvStack(1).getCustomName().getString();
size += inventory.getInvStack(1).getCount();
}
info.add(new TextComponent(size + " " + name));
}
@ -243,13 +243,13 @@ public class TileTechStorageBase extends TileMachineBase
public void setStoredItemCount(int amount) {
storedItem.addAmount(amount);
storedItem.increment(amount);
markDirty();
}
public void setStoredItemType(ItemStack type, int amount) {
storedItem = type;
storedItem.setAmount(amount);
storedItem.setCount(amount);
markDirty();
}

View file

@ -139,7 +139,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
return true;
}
if (ItemUtils.isItemEqual(inventory.getInvStack(slot), stack, true, tags)) {
if (stack.getAmount() + inventory.getInvStack(slot).getAmount() <= stack.getMaxAmount()) {
if (stack.getCount() + inventory.getInvStack(slot).getCount() <= stack.getMaxCount()) {
return true;
}
}
@ -241,9 +241,9 @@ public class TileFusionControlComputer extends TilePowerAcceptor
if (canUseEnergy(currentRecipe.getStartEU())) {
useEnergy(currentRecipe.getStartEU());
hasStartedCrafting = true;
inventory.shrinkSlot(topStackSlot, currentRecipe.getTopInput().getAmount());
inventory.shrinkSlot(topStackSlot, currentRecipe.getTopInput().getCount());
if (!currentRecipe.getBottomInput().isEmpty()) {
inventory.shrinkSlot(bottomStackSlot, currentRecipe.getBottomInput().getAmount());
inventory.shrinkSlot(bottomStackSlot, currentRecipe.getBottomInput().getCount());
}
}
}
@ -264,13 +264,13 @@ public class TileFusionControlComputer extends TilePowerAcceptor
if (inventory.getInvStack(outputStackSlot).isEmpty()) {
inventory.setStackInSlot(outputStackSlot, currentRecipe.getOutput().copy());
} else {
inventory.shrinkSlot(outputStackSlot, -currentRecipe.getOutput().getAmount());
inventory.shrinkSlot(outputStackSlot, -currentRecipe.getOutput().getCount());
}
if (validateReactorRecipe(this.currentRecipe)) {
crafingTickTime = 0;
inventory.shrinkSlot(topStackSlot, currentRecipe.getTopInput().getAmount());
inventory.shrinkSlot(topStackSlot, currentRecipe.getTopInput().getCount());
if (!currentRecipe.getBottomInput().isEmpty()) {
inventory.shrinkSlot(bottomStackSlot, currentRecipe.getBottomInput().getAmount());
inventory.shrinkSlot(bottomStackSlot, currentRecipe.getBottomInput().getCount());
}
} else {
resetCrafter();

View file

@ -95,7 +95,7 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
if (burnTime > 0) {
updateState();
burnItem = inventory.getInvStack(fuelSlot);
if (inventory.getInvStack(fuelSlot).getAmount() == 1) {
if (inventory.getInvStack(fuelSlot).getCount() == 1) {
if (inventory.getInvStack(fuelSlot).getItem() == Items.LAVA_BUCKET || inventory.getInvStack(fuelSlot).getItem() instanceof BucketItem) {
inventory.setStackInSlot(fuelSlot, new ItemStack(Items.BUCKET));
} else {

View file

@ -148,10 +148,10 @@ public class TileIronAlloyFurnace extends TileMachineBase
return false;
if (inventory.getInvStack(this.output).isEmpty())
return true;
if (!inventory.getInvStack(this.output).isEqualIgnoreTags(itemstack))
if (!inventory.getInvStack(this.output).isItemEqualIgnoreDamage(itemstack))
return false;
final int result = inventory.getInvStack(this.output).getAmount() + itemstack.getAmount();
return result <= inventory.getStackLimit() && result <= inventory.getInvStack(this.output).getMaxAmount(); // Forge
final int result = inventory.getInvStack(this.output).getCount() + itemstack.getCount();
return result <= inventory.getStackLimit() && result <= inventory.getInvStack(this.output).getMaxCount(); // Forge
// BugFix:
// Make
// it
@ -182,7 +182,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
if (inventory.getInvStack(this.output).isEmpty()) {
inventory.setStackInSlot(this.output, itemstack.copy());
} else if (inventory.getInvStack(this.output).getItem() == itemstack.getItem()) {
inventory.shrinkSlot(this.output, -itemstack.getAmount());
inventory.shrinkSlot(this.output, -itemstack.getCount());
}
for (final RebornRecipe recipeType : ModRecipes.ALLOY_SMELTER.getRecipes(world)) {

View file

@ -92,9 +92,9 @@ public class TileIronFurnace extends TileMachineBase
ItemStack fuelStack = inventory.getInvStack(this.fuelslot);
if (fuelStack.getItem().hasRecipeRemainder()) {
inventory.setStackInSlot(this.fuelslot, new ItemStack(fuelStack.getItem().getRecipeRemainder()));
} else if (fuelStack.getAmount() > 1) {
} else if (fuelStack.getCount() > 1) {
inventory.shrinkSlot(this.fuelslot, 1);
} else if (fuelStack.getAmount() == 1) {
} else if (fuelStack.getCount() == 1) {
inventory.setStackInSlot(this.fuelslot, ItemStack.EMPTY);
}
updateInventory = true;
@ -124,10 +124,10 @@ public class TileIronFurnace extends TileMachineBase
if (inventory.getInvStack(this.output).isEmpty()) {
inventory.setStackInSlot(this.output, itemstack.copy());
} else if (inventory.getInvStack(this.output).isEqualIgnoreTags(itemstack)) {
inventory.getInvStack(this.output).addAmount(itemstack.getAmount());
} else if (inventory.getInvStack(this.output).isItemEqualIgnoreDamage(itemstack)) {
inventory.getInvStack(this.output).increment(itemstack.getCount());
}
if (inventory.getInvStack(this.input1).getAmount() > 1) {
if (inventory.getInvStack(this.input1).getCount() > 1) {
inventory.shrinkSlot(this.input1, 1);
} else {
inventory.setStackInSlot(this.input1, ItemStack.EMPTY);
@ -143,10 +143,10 @@ public class TileIronFurnace extends TileMachineBase
return false;
if (inventory.getInvStack(this.output).isEmpty())
return true;
if (!inventory.getInvStack(this.output).isEqualIgnoreTags(itemstack))
if (!inventory.getInvStack(this.output).isItemEqualIgnoreDamage(itemstack))
return false;
final int result = inventory.getInvStack(this.output).getAmount() + itemstack.getAmount();
return result <= inventory.getStackLimit() && result <= itemstack.getMaxAmount();
final int result = inventory.getInvStack(this.output).getCount() + itemstack.getCount();
return result <= inventory.getStackLimit() && result <= itemstack.getMaxCount();
}
public boolean isBurning() {
@ -181,7 +181,7 @@ public class TileIronFurnace extends TileMachineBase
boolean isFuel = FurnaceBlockEntity.canUseAsFuel(stack);
if(isFuel){
ItemStack fuelSlotStack = tile.inventory.getInvStack(tile.fuelslot);
if(fuelSlotStack.isEmpty() || ItemUtils.isItemEqual(stack, fuelSlotStack, true, true) && fuelSlotStack.getMaxAmount() != fuelSlotStack.getAmount()){
if(fuelSlotStack.isEmpty() || ItemUtils.isItemEqual(stack, fuelSlotStack, true, true) && fuelSlotStack.getMaxCount() != fuelSlotStack.getCount()){
return slotID == tile.fuelslot;
}
}

View file

@ -43,18 +43,18 @@ import techreborn.tiles.TileGenericMachine;
@RebornRegister(TechReborn.MOD_ID)
public class TileDistillationTower extends TileGenericMachine implements IContainerProvider {
@ConfigRegistry(config = "machines", category = "EnvTypeillation_tower", key = "EnvTypeillationTowerMaxInput", comment = "EnvTypeillation Tower Max Input (Value in EU)")
@ConfigRegistry(config = "machines", category = "Distillation_tower", key = "DistillationTowerMaxInput", comment = "Distillation Tower Max Input (Value in EU)")
public static int maxInput = 128;
@ConfigRegistry(config = "machines", category = "EnvTypeillation_tower", key = "EnvTypeillationTowerMaxEnergy", comment = "EnvTypeillation Tower Max Energy (Value in EU)")
@ConfigRegistry(config = "machines", category = "Distillation_tower", key = "DistillationTowerMaxEnergy", comment = "Distillation Tower Max Energy (Value in EU)")
public static int maxEnergy = 10_000;
public MultiblockChecker multiblockChecker;
public TileDistillationTower() {
super(TRTileEntities.EnvTypeILLATION_TOWER,"EnvTypeillationTower", maxInput, maxEnergy, TRContent.Machine.EnvTypeILLATION_TOWER.block, 6);
super(TRTileEntities.DISTILLATION_TOWER,"DistillationTower", maxInput, maxEnergy, TRContent.Machine.DISTILLATION_TOWER.block, 6);
final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2, 3, 4, 5 };
this.inventory = new Inventory<>(7, "TileEnvTypeillationTower", 64, this).withConfiguredAccess();
this.inventory = new Inventory<>(7, "TileDistillationTower", 64, this).withConfiguredAccess();
this.crafter = new RecipeCrafter(ModRecipes.DISTILLATION_TOWER, this, 2, 4, this.inventory, inputs, outputs);
}
@ -89,7 +89,7 @@ public class TileDistillationTower extends TileGenericMachine implements IContai
// IContainerProvider
@Override
public BuiltContainer createContainer(final PlayerEntity player) {
return new ContainerBuilder("EnvTypeillationtower").player(player.inventory).inventory().hotbar().addInventory()
return new ContainerBuilder("Distillationtower").player(player.inventory).inventory().hotbar().addInventory()
.tile(this).slot(0, 35, 27).slot(1, 35, 47).outputSlot(2, 79, 37).outputSlot(3, 99, 37)
.outputSlot(4, 119, 37).outputSlot(5, 139, 37).energySlot(6, 8, 72).syncEnergyValue().syncCrafterValue()
.addInventory().create(this);

View file

@ -126,7 +126,7 @@ public class TileFluidReplicator extends TileGenericMachine implements IContaine
private static IInventoryAccess<TileFluidReplicator> getInventoryAccess(){
return (slotID, stack, face, direction, tile) -> {
if(slotID == 0){
return stack.isEqualIgnoreTags(TRContent.Parts.UU_MATTER.getStack());
return stack.isItemEqualIgnoreDamage(TRContent.Parts.UU_MATTER.getStack());
}
return true;
};
@ -143,7 +143,7 @@ public class TileFluidReplicator extends TileGenericMachine implements IContaine
@Override
public BuiltContainer createContainer(PlayerEntity player) {
return new ContainerBuilder("fluidreplicator").player(player.inventory).inventory().hotbar().addInventory()
.tile(this).fluidSlot(1, 124, 35).filterSlot(0, 55, 45, stack -> stack.isEqualIgnoreTags(TRContent.Parts.UU_MATTER.getStack()))
.tile(this).fluidSlot(1, 124, 35).filterSlot(0, 55, 45, stack -> stack.isItemEqualIgnoreDamage(TRContent.Parts.UU_MATTER.getStack()))
.outputSlot(2, 124, 55).energySlot(3, 8, 72).syncEnergyValue().syncCrafterValue().addInventory()
.create(this);
}

View file

@ -123,7 +123,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
boolean missingOutput = false;
int[] stacksInSlots = new int[9];
for (int i = 0; i < 9; i++) {
stacksInSlots[i] = inventory.getInvStack(i).getAmount();
stacksInSlots[i] = inventory.getInvStack(i).getCount();
}
DefaultedList<Ingredient> ingredients = recipe.getPreviewInputs();
@ -133,7 +133,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
for (int i = 0; i < 9; i++) {
ItemStack stack = inventory.getInvStack(i);
int requiredSize = locked ? 1 : 0;
if (stack.getMaxAmount() == 1) {
if (stack.getMaxCount() == 1) {
requiredSize = 0;
}
if (stacksInSlots[i] > requiredSize) {
@ -178,7 +178,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
return true;
}
if (ItemUtils.isItemEqual(stack, output, true, true)) {
if (stack.getMaxAmount() > stack.getAmount() + output.getAmount()) {
if (stack.getMaxCount() > stack.getCount() + output.getCount()) {
return true;
}
}
@ -196,13 +196,13 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
ItemStack bestSlot = inventory.getInvStack(i);
if (ingredient.method_8093(bestSlot)) {
handleContainerItem(bestSlot);
bestSlot.subtractAmount(1);
bestSlot.decrement(1);
} else {
for (int j = 0; j < 9; j++) {
ItemStack stack = inventory.getInvStack(j);
if (ingredient.method_8093(stack)) {
handleContainerItem(stack);
stack.subtractAmount(1); // TODO is this right? or do I need
stack.decrement(1); // TODO is this right? or do I need
// to use it as an actull
// crafting grid
break;
@ -217,7 +217,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
inventory.setStackInSlot(9, ouputStack.copy());
} else {
// TODO use ouputStack in someway?
output.addAmount(recipe.getOutput().getAmount());
output.increment(recipe.getOutput().getCount());
}
return true;
}
@ -230,8 +230,8 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
if (extraOutputSlot.isEmpty()) {
inventory.setStackInSlot(10, containerItem.copy());
} else if (ItemUtils.isItemEqual(extraOutputSlot, containerItem, true, true)
&& extraOutputSlot.getMaxAmount() < extraOutputSlot.getAmount() + containerItem.getAmount()) {
extraOutputSlot.addAmount(1);
&& extraOutputSlot.getMaxCount() < extraOutputSlot.getCount() + containerItem.getCount()) {
extraOutputSlot.increment(1);
}
}
}
@ -271,7 +271,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
if (stackInSlot.isEmpty()) {
possibleSlots.add(i);
} else if (stackInSlot.getItem() == stack.getItem()) {
if (stackInSlot.getMaxAmount() >= stackInSlot.getAmount() + stack.getAmount()) {
if (stackInSlot.getMaxCount() >= stackInSlot.getCount() + stack.getCount()) {
possibleSlots.add(i);
}
}
@ -285,9 +285,9 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
return slot;
}
if (smallestCount == null) {
smallestCount = Pair.of(slot, slotStack.getAmount());
} else if (smallestCount.getRight() >= slotStack.getAmount()) {
smallestCount = Pair.of(slot, slotStack.getAmount());
smallestCount = Pair.of(slot, slotStack.getCount());
} else if (smallestCount.getRight() >= slotStack.getCount()) {
smallestCount = Pair.of(slot, slotStack.getCount());
}
}
if (smallestCount != null) {

View file

@ -75,10 +75,10 @@ public class TileElectricFurnace extends TilePowerAcceptor
if (inventory.getInvStack(output).isEmpty()) {
inventory.setStackInSlot(output, itemstack.copy());
} else if (inventory.getInvStack(output).isEqualIgnoreTags(itemstack)) {
inventory.getInvStack(output).addAmount(itemstack.getAmount());
} else if (inventory.getInvStack(output).isItemEqualIgnoreDamage(itemstack)) {
inventory.getInvStack(output).increment(itemstack.getCount());
}
if (inventory.getInvStack(input1).getAmount() > 1) {
if (inventory.getInvStack(input1).getCount() > 1) {
inventory.shrinkSlot(input1, 1);
} else {
inventory.setStackInSlot(input1, ItemStack.EMPTY);
@ -97,11 +97,11 @@ public class TileElectricFurnace extends TilePowerAcceptor
if (inventory.getInvStack(output).isEmpty()) {
return true;
}
if (!inventory.getInvStack(output).isEqualIgnoreTags(itemstack)) {
if (!inventory.getInvStack(output).isItemEqualIgnoreDamage(itemstack)) {
return false;
}
final int result = inventory.getInvStack(output).getAmount() + itemstack.getAmount();
return result <= this.inventory.getStackLimit() && result <= itemstack.getMaxAmount();
final int result = inventory.getInvStack(output).getCount() + itemstack.getCount();
return result <= this.inventory.getStackLimit() && result <= itemstack.getMaxCount();
}
public boolean isBurning() {

View file

@ -86,7 +86,7 @@ public class TileRecycler extends TilePowerAcceptor
inventory.setStackInSlot(1, itemstack.copy());
}
else {
inventory.getInvStack(1).addAmount(itemstack.getAmount());
inventory.getInvStack(1).increment(itemstack.getCount());
}
}
inventory.shrinkSlot(0, 1);
@ -99,7 +99,7 @@ public class TileRecycler extends TilePowerAcceptor
public boolean hasSlotGotSpace(int slot) {
if (inventory.getInvStack(slot).isEmpty()) {
return true;
} else if (inventory.getInvStack(slot).getAmount() < inventory.getInvStack(slot).getMaxAmount()) {
} else if (inventory.getInvStack(slot).getCount() < inventory.getInvStack(slot).getMaxCount()) {
return true;
}
return false;

View file

@ -148,10 +148,10 @@ public class TileRollingMachine extends TilePowerAcceptor
tickTime = 0;
hasCrafted = true;
} else {
if (inventory.getInvStack(outputSlot).getAmount()
+ currentRecipeOutput.getAmount() <= currentRecipeOutput.getMaxAmount()) {
if (inventory.getInvStack(outputSlot).getCount()
+ currentRecipeOutput.getCount() <= currentRecipeOutput.getMaxCount()) {
final ItemStack stack = inventory.getInvStack(outputSlot);
stack.setAmount(stack.getAmount() + currentRecipeOutput.getAmount());
stack.setCount(stack.getCount() + currentRecipeOutput.getCount());
inventory.setStackInSlot(outputSlot, stack);
tickTime = 0;
hasCrafted = true;
@ -237,7 +237,7 @@ public class TileRollingMachine extends TilePowerAcceptor
if(!possibleSlots.isEmpty()){
int totalItems = possibleSlots.stream()
.mapToInt(value -> inventory.getInvStack(value).getAmount()).sum();
.mapToInt(value -> inventory.getInvStack(value).getCount()).sum();
int slots = possibleSlots.size();
//This makes an array of ints with the best possible slot EnvTyperibution
@ -254,7 +254,7 @@ public class TileRollingMachine extends TilePowerAcceptor
}
List<Integer> slotEnvTyperubution = possibleSlots.stream()
.mapToInt(value -> inventory.getInvStack(value).getAmount())
.mapToInt(value -> inventory.getInvStack(value).getCount())
.boxed().collect(Collectors.toList());
boolean needsBalance = false;
@ -282,20 +282,20 @@ public class TileRollingMachine extends TilePowerAcceptor
bestSlot = Pair.of(slot, 0);
}
if (bestSlot == null) {
bestSlot = Pair.of(slot, slotStack.getAmount());
} else if (bestSlot.getRight() >= slotStack.getAmount()) {
bestSlot = Pair.of(slot, slotStack.getAmount());
bestSlot = Pair.of(slot, slotStack.getCount());
} else if (bestSlot.getRight() >= slotStack.getCount()) {
bestSlot = Pair.of(slot, slotStack.getCount());
}
}
if (bestSlot == null
|| bestSlot.getLeft() == balanceSlot
|| bestSlot.getRight() == sourceStack.getAmount()
|| bestSlot.getRight() == sourceStack.getCount()
|| inventory.getInvStack(bestSlot.getLeft()).isEmpty()
|| !ItemUtils.isItemEqual(sourceStack, inventory.getInvStack(bestSlot.getLeft()), true, true)) {
return Optional.empty();
}
sourceStack.subtractAmount(1);
inventory.getInvStack(bestSlot.getLeft()).addAmount(1);
sourceStack.decrement(1);
inventory.getInvStack(bestSlot.getLeft()).increment(1);
inventory.setChanged();
return Optional.of(getCraftingMatrix());
@ -319,7 +319,7 @@ public class TileRollingMachine extends TilePowerAcceptor
if (locked) {
for (int i = 0; i < craftMatrix.getInvSize(); i++) {
ItemStack stack1 = craftMatrix.getInvStack(i);
if (!stack1.isEmpty() && stack1.getAmount() < 2) {
if (!stack1.isEmpty() && stack1.getCount() < 2) {
return false;
}
}

View file

@ -38,11 +38,11 @@ public class TileCreativeQuantumChest extends TileQuantumChest {
super.tick();
ItemStack stack = inventory.getInvStack(1);
if (!stack.isEmpty() && storedItem.isEmpty()) {
stack.setAmount(stack.getMaxAmount());
stack.setCount(stack.getMaxCount());
storedItem = stack.copy();
}
storedItem.setAmount(maxCapacity - storedItem.getMaxAmount());
storedItem.setCount(maxCapacity - storedItem.getMaxCount());
}
@Override

View file

@ -73,7 +73,7 @@ public class TileMatterFabricator extends TilePowerAcceptor
private boolean spaceForOutput(int slot) {
return inventory.getInvStack(slot).isEmpty()
|| ItemUtils.isItemEqual(inventory.getInvStack(slot), TRContent.Parts.UU_MATTER.getStack(), true, true)
&& inventory.getInvStack(slot).getAmount() < 64;
&& inventory.getInvStack(slot).getCount() < 64;
}
private void addOutputProducts() {
@ -90,7 +90,7 @@ public class TileMatterFabricator extends TilePowerAcceptor
inventory.setStackInSlot(slot, TRContent.Parts.UU_MATTER.getStack());
}
else if (ItemUtils.isItemEqual(this.inventory.getInvStack(slot), TRContent.Parts.UU_MATTER.getStack(), true, true)) {
inventory.getInvStack(slot).setAmount((Math.min(64, 1 + inventory.getInvStack(slot).getAmount())));
inventory.getInvStack(slot).setCount((Math.min(64, 1 + inventory.getInvStack(slot).getCount())));
}
}
@ -109,7 +109,7 @@ public class TileMatterFabricator extends TilePowerAcceptor
}
public int getValue(ItemStack itemStack) {
if (itemStack.isEqualIgnoreTags(TRContent.Parts.SCRAP.getStack())) {
if (itemStack.isItemEqualIgnoreDamage(TRContent.Parts.SCRAP.getStack())) {
return 200;
} else if (itemStack.getItem() == TRContent.SCRAP_BOX) {
return 2000;

View file

@ -48,7 +48,7 @@ public class BehaviorDispenseScrapbox extends ItemDispenserBehavior {
public static boolean dispenseScrapboxes = true;
@Override
protected ItemStack dispenseStack(BlockPointer source, ItemStack stack) {
protected ItemStack dispenseSilently(BlockPointer source, ItemStack stack) {
if (dispenseScrapboxes) {
List<RebornRecipe> scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(source.getWorld());
int random = new Random().nextInt(scrapboxRecipeList.size());
@ -58,7 +58,7 @@ public class BehaviorDispenseScrapbox extends ItemDispenserBehavior {
DispenserBlockEntity tile = source.getBlockEntity();
Direction enumfacing = tile.getWorld().getBlockState(new BlockPos(source.getX(), source.getY(), source.getZ())).get(DispenserBlock.FACING);
Position iposition = DispenserBlock.getOutputLocation(source);
dispenseItem(source.getWorld(), out, 6, enumfacing, iposition);
spawnItem(source.getWorld(), out, 6, enumfacing, iposition);
}
return stack;
}