This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
106 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
common/src/main/java/muramasa/gregtech/blockentity/single/BlockEntityScanner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package muramasa.gregtech.blockentity.single; | ||
|
||
import earth.terrarium.botarium.common.fluid.base.FluidHolder; | ||
import earth.terrarium.botarium.common.fluid.utils.FluidHooks; | ||
import muramasa.antimatter.blockentity.BlockEntityMachine; | ||
import muramasa.antimatter.capability.machine.MachineRecipeHandler; | ||
import muramasa.antimatter.machine.types.Machine; | ||
import muramasa.antimatter.recipe.IRecipe; | ||
import muramasa.antimatter.recipe.ingredient.RecipeIngredient; | ||
import muramasa.gregtech.data.GregTechData; | ||
import muramasa.gregtech.data.RecipeMaps; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import tesseract.TesseractGraphWrappers; | ||
import tesseract.api.item.ExtendedItemContainer; | ||
|
||
import static muramasa.gregtech.data.Materials.Glue; | ||
|
||
public class BlockEntityScanner extends BlockEntityMachine<BlockEntityScanner> { | ||
public BlockEntityScanner(Machine<?> type, BlockPos pos, BlockState state) { | ||
super(type, pos, state); | ||
recipeHandler.set(() -> new MachineRecipeHandler<>(this){ | ||
@Override | ||
public IRecipe findRecipe() { | ||
IRecipe recipe = super.findRecipe(); | ||
if (recipe == null){ | ||
ExtendedItemContainer container = itemHandler.get().getInputHandler(); | ||
ItemStack dataStick = ItemStack.EMPTY; | ||
for (int i = 0; i < container.getContainerSize(); i++) { | ||
ItemStack stack = container.getItem(i); | ||
if (stack.getItem() == GregTechData.DataStick && dataStick.isEmpty()){ | ||
dataStick = stack.copy(); | ||
} | ||
} | ||
if (!dataStick.isEmpty()){ | ||
CompoundTag prospect = dataStick.getTagElement("prospectData"); | ||
if (prospect != null){ | ||
ItemStack output = dataStick.copy(); | ||
output.getTagElement("prospectData").putBoolean("analyzed", true); | ||
return RecipeMaps.SCANNING.RB().recipeMapOnly().ii(RecipeIngredient.of(dataStick.copy())).io(output).add("data_stick_prospection", 1000, 32); | ||
} | ||
} | ||
} | ||
return recipe; | ||
} | ||
|
||
@Override | ||
public boolean accepts(ItemStack stack) { | ||
return super.accepts(stack) || stack.getItem() == GregTechData.DataStick; | ||
} | ||
}); | ||
//recipeHandler.set(() -> new ParallelRecipeHandler<>(this, true, 5)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
common/src/main/java/muramasa/gregtech/items/ItemDataStick.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,37 @@ | ||
package muramasa.gregtech.items; | ||
|
||
import muramasa.antimatter.item.ItemBasic; | ||
import muramasa.antimatter.util.Utils; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.TooltipFlag; | ||
import net.minecraft.world.level.Level; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.List; | ||
|
||
public class ItemDataStick extends ItemBasic<ItemDataStick> { | ||
public ItemDataStick(String domain, String id) { | ||
super(domain, id); | ||
} | ||
|
||
@Override | ||
public void appendHoverText(ItemStack stack, @Nullable Level level, List<Component> tooltipComponents, TooltipFlag isAdvanced) { | ||
super.appendHoverText(stack, level, tooltipComponents, isAdvanced); | ||
CompoundTag nbt = stack.getTag(); | ||
if (nbt != null){ | ||
if (nbt.contains("prospectData")){ | ||
CompoundTag prospect = nbt.getCompound("prospectData"); | ||
String raw = prospect.contains("analyzed") ? "analyzed" : "raw"; | ||
tooltipComponents.add(Utils.translatable("tooltip.gti.data_stick." + raw + "_prospection_data")); | ||
if (prospect.contains("analyzed")){ | ||
BlockPos pos = BlockPos.of(prospect.getLong("pos")); | ||
String dimension = prospect.getString("dimension"); | ||
tooltipComponents.add(Utils.translatable("tooltip.gti.data_stick.by", pos.getX(), pos.getZ(), dimension)); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
common/src/main/java/muramasa/gregtech/loader/machines/ScannerLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package muramasa.gregtech.loader.machines; | ||
|
||
import muramasa.gregtech.data.RecipeMaps; | ||
|
||
public class ScannerLoader { | ||
public static void init(){ | ||
//RecipeMaps.SCANNING.RB(). | ||
} | ||
} |