Skip to content

Commit

Permalink
added steel upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Dec 22, 2024
1 parent 7775ff4 commit 8dc18d3
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
package trinsdar.gt4r.blockentity.single;

import muramasa.antimatter.machine.Tier;
import muramasa.antimatter.machine.types.Machine;
import muramasa.antimatter.blockentity.BlockEntityMachine;
import muramasa.antimatter.tool.AntimatterToolType;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.phys.BlockHitResult;
import org.jetbrains.annotations.Nullable;
import trinsdar.gt4r.data.GT4RData;
import trinsdar.gt4r.machine.CoalBoilerFluidHandler;
import trinsdar.gt4r.machine.CoalBoilerRecipeHandler;

Expand Down Expand Up @@ -49,4 +60,19 @@ public int getMaxHeat() {
});
return v.get();
}

@Override
public InteractionResult onInteractServer(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit, @Nullable AntimatterToolType type) {
if (player.getItemInHand(hand).getItem() == GT4RData.SteelUpgrade){
CompoundTag nbt = new CompoundTag();
this.saveAdditional(nbt);
world.setBlock(pos, this.getMachineType().getBlockState(Tier.STEEL).defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, this.getFacing()), 3);
world.getBlockEntity(pos).load(nbt);
if (!player.isCreative()){
player.getItemInHand(hand).shrink(1);
}
return InteractionResult.SUCCESS;
}
return super.onInteractServer(state, world, pos, player, hand, hit, type);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,22 @@
import muramasa.antimatter.machine.Tier;
import muramasa.antimatter.machine.types.Machine;
import muramasa.antimatter.recipe.IRecipe;
import muramasa.antimatter.tool.AntimatterToolType;
import muramasa.antimatter.util.TagUtils;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.tags.TagKey;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.phys.BlockHitResult;
import org.jetbrains.annotations.Nullable;
import tesseract.TesseractGraphWrappers;
import trinsdar.gt4r.data.GT4RData;

import static muramasa.antimatter.machine.Tier.BRONZE;
import static trinsdar.gt4r.data.Machines.STEAM_FORGE_HAMMER;
Expand All @@ -33,6 +43,21 @@ public Tier getPowerLevel() {
return Tier.LV;
}

@Override
public InteractionResult onInteractServer(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit, @Nullable AntimatterToolType type) {
if (player.getItemInHand(hand).getItem() == GT4RData.SteelUpgrade){
CompoundTag nbt = new CompoundTag();
this.saveAdditional(nbt);
world.setBlock(pos, this.getMachineType().getBlockState(Tier.STEEL).defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, this.getFacing()), 3);
world.getBlockEntity(pos).load(nbt);
if (!player.isCreative()){
player.getItemInHand(hand).shrink(1);
}
return InteractionResult.SUCCESS;
}
return super.onInteractServer(state, world, pos, player, hand, hit, type);
}

public static class SteamMachineRecipeHandler extends MachineRecipeHandler<BlockEntitySteamMachine>{
protected boolean isSteamClear = false;

Expand Down
1 change: 1 addition & 0 deletions common/src/main/java/trinsdar/gt4r/data/GT4RData.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ private static Block.Properties prepareProperties() {
public static ItemCover RedstoneMachineController = AntimatterAPI.get(ItemCover.class, COVER_REDSTONE_MACHINE_CONTROLLER.getId(), GT4RRef.ID);
public static ItemBasic<?> Shutter = new ItemBasic<>(GT4RRef.ID, "shutter").tip("Can be placed on machines as a cover");

public static ItemBasic<?> SteelUpgrade = new ItemBasic<>(GT4RRef.ID, "steel_upgrade").tip("Can be used to upgrade bronze steam machines to steel steam machines");
public static ItemBasic<?> OverclockerUpgrade = new ItemBasic<>(GT4RRef.ID, "overclocker_upgrade");
public static ItemBasic<?> TransformerUpgrade = new ItemBasic<>(GT4RRef.ID, "transformer_upgrade");
public static ItemBasic<?> SteamUpgrade = new ItemBasic<>(GT4RRef.ID, "steam_upgrade");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ public static void loadRecipes(Consumer<FinishedRecipe> output, AntimatterRecipe
NeutronReflector, of('C', AntimatterMaterialTypes.DUST.get(AntimatterMaterials.Coal), 'T', AntimatterMaterialTypes.DUST.get(Tin), 'I', AntimatterMaterialTypes.PLATE.get(AntimatterMaterials.Copper)), "TCT", "CIC", "TCT");
provider.addItemRecipe(output, "upgrades", TransformerUpgrade,
of('G', ForgeCTags.GLASS, 'C', CABLE_GOLD.getBlockItem(PipeSize.VTINY), 'T', Machines.TRANSFORMER.getItem(MV), 'c', CIRCUITS_BASIC), "GGG", "CTC", "GcG");
provider.addItemRecipe(output, "upgrades", SteelUpgrade, of('S', PLATE.getMaterialTag(Steel), 'B', PLATE.getMaterialTag(Bronze)), "SSS", "SBS");
provider.shapeless(output, GT4RRef.ID, "tape_from_empty", "tapes", new ItemStack(Tape), TapeEmpty, TapeEmpty, TapeEmpty, TapeEmpty);
provider.shapeless(output, GT4RRef.ID, "duct_tape_from_empty", "tapes", new ItemStack(DuctTape), DuctTapeEmpty, DuctTapeEmpty, DuctTapeEmpty, DuctTapeEmpty);
provider.shapeless(output, GT4RRef.ID, "fal_duct_tape_from_empty", "tapes", new ItemStack(FALDuctTape), FALDuctTapeEmpty, FALDuctTapeEmpty, FALDuctTapeEmpty, FALDuctTapeEmpty);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8dc18d3

Please sign in to comment.