Registries for Electrodes & Cable Types
- Port my registry commit to 1.21.1! - Added registries for Electrodes and Cable Types. - Winding Machines now tint the main spool instead of requiring partial models for each spool. - Electrode Holders now render the item model of the electrode instead of requiring partial models for each electrode. - Added Resistivity config for Cable Types. - Updated classes to handle the new registries instead of enums. - Moved the ChemicalVatCategory's recipe sprite to a separate method so mixins can target the sprites specifically.
@@ -62,6 +62,8 @@ public class TFMG {
|
||||
|
||||
|
||||
TFMGSoundEvents.prepare();
|
||||
TFMGElectrodes.init();
|
||||
TFMGCableTypes.init();
|
||||
TFMGCreativeTabs.register(modEventBus);
|
||||
TFMGBlocks.init();
|
||||
TFMGBlockEntities.init();
|
||||
|
||||
30
src/main/java/com/drmangotea/tfmg/TFMGRegistries.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.drmangotea.tfmg;
|
||||
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cable_type.CableType;
|
||||
import com.drmangotea.tfmg.content.machinery.vat.electrode_holder.electrode.Electrode;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.neoforged.neoforge.registries.RegistryBuilder;
|
||||
|
||||
import static com.drmangotea.tfmg.TFMG.REGISTRATE;
|
||||
|
||||
public class TFMGRegistries {
|
||||
public static final ResourceKey<Registry<CableType>> CABLE_TYPE = createRegistryKey("cable_types");
|
||||
public static final ResourceKey<Registry<Electrode>> ELECTRODE = createRegistryKey("electrodes");
|
||||
|
||||
public static final Registry<CableType> CABLE_TYPE_REGISTRY = makeSyncedRegistry(CABLE_TYPE);
|
||||
public static final Registry<Electrode> ELECTRODE_REGISTRY = makeSyncedRegistry(ELECTRODE);
|
||||
|
||||
|
||||
private static <T> ResourceKey<Registry<T>> createRegistryKey(String name) {
|
||||
return ResourceKey.createRegistryKey(TFMG.asResource(name));
|
||||
}
|
||||
|
||||
private static <T> Registry<T> makeSyncedRegistry(ResourceKey<Registry<T>> registryKey) {
|
||||
return new RegistryBuilder<>(registryKey).sync(true).create();
|
||||
}
|
||||
|
||||
private static <T> Registry<T> makeRegistry(ResourceKey<Registry<T>> registryKey) {
|
||||
return new RegistryBuilder<>(registryKey).create();
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,17 @@ package com.drmangotea.tfmg.base;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.base.fluid.GasFluidType;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cable_type.CableType;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cable_type.CableTypeBuilder;
|
||||
import com.drmangotea.tfmg.content.machinery.vat.electrode_holder.electrode.Electrode;
|
||||
import com.drmangotea.tfmg.content.machinery.vat.electrode_holder.electrode.ElectrodeBuilder;
|
||||
import com.simibubi.create.content.fluids.VirtualFluid;
|
||||
import com.simibubi.create.foundation.data.CreateRegistrate;
|
||||
import com.simibubi.create.foundation.data.VirtualFluidBuilder;
|
||||
import com.simibubi.create.foundation.item.TooltipModifier;
|
||||
import com.tterrag.registrate.Registrate;
|
||||
import com.tterrag.registrate.builders.FluidBuilder;
|
||||
import com.tterrag.registrate.util.nullness.NonNullFunction;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
@@ -69,4 +74,36 @@ public class TFMGRegistrate extends CreateRegistrate {
|
||||
return TFMG.REGISTRATE.get(name+"_bucket", Registries.ITEM).get();
|
||||
}
|
||||
|
||||
public <T extends CableType> CableTypeBuilder<T, TFMGRegistrate> cableType(NonNullFunction<CableType.Properties, T> factory) {
|
||||
return cableType((TFMGRegistrate) self(), factory);
|
||||
}
|
||||
|
||||
public <T extends CableType> CableTypeBuilder<T, TFMGRegistrate> cableType(String name, NonNullFunction<CableType.Properties, T> factory) {
|
||||
return cableType((TFMGRegistrate) self(), name, factory);
|
||||
}
|
||||
|
||||
public <T extends CableType, P> CableTypeBuilder<T, P> cableType(P parent, NonNullFunction<CableType.Properties, T> factory) {
|
||||
return cableType(parent, currentName(), factory);
|
||||
}
|
||||
|
||||
public <T extends CableType, P> CableTypeBuilder<T, P> cableType(P parent, String name, NonNullFunction<CableType.Properties, T> factory) {
|
||||
return entry(name, callback -> CableTypeBuilder.create(this, parent, name, callback, factory));
|
||||
}
|
||||
|
||||
public <T extends Electrode> ElectrodeBuilder<T, TFMGRegistrate> electrode(NonNullFunction<Electrode.Properties, T> factory) {
|
||||
return electrode((TFMGRegistrate) self(), factory);
|
||||
}
|
||||
|
||||
public <T extends Electrode> ElectrodeBuilder<T, TFMGRegistrate> electrode(String name, NonNullFunction<Electrode.Properties, T> factory) {
|
||||
return electrode((TFMGRegistrate) self(), name, factory);
|
||||
}
|
||||
|
||||
public <T extends Electrode, P> ElectrodeBuilder<T, P> electrode(P parent, NonNullFunction<Electrode.Properties, T> factory) {
|
||||
return electrode(parent, currentName(), factory);
|
||||
}
|
||||
|
||||
public <T extends Electrode, P> ElectrodeBuilder<T, P> electrode(P parent, String name, NonNullFunction<Electrode.Properties, T> factory) {
|
||||
return entry(name, callback -> ElectrodeBuilder.create(this, parent, name, callback, factory));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,9 +2,12 @@ package com.drmangotea.tfmg.base;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.TFMGRegistries;
|
||||
import com.drmangotea.tfmg.base.spark.ElectricSparkParticle;
|
||||
import com.drmangotea.tfmg.base.spark.Spark;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cable_type.CableType;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cables.CablePos;
|
||||
import com.drmangotea.tfmg.content.machinery.vat.electrode_holder.electrode.Electrode;
|
||||
import com.drmangotea.tfmg.registry.TFMGEntityTypes;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
@@ -22,6 +25,7 @@ import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.Mth;
|
||||
@@ -383,4 +387,12 @@ public class TFMGUtils {
|
||||
}
|
||||
|
||||
|
||||
public static Electrode getElectrode(ResourceLocation key) {
|
||||
return TFMGRegistries.ELECTRODE_REGISTRY.get(key);
|
||||
}
|
||||
|
||||
public static CableType getCableType(ResourceLocation key) {
|
||||
return TFMGRegistries.CABLE_TYPE_REGISTRY.get(key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.drmangotea.tfmg.base.events;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.TFMGRegistries;
|
||||
import com.drmangotea.tfmg.content.decoration.tanks.TFMGFluidTankBlockEntity;
|
||||
import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlockEntity;
|
||||
import com.drmangotea.tfmg.content.electricity.base.IElectric;
|
||||
@@ -37,6 +38,7 @@ import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent;
|
||||
import net.neoforged.neoforge.event.AddReloadListenerEvent;
|
||||
import net.neoforged.neoforge.event.level.BlockEvent;
|
||||
import net.neoforged.neoforge.event.level.LevelEvent;
|
||||
import net.neoforged.neoforge.registries.NewRegistryEvent;
|
||||
|
||||
|
||||
@EventBusSubscriber
|
||||
@@ -105,6 +107,13 @@ public class TFMGCommonEvents {
|
||||
CokeOvenBlockEntity.registerCapabilities(event);
|
||||
AirIntakeBlockEntity.registerCapabilities(event);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void newRegistry(NewRegistryEvent event) {
|
||||
event.register(TFMGRegistries.CABLE_TYPE_REGISTRY);
|
||||
event.register(TFMGRegistries.ELECTRODE_REGISTRY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.drmangotea.tfmg.config;
|
||||
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cable_type.ResistivityValues;
|
||||
import com.simibubi.create.api.stress.BlockStressValues;
|
||||
import com.simibubi.create.infrastructure.config.CCommon;
|
||||
|
||||
@@ -60,6 +61,8 @@ public class TFMGConfigs {
|
||||
TFMGStress stress = TFMGConfigs.server().stressValues;
|
||||
BlockStressValues.IMPACTS.registerProvider(stress::getImpact);
|
||||
BlockStressValues.CAPACITIES.registerProvider(stress::getCapacity);
|
||||
TFMGResistivity resistivity = server().resistivityValues;
|
||||
ResistivityValues.RESISTIVITIES.registerProvider(resistivity::getResistivity);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.drmangotea.tfmg.config;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cable_type.CableType;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cable_type.CableTypeBuilder;
|
||||
import com.tterrag.registrate.util.nullness.NonNullUnaryOperator;
|
||||
import it.unimi.dsi.fastutil.objects.Object2DoubleMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2DoubleOpenHashMap;
|
||||
import net.createmod.catnip.config.ConfigBase;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.neoforged.neoforge.common.ModConfigSpec;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.DoubleSupplier;
|
||||
|
||||
public class TFMGResistivity extends ConfigBase {
|
||||
// bump this version to reset configured values.
|
||||
private static final int VERSION = 2;
|
||||
|
||||
// IDs need to be used since configs load before registration
|
||||
|
||||
private static final Object2DoubleMap<ResourceLocation> DEFAULT_RESISTIVITIES = new Object2DoubleOpenHashMap<>();
|
||||
|
||||
protected final Map<ResourceLocation, ModConfigSpec.ConfigValue<Double>> resistivities = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void registerAll(ModConfigSpec.Builder builder) {
|
||||
builder.comment(".", Comments.resistivity).push("resistivity");
|
||||
DEFAULT_RESISTIVITIES.forEach((id, value) -> this.resistivities.put(id, builder.define(id.getPath(), value)));
|
||||
builder.pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "resistivityValues.v" + VERSION;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public DoubleSupplier getResistivity(CableType cableType) {
|
||||
ResourceLocation id = cableType.getKey();
|
||||
ModConfigSpec.ConfigValue<Double> value = this.resistivities.get(id);
|
||||
return value == null ? null : value::get;
|
||||
}
|
||||
|
||||
public static <B extends CableType, P> NonNullUnaryOperator<CableTypeBuilder<B, P>> setNoResistivity() {
|
||||
return setResistivity(0);
|
||||
}
|
||||
|
||||
public static <B extends CableType, P> NonNullUnaryOperator<CableTypeBuilder<B, P>> setResistivity(double value) {
|
||||
return builder -> {
|
||||
//assertFromCreate(builder);
|
||||
ResourceLocation id = TFMG.asResource(builder.getName());
|
||||
DEFAULT_RESISTIVITIES.put(id, value);
|
||||
return builder;
|
||||
};
|
||||
}
|
||||
|
||||
private static class Comments {
|
||||
static String resistivity = "Configure the individual resistivity of cable types.";
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ public class TFMGServerConfig extends ConfigBase {
|
||||
|
||||
|
||||
public final TFMGStress stressValues = nested(0, TFMGStress::new, "Fine tune the kinetic stats of individual components");
|
||||
public final TFMGResistivity resistivityValues = nested(0, TFMGResistivity::new, "Fine tune the resistivity stats of individual cable types");
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.drmangotea.tfmg.content.electricity.connection.cable_type;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
import com.tterrag.registrate.util.entry.ItemEntry;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
public class CableType {
|
||||
private String descriptionId;
|
||||
private final ResourceLocation id;
|
||||
private final int color;
|
||||
private final ItemEntry<?> spool;
|
||||
|
||||
public CableType(Properties properties) {
|
||||
this.id = properties.id;
|
||||
this.color = properties.color;
|
||||
this.spool = properties.spool;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public ItemEntry<?> getSpool() {
|
||||
return this.spool;
|
||||
}
|
||||
|
||||
public String getOrCreateDescriptionId() {
|
||||
if (this.descriptionId == null) {
|
||||
this.descriptionId = Util.makeDescriptionId("cable_type", getKey());
|
||||
}
|
||||
|
||||
return this.descriptionId;
|
||||
}
|
||||
|
||||
public String getDescriptionId() {
|
||||
return this.getOrCreateDescriptionId();
|
||||
}
|
||||
|
||||
public Component getDisplayName() {
|
||||
return Component.translatable(this.getOrCreateDescriptionId());
|
||||
}
|
||||
|
||||
public ResourceLocation getKey() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public static class Properties {
|
||||
private ResourceLocation id;
|
||||
|
||||
int color = 0xffffff;
|
||||
ItemEntry<?> spool = TFMGItems.COPPER_SPOOL;
|
||||
|
||||
public Properties color(int color) {
|
||||
this.color = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Properties spool(ItemEntry<?> spool) {
|
||||
this.spool = spool;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Properties(ResourceLocation id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.drmangotea.tfmg.content.electricity.connection.cable_type;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.TFMGRegistries;
|
||||
import com.tterrag.registrate.AbstractRegistrate;
|
||||
import com.tterrag.registrate.builders.AbstractBuilder;
|
||||
import com.tterrag.registrate.builders.BuilderCallback;
|
||||
import com.tterrag.registrate.util.entry.RegistryEntry;
|
||||
import com.tterrag.registrate.util.nullness.NonNullFunction;
|
||||
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||
import com.tterrag.registrate.util.nullness.NonNullUnaryOperator;
|
||||
import com.tterrag.registrate.util.nullness.NonnullType;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
|
||||
public class CableTypeBuilder<T extends CableType, P> extends AbstractBuilder<CableType, T, P, CableTypeBuilder<T, P>> {
|
||||
|
||||
public static <T extends CableType, P> CableTypeBuilder<T, P> create(AbstractRegistrate<?> owner, P parent, String name, BuilderCallback callback, NonNullFunction<CableType.Properties, T> factory) {
|
||||
return new CableTypeBuilder<>(owner, parent, name, callback, factory);
|
||||
}
|
||||
|
||||
private final NonNullFunction<CableType.Properties, T> factory;
|
||||
|
||||
private NonNullSupplier<CableType.Properties> initialProperties = () -> new CableType.Properties(ResourceLocation.fromNamespaceAndPath(getOwner().getModid(), getName()));
|
||||
private NonNullFunction<CableType.Properties, CableType.Properties> propertiesCallback = NonNullUnaryOperator.identity();
|
||||
|
||||
public CableTypeBuilder(AbstractRegistrate<?> owner, P parent, String name, BuilderCallback callback, NonNullFunction<CableType.Properties, T> factory) {
|
||||
super(owner, parent, name, callback, TFMGRegistries.CABLE_TYPE);
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
public CableTypeBuilder<T, P> properties(NonNullUnaryOperator<CableType.Properties> func) {
|
||||
propertiesCallback = propertiesCallback.andThen(func);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CableTypeBuilder<T, P> initialProperties(NonNullSupplier<CableType.Properties> properties) {
|
||||
initialProperties = properties;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CableTypeBuilder<T, P> defaultLang() {
|
||||
return lang(CableType::getDescriptionId);
|
||||
}
|
||||
|
||||
public CableTypeBuilder<T, P> lang(String name) {
|
||||
return lang(CableType::getDescriptionId, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NonnullType T createEntry() {
|
||||
CableType.Properties properties = this.initialProperties.get();
|
||||
properties = propertiesCallback.apply(properties);
|
||||
return factory.apply(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RegistryEntry<CableType, T> createEntryWrapper(DeferredHolder<CableType, T> delegate) {
|
||||
return new CableTypeEntry<>(getOwner(), delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CableTypeEntry<T> register() {
|
||||
//Registry.register(TFMGRegistries.CABLE_TYPE_REGISTRY, ResourceLocation.fromNamespaceAndPath(getOwner().getModid(), getName()), createEntry());
|
||||
return (CableTypeEntry<T>) super.register();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.drmangotea.tfmg.content.electricity.connection.cable_type;
|
||||
|
||||
import com.tterrag.registrate.AbstractRegistrate;
|
||||
import com.tterrag.registrate.util.entry.RegistryEntry;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
|
||||
public class CableTypeEntry<T extends CableType> extends RegistryEntry<CableType, T> {
|
||||
public CableTypeEntry(AbstractRegistrate<?> owner, DeferredHolder<CableType, T> delegate) {
|
||||
super(owner, delegate);
|
||||
}
|
||||
|
||||
public static <T extends CableType> CableTypeEntry<T> cast(RegistryEntry<CableType, T> entry) {
|
||||
return RegistryEntry.cast(CableTypeEntry.class, entry);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.drmangotea.tfmg.content.electricity.connection.cable_type;
|
||||
|
||||
import com.simibubi.create.api.registry.SimpleRegistry;
|
||||
|
||||
import java.util.function.DoubleSupplier;
|
||||
|
||||
public class ResistivityValues {
|
||||
public static final SimpleRegistry<CableType, DoubleSupplier> RESISTIVITIES = SimpleRegistry.create();
|
||||
|
||||
public static double getResistivity(CableType conductor) {
|
||||
DoubleSupplier supplier = RESISTIVITIES.get(conductor);
|
||||
return supplier == null ? 0 : supplier.getAsDouble();
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.drmangotea.tfmg.content.electricity.connection.cables;
|
||||
|
||||
import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cable_type.CableType;
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
import com.tterrag.registrate.util.entry.ItemEntry;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
@@ -46,7 +48,7 @@ public class CableConnection {
|
||||
|
||||
compoundTag.putBoolean("Visible", visible);
|
||||
|
||||
compoundTag.putString("CableType", type.toString());
|
||||
compoundTag.putString("CableType", type.getKey().toString());
|
||||
|
||||
return compoundTag;
|
||||
}
|
||||
@@ -63,29 +65,11 @@ public class CableConnection {
|
||||
BlockPos blockPos1 = BlockPos.of(compoundTag.getLong("Pos"));
|
||||
|
||||
boolean visible = compoundTag.getBoolean("Visible");
|
||||
CableType type = CableType.valueOf(compoundTag.getString("CableType"));
|
||||
CableType type = TFMGUtils.getCableType(ResourceLocation.parse(compoundTag.getString("CableType")));
|
||||
return new CableConnection(pos1,pos2,blockPos1,type,visible);
|
||||
}
|
||||
public float getLength(){
|
||||
return TFMGUtils.getDistance(new BlockPos((int) pos1.x(), (int) pos1.y(), (int) pos1.z()),new BlockPos((int) pos2.x(), (int) pos2.y(), (int) pos2.z()), false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public enum CableType{
|
||||
NONE(TFMGItems.COPPER_WIRE, 0,0xffffff),
|
||||
COPPER(TFMGItems.COPPER_WIRE, 0.00188f,0xD8735A),
|
||||
ALUMINUM(TFMGItems.ALUMINUM_WIRE, 0.0027f,0xEDEFEF),
|
||||
CONSTANTAN(TFMGItems.CONSTANTAN_WIRE, 1f,0xEDEFEF),
|
||||
STEEL_REINFORCED_ALUMINUM(TFMGItems.COPPER_WIRE, 0.0027f,0xB8A08D)
|
||||
;
|
||||
public final ItemEntry<?> wire;
|
||||
public final float resistivity;
|
||||
public final int color;
|
||||
CableType(ItemEntry<?> wire, float resistivity, int color){
|
||||
this.wire = wire;
|
||||
this.resistivity = resistivity;
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class CableConnectorBlockEntity extends ElectricBlockEntity implements IH
|
||||
return;
|
||||
|
||||
for (CableConnection connection : connections) {
|
||||
ItemEntity itemToDrop = new ItemEntity(level, getBlockPos().getX() + 0.5f, getBlockPos().getY() + 0.5f, getBlockPos().getZ() + 0.5f, new ItemStack(connection.type.wire.get(), (int) (connection.getLength()/8)));
|
||||
ItemEntity itemToDrop = new ItemEntity(level, getBlockPos().getX() + 0.5f, getBlockPos().getY() + 0.5f, getBlockPos().getZ() + 0.5f, new ItemStack(connection.type.getSpool().get(), (int) (connection.getLength()/8)));
|
||||
if (itemToDrop.getItem().getCount() > 0) {
|
||||
level.addFreshEntity(itemToDrop);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class CableConnectorRenderer extends SafeBlockEntityRenderer<CableConnect
|
||||
|
||||
for (CableConnection connection : be.connections) {
|
||||
if (connection.visible)
|
||||
TFMGUtils.renderWire(be.getLevel(), ms, bufferSource, connection.pos2, connection.pos1, connection.getLength() / 4500, new Color(connection.type.color).getRed(), new Color(connection.type.color).getGreen(), new Color(connection.type.color).getBlue());
|
||||
TFMGUtils.renderWire(be.getLevel(), ms, bufferSource, connection.pos2, connection.pos1, connection.getLength() / 4500, new Color(connection.type.getColor()).getRed(), new Color(connection.type.getColor()).getGreen(), new Color(connection.type.getColor()).getBlue());
|
||||
}
|
||||
|
||||
//for (BlockPos connection : be.connections) {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.drmangotea.tfmg.content.machinery.misc.winding_machine;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.TFMGRegistries;
|
||||
import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cable_type.CableType;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnection;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnectorBlockEntity;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cables.CablePos;
|
||||
@@ -15,6 +17,7 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
@@ -31,20 +34,19 @@ import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.simibubi.create.foundation.utility.Debug.debugMessage;
|
||||
|
||||
public class SpoolItem extends Item {
|
||||
|
||||
public final PartialModel model;
|
||||
public final int barColor;
|
||||
public final CableConnection.CableType type;
|
||||
public final ResourceLocation cableTypeKey;
|
||||
|
||||
public SpoolItem(Properties properties, PartialModel model, int barColor, CableConnection.CableType type) {
|
||||
public SpoolItem(Properties properties, int barColor, ResourceLocation cableTypeKey) {
|
||||
super(properties);
|
||||
this.model = model;
|
||||
this.barColor = barColor;
|
||||
this.type = type;
|
||||
this.cableTypeKey = cableTypeKey;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,13 +110,13 @@ public class SpoolItem extends Item {
|
||||
if(level.isClientSide)
|
||||
return InteractionResult.SUCCESS;
|
||||
|
||||
if(type == CableConnection.CableType.NONE)
|
||||
if(Objects.equals(cableTypeKey, TFMG.asResource("empty")))
|
||||
return InteractionResult.PASS;
|
||||
|
||||
if(level.getBlockEntity(pos) instanceof CableConnectorBlockEntity be){
|
||||
if(stack.get(TFMGDataComponents.POSITION)!=null){
|
||||
BlockPos posToConnect = BlockPos.of(stack.get(TFMGDataComponents.POSITION));
|
||||
if(posToConnect == pos){
|
||||
if(posToConnect.equals(pos)){
|
||||
stack.set(TFMGDataComponents.POSITION,0l);
|
||||
if (level.isClientSide)
|
||||
player.displayClientMessage(CreateLang.translateDirect("wires.cant_connect_itself")
|
||||
@@ -128,9 +130,10 @@ public class SpoolItem extends Item {
|
||||
if(level.getBlockEntity(posToConnect) instanceof CableConnectorBlockEntity otherBE) {
|
||||
//CableConnectorBlockEntity connectedBe1 = pos.asLong()>posToConnect.asLong() ? otherBE : be;
|
||||
//CableConnectorBlockEntity connectedBe2= pos.asLong()>posToConnect.asLong() ? be : otherBE;
|
||||
//
|
||||
CableConnection connection1 = new CableConnection(be.getCablePosition(), otherBE.getCablePosition(), otherBE.getBlockPos(),type,true);
|
||||
CableConnection connection2 = new CableConnection(otherBE.getCablePosition(), be.getCablePosition(), be.getBlockPos(),type,false);
|
||||
CableType cableType = TFMGUtils.getCableType(cableTypeKey);
|
||||
|
||||
CableConnection connection1 = new CableConnection(be.getCablePosition(), otherBE.getCablePosition(), otherBE.getBlockPos(),cableType,true);
|
||||
CableConnection connection2 = new CableConnection(otherBE.getCablePosition(), be.getCablePosition(), be.getBlockPos(),cableType,false);
|
||||
|
||||
float wireCost = (connection1.getLength()/8);
|
||||
|
||||
@@ -224,7 +227,7 @@ public class SpoolItem extends Item {
|
||||
|
||||
@Override
|
||||
public boolean isBarVisible(ItemStack stack) {
|
||||
return model != null;
|
||||
return !Objects.equals(cableTypeKey, TFMG.asResource("empty")) && TFMGRegistries.CABLE_TYPE_REGISTRY.containsKey(cableTypeKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,18 +52,18 @@ public class WindingMachineRenderer extends KineticBlockEntityRenderer<WindingMa
|
||||
.uncenter()
|
||||
.renderInto(ms, vb);
|
||||
|
||||
if (((SpoolItem) be.spool.getItem()).model != null) {
|
||||
CachedBuffers.partial(((SpoolItem) be.spool.getItem()).model, blockState)
|
||||
if (!be.spool.isEmpty()) {
|
||||
CachedBuffers.partial(TFMGPartialModels.SPOOL_WIRE, blockState)
|
||||
.light(light)
|
||||
.center()
|
||||
.rotateYDegrees(blockState.getValue(HORIZONTAL_FACING).getAxis() == Direction.Axis.Z ? Math.abs(blockState.getValue(FACING).toYRot() - 180) : blockState.getValue(FACING).toYRot())
|
||||
.translateZ(-0.4f)
|
||||
.translateY(0.4f)
|
||||
.color(be.spool.getBarColor())
|
||||
.rotateXDegrees(be.angle)
|
||||
.uncenter()
|
||||
.renderInto(ms, vb);
|
||||
if (!be.inventory.isEmpty()) {
|
||||
|
||||
CachedBuffers.partial(be.getSpeed() != 0 ? TFMGPartialModels.CONNNECTING_WIRE_ANIMATED : TFMGPartialModels.CONNNECTING_WIRE, blockState)
|
||||
.light(light)
|
||||
.center()
|
||||
@@ -75,6 +75,7 @@ public class WindingMachineRenderer extends KineticBlockEntityRenderer<WindingMa
|
||||
.uncenter()
|
||||
.renderInto(ms, vb);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (!be.inventory.isEmpty()) {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.drmangotea.tfmg.content.machinery.vat.electrode_holder;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.content.electricity.base.IElectric;
|
||||
import com.drmangotea.tfmg.content.machinery.vat.electrode_holder.electrode.Electrode;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -25,15 +28,21 @@ public class ElectrodeHolderBlock extends Block implements IBE<ElectrodeHolderBl
|
||||
if(hand == InteractionHand.OFF_HAND)
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
if(level.getBlockEntity(pos) instanceof ElectrodeHolderBlockEntity be){
|
||||
ElectrodeHolderBlockEntity.ElectrodeType electrodeType = be.electrodeType;
|
||||
ItemStack stackInside = electrodeType.item;
|
||||
Electrode electrode = be.electrode;
|
||||
ItemStack stackInside = electrode.getStack();
|
||||
if(stack.is(stackInside.getItem()))
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
if(be.setElectrode(stack, true)) {
|
||||
player.setItemInHand(hand, electrodeType.item);
|
||||
player.setItemInHand(hand, electrode.getStack());
|
||||
be.setElectrode(stack, false);
|
||||
return ItemInteractionResult.SUCCESS;
|
||||
}
|
||||
if (player.isShiftKeyDown() && player.getItemInHand(hand).isEmpty()) {
|
||||
if (be.electrode == TFMGUtils.getElectrode(TFMG.asResource("none"))) return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
player.setItemInHand(hand, electrode.getStack());
|
||||
be.setElectrode(TFMGUtils.getElectrode(TFMG.asResource("none")), false);
|
||||
return ItemInteractionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
}
|
||||
|
||||
@@ -1,31 +1,32 @@
|
||||
package com.drmangotea.tfmg.content.machinery.vat.electrode_holder;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.TFMGRegistries;
|
||||
import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.config.TFMGConfigs;
|
||||
import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity;
|
||||
import com.drmangotea.tfmg.content.machinery.vat.base.IVatMachine;
|
||||
import com.drmangotea.tfmg.content.machinery.vat.base.VatBlock;
|
||||
import com.drmangotea.tfmg.content.machinery.vat.base.VatBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.drmangotea.tfmg.content.machinery.vat.electrode_holder.electrode.Electrode;
|
||||
import com.simibubi.create.foundation.utility.CreateLang;
|
||||
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ElectrodeHolderBlockEntity extends ElectricBlockEntity implements IVatMachine {
|
||||
|
||||
ElectrodeType electrodeType = ElectrodeType.NONE;
|
||||
Electrode electrode = TFMGUtils.getElectrode(TFMG.asResource("none"));
|
||||
boolean isTallEnough = true;
|
||||
|
||||
public ElectrodeHolderBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
@@ -40,10 +41,12 @@ public class ElectrodeHolderBlockEntity extends ElectricBlockEntity implements I
|
||||
|
||||
|
||||
public boolean setElectrode(ItemStack modeItem, boolean simulate) {
|
||||
for (ElectrodeType type : ElectrodeType.values()) {
|
||||
if (type.item.is(modeItem.getItem())) {
|
||||
if (level == null) return false;
|
||||
for (Electrode electrode : TFMGRegistries.ELECTRODE_REGISTRY.stream().toList()) {
|
||||
if (electrode.getStack().isEmpty()) continue;
|
||||
if (modeItem.is(electrode.getStack().getItem())) {
|
||||
if (!simulate) {
|
||||
electrodeType = type;
|
||||
this.electrode = electrode;
|
||||
} else return true;
|
||||
}
|
||||
}
|
||||
@@ -68,14 +71,7 @@ public class ElectrodeHolderBlockEntity extends ElectricBlockEntity implements I
|
||||
|
||||
@Override
|
||||
public float resistance() {
|
||||
|
||||
if (electrodeType != ElectrodeType.NONE) {
|
||||
if (electrodeType == ElectrodeType.GRAPHITE) {
|
||||
return 300;
|
||||
} else return 100;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return this.electrode.getResistance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,13 +79,11 @@ public class ElectrodeHolderBlockEntity extends ElectricBlockEntity implements I
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean setElectrode(String name, boolean simulate) {
|
||||
for (ElectrodeType type : ElectrodeType.values()) {
|
||||
if (Objects.equals(type.name, name)) {
|
||||
if (!simulate) {
|
||||
electrodeType = type;
|
||||
} else return true;
|
||||
}
|
||||
public boolean setElectrode(Electrode electrode, boolean simulate) {
|
||||
if (electrode != null) {
|
||||
if (!simulate) {
|
||||
this.electrode = electrode;
|
||||
} else return true;
|
||||
}
|
||||
if (!simulate && hasLevel())
|
||||
VatBlock.updateVatState(getBlockState(), getLevel(), getBlockPos().relative(Direction.DOWN));
|
||||
@@ -115,11 +109,8 @@ public class ElectrodeHolderBlockEntity extends ElectricBlockEntity implements I
|
||||
|
||||
@Override
|
||||
public void write(CompoundTag compound, HolderLookup.Provider registries, boolean clientPacket) {
|
||||
for (ElectrodeType electrode : ElectrodeType.values()) {
|
||||
if (electrode == electrodeType) {
|
||||
compound.putString("Electrode", electrode.name);
|
||||
}
|
||||
}
|
||||
compound.putString("Electrode", electrode.getKey().toString());
|
||||
|
||||
super.write(compound,registries , clientPacket);
|
||||
}
|
||||
|
||||
@@ -127,20 +118,13 @@ public class ElectrodeHolderBlockEntity extends ElectricBlockEntity implements I
|
||||
protected void read(CompoundTag compound, HolderLookup.Provider registries, boolean clientPacket) {
|
||||
super.read(compound,registries , clientPacket);
|
||||
|
||||
setElectrode(compound.getString("Electrode"), false);
|
||||
setElectrode(TFMGUtils.getElectrode(ResourceLocation.parse(compound.getString("Electrode"))), false);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOperationId() {
|
||||
|
||||
|
||||
return switch (electrodeType) {
|
||||
|
||||
case NONE -> "";
|
||||
case COPPER, ZINC -> isOperational() ? "tfmg:electrode" : "";
|
||||
case GRAPHITE -> isOperational() ? "tfmg:graphite_electrode" : "";
|
||||
};
|
||||
return isOperational() ? electrode.getOperationId() : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -154,22 +138,4 @@ public class ElectrodeHolderBlockEntity extends ElectricBlockEntity implements I
|
||||
}
|
||||
|
||||
|
||||
enum ElectrodeType {
|
||||
|
||||
NONE("none", ItemStack.EMPTY, null),
|
||||
COPPER("copper", TFMGItems.COPPER_ELECTRODE.asStack(), TFMGPartialModels.COPPER_ELECTRODE),
|
||||
ZINC("zinc", TFMGItems.ZINC_ELECTRODE.asStack(), TFMGPartialModels.ZINC_ELECTRODE),
|
||||
GRAPHITE("graphite", TFMGItems.GRAPHITE_ELECTRODE.asStack(), TFMGPartialModels.GRAPHITE_ELECTRODE);
|
||||
|
||||
public final String name;
|
||||
public final ItemStack item;
|
||||
public final PartialModel model;
|
||||
|
||||
ElectrodeType(String name, ItemStack stack, PartialModel model) {
|
||||
this.name = name;
|
||||
this.item = stack;
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,27 @@
|
||||
package com.drmangotea.tfmg.content.machinery.vat.electrode_holder;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
|
||||
import net.createmod.catnip.render.CachedBuffers;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class ElectrodeHolderRenderer extends SafeBlockEntityRenderer<ElectrodeHolderBlockEntity> {
|
||||
|
||||
private final ItemRenderer itemRenderer;
|
||||
|
||||
public ElectrodeHolderRenderer(BlockEntityRendererProvider.Context context) {
|
||||
this.itemRenderer = context.getItemRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -24,16 +32,17 @@ public class ElectrodeHolderRenderer extends SafeBlockEntityRenderer<ElectrodeHo
|
||||
BlockState blockState = be.getBlockState();
|
||||
|
||||
|
||||
if (be.electrodeType == ElectrodeHolderBlockEntity.ElectrodeType.NONE)
|
||||
if (be.electrode == TFMGUtils.getElectrode(TFMG.asResource("none")))
|
||||
return;
|
||||
if (be.electrodeType.model == null)
|
||||
if (be.electrode.getStack().isEmpty())
|
||||
return;
|
||||
|
||||
|
||||
CachedBuffers.partial(be.electrodeType.model, blockState)
|
||||
.light(LevelRenderer.getLightColor(be.getLevel(), be.getBlockPos().below()))
|
||||
.translateY(-1)
|
||||
.renderInto(ms, buffer.getBuffer(RenderType.cutoutMipped()));
|
||||
ms.pushPose();
|
||||
ms.mulPose(Axis.XP.rotationDegrees(0));
|
||||
ms.translate(0.5, -1.4369, 0.5);
|
||||
ms.scale(3.33f, 3.33f, 3.33f);
|
||||
itemRenderer.renderStatic(be.electrode.getStack(), ItemDisplayContext.GROUND, LevelRenderer.getLightColor(be.getLevel(), be.getBlockPos().below()), OverlayTexture.NO_OVERLAY, ms, buffer, be.getLevel(), 0);
|
||||
ms.popPose();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.drmangotea.tfmg.content.machinery.vat.electrode_holder.electrode;
|
||||
|
||||
import com.tterrag.registrate.util.entry.ItemEntry;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class Electrode {
|
||||
private String descriptionId;
|
||||
private final ResourceLocation id;
|
||||
private final ItemEntry<?> item;
|
||||
private final int resistance;
|
||||
private final String operationId;
|
||||
|
||||
public Electrode(Properties properties) {
|
||||
this.id = properties.id;
|
||||
this.item = properties.item;
|
||||
this.resistance = properties.resistance;
|
||||
this.operationId = properties.operationId;
|
||||
}
|
||||
|
||||
public ItemEntry<?> getItem() {
|
||||
return this.item;
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return getItem() != null ? getItem().asStack() : ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public int getResistance() {
|
||||
return this.resistance;
|
||||
}
|
||||
|
||||
public String getOperationId() {
|
||||
return this.operationId;
|
||||
}
|
||||
|
||||
public String getOrCreateDescriptionId() {
|
||||
if (this.descriptionId == null) {
|
||||
this.descriptionId = Util.makeDescriptionId("electrode", getKey());
|
||||
}
|
||||
|
||||
return this.descriptionId;
|
||||
}
|
||||
|
||||
public String getDescriptionId() {
|
||||
return this.getOrCreateDescriptionId();
|
||||
}
|
||||
|
||||
public Component getDisplayName() {
|
||||
return Component.translatable(this.getOrCreateDescriptionId());
|
||||
}
|
||||
|
||||
public ResourceLocation getKey() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public static class Properties {
|
||||
private ResourceLocation id;
|
||||
|
||||
ItemEntry<?> item;
|
||||
int resistance = 0;
|
||||
String operationId = "";
|
||||
|
||||
public Properties item(ItemEntry<?> item) {
|
||||
this.item = item;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Properties resistance(int resistance) {
|
||||
this.resistance = resistance;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Properties operationId(String operationId) {
|
||||
this.operationId = operationId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Properties(ResourceLocation id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.drmangotea.tfmg.content.machinery.vat.electrode_holder.electrode;
|
||||
|
||||
import com.drmangotea.tfmg.TFMGRegistries;
|
||||
import com.tterrag.registrate.AbstractRegistrate;
|
||||
import com.tterrag.registrate.builders.AbstractBuilder;
|
||||
import com.tterrag.registrate.builders.BuilderCallback;
|
||||
import com.tterrag.registrate.util.entry.RegistryEntry;
|
||||
import com.tterrag.registrate.util.nullness.NonNullFunction;
|
||||
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||
import com.tterrag.registrate.util.nullness.NonNullUnaryOperator;
|
||||
import com.tterrag.registrate.util.nullness.NonnullType;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
|
||||
public class ElectrodeBuilder<T extends Electrode, P> extends AbstractBuilder<Electrode, T, P, ElectrodeBuilder<T, P>> {
|
||||
|
||||
public static <T extends Electrode, P> ElectrodeBuilder<T, P> create(AbstractRegistrate<?> owner, P parent, String name, BuilderCallback callback, NonNullFunction<Electrode.Properties, T> factory) {
|
||||
return new ElectrodeBuilder<>(owner, parent, name, callback, factory);
|
||||
}
|
||||
|
||||
private final NonNullFunction<Electrode.Properties, T> factory;
|
||||
|
||||
private NonNullSupplier<Electrode.Properties> initialProperties = () -> new Electrode.Properties(ResourceLocation.fromNamespaceAndPath(getOwner().getModid(), getName()));
|
||||
private NonNullFunction<Electrode.Properties, Electrode.Properties> propertiesCallback = NonNullUnaryOperator.identity();
|
||||
|
||||
public ElectrodeBuilder(AbstractRegistrate<?> owner, P parent, String name, BuilderCallback callback, NonNullFunction<Electrode.Properties, T> factory) {
|
||||
super(owner, parent, name, callback, TFMGRegistries.ELECTRODE);
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
public ElectrodeBuilder<T, P> properties(NonNullUnaryOperator<Electrode.Properties> func) {
|
||||
propertiesCallback = propertiesCallback.andThen(func);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ElectrodeBuilder<T, P> initialProperties(NonNullSupplier<Electrode.Properties> properties) {
|
||||
initialProperties = properties;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ElectrodeBuilder<T, P> defaultLang() {
|
||||
return lang(Electrode::getDescriptionId);
|
||||
}
|
||||
|
||||
public ElectrodeBuilder<T, P> lang(String name) {
|
||||
return lang(Electrode::getDescriptionId, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NonnullType T createEntry() {
|
||||
Electrode.Properties properties = this.initialProperties.get();
|
||||
properties = propertiesCallback.apply(properties);
|
||||
return factory.apply(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RegistryEntry<Electrode, T> createEntryWrapper(DeferredHolder<Electrode, T> delegate) {
|
||||
return new ElectrodeEntry<>(getOwner(), delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ElectrodeEntry<T> register() {
|
||||
//Registry.register(TFMGRegistries.ELECTRODE_REGISTRY, ResourceLocation.fromNamespaceAndPath(getOwner().getModid(), getName()), createEntry());
|
||||
return (ElectrodeEntry<T>) super.register();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.drmangotea.tfmg.content.machinery.vat.electrode_holder.electrode;
|
||||
|
||||
import com.tterrag.registrate.AbstractRegistrate;
|
||||
import com.tterrag.registrate.util.entry.RegistryEntry;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
|
||||
public class ElectrodeEntry<T extends Electrode> extends RegistryEntry<Electrode, T> {
|
||||
public ElectrodeEntry(AbstractRegistrate<?> owner, DeferredHolder<Electrode, T> delegate) {
|
||||
super(owner, delegate);
|
||||
}
|
||||
|
||||
public static <T extends Electrode> ElectrodeEntry<T> cast(RegistryEntry<Electrode, T> entry) {
|
||||
return RegistryEntry.cast(ElectrodeEntry.class, entry);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.drmangotea.tfmg.mixin;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mixin(BuiltInRegistries.class)
|
||||
public class BuiltInRegistriesMixin {
|
||||
static {
|
||||
//TFMGBuiltInRegistries.init();
|
||||
}
|
||||
|
||||
@WrapOperation(method = "validate", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/Registry;forEach(Ljava/util/function/Consumer;)V"))
|
||||
private static <T extends Registry<?>> void create$ourRegistriesAreNotEmpty(Registry<T> instance, Consumer<T> consumer, Operation<Void> original) {
|
||||
Consumer<T> callback = (t) -> {
|
||||
if (!t.key().location().getNamespace().equals(TFMG.MOD_ID))
|
||||
consumer.accept(t);
|
||||
};
|
||||
|
||||
original.call(instance, callback);
|
||||
}
|
||||
}
|
||||
@@ -88,31 +88,11 @@ public class ChemicalVatCategory extends CreateRecipeCategory<VatMachineRecipe>
|
||||
|
||||
TFMGGuiTextures.VAT.render(graphics, 0, 24);
|
||||
|
||||
if (allowedVatTypes.contains("tfmg:firebrick_lined_vat") && allowedVatTypes.size() == 1) {
|
||||
TFMGGuiTextures.FIREPROOF_BRICK_OVERLAY.render(graphics, 55 - 48, 32);
|
||||
}
|
||||
drawVatTypes(allowedVatTypes, graphics);
|
||||
|
||||
drawSprites(machines, graphics);
|
||||
renderHeated(recipe.getRequiredHeat(), graphics);
|
||||
|
||||
if (machines.contains("tfmg:mixing")) {
|
||||
TFMGGuiTextures.VAT_MACHINE.render(graphics, 55 - 12, 0);
|
||||
TFMGGuiTextures.MIXER.render(graphics, 55 - 19, 32);
|
||||
}
|
||||
if (machines.contains("tfmg:electrode")) {
|
||||
TFMGGuiTextures.VAT_MACHINE.render(graphics, 55 - 12 - 32, 0);
|
||||
TFMGGuiTextures.VAT_MACHINE.render(graphics, 55 - 12 + 32, 0);
|
||||
TFMGGuiTextures.ELECTRODE.render(graphics, 55 - 3 - 32, 32);
|
||||
TFMGGuiTextures.ELECTRODE.render(graphics, 55 - 3 + 32, 32);
|
||||
}
|
||||
if (machines.contains("tfmg:graphite_electrode")) {
|
||||
TFMGGuiTextures.VAT_MACHINE.render(graphics, 55 - 12 - 32, 0);
|
||||
TFMGGuiTextures.VAT_MACHINE.render(graphics, 55 - 12 + 32, 0);
|
||||
TFMGGuiTextures.VAT_MACHINE.render(graphics, 55 - 12, 0);
|
||||
TFMGGuiTextures.GRAPHITE_ELECTRODE.render(graphics, 55 - 4 - 32, 32);
|
||||
TFMGGuiTextures.GRAPHITE_ELECTRODE.render(graphics, 55 - 4 + 32, 32);
|
||||
TFMGGuiTextures.GRAPHITE_ELECTRODE.render(graphics, 55 - 4, 32);
|
||||
}
|
||||
if (recipe.getRequiredHeat() == HeatCondition.HEATED){
|
||||
TFMGGuiTextures.VAT_HEATER.render(graphics, 55 - 10, 109);
|
||||
}
|
||||
int pos = 55;
|
||||
int width = ((recipe.getFluidIngredients().size()) * 21) / 2;
|
||||
for (int i = 0; i < recipe.getFluidIngredients().size(); i++) {
|
||||
@@ -137,5 +117,38 @@ public class ChemicalVatCategory extends CreateRecipeCategory<VatMachineRecipe>
|
||||
|
||||
}
|
||||
|
||||
private void renderHeated(HeatCondition heatCondition, GuiGraphics graphics) {
|
||||
if (heatCondition == HeatCondition.HEATED)
|
||||
TFMGGuiTextures.VAT_HEATER.render(graphics, 55 - 10, 109);
|
||||
if (heatCondition == HeatCondition.SUPERHEATED)
|
||||
TFMGGuiTextures.VAT_SUPERHEATER.render(graphics, 55 - 10, 109);
|
||||
}
|
||||
|
||||
private void drawVatTypes(List<String> allowedVatTypes, GuiGraphics graphics) {
|
||||
if (allowedVatTypes.contains("firebrick_lined_vat") && allowedVatTypes.size() == 1) {
|
||||
TFMGGuiTextures.FIREPROOF_BRICK_OVERLAY.render(graphics, 55 - 48, 32);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawSprites(List<String> machines, GuiGraphics graphics) {
|
||||
if (machines.contains("tfmg:mixing")) {
|
||||
TFMGGuiTextures.VAT_MACHINE.render(graphics, 55 - 12, 0);
|
||||
TFMGGuiTextures.MIXER.render(graphics, 55 - 19, 32);
|
||||
}
|
||||
if (machines.contains("tfmg:electrode")) {
|
||||
TFMGGuiTextures.VAT_MACHINE.render(graphics, 55 - 12 - 32, 0);
|
||||
TFMGGuiTextures.VAT_MACHINE.render(graphics, 55 - 12 + 32, 0);
|
||||
TFMGGuiTextures.ELECTRODE.render(graphics, 55 - 3 - 32, 32);
|
||||
TFMGGuiTextures.ELECTRODE.render(graphics, 55 - 3 + 32, 32);
|
||||
}
|
||||
if (machines.contains("tfmg:graphite_electrode")) {
|
||||
TFMGGuiTextures.VAT_MACHINE.render(graphics, 55 - 12 - 32, 0);
|
||||
TFMGGuiTextures.VAT_MACHINE.render(graphics, 55 - 12 + 32, 0);
|
||||
TFMGGuiTextures.VAT_MACHINE.render(graphics, 55 - 12, 0);
|
||||
TFMGGuiTextures.GRAPHITE_ELECTRODE.render(graphics, 55 - 4 - 32, 32);
|
||||
TFMGGuiTextures.GRAPHITE_ELECTRODE.render(graphics, 55 - 4 + 32, 32);
|
||||
TFMGGuiTextures.GRAPHITE_ELECTRODE.render(graphics, 55 - 4, 32);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,14 +49,12 @@ public class WindingCategory extends CreateRecipeCategory<WindingRecipe> {
|
||||
AllGuiTextures.JEI_ARROW.render(graphics, 85, 32);
|
||||
AllGuiTextures.JEI_DOWN_ARROW.render(graphics, 43, 4);
|
||||
|
||||
PartialModel coil = null;
|
||||
int coilColor = 0;
|
||||
|
||||
if (recipe.getIngredients().get(1).getItems()[0].getItem() instanceof SpoolItem) {
|
||||
|
||||
coil = ((SpoolItem)recipe.getIngredients().get(1).getItems()[0].getItem()).model;
|
||||
|
||||
coilColor = recipe.getIngredients().get(1).getItems()[0].getBarColor();
|
||||
}
|
||||
this.windingMachine.draw(graphics, 48, 27,coil,true);
|
||||
this.windingMachine.draw(graphics, 48, 27,coilColor,true);
|
||||
graphics.drawString(Minecraft.getInstance().font, recipe.getProcessingDuration() + " Turns", 86.0F, 9.0F, 4210752, false);
|
||||
}
|
||||
|
||||
@@ -77,18 +75,16 @@ public class WindingCategory extends CreateRecipeCategory<WindingRecipe> {
|
||||
|
||||
PoseStack ms = graphics.pose();
|
||||
|
||||
PartialModel coil = null;
|
||||
int coilColor = 0;
|
||||
|
||||
if (recipe.getRecipe().getIngredients().get(1).getItems()[0].getItem() instanceof SpoolItem) {
|
||||
|
||||
coil = ((SpoolItem)recipe.getRecipe().getIngredients().get(1).getItems()[0].getItem()).model;
|
||||
|
||||
coilColor = recipe.getRecipe().getIngredients().get(1).getItems()[0].getBarColor();
|
||||
}
|
||||
windingMachine.offset = index;
|
||||
ms.pushPose();
|
||||
ms.translate(0.0, 67, 0.0);
|
||||
ms.scale(0.7F, 0.7F, 0.7F);
|
||||
this.windingMachine.draw(graphics, this.getWidth() / 2, 0,coil,false);
|
||||
this.windingMachine.draw(graphics, this.getWidth() / 2, 0,coilColor,false);
|
||||
ms.popPose();
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ public class WindingMachine extends AnimatedKinetics {
|
||||
public WindingMachine() {
|
||||
}
|
||||
|
||||
public void draw(GuiGraphics graphics, int xOffset, int yOffset, PartialModel coil, boolean shadow) {
|
||||
public void draw(GuiGraphics graphics, int xOffset, int yOffset, int coilColor, boolean shadow) {
|
||||
|
||||
PoseStack matrixStack = graphics.pose();
|
||||
|
||||
@@ -42,12 +42,13 @@ public class WindingMachine extends AnimatedKinetics {
|
||||
.atLocal(-0.15, -0.4, -0.23)
|
||||
.scale(scale)
|
||||
.render(graphics);
|
||||
if (coil != null)
|
||||
blockElement(coil)
|
||||
.rotateBlock(22.5, 22.5, 0)
|
||||
.atLocal(-0.15, -0.4, -0.23)
|
||||
.scale(scale)
|
||||
.render(graphics);
|
||||
|
||||
blockElement(TFMGPartialModels.SPOOL_WIRE)
|
||||
.rotateBlock(22.5, 22.5, 0)
|
||||
.atLocal(-0.15, -0.4, -0.23)
|
||||
.color(coilColor)
|
||||
.scale(scale)
|
||||
.render(graphics);
|
||||
|
||||
matrixStack.popPose();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.drmangotea.tfmg.registry;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.TFMGRegistries;
|
||||
import com.drmangotea.tfmg.config.TFMGResistivity;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cable_type.CableType;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cable_type.CableTypeEntry;
|
||||
import com.simibubi.create.api.contraption.ContraptionType;
|
||||
import com.simibubi.create.api.registry.CreateBuiltInRegistries;
|
||||
import com.simibubi.create.content.contraptions.Contraption;
|
||||
import com.tterrag.registrate.util.entry.ItemEntry;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.drmangotea.tfmg.TFMG.REGISTRATE;
|
||||
import static com.simibubi.create.AllContraptionTypes.BY_LEGACY_NAME;
|
||||
|
||||
public class TFMGCableTypes {
|
||||
|
||||
public static final CableTypeEntry<CableType> empty = REGISTRATE.cableType("empty", CableType::new)
|
||||
.properties((p) -> p.spool(TFMGItems.COPPER_SPOOL))
|
||||
.register();
|
||||
|
||||
public static final CableTypeEntry<CableType> copper = REGISTRATE.cableType("copper", CableType::new)
|
||||
.properties((p) -> p.color(0xD8735A).spool(TFMGItems.COPPER_SPOOL))
|
||||
.transform(TFMGResistivity.setResistivity(0.00188f))
|
||||
.register();
|
||||
|
||||
public static final CableTypeEntry<CableType> aluminum = REGISTRATE.cableType("aluminum", CableType::new)
|
||||
.properties((p) -> p.color(0xEDEFEF).spool(TFMGItems.ALUMINUM_SPOOL))
|
||||
.transform(TFMGResistivity.setResistivity(0.0027f))
|
||||
.register();
|
||||
|
||||
public static final CableTypeEntry<CableType> constantan = REGISTRATE.cableType("constantan", CableType::new)
|
||||
.properties((p) -> p.color(0xCFC2A8).spool(TFMGItems.CONSTANTAN_SPOOL))
|
||||
.transform(TFMGResistivity.setResistivity(1f))
|
||||
.register();
|
||||
|
||||
// Why is this a thing? I'll leave it her in case you do need it. - Krystal
|
||||
//public static final CableTypeEntry<CableType> steelReinforcedAluminum = REGISTRATE.cableType("steel_reinforced_aluminum", CableType::new)
|
||||
// .properties((p) -> p.color(0xB8A08D).spool(TFMGItems.COPPER_SPOOL))
|
||||
// .transform(TFMGResistivity.setResistivity(0.0027f))
|
||||
// .register();
|
||||
|
||||
public static void init() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.drmangotea.tfmg.registry;
|
||||
|
||||
import com.drmangotea.tfmg.content.machinery.vat.electrode_holder.electrode.Electrode;
|
||||
import com.drmangotea.tfmg.content.machinery.vat.electrode_holder.electrode.ElectrodeEntry;
|
||||
|
||||
import static com.drmangotea.tfmg.TFMG.REGISTRATE;
|
||||
|
||||
public class TFMGElectrodes {
|
||||
|
||||
public static final ElectrodeEntry<Electrode> none = REGISTRATE.electrode("none", Electrode::new)
|
||||
.properties((p) -> p)
|
||||
.register();
|
||||
|
||||
public static final ElectrodeEntry<Electrode> copper = REGISTRATE.electrode("copper", Electrode::new)
|
||||
.properties((p) -> p
|
||||
.resistance(100)
|
||||
.item(TFMGItems.COPPER_ELECTRODE)
|
||||
.operationId("tfmg:electrode")
|
||||
)
|
||||
.register();
|
||||
|
||||
public static final ElectrodeEntry<Electrode> zinc = REGISTRATE.electrode("zinc", Electrode::new)
|
||||
.properties((p) -> p
|
||||
.resistance(100)
|
||||
.item(TFMGItems.ZINC_ELECTRODE)
|
||||
.operationId("tfmg:electrode")
|
||||
)
|
||||
.register();
|
||||
|
||||
public static final ElectrodeEntry<Electrode> graphite = REGISTRATE.electrode("graphite", Electrode::new)
|
||||
.properties((p) -> p
|
||||
.resistance(300)
|
||||
.item(TFMGItems.GRAPHITE_ELECTRODE)
|
||||
.operationId("tfmg:graphite_electrode")
|
||||
)
|
||||
.register();
|
||||
|
||||
public static void init() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ public enum TFMGGuiTextures implements ScreenElement {
|
||||
GRAPHITE_ELECTRODE("chemical_vat", 176, 0, 8, 29),
|
||||
FIREPROOF_BRICK_OVERLAY("chemical_vat", 0, 84, 96, 72),
|
||||
VAT_HEATER("chemical_vat", 112, 44, 20, 14),
|
||||
VAT_SUPERHEATER("chemical_vat", 112, 58, 20, 14),
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.tterrag.registrate.util.entry.RegistryEntry;
|
||||
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.data.recipes.RecipeCategory;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
@@ -191,14 +192,14 @@ public class TFMGItems {
|
||||
ENGINE_CYLINDER = REGISTRATE.item("engine_cylinder", CylinderItem::new).register(),
|
||||
TURBINE_BLADE = REGISTRATE.item("turbine_blade", CylinderItem::new).register();
|
||||
public static final ItemEntry<SpoolItem>
|
||||
EMPTY_SPOOL = spoolItem("empty", null, 0x000000, CableConnection.CableType.NONE)
|
||||
EMPTY_SPOOL = spoolItem("empty", 0x000000, TFMG.asResource("empty"))
|
||||
.recipe((c, p) -> p.stonecutting(DataIngredient.items(TFMGBlocks.HARDENED_PLANKS.asItem()), RecipeCategory.BUILDING_BLOCKS, c::get, 1))
|
||||
.register(),
|
||||
COPPER_SPOOL = spoolItem("copper", TFMGPartialModels.COPPER_SPOOL, 0xD8735A, CableConnection.CableType.COPPER)
|
||||
COPPER_SPOOL = spoolItem("copper", 0xD8735A, TFMG.asResource("copper"))
|
||||
.register(),
|
||||
ALUMINUM_SPOOL = spoolItem("aluminum", TFMGPartialModels.ALUMINUM_SPOOL, 0xEDEFEF, CableConnection.CableType.ALUMINUM)
|
||||
ALUMINUM_SPOOL = spoolItem("aluminum", 0xEDEFEF, TFMG.asResource("aluminum"))
|
||||
.register(),
|
||||
CONSTANTAN_SPOOL = spoolItem("constantan", TFMGPartialModels.CONSTANTAN_SPOOL, 0xCFC2A8, CableConnection.CableType.CONSTANTAN)
|
||||
CONSTANTAN_SPOOL = spoolItem("constantan", 0xCFC2A8, TFMG.asResource("constantan"))
|
||||
.register();
|
||||
|
||||
public static final ItemEntry<ElectromagneticCoilItem> ELECTROMAGNETIC_COIL =
|
||||
@@ -447,8 +448,8 @@ public class TFMGItems {
|
||||
return map;
|
||||
}
|
||||
|
||||
public static ItemBuilder<SpoolItem, CreateRegistrate> spoolItem(String name, PartialModel model, int barColor, CableConnection.CableType type) {
|
||||
return REGISTRATE.item(name + "_spool", p -> new SpoolItem(p, model, barColor, type))
|
||||
public static ItemBuilder<SpoolItem, CreateRegistrate> spoolItem(String name, int barColor, ResourceLocation type) {
|
||||
return REGISTRATE.item(name + "_spool", p -> new SpoolItem(p, barColor, type))
|
||||
.tag(TFMGTags.TFMGItemTags.SPOOLS.tag)
|
||||
.properties(p -> p.stacksTo(1));
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ public class TFMGPartialModels {
|
||||
SHAFTLESS_LARGE_ALUMINUM_COGHWEEL = block("large_aluminum_cogwheel_shaftless"),
|
||||
SHAFTLESS_LARGE_STEEL_COGHWEEL = block("large_steel_cogwheel_shaftless"),
|
||||
SPOOL = block("winding_machine/spool"),
|
||||
SPOOL_WIRE = block("winding_machine/spool_wire"),
|
||||
COPPER_SPOOL = block("winding_machine/copper_spool"),
|
||||
ALUMINUM_SPOOL = block("winding_machine/aluminum_spool"),
|
||||
CONSTANTAN_SPOOL = block("winding_machine/constantan_spool"),
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"textures": {
|
||||
"0": "tfmg:block/spool_wire",
|
||||
"particle": "tfmg:block/spool_wire"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [4, 6, 6],
|
||||
"to": [11, 10, 10],
|
||||
"rotation": {"angle": 0, "axis": "y", "origin": [4, 7, 7]},
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 4, 7], "rotation": 90, "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 4, 7], "rotation": 90, "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 4, 7], "rotation": 90, "texture": "#0"},
|
||||
"down": {"uv": [0, 0, 4, 7], "rotation": 90, "texture": "#0"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
src/main/resources/assets/tfmg/textures/block/spool_wire.png
Normal file
|
After Width: | Height: | Size: 110 B |
|
Before Width: | Height: | Size: 193 B After Width: | Height: | Size: 121 B |
|
Before Width: | Height: | Size: 243 B After Width: | Height: | Size: 264 B |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.1 KiB |
@@ -5,6 +5,7 @@
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"refmap": "tfmg.refmap.json",
|
||||
"mixins": [
|
||||
"BuiltInRegistriesMixin",
|
||||
"FluidPipeBlockMixin",
|
||||
"FluidPropagatorMixin",
|
||||
"FluidTankBlockEntityMixin",
|
||||
|
||||