Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
started work on selector tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Jul 6, 2024
1 parent a4151aa commit f3e293b
Show file tree
Hide file tree
Showing 46 changed files with 179 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package io.github.gregtechintergalactical.gtcore.cover;

import io.github.gregtechintergalactical.gtcore.GTCore;
import io.github.gregtechintergalactical.gtcore.blockentity.BlockEntityRedstoneWire;
import muramasa.antimatter.capability.ICoverHandler;
import muramasa.antimatter.cover.BaseCover;
import muramasa.antimatter.cover.CoverFactory;
import muramasa.antimatter.machine.Tier;
import muramasa.antimatter.texture.Texture;
import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.function.BiConsumer;

public class CoverSelectorTag extends BaseCover {
public CoverSelectorTag(@NotNull ICoverHandler<?> source, @Nullable Tier tier, Direction side, CoverFactory factory) {
super(source, tier, side, factory);
}

@Override
public void onPlace() {
if (source().getTile() instanceof BlockEntityRedstoneWire<?> wire) {

}
}

@Override
protected String getRenderId() {
return "selector_tag";
}

@Override
public void setTextures(BiConsumer<String, Texture> texer) {
texer.accept("overlay", factory.getTextures().get(0));
texer.accept("underlay", factory.getTextures().get(1));
}

@Override
public ResourceLocation getModel(String type, Direction dir) {
return new ResourceLocation(GTCore.ID + ":block/cover/" + this.getRenderId());
}
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
package io.github.gregtechintergalactical.gtcore.data;

import com.google.common.collect.ImmutableMap;
import io.github.gregtechintergalactical.gtcore.GTCore;
import io.github.gregtechintergalactical.gtcore.cover.CoverRedstoneTorch;
import io.github.gregtechintergalactical.gtcore.cover.CoverSelectorTag;
import io.github.gregtechintergalactical.gtcore.item.ItemFertilizer;
import io.github.gregtechintergalactical.gtcore.item.ItemHazmatArmor;
import io.github.gregtechintergalactical.gtcore.item.ItemMagnifyingGlass;
import io.github.gregtechintergalactical.gtcore.item.ItemMatch;
import io.github.gregtechintergalactical.gtcore.item.ItemPowerUnit;
import io.github.gregtechintergalactical.gtcore.item.ItemRadaway;
import io.github.gregtechintergalactical.gtcore.item.ItemSelectorTag;
import io.github.gregtechintergalactical.gtcore.item.ItemTape;
import io.github.gregtechintergalactical.gtcore.tree.item.ItemRubberBoat;
import muramasa.antimatter.Ref;
import muramasa.antimatter.cover.CoverFactory;
import muramasa.antimatter.item.ItemBasic;
import muramasa.antimatter.item.ItemMultiTextureBattery;
import muramasa.antimatter.machine.Tier;
import muramasa.antimatter.material.Material;
import muramasa.antimatter.recipe.ingredient.RecipeIngredient;
import muramasa.antimatter.texture.Texture;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.Item;

import static io.github.gregtechintergalactical.gtcore.data.GTCoreMaterials.*;
import static muramasa.antimatter.data.AntimatterMaterials.Diamond;

public class GTCoreItems {

public static final ImmutableMap<Integer, RecipeIngredient> SELECTOR_TAG_INGREDIENTS;
public static final ImmutableMap<Integer, Item> SELECTOR_TAG_ITEMS;
public static final ImmutableMap<Integer, CoverFactory> SELECTOR_TAG_COVERS;

public static ItemBasic<?> StickyResin = new ItemBasic<>(GTCore.ID, "sticky_resin");
public static ItemRubberBoat RubberBoat = new ItemRubberBoat();

Expand Down Expand Up @@ -193,6 +205,26 @@ public class GTCoreItems {
public static ItemBasic<?> ShapeGear = new ItemBasic<>(GTCore.ID, "gear_shape", "molds/").tip("Shape for making Gears");
public static ItemBasic<?> ShapeGearSmall = new ItemBasic<>(GTCore.ID, "small_gear_shape", "molds/").tip("Shape for making Small Gears");

static {
{
ImmutableMap.Builder<Integer, RecipeIngredient> ingredientBuilder = ImmutableMap.builder();
ImmutableMap.Builder<Integer, Item> itemBuilder = ImmutableMap.builder();
ImmutableMap.Builder<Integer, CoverFactory> coverBuilder = ImmutableMap.builder();
for (int i = 0; i <= 24; i++) {
ItemSelectorTag selectorTag = new ItemSelectorTag(GTCore.ID, "selector_tag_"+i,i);
ingredientBuilder.put(i, RecipeIngredient.of(selectorTag,1).setNoConsume());
itemBuilder.put(i, selectorTag);
if (i > 15) continue;
coverBuilder.put(i, CoverFactory.builder(CoverSelectorTag::new)
.addTextures(new Texture(GTCore.ID, "block/cover/selector_tags/" + i), new Texture(GTCore.ID, "block/cover/selector_tags/underlay"))
.item((c, t) -> selectorTag).build(GTCore.ID, "selector_tag_"+i));
}
SELECTOR_TAG_INGREDIENTS = ingredientBuilder.build();
SELECTOR_TAG_ITEMS = itemBuilder.build();
SELECTOR_TAG_COVERS = coverBuilder.build();
}
}

public static void init(){

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package io.github.gregtechintergalactical.gtcore.item;

import io.github.gregtechintergalactical.gtcore.data.GTCoreItems;
import muramasa.antimatter.cover.CoverFactory;
import muramasa.antimatter.cover.ICover;
import muramasa.antimatter.cover.IHaveCover;
import muramasa.antimatter.item.ItemBasic;
import muramasa.antimatter.texture.Texture;
import muramasa.antimatter.util.Utils;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player;
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 ItemSelectorTag extends ItemBasic<ItemSelectorTag> implements IHaveCover {

public final int circuitId;

public ItemSelectorTag(String domain, String id, int circuitId, Properties properties) {
super(domain, id, "selector_tags/", properties);
this.circuitId = circuitId;
}

public ItemSelectorTag(String domain, String id, int circuitId) {
super(domain, id, "selector_tags/");
this.circuitId = circuitId;
}

@Override
public Texture[] getTextures() {
return new Texture[]{new Texture(this.domain, "item/basic/" + this.subDir + circuitId)};
}

@Override
public InteractionResultHolder<ItemStack> use(Level worldIn, Player playerIn, InteractionHand handIn) {
int newId = playerIn.isCrouching() ? this.getNewCircuitIdBackward() : this.getNewCircuitIdForward();
ItemStack stack = playerIn.getItemInHand(handIn);
ItemStack newStack = new ItemStack(GTCoreItems.SELECTOR_TAG_ITEMS.get(newId), stack.getCount());
playerIn.setItemInHand(handIn, newStack);
return InteractionResultHolder.consume(stack);
}

private int getNewCircuitIdForward(){
if (this.circuitId == 24){
return 0;
}
return this.circuitId + 1;
}
private int getNewCircuitIdBackward(){
if (this.circuitId == 0){
return 24;
}
return this.circuitId - 1;
}

@Override
public void appendHoverText(ItemStack stack, @Nullable Level level, List<Component> tooltipComponents, TooltipFlag isAdvanced) {
super.appendHoverText(stack, level, tooltipComponents, isAdvanced);
tooltipComponents.add(Utils.translatable("tooltip.gtcore.selector_tag.0"));
tooltipComponents.add(Utils.translatable("tooltip.gtcore.selector_tag.1"));
}

@Override
public CoverFactory getCover() {
if (circuitId > 15) return ICover.emptyFactory;
return GTCoreItems.SELECTOR_TAG_COVERS.get(circuitId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"credit": "Made with Blockbench",
"elements": [
{
"from": [0, 0, 16],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 16, 16], "texture": "#base", "tintindex": 0},
"south": {"uv": [0, 0, 16, 16], "texture": "#base", "tintindex": 0}
}
},
{
"from": [0, 0, 16],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 16, 16], "texture": "#underlay"},
"south": {"uv": [0, 0, 16, 16], "texture": "#underlay"}
}
},
{
"from": [0, 0, 16],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 16, 16], "texture": "#overlay"},
"south": {"uv": [0, 0, 16, 16], "texture": "#overlay"}
}
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 f3e293b

Please sign in to comment.