stufffffffffffffff

This commit is contained in:
DrMangoTea
2025-05-09 23:01:47 +02:00
parent 6151e4a087
commit 304d3fb9ac
346 changed files with 27391 additions and 100816 deletions

View File

@@ -3,7 +3,10 @@ package com.drmangotea.tfmg;
import com.drmangotea.tfmg.content.items.weapons.advanced_potato_cannon.AdvancedPotatoCannonRenderHandler;
import com.drmangotea.tfmg.content.items.weapons.flamethrover.FlamethrowerRenderHandler;
import com.drmangotea.tfmg.content.items.weapons.quad_potato_cannon.QuadPotatoCannonRenderHandler;
import com.drmangotea.tfmg.ponder.TFMGPonderPlugin;
import com.drmangotea.tfmg.registry.TFMGParticleTypes;
import com.simibubi.create.foundation.ponder.CreatePonderPlugin;
import net.createmod.ponder.foundation.PonderIndex;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@@ -27,6 +30,8 @@ public class TFMGClient {
modEventBus.addListener(TFMGParticleTypes::registerFactories);
modEventBus.register(this);
PonderIndex.addPlugin(new TFMGPonderPlugin());
ADVANCED_POTATO_CANNON_RENDER_HANDLER.registerListeners(forgeEventBus);
QUAD_POTATO_CANNON_RENDER_HANDLER.registerListeners(forgeEventBus);

View File

@@ -2,6 +2,8 @@ package com.drmangotea.tfmg.base;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGVanillaBlockStates;
import com.drmangotea.tfmg.config.TFMGStress;
import com.drmangotea.tfmg.content.decoration.FrameBlock;
import com.drmangotea.tfmg.content.decoration.TrussBlock;
@@ -16,7 +18,6 @@ import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllTags;
import com.simibubi.create.content.contraptions.behaviour.DoorMovingInteraction;
import com.simibubi.create.content.decoration.encasing.EncasedCTBehaviour;
import com.simibubi.create.content.decoration.girder.GirderBlock;
import com.simibubi.create.content.decoration.slidingDoor.SlidingDoorMovementBehaviour;
import com.simibubi.create.content.kinetics.base.RotatedPillarKineticBlock;
import com.simibubi.create.content.kinetics.simpleRelays.encased.EncasedCogCTBehaviour;
@@ -25,10 +26,8 @@ import com.simibubi.create.foundation.data.*;
import com.tterrag.registrate.builders.BlockBuilder;
import com.tterrag.registrate.providers.DataGenContext;
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
import com.tterrag.registrate.providers.RegistrateRecipeProvider;
import com.tterrag.registrate.util.DataIngredient;
import com.tterrag.registrate.util.entry.BlockEntry;
import com.tterrag.registrate.util.nullness.NonNullBiConsumer;
import com.tterrag.registrate.util.nullness.NonNullFunction;
import com.tterrag.registrate.util.nullness.NonNullUnaryOperator;
import net.minecraft.client.renderer.RenderType;
@@ -36,15 +35,12 @@ import net.minecraft.core.Direction;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraftforge.client.model.generators.ModelFile;
import net.minecraftforge.client.model.generators.MultiPartBlockStateBuilder;
import java.nio.channels.Pipe;
import java.util.*;
import java.util.function.Supplier;

View File

@@ -1,21 +0,0 @@
package com.drmangotea.tfmg.base;
import com.drmangotea.tfmg.TFMG;
import net.minecraft.world.level.LevelAccessor;
import net.minecraftforge.event.level.LevelEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber
public class TFMGCommonEvents {
@SubscribeEvent
public static void onLoadWorld(LevelEvent.Load event) {
LevelAccessor world = event.getLevel();
TFMG.NETWORK_MANAGER.onLoadWorld(world);
}
@SubscribeEvent
public static void onUnloadWorld(LevelEvent.Unload event) {
LevelAccessor world = event.getLevel();
TFMG.NETWORK_MANAGER.onUnloadWorld(world);
}
}

View File

@@ -1,7 +1,9 @@
package com.drmangotea.tfmg.base;
import com.drmangotea.tfmg.content.decoration.encased.TFMGEncasedCogwheelBlock;
import com.drmangotea.tfmg.content.machinery.misc.winding_machine.SpoolItem;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import com.drmangotea.tfmg.registry.TFMGEncasedBlocks;
import com.drmangotea.tfmg.registry.TFMGItems;
import com.simibubi.create.AllCreativeModeTabs;
import com.simibubi.create.content.processing.sequenced.SequencedAssemblyItem;
@@ -10,6 +12,7 @@ import com.tterrag.registrate.util.entry.RegistryEntry;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
@@ -66,6 +69,8 @@ public class TFMGCreativeTabs {
continue;
if(blacklist().contains(item))
continue;
if(item.get() instanceof BlockItem blockItem && blockItem.getBlock() instanceof TFMGEncasedCogwheelBlock)
continue;
if(item.get() instanceof SequencedAssemblyItem)
continue;
@@ -79,8 +84,12 @@ public class TFMGCreativeTabs {
CREATIVE_MODE_TABS.register(modEventBus);
}
public static List<RegistryEntry<Item>> blacklist(){
List<RegistryEntry<Item>> list = new ArrayList<>();
public static List<RegistryEntry<? extends Item>> blacklist(){
List<RegistryEntry<? extends Item>> list = new ArrayList<>();
list.add(TFMGItems.LIT_LITHIUM_BLADE);
return list;
}
public static List<ItemStack> customAdditions(){
@@ -101,7 +110,16 @@ public class TFMGCreativeTabs {
CompoundTag lpgTagName = new CompoundTag();
lpgTagName.putString("lpg", "LPG");
//
CompoundTag keroseneTag = new CompoundTag();
keroseneTag.putString("kerosene", "forge:kerosene");
CompoundTag keroseneTagName = new CompoundTag();
keroseneTagName.putString("kerosene", "KEROSENE");
//
CompoundTag naphthaTag = new CompoundTag();
naphthaTag.putString("naphtha", "forge:naphtha");
CompoundTag naphthaTagName = new CompoundTag();
naphthaTagName.putString("naphtha", "NAPHTHA");
//
ItemStack gasoline = TFMGItems.ENGINE_CYLINDER.asStack();
gasoline.getOrCreateTag().put("Fuels", gasolineTag);

View File

@@ -11,6 +11,7 @@ import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.*;
import net.minecraftforge.registries.ForgeRegistries;
import static com.drmangotea.tfmg.registry.TFMGFluids.getGasTexture;
import static com.simibubi.create.foundation.data.ModelGen.customItemModel;
public class TFMGRegistrate extends CreateRegistrate {
@@ -29,10 +30,9 @@ public class TFMGRegistrate extends CreateRegistrate {
return builder.toString();
}
public FluidBuilder<VirtualFluid, CreateRegistrate> gasFluid(String name, ResourceLocation still,
ResourceLocation flow) {
return entry(name, c -> new VirtualFluidBuilder<>(self(),self(), name, c, still, flow,
GasFluidType.create(),VirtualFluid::createSource,VirtualFluid::createFlowing));
public FluidBuilder<VirtualFluid, CreateRegistrate> gasFluid(String name, int color) {
return entry(name, c -> new VirtualFluidBuilder<>(self(),self(), name, c, getGasTexture(), getGasTexture(),
GasFluidType.create(color),VirtualFluid::createSource,VirtualFluid::createFlowing));
}
protected TFMGRegistrate() {

View File

@@ -26,14 +26,20 @@ public class TFMGShapes {
.add(13, 5, -1, 16, 7, 1)
.add(0, 5, -1, 3, 7, 1)
.add(15, 5, 9, 15, 11, 9)
.forDirectional(SOUTH),
.forDirectional(NORTH),
ENGINE_CONTROLLER = shape(0, 0, 0, 4, 5, 16)
.add(2, 5, 5, 14, 12, 14)
.add(4, 0, 5, 15, 5, 16)
.forHorizontal(SOUTH),
ENGINE_FRONT = shape(0, 0, 1, 16, 7, 16).add(3, 7, 1, 13, 12, 16)
.forDirectional(SOUTH),
PUMPJACK_HAMMER_PART = shape(0, 2, 0, 16, 14, 16)
.forDirectional(),
RADIAL_ENGINE = shape(1, 4, 1, 15, 12, 15)
RADIAL_ENGINE_SINGLE = shape(1, 4, 1, 15, 12, 15)
.forDirectional(),
LARGE_RADIAL_ENGINE = shape(-3, 4, -3, 19, 12, 19)
RADIAL_ENGINE_SIDE = shape(1, 4, 1, 15, 16, 15)
.forDirectional(),
RADIAL_ENGINE_MIDDLE = shape(1, 0, 1, 15, 16, 15)
.forDirectional(),
PUMPJACK_HEAD = shape(1, 0, -4, 15, 14, 24)
.forDirectional(),

View File

@@ -1,9 +1,8 @@
package com.drmangotea.tfmg.base;
package com.drmangotea.tfmg.base.blocks;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.DirectionalBlock;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;

View File

@@ -1,4 +1,4 @@
package com.drmangotea.tfmg.base;
package com.drmangotea.tfmg.base.blocks;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.block.Block;

View File

@@ -1,7 +1,6 @@
package com.drmangotea.tfmg.base;
package com.drmangotea.tfmg.base.blocks;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.content.decoration.concrete.RebarStairsBlock;
import com.simibubi.create.foundation.data.CreateRegistrate;
import com.tterrag.registrate.builders.BlockBuilder;
import com.tterrag.registrate.builders.ItemBuilder;

View File

@@ -1,4 +1,4 @@
package com.drmangotea.tfmg.base;
package com.drmangotea.tfmg.base.blocks;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;

View File

@@ -1,6 +1,16 @@
package com.drmangotea.tfmg.base.events;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.content.electricity.measurement.MultimeterOverlayRenderer;
import com.drmangotea.tfmg.content.engines.engine_controller.EngineControllerClientHandler;
import com.simibubi.create.CreateClient;
import com.simibubi.create.content.equipment.armor.RemainingAirOverlay;
import com.simibubi.create.content.equipment.blueprint.BlueprintOverlayRenderer;
import com.simibubi.create.content.equipment.goggles.GoggleOverlayRenderer;
import com.simibubi.create.content.equipment.toolbox.ToolboxHandlerClient;
import com.simibubi.create.content.redstone.link.controller.LinkedControllerClientHandler;
import com.simibubi.create.content.trains.TrainHUD;
import com.simibubi.create.content.trains.track.TrackPlacementOverlay;
import net.minecraft.client.Minecraft;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.ConfigScreenHandler;
@@ -32,6 +42,12 @@ public class TFMGClientEvents {
}
}
@SubscribeEvent
public static void registerGuiOverlays(RegisterGuiOverlaysEvent event) {
TFMG.LOGGER.debug("ADOIAJDOAIWDJOIA");
event.registerAbove(VanillaGuiOverlay.HOTBAR.id(), "multimeter_info", MultimeterOverlayRenderer.OVERLAY);
}
protected static boolean isGameActive() {
return !(Minecraft.getInstance().level == null || Minecraft.getInstance().player == null);

View File

@@ -25,9 +25,18 @@ public class TFMGCommonEvents {
// TFMG.LOGGER.debug("PLAYER LOG");
//}
@SubscribeEvent
public static void onUnloadWorld(LevelEvent.Unload event) {
LevelAccessor world = event.getLevel();
TFMG.NETWORK_MANAGER.onUnloadWorld(world);
}
@SubscribeEvent
public static void onLoadWorld(LevelEvent.Load event) {
LevelAccessor world = event.getLevel();
TFMG.NETWORK_MANAGER.onLoadWorld(world);
TFMG.DEPOSITS.levelLoaded(world);
TFMG.LOGGER.debug("WORLD LOAD");
}

View File

@@ -1,6 +1,8 @@
package com.drmangotea.tfmg.base.fluid;
import com.drmangotea.tfmg.datagen.TFMGDamageSources;
import com.drmangotea.tfmg.datagen.TFMGDamageTypes;
import com.simibubi.create.AllFluids;
import com.simibubi.create.Create;
import com.tterrag.registrate.builders.FluidBuilder;
@@ -61,8 +63,8 @@ public class AcidFluidType extends AllFluids.TintedFluidType {
// if(Create.RANDOM.nextInt(2)==0)
// entity.hurt(damageSourceAcid,2);
if(Create.RANDOM.nextInt(2)==0)
entity.hurt(TFMGDamageSources.acid(entity.level()),2);
return false;
}

View File

@@ -1,24 +1,92 @@
package com.drmangotea.tfmg.base.fluid;
import com.drmangotea.tfmg.registry.TFMGFluids;
import com.mojang.blaze3d.shaders.FogShape;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllFluids;
import com.tterrag.registrate.builders.FluidBuilder;
import net.minecraft.client.Camera;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.FogRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.material.FluidState;
import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidType;
import org.jetbrains.annotations.NotNull;
import org.joml.Vector3f;
import java.util.function.Consumer;
import java.util.function.Supplier;
public class GasFluidType extends FluidType {
public GasFluidType(Properties properties) {
super(properties);
import static com.drmangotea.tfmg.registry.TFMGFluids.getGasTexture;
public class GasFluidType extends TFMGFluids.SolidRenderedPlaceableFluidType {
final int color;
public GasFluidType(Properties properties, ResourceLocation stillTexture, ResourceLocation flowingTexture, int color) {
super(properties, stillTexture, flowingTexture);
this.color = color;
}
public static FluidBuilder.FluidTypeFactory create() {
public static FluidBuilder.FluidTypeFactory create(int color) {
return (p, s, f) -> {
HotFluidType fluidType = new HotFluidType(p, s, f);
GasFluidType fluidType = new GasFluidType(p,s,f,color);
return fluidType;
};
}
@Override
public void initializeClient(Consumer<IClientFluidTypeExtensions> consumer) {
consumer.accept(new IClientFluidTypeExtensions() {
@Override
public ResourceLocation getStillTexture() {
return getGasTexture();
}
@Override
public ResourceLocation getFlowingTexture() {
return getGasTexture();
}
@Override
public int getTintColor(FluidStack stack) {
return color;
}
@Override
public int getTintColor(FluidState state, BlockAndTintGetter getter, BlockPos pos) {
return 0xff99f22f;
}
@Override
public @NotNull Vector3f modifyFogColor(Camera camera, float partialTick, ClientLevel level,
int renderDistance, float darkenWorldAmount, Vector3f fluidFogColor) {
Vector3f customFogColor = GasFluidType.this.getCustomFogColor();
return customFogColor == null ? fluidFogColor : customFogColor;
}
@Override
public void modifyFogRender(Camera camera, FogRenderer.FogMode mode, float renderDistance, float partialTick,
float nearDistance, float farDistance, FogShape shape) {
float modifier = GasFluidType.this.getFogDistanceModifier();
float baseWaterFog = 96.0f;
if (modifier != 1f) {
RenderSystem.setShaderFogShape(FogShape.CYLINDER);
RenderSystem.setShaderFogStart(-8);
RenderSystem.setShaderFogEnd(baseWaterFog * modifier);
}
}
});
}
@Override
public int getDensity() {

View File

@@ -1,6 +1,6 @@
package com.drmangotea.tfmg.content.decoration;
import com.drmangotea.tfmg.base.WallMountBlock;
import com.drmangotea.tfmg.base.blocks.WallMountBlock;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import net.minecraft.core.BlockPos;
@@ -25,7 +25,6 @@ import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import java.util.Map;
import java.util.Properties;
public class LithiumTorchBlock extends WallMountBlock implements SimpleWaterloggedBlock {

View File

@@ -1,6 +1,6 @@
package com.drmangotea.tfmg.content.decoration;
import com.drmangotea.tfmg.base.WallMountBlock;
import com.drmangotea.tfmg.base.blocks.WallMountBlock;
import com.simibubi.create.foundation.data.SpecialBlockStateGen;
import com.tterrag.registrate.providers.DataGenContext;
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;

View File

@@ -1,115 +0,0 @@
package com.drmangotea.tfmg.content.decoration.cogs;
import com.drmangotea.tfmg.registry.TFMGPartialModels;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import com.simibubi.create.AllPartialModels;
import com.simibubi.create.content.kinetics.base.IRotate;
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
import com.simibubi.create.content.kinetics.base.KineticBlockEntityVisual;
import com.simibubi.create.content.kinetics.base.RotatingInstance;
import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockEntityRenderer;
import com.simibubi.create.content.kinetics.simpleRelays.encased.EncasedCogVisual;
import com.simibubi.create.foundation.render.AllInstanceTypes;
import dev.engine_room.flywheel.api.instance.Instance;
import dev.engine_room.flywheel.api.model.Model;
import dev.engine_room.flywheel.api.visualization.VisualizationContext;
import dev.engine_room.flywheel.lib.model.Models;
import net.createmod.catnip.data.Iterate;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import org.jetbrains.annotations.Nullable;
import java.util.Optional;
import java.util.function.Consumer;
public class EncasedAluminumCogVisual extends KineticBlockEntityVisual<KineticBlockEntity> {
protected final RotatingInstance rotatingModel;
@Nullable
protected final RotatingInstance rotatingTopShaft;
@Nullable
protected final RotatingInstance rotatingBottomShaft;
public static EncasedCogVisual small(VisualizationContext modelManager, KineticBlockEntity blockEntity, float partialTick) {
return new EncasedCogVisual(modelManager, blockEntity, false, partialTick, Models.partial(TFMGPartialModels.ALUMINUM_COGHWEEL));
}
public static EncasedCogVisual large(VisualizationContext modelManager, KineticBlockEntity blockEntity, float partialTick) {
return new EncasedCogVisual(modelManager, blockEntity, true, partialTick, Models.partial(TFMGPartialModels.LARGE_ALUMINUM_COGHWEEL));
}
public EncasedAluminumCogVisual(VisualizationContext modelManager, KineticBlockEntity blockEntity, boolean large, float partialTick, Model model) {
super(modelManager, blockEntity, partialTick);
rotatingModel = instancerProvider().instancer(AllInstanceTypes.ROTATING, model)
.createInstance();
rotatingModel.setup(blockEntity)
.setPosition(getVisualPosition())
.rotateToFace(rotationAxis())
.setChanged();
RotatingInstance rotatingTopShaft = null;
RotatingInstance rotatingBottomShaft = null;
Block block = blockState.getBlock();
if (block instanceof IRotate def) {
for (Direction d : Iterate.directionsInAxis(rotationAxis())) {
if (!def.hasShaftTowards(blockEntity.getLevel(), blockEntity.getBlockPos(), blockState, d))
continue;
RotatingInstance instance = instancerProvider().instancer(AllInstanceTypes.ROTATING, Models.partial(AllPartialModels.SHAFT_HALF))
.createInstance();
instance.setup(blockEntity)
.setPosition(getVisualPosition())
.rotateToFace(Direction.SOUTH, d)
.setChanged();
if (large) {
instance.setRotationOffset(BracketedKineticBlockEntityRenderer.getShaftAngleOffset(rotationAxis(), pos));
}
if (d.getAxisDirection() == Direction.AxisDirection.POSITIVE) {
rotatingTopShaft = instance;
} else {
rotatingBottomShaft = instance;
}
}
}
this.rotatingTopShaft = rotatingTopShaft;
this.rotatingBottomShaft = rotatingBottomShaft;
}
@Override
public void update(float pt) {
rotatingModel.setup(blockEntity)
.setChanged();
if (rotatingTopShaft != null) rotatingTopShaft.setup(blockEntity)
.setChanged();
if (rotatingBottomShaft != null) rotatingBottomShaft.setup(blockEntity)
.setChanged();
}
@Override
public void updateLight(float partialTick) {
relight(rotatingModel, rotatingTopShaft, rotatingBottomShaft);
}
@Override
protected void _delete() {
rotatingModel.delete();
if (rotatingTopShaft != null) rotatingTopShaft.delete();
if (rotatingBottomShaft != null) rotatingBottomShaft.delete();
}
@Override
public void collectCrumblingInstances(Consumer<@Nullable Instance> consumer) {
consumer.accept(rotatingModel);
consumer.accept(rotatingTopShaft);
consumer.accept(rotatingBottomShaft);
}
}

View File

@@ -1,72 +0,0 @@
package com.drmangotea.tfmg.content.decoration.cogs;
import com.drmangotea.tfmg.registry.TFMGPartialModels;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllPartialModels;
import com.simibubi.create.content.kinetics.base.IRotate;
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockEntityRenderer;
import com.simibubi.create.content.kinetics.simpleRelays.SimpleKineticBlockEntity;
import com.simibubi.create.content.kinetics.simpleRelays.encased.EncasedCogwheelBlock;
import dev.engine_room.flywheel.api.visualization.VisualizationManager;
import net.createmod.catnip.data.Iterate;
import net.createmod.catnip.render.CachedBuffers;
import net.createmod.catnip.render.SuperByteBuffer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
public class EncasedSteelCogRenderer extends KineticBlockEntityRenderer<SimpleKineticBlockEntity> {
private boolean large;
public static EncasedSteelCogRenderer small(BlockEntityRendererProvider.Context context) {
return new EncasedSteelCogRenderer(context, false);
}
public static EncasedSteelCogRenderer large(BlockEntityRendererProvider.Context context) {
return new EncasedSteelCogRenderer(context, true);
}
public EncasedSteelCogRenderer(BlockEntityRendererProvider.Context context, boolean large) {
super(context);
this.large = large;
}
@Override
protected void renderSafe(SimpleKineticBlockEntity be, float partialTicks, PoseStack ms, MultiBufferSource buffer,
int light, int overlay) {
super.renderSafe(be, partialTicks, ms, buffer, light, overlay);
if (VisualizationManager.supportsVisualization(be.getLevel()))
return;
BlockState blockState = be.getBlockState();
Block block = blockState.getBlock();
if (!(block instanceof IRotate))
return;
IRotate def = (IRotate) block;
Direction.Axis axis = getRotationAxisOf(be);
BlockPos pos = be.getBlockPos();
float angle = large ? BracketedKineticBlockEntityRenderer.getAngleForLargeCogShaft(be, axis)
: getAngleForBe(be, pos, axis);
for (Direction d : Iterate.directionsInAxis(getRotationAxisOf(be))) {
if (!def.hasShaftTowards(be.getLevel(), be.getBlockPos(), blockState, d))
continue;
SuperByteBuffer shaft = CachedBuffers.partialFacing(AllPartialModels.SHAFT_HALF, be.getBlockState(), d);
kineticRotationTransform(shaft, be, axis, angle, light);
shaft.renderInto(ms, buffer.getBuffer(RenderType.cutoutMipped()));
}
}
@Override
protected SuperByteBuffer getRotatedModel(SimpleKineticBlockEntity be, BlockState state) {
return CachedBuffers.partialFacingVertical(
large ? TFMGPartialModels.LARGE_STEEL_COGHWEEL : TFMGPartialModels.STEEL_COGHWEEL, state,
Direction.fromAxisAndDirection(state.getValue(EncasedCogwheelBlock.AXIS), Direction.AxisDirection.POSITIVE));
}
}

View File

@@ -9,6 +9,7 @@ import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockEn
import com.simibubi.create.content.kinetics.simpleRelays.SimpleKineticBlockEntity;
import com.simibubi.create.content.kinetics.simpleRelays.encased.EncasedCogwheelBlock;
import dev.engine_room.flywheel.api.visualization.VisualizationManager;
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
import net.createmod.catnip.data.Iterate;
import net.createmod.catnip.render.CachedBuffers;
import net.createmod.catnip.render.SuperByteBuffer;
@@ -20,21 +21,30 @@ import net.minecraft.core.Direction;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
public class EncasedAluminumCogRenderer extends KineticBlockEntityRenderer<SimpleKineticBlockEntity> {
public class TFMGEncasedCogRenderer extends KineticBlockEntityRenderer<SimpleKineticBlockEntity> {
private boolean large;
private boolean steel;
public static EncasedAluminumCogRenderer small(BlockEntityRendererProvider.Context context) {
return new EncasedAluminumCogRenderer(context, false);
public static TFMGEncasedCogRenderer steelSmall(BlockEntityRendererProvider.Context context) {
return new TFMGEncasedCogRenderer(context, false,true);
}
public static EncasedAluminumCogRenderer large(BlockEntityRendererProvider.Context context) {
return new EncasedAluminumCogRenderer(context, true);
public static TFMGEncasedCogRenderer steellarge(BlockEntityRendererProvider.Context context) {
return new TFMGEncasedCogRenderer(context, true,true);
}
public static TFMGEncasedCogRenderer aluminumSmall(BlockEntityRendererProvider.Context context) {
return new TFMGEncasedCogRenderer(context, false,false);
}
public EncasedAluminumCogRenderer(BlockEntityRendererProvider.Context context, boolean large) {
public static TFMGEncasedCogRenderer aluminumlarge(BlockEntityRendererProvider.Context context) {
return new TFMGEncasedCogRenderer(context, true,false);
}
public TFMGEncasedCogRenderer(BlockEntityRendererProvider.Context context, boolean large, boolean steel) {
super(context);
this.large = large;
this.steel = steel;
}
@Override
@@ -46,9 +56,8 @@ public class EncasedAluminumCogRenderer extends KineticBlockEntityRenderer<Simpl
BlockState blockState = be.getBlockState();
Block block = blockState.getBlock();
if (!(block instanceof IRotate))
if (!(block instanceof IRotate def))
return;
IRotate def = (IRotate) block;
Direction.Axis axis = getRotationAxisOf(be);
BlockPos pos = be.getBlockPos();
@@ -60,15 +69,17 @@ public class EncasedAluminumCogRenderer extends KineticBlockEntityRenderer<Simpl
continue;
SuperByteBuffer shaft = CachedBuffers.partialFacing(AllPartialModels.SHAFT_HALF, be.getBlockState(), d);
kineticRotationTransform(shaft, be, axis, angle, light);
shaft.renderInto(ms, buffer.getBuffer(RenderType.cutoutMipped()));
shaft.renderInto(ms, buffer.getBuffer(RenderType.solid()));
}
}
@Override
protected SuperByteBuffer getRotatedModel(SimpleKineticBlockEntity be, BlockState state) {
return CachedBuffers.partialFacingVertical(
large ? TFMGPartialModels.LARGE_ALUMINUM_COGHWEEL : TFMGPartialModels.ALUMINUM_COGHWEEL, state,
large ? steel? TFMGPartialModels.SHAFTLESS_LARGE_STEEL_COGHWEEL :TFMGPartialModels.SHAFTLESS_LARGE_ALUMINUM_COGHWEEL : steel ? TFMGPartialModels.SHAFTLESS_STEEL_COGHWEEL : TFMGPartialModels.SHAFTLESS_ALUMINUM_COGHWEEL, state,
Direction.fromAxisAndDirection(state.getValue(EncasedCogwheelBlock.AXIS), Direction.AxisDirection.POSITIVE));
}
}
}

View File

@@ -7,7 +7,6 @@ import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
import com.simibubi.create.content.kinetics.base.KineticBlockEntityVisual;
import com.simibubi.create.content.kinetics.base.RotatingInstance;
import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockEntityRenderer;
import com.simibubi.create.content.kinetics.simpleRelays.encased.EncasedCogVisual;
import com.simibubi.create.foundation.render.AllInstanceTypes;
import dev.engine_room.flywheel.api.instance.Instance;
import dev.engine_room.flywheel.api.model.Model;
@@ -20,7 +19,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.function.Consumer;
public class EncasedSteelCogVisual extends KineticBlockEntityVisual<KineticBlockEntity> {
public class TFMGEncasedCogVisual extends KineticBlockEntityVisual<KineticBlockEntity> {
protected final RotatingInstance rotatingModel;
@@ -29,15 +28,23 @@ public class EncasedSteelCogVisual extends KineticBlockEntityVisual<KineticBlock
@Nullable
protected final RotatingInstance rotatingBottomShaft;
public static EncasedCogVisual small(VisualizationContext modelManager, KineticBlockEntity blockEntity, float partialTick) {
return new EncasedCogVisual(modelManager, blockEntity, false, partialTick, Models.partial(TFMGPartialModels.STEEL_COGHWEEL));
public static TFMGEncasedCogVisual steelSmall(VisualizationContext modelManager, KineticBlockEntity blockEntity, float partialTick) {
return new TFMGEncasedCogVisual(modelManager, blockEntity, false, partialTick, Models.partial(TFMGPartialModels.SHAFTLESS_STEEL_COGHWEEL));
}
public static EncasedCogVisual large(VisualizationContext modelManager, KineticBlockEntity blockEntity, float partialTick) {
return new EncasedCogVisual(modelManager, blockEntity, true, partialTick, Models.partial(TFMGPartialModels.LARGE_STEEL_COGHWEEL));
public static TFMGEncasedCogVisual steelLarge(VisualizationContext modelManager, KineticBlockEntity blockEntity, float partialTick) {
return new TFMGEncasedCogVisual(modelManager, blockEntity, true, partialTick, Models.partial(TFMGPartialModels.SHAFTLESS_LARGE_STEEL_COGHWEEL));
}
public EncasedSteelCogVisual(VisualizationContext modelManager, KineticBlockEntity blockEntity, boolean large, float partialTick, Model model) {
public static TFMGEncasedCogVisual aluminumSmall(VisualizationContext modelManager, KineticBlockEntity blockEntity, float partialTick) {
return new TFMGEncasedCogVisual(modelManager, blockEntity, false, partialTick, Models.partial(TFMGPartialModels.SHAFTLESS_ALUMINUM_COGHWEEL));
}
public static TFMGEncasedCogVisual aluminumLarge(VisualizationContext modelManager, KineticBlockEntity blockEntity, float partialTick) {
return new TFMGEncasedCogVisual(modelManager, blockEntity, true, partialTick, Models.partial(TFMGPartialModels.SHAFTLESS_LARGE_ALUMINUM_COGHWEEL));
}
public TFMGEncasedCogVisual(VisualizationContext modelManager, KineticBlockEntity blockEntity, boolean large, float partialTick, Model model) {
super(modelManager, blockEntity, partialTick);
rotatingModel = instancerProvider().instancer(AllInstanceTypes.ROTATING, model)
@@ -67,11 +74,11 @@ public class EncasedSteelCogVisual extends KineticBlockEntityVisual<KineticBlock
instance.setRotationOffset(BracketedKineticBlockEntityRenderer.getShaftAngleOffset(rotationAxis(), pos));
}
if (d.getAxisDirection() == Direction.AxisDirection.POSITIVE) {
rotatingTopShaft = instance;
} else {
rotatingBottomShaft = instance;
}
//if (d.getAxisDirection() == Direction.AxisDirection.POSITIVE) {
// rotatingTopShaft = instance;
//} else {
// rotatingBottomShaft = instance;
//}
}
}

View File

@@ -1,10 +1,8 @@
package com.drmangotea.tfmg.content.decoration.concrete;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.base.TFMGDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGDirectionalBlock;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import com.google.common.collect.ImmutableMap;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
@@ -24,8 +22,6 @@ import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import java.util.function.Function;
public class RebarPillarBlock extends TFMGDirectionalBlock implements ConcreteloggedBlock {

View File

@@ -1,11 +1,8 @@
package com.drmangotea.tfmg.content.decoration.concrete;
import com.drmangotea.tfmg.base.WallMountBlock;
import com.drmangotea.tfmg.content.decoration.LithiumTorchBlock;
import com.simibubi.create.foundation.data.SpecialBlockStateGen;
import com.tterrag.registrate.providers.DataGenContext;
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.StairBlock;
import net.minecraft.world.level.block.state.BlockState;

View File

@@ -30,10 +30,7 @@ public class ElectricBlockEntity extends SmartBlockEntity implements IElectric,
}
}
@Override
public boolean addToTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
return makeElectricityTooltip(tooltip, isPlayerSneaking);
}
@Override
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {

View File

@@ -102,60 +102,50 @@ public interface IElectric {
}
default boolean makeElectricityTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
CreateLang.number(getOrCreateElectricNetwork().members.size()).forGoggles(tooltip, 1);
if (getData().failTimer > 0)
CreateLang.text("Skill issue: " + getData().failTimer).forGoggles(tooltip, 1);
CreateLang.text("X " + BlockPos.of(getData().electricalNetworkId).getX() + " Y " + BlockPos.of(getData().electricalNetworkId).getY() + " Z " + BlockPos.of(getData().electricalNetworkId).getZ()).forGoggles(tooltip, 1);
default boolean makeMultimeterTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
CreateLang.translate("multimeter.header")
.style(ChatFormatting.WHITE)
.forGoggles(tooltip, 1);
CreateLang.text(" R = " + TFMGUtils.formatUnits(voltageGeneration() > 0 ? getGeneratorResistance() : resistance(), "Ω"))
.style(ChatFormatting.GOLD)
.forGoggles(tooltip, 1);
CreateLang.text(" P = " + TFMGUtils.formatUnits(getPowerUsage(), "W"))
.style(ChatFormatting.GOLD)
.forGoggles(tooltip, 1);
CreateLang.text(" U = " + TFMGUtils.formatUnits(getData().getVoltage(), "V"))
.style(ChatFormatting.AQUA)
.forGoggles(tooltip, 1);
CreateLang.text(" I = " + TFMGUtils.formatUnits(getCurrent(), "A"))
.style(ChatFormatting.GREEN)
.forGoggles(tooltip, 1);
////////
CreateLang.text(" Network Resistance: " + TFMGUtils.formatUnits(getNetworkResistance(), "Ω"))
.style(ChatFormatting.YELLOW)
.forGoggles(tooltip, 1);
CreateLang.text(" Max Current: " + TFMGUtils.formatUnits(getData().highestCurrent, "A"))
.style(ChatFormatting.AQUA)
.forGoggles(tooltip, 1);
CreateLang.text(" Network Power Usage: " + TFMGUtils.formatUnits(getNetworkPowerUsage(), "W"))
.style(ChatFormatting.YELLOW)
.forGoggles(tooltip, 1);
CreateLang.text(" Group: " + getData().group.id)
.style(ChatFormatting.DARK_PURPLE)
.forGoggles(tooltip, 1);
CreateLang.text(" Group Resistance: " + getData().group.resistance)
.style(ChatFormatting.DARK_PURPLE)
.forGoggles(tooltip, 1);
CreateLang.text(" Voltage Supply: " + getData().voltageSupply)
.style(ChatFormatting.DARK_PURPLE)
.forGoggles(tooltip, 1);
.forGoggles(tooltip);
if (voltageGeneration() > 0) {
CreateLang.translate("multimeter.power_generated")
.add(Component.literal(TFMGUtils.formatUnits(powerGeneration(), "W")))
.style(ChatFormatting.BLUE)
.color(0x852e4a)
.forGoggles(tooltip, 1);
CreateLang.translate("multimeter.voltage_generated")
.add(Component.literal(TFMGUtils.formatUnits(voltageGeneration(), "V")))
.style(ChatFormatting.BLUE)
.color(0x127799)
.forGoggles(tooltip, 1);
CreateLang.text("----------------------------")
.style(ChatFormatting.WHITE)
.forGoggles(tooltip);
}
CreateLang.text(" R = " + TFMGUtils.formatUnits(voltageGeneration() > 0 ? getGeneratorResistance() : resistance(), "Ω"))
.color(0xc98969)
.forGoggles(tooltip, 1);
CreateLang.text(" U = " + TFMGUtils.formatUnits(getData().getVoltage(), "V"))
.color(0x4bbbcc)
.forGoggles(tooltip, 1);
CreateLang.text(" I = " + TFMGUtils.formatUnits(getCurrent(), "A"))
.color(0x22a146)
.forGoggles(tooltip, 1);
CreateLang.text(" P = " + TFMGUtils.formatUnits(getPowerUsage(), "W"))
.color(0xcc4b74)
.forGoggles(tooltip, 1);
if(getData().group.id!=-1){
CreateLang.text("----------------------------")
.style(ChatFormatting.WHITE)
.forGoggles(tooltip);
CreateLang.translate("multimeter.group")
.add(CreateLang.number(getData().group.id))
.color(0xd8db27)
.forGoggles(tooltip, 1);
}
return true;
}

View File

@@ -31,11 +31,11 @@ public class KineticElectricBlockEntity extends GeneratingKineticBlockEntity imp
data.connectNextTick = true;
}
@Override
public boolean addToTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
CreateLang.text("MAX POWER: "+getNetworkPowerGeneration()).forGoggles(tooltip);
return makeElectricityTooltip(tooltip, isPlayerSneaking);
}
//@Override
//public boolean addToTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
// CreateLang.text("MAX POWER: "+getNetworkPowerGeneration()).forGoggles(tooltip);
// return makeElectricityTooltip(tooltip, isPlayerSneaking);
//}
@Override
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {}

View File

@@ -1,7 +1,7 @@
package com.drmangotea.tfmg.content.electricity.connection.cables;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.base.WallMountBlock;
import com.drmangotea.tfmg.base.blocks.WallMountBlock;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.simibubi.create.foundation.block.IBE;

View File

@@ -14,7 +14,6 @@ import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
@@ -22,7 +21,7 @@ import net.minecraft.world.phys.AABB;
import java.util.ArrayList;
import java.util.List;
import static com.drmangotea.tfmg.base.WallMountBlock.FACING;
import static com.drmangotea.tfmg.base.blocks.WallMountBlock.FACING;
import static com.drmangotea.tfmg.content.electricity.connection.cables.CableConnectorBlock.EXTENSION;
public class CableConnectorBlockEntity extends ElectricBlockEntity implements IHaveHoveringInformation {
@@ -66,13 +65,6 @@ public class CableConnectorBlockEntity extends ElectricBlockEntity implements IH
return direction == getBlockState().getValue(FACING).getOpposite();
}
@Override
public boolean makeElectricityTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
return super.makeElectricityTooltip(tooltip, isPlayerSneaking);
}
public void notifyRemoval() {
if(level.isClientSide)

View File

@@ -1,7 +1,7 @@
package com.drmangotea.tfmg.content.electricity.connection.cables;
import com.drmangotea.tfmg.base.WallMountBlock;
import com.drmangotea.tfmg.base.blocks.WallMountBlock;
import com.simibubi.create.foundation.data.AssetLookup;
import com.simibubi.create.foundation.data.SpecialBlockStateGen;
import com.tterrag.registrate.providers.DataGenContext;

View File

@@ -5,6 +5,7 @@ package com.drmangotea.tfmg.content.electricity.connection.copycat_cable;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllTags;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.foundation.block.IBE;
@@ -66,7 +67,7 @@ public class CopycatCableBlock extends Block implements IBE<CopycatCableBlockEnt
.placeItemBackInInventory(consumedItem);
context.getLevel()
.levelEvent(2001, context.getClickedPos(), Block.getId(ufte.getBlockState()));
ufte.setMaterial(TFMGBlocks.COPYCAT_CABLE_BASE.getDefaultState());
ufte.setMaterial(AllBlocks.COPYCAT_BASE.getDefaultState());
ufte.setConsumedItem(ItemStack.EMPTY);
return InteractionResult.SUCCESS;
});

View File

@@ -35,13 +35,6 @@ public class CopycatCableBlockEntity extends CopycatBlockEntity implements IElec
data.group = new ElectricalGroup(-1);
}
}
public boolean addToTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
return makeElectricityTooltip(tooltip, isPlayerSneaking);
}
@Override
public boolean hasCustomMaterial() {
return !AllBlocks.COPYCAT_BASE.has(getMaterial());

View File

@@ -1,38 +0,0 @@
package com.drmangotea.tfmg.content.electricity.debug;
import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.network.PacketDistributor;
public class DebugElectricBlock extends Block implements IBE<ElectricBlockEntity> {
public DebugElectricBlock(Properties p_49795_) {
super(p_49795_);
}
@Override
public void onPlace(BlockState pState, Level level, BlockPos pos, BlockState pOldState, boolean pIsMoving) {
withBlockEntityDo(level,pos, IElectric::onPlaced);
}
@Override
public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) {
IBE.onRemove(state, level, pos, newState);
}
@Override
public Class<ElectricBlockEntity> getBlockEntityClass() {
return ElectricBlockEntity.class;
}
@Override
public BlockEntityType<? extends ElectricBlockEntity> getBlockEntityType() {
return TFMGBlockEntities.DEBUG_ELECTRIC_BLOCK.get();
}
}

View File

@@ -1,36 +0,0 @@
package com.drmangotea.tfmg.content.electricity.debug;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
public class DebugGeneratorBlock extends Block implements IBE<DebugGeneratorBlockEntity> {
public DebugGeneratorBlock(Properties p_49795_) {
super(p_49795_);
}
@Override
public void onPlace(BlockState pState, Level level, BlockPos pos, BlockState pOldState, boolean pIsMoving) {
withBlockEntityDo(level,pos, IElectric::onPlaced);
}
@Override
public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) {
IBE.onRemove(state, level, pos, newState);
}
@Override
public Class<DebugGeneratorBlockEntity> getBlockEntityClass() {
return DebugGeneratorBlockEntity.class;
}
@Override
public BlockEntityType<? extends DebugGeneratorBlockEntity> getBlockEntityType() {
return TFMGBlockEntities.DEBUG_GENERATOR_BLOCK.get();
}
}

View File

@@ -1,44 +0,0 @@
package com.drmangotea.tfmg.content.electricity.debug;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity;
import com.drmangotea.tfmg.content.electricity.base.ElectricNetworkManager;
import com.drmangotea.tfmg.content.electricity.base.ElectricalNetwork;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation;
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import java.util.List;
public class DebugGeneratorBlockEntity extends ElectricBlockEntity {
public DebugGeneratorBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
}
@Override
public boolean hasElectricitySlot(Direction direction) {
return direction.getAxis().isHorizontal();
}
//@Override
//public int voltageGeneration() {
// return 100;
//}
@Override
public float resistance() {
return 1000;
}
}

View File

@@ -1,6 +1,6 @@
package com.drmangotea.tfmg.content.electricity.lights;
import com.drmangotea.tfmg.base.WallMountBlock;
import com.drmangotea.tfmg.base.blocks.WallMountBlock;
import com.simibubi.create.foundation.data.AssetLookup;
import com.simibubi.create.foundation.data.SpecialBlockStateGen;
import com.tterrag.registrate.providers.DataGenContext;

View File

@@ -1,12 +1,8 @@
package com.drmangotea.tfmg.content.electricity.lights;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.base.WallMountBlock;
import com.drmangotea.tfmg.content.electricity.base.ConnectNeightborsPacket;
import com.drmangotea.tfmg.base.blocks.WallMountBlock;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.drmangotea.tfmg.registry.TFMGPackets;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.foundation.block.IBE;
import com.tterrag.registrate.util.entry.BlockEntityEntry;
@@ -36,7 +32,6 @@ import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.network.PacketDistributor;
public class LightBulbBlock extends WallMountBlock implements IBE<LightBulbBlockEntity>, SimpleWaterloggedBlock, IWrenchable {

View File

@@ -9,14 +9,13 @@ import net.createmod.catnip.nbt.NBTHelper;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import static com.drmangotea.tfmg.base.WallMountBlock.FACING;
import static com.drmangotea.tfmg.base.blocks.WallMountBlock.FACING;
import static com.drmangotea.tfmg.content.electricity.lights.LightBulbBlock.LIGHT;

View File

@@ -2,7 +2,7 @@ package com.drmangotea.tfmg.content.electricity.lights;
import com.drmangotea.tfmg.base.WallMountBlock;
import com.drmangotea.tfmg.base.blocks.WallMountBlock;
import com.drmangotea.tfmg.registry.TFMGPartialModels;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;

View File

@@ -1,8 +1,6 @@
package com.drmangotea.tfmg.content.electricity.lights.neon_tube;
import com.drmangotea.tfmg.base.WallMountBlock;
import com.drmangotea.tfmg.content.electricity.lights.LightBulbBlockEntity;
import com.drmangotea.tfmg.registry.TFMGPartialModels;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
@@ -15,7 +13,6 @@ import net.minecraft.core.Direction;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.level.block.PipeBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
public class NeonTubeRenderer extends SafeBlockEntityRenderer<NeonTubeBlockEntity> {

View File

@@ -1,9 +1,15 @@
package com.drmangotea.tfmg.content.electricity.measurement;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
public class MultimeterItem extends Item {
public MultimeterItem(Properties p_41383_) {
super(p_41383_);
}
public static boolean isHeldByPlayer(Player player){
return player.getItemInHand(InteractionHand.MAIN_HAND).getItem() instanceof MultimeterItem || player.getItemInHand(InteractionHand.OFF_HAND).getItem() instanceof MultimeterItem;
}
}

View File

@@ -0,0 +1,199 @@
package com.drmangotea.tfmg.content.electricity.measurement;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.registry.TFMGItems;
import com.mojang.blaze3d.platform.Window;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.api.equipment.goggles.IProxyHoveringInformation;
import com.simibubi.create.compat.Mods;
import com.simibubi.create.foundation.blockEntity.behaviour.ValueBox;
import com.simibubi.create.foundation.gui.RemovedGuiUtils;
import com.simibubi.create.foundation.mixin.accessor.MouseHandlerAccessor;
import com.simibubi.create.foundation.utility.CreateLang;
import com.simibubi.create.infrastructure.config.AllConfigs;
import com.simibubi.create.infrastructure.config.CClient;
import net.createmod.catnip.gui.element.BoxElement;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.outliner.Outline;
import net.createmod.catnip.outliner.Outliner;
import net.createmod.catnip.outliner.Outliner.OutlineEntry;
import net.createmod.catnip.theme.Color;
import net.minecraft.client.Minecraft;
import net.minecraft.client.MouseHandler;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.FormattedText;
import net.minecraft.util.Mth;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraftforge.client.gui.overlay.ForgeGui;
import net.minecraftforge.client.gui.overlay.IGuiOverlay;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class MultimeterOverlayRenderer {
public static final IGuiOverlay OVERLAY = MultimeterOverlayRenderer::renderOverlay;
private static final Map<Object, OutlineEntry> outlines = Outliner.getInstance().getOutlines();
public static int hoverTicks = 0;
public static BlockPos lastHovered = null;
public static void renderOverlay(ForgeGui gui, GuiGraphics graphics, float partialTicks, int width,
int height) {
TFMG.LOGGER.debug("GGGGGGGGGGGGGGGGGGGGGGGGGGG");
Minecraft mc = Minecraft.getInstance();
if (mc.options.hideGui || mc.gameMode.getPlayerMode() == GameType.SPECTATOR)
return;
TFMG.LOGGER.debug("CCCCCCCCCCCCCCCCCCCCCC");
HitResult objectMouseOver = mc.hitResult;
if (!(objectMouseOver instanceof BlockHitResult result)) {
lastHovered = null;
hoverTicks = 0;
return;
}
TFMG.LOGGER.debug("DDDDDDDDDDDDDDDDDDDDDDDDDDD");
for (OutlineEntry entry : outlines.values()) {
if (!entry.isAlive())
continue;
Outline outline = entry.getOutline();
if (outline instanceof ValueBox && !((ValueBox) outline).isPassive)
return;
}
TFMG.LOGGER.debug("EEEEEEEEEEEEEEEEEEEE");
ClientLevel world = mc.level;
BlockPos pos = result.getBlockPos();
int prevHoverTicks = hoverTicks;
hoverTicks++;
lastHovered = pos;
pos = proxiedOverlayPosition(world, pos);
BlockEntity be = world.getBlockEntity(pos);
boolean holdsMultimeter = MultimeterItem.isHeldByPlayer(mc.player);
boolean isShifting = mc.player.isShiftKeyDown();
boolean isElectricBlock = be instanceof IElectric;
TFMG.LOGGER.debug("AAAAAAAAAAAAAAAAAAAAAAAAA");
if(!isElectricBlock)
return;
TFMG.LOGGER.debug("BBBBBBBBBBBBBBBBBBBBBBBBBB");
ItemStack item = TFMGItems.MULTIMETER.asStack();
List<Component> tooltip = new ArrayList<>();
tooltip.add(CreateLang.number(1).component());
((IElectric)be).makeMultimeterTooltip(tooltip,isShifting);
// break early if goggle or hover returned false when present
// if ((!isElectricBlock)||!holdsMultimeter) {
// hoverTicks = 0;
// return;
// }
//
//
//if (tooltip.isEmpty()) {
// hoverTicks = 0;
// return;
//}
PoseStack poseStack = graphics.pose();
poseStack.pushPose();
int tooltipTextWidth = 0;
for (FormattedText textLine : tooltip) {
int textLineWidth = mc.font.width(textLine);
if (textLineWidth > tooltipTextWidth)
tooltipTextWidth = textLineWidth;
}
int tooltipHeight = 8;
if (tooltip.size() > 1) {
tooltipHeight += 2; // gap between title lines and next lines
tooltipHeight += (tooltip.size() - 1) * 10;
}
CClient cfg = AllConfigs.client();
int posX = width / 2 + cfg.overlayOffsetX.get();
int posY = height / 2 + cfg.overlayOffsetY.get();
posX = Math.min(posX, width - tooltipTextWidth - 20);
posY = Math.min(posY, height - tooltipHeight - 20);
float fade = Mth.clamp((hoverTicks + partialTicks) / 24f, 0, 1);
Boolean useCustom = cfg.overlayCustomColor.get();
Color colorBackground = useCustom ? new Color(cfg.overlayBackgroundColor.get())
: BoxElement.COLOR_VANILLA_BACKGROUND.scaleAlpha(.75f);
Color colorBorderTop = new Color(0x50_dbdb14);
Color colorBorderBot = new Color(0x50_bdbd0f);
if (fade < 1) {
poseStack.translate(Math.pow(1 - fade, 3) * Math.signum(cfg.overlayOffsetX.get() + .5f) * 8, 0, 0);
colorBackground.scaleAlpha(fade);
colorBorderTop.scaleAlpha(fade);
colorBorderBot.scaleAlpha(fade);
}
GuiGameElement.of(item)
.at(posX + 10, posY - 16, 450)
.render(graphics);
if (!Mods.MODERNUI.isLoaded()) {
// default tooltip rendering when modernUI is not loaded
RemovedGuiUtils.drawHoveringText(graphics, tooltip, posX, posY, width, height, -1, colorBackground.getRGB(),
colorBorderTop.getRGB(), colorBorderBot.getRGB(), mc.font);
poseStack.popPose();
return;
}
/*
* special handling for modernUI
*
* their tooltip handler causes the overlay to jiggle each frame,
* if the mouse is moving, guiScale is anything but 1 and exactPositioning is enabled
*
* this is a workaround to fix this behavior
*/
MouseHandler mouseHandler = Minecraft.getInstance().mouseHandler;
Window window = Minecraft.getInstance().getWindow();
double guiScale = window.getGuiScale();
double cursorX = mouseHandler.xpos();
double cursorY = mouseHandler.ypos();
((MouseHandlerAccessor) mouseHandler).create$setXPos(Math.round(cursorX / guiScale) * guiScale);
((MouseHandlerAccessor) mouseHandler).create$setYPos(Math.round(cursorY / guiScale) * guiScale);
RemovedGuiUtils.drawHoveringText(graphics, tooltip, posX, posY, width, height, -1, colorBackground.getRGB(),
colorBorderTop.getRGB(), colorBorderBot.getRGB(), mc.font);
((MouseHandlerAccessor) mouseHandler).create$setXPos(cursorX);
((MouseHandlerAccessor) mouseHandler).create$setYPos(cursorY);
poseStack.popPose();
}
public static BlockPos proxiedOverlayPosition(Level level, BlockPos pos) {
BlockState targetedState = level.getBlockState(pos);
if (targetedState.getBlock() instanceof IProxyHoveringInformation proxy)
return proxy.getInformationSource(level, pos, targetedState);
return pos;
}
}

View File

@@ -1,7 +1,7 @@
package com.drmangotea.tfmg.content.electricity.measurement;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.simibubi.create.content.equipment.wrench.IWrenchable;

View File

@@ -1,39 +1,22 @@
package com.drmangotea.tfmg.content.electricity.storage;
import com.drmangotea.tfmg.base.TFMGDirectionalBlock;
import com.drmangotea.tfmg.content.electricity.base.ConnectNeightborsPacket;
import com.drmangotea.tfmg.base.blocks.TFMGDirectionalBlock;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.content.electricity.connection.cables.IHaveCables;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import com.drmangotea.tfmg.registry.TFMGPackets;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.DirectionalBlock;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraftforge.network.PacketDistributor;
import java.util.Collections;
import java.util.List;

View File

@@ -67,32 +67,7 @@ public class AccumulatorBlockEntity extends ElectricBlockEntity {
be.signalChanged = true;
}
}
@Override
public boolean makeElectricityTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
if (isController())
CreateLang.text("Controller").forGoggles(tooltip);
CreateLang.text("Energy").add(CreateLang.number(getCapability(ForgeCapabilities.ENERGY).orElseGet(null).getEnergyStored())).forGoggles(tooltip);
CreateLang.number(energy.getMaxEnergyStored()).forGoggles(tooltip);
super.makeElectricityTooltip(tooltip, isPlayerSneaking);
CreateLang.number(length).forGoggles(tooltip);
CreateLang.translate("multimeter.energy_stored")
.add(Component.literal(TFMGUtils.formatUnits((int) energy.getEnergyStored(), "FE")))
.style(ChatFormatting.GOLD)
.forGoggles(tooltip, 1);
/////
CreateLang.text(" Usage: ")
.add(Component.literal(TFMGUtils.formatUnits(getData().networkResistance, "W")))
.style(ChatFormatting.LIGHT_PURPLE)
.forGoggles(tooltip, 1);
int energyToExtract = data.networkPowerGeneration == 0 ? getNetworkPowerUsage() : (int) Math.max(0, Math.max(((float) powerGeneration() / (float) data.networkPowerGeneration) * (float) getNetworkPowerUsage(), 0));
energyToExtract /= TFMGConfigs.common().machines.FEtoWattTickConversionRate.get();
CreateLang.text(" Power Usage: ")
.add(CreateLang.number(energyToExtract))
.style(ChatFormatting.LIGHT_PURPLE)
.forGoggles(tooltip, 1);
return true;
}
@Override

View File

@@ -1,6 +1,6 @@
package com.drmangotea.tfmg.content.electricity.utilities.converter;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;

View File

@@ -95,34 +95,6 @@ public class ConverterBlockEntity extends ElectricBlockEntity {
return super.getCapability(cap, side);
}
@Override
public boolean makeElectricityTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
CreateLang.text("Energy").add(CreateLang.number(getCapability(ForgeCapabilities.ENERGY).orElseGet(null).getEnergyStored())).forGoggles(tooltip);
CreateLang.number(energy.getMaxEnergyStored()).forGoggles(tooltip);
super.makeElectricityTooltip(tooltip, isPlayerSneaking);
CreateLang.translate("multimeter.energy_stored")
.add(Component.literal(TFMGUtils.formatUnits((int) energy.getEnergyStored(), "FE")))
.style(ChatFormatting.GOLD)
.forGoggles(tooltip, 1);
/////
CreateLang.text(" Usage: ")
.add(Component.literal(TFMGUtils.formatUnits(getData().networkResistance, "W")))
.style(ChatFormatting.LIGHT_PURPLE)
.forGoggles(tooltip, 1);
int energyToExtract = data.networkPowerGeneration == 0 ? getNetworkPowerUsage() : (int) Math.max(0, Math.max(((float) powerGeneration() / (float) data.networkPowerGeneration) * (float) getNetworkPowerUsage(), 0));
energyToExtract /= TFMGConfigs.common().machines.FEtoWattTickConversionRate.get();
CreateLang.text(" Power Usage: ")
.add(CreateLang.number(energyToExtract))
.style(ChatFormatting.LIGHT_PURPLE)
.forGoggles(tooltip, 1);
return true;
}
@Override
public float resistance() {
@@ -162,7 +134,7 @@ public class ConverterBlockEntity extends ElectricBlockEntity {
@Override
public int powerGeneration() {
if (canPower()) {
return getData().networkResistance > 0 ? voltageGenerated.getValue() : 0;
return 10000;
}
return 0;
}

View File

@@ -1,6 +1,6 @@
package com.drmangotea.tfmg.content.electricity.utilities.diode;
import com.drmangotea.tfmg.base.TFMGDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGDirectionalBlock;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.content.electricity.base.IVoltageChanger;

View File

@@ -1,15 +1,13 @@
package com.drmangotea.tfmg.content.electricity.utilities.diode;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.content.electricity.base.UpdateInFrontPacket;
import com.drmangotea.tfmg.content.electricity.base.VoltageAlteringBlockEntity;
import com.drmangotea.tfmg.registry.TFMGPackets;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.DirectionalBlock;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;

View File

@@ -1,37 +1,25 @@
package com.drmangotea.tfmg.content.electricity.utilities.diode;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.base.TFMGDirectionalBlock;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.base.blocks.TFMGDirectionalBlock;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.content.electricity.base.IVoltageChanger;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.decoration.encasing.EncasableBlock;
import com.simibubi.create.content.decoration.encasing.EncasedBlock;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.content.fluids.FluidTransportBehaviour;
import com.simibubi.create.content.fluids.pipes.EncasedPipeBlock;
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
import com.simibubi.create.content.kinetics.base.RotatedPillarKineticBlock;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
public class EncasedDiodeBlock extends TFMGDirectionalBlock implements IBE<ElectricDiodeBlockEntity>, IVoltageChanger, EncasedBlock, IWrenchable {
public EncasedDiodeBlock(Properties p_54120_) {

View File

@@ -199,10 +199,7 @@ public class ElectricPumpBlockEntity extends PumpBlockEntity implements IElectri
//////////////////////
@Override
public boolean addToTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
return makeElectricityTooltip(tooltip, isPlayerSneaking);
}
@Override

View File

@@ -1,6 +1,6 @@
package com.drmangotea.tfmg.content.electricity.utilities.electric_switch;
import com.drmangotea.tfmg.base.TFMGDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGDirectionalBlock;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.content.electricity.base.IVoltageChanger;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;

View File

@@ -1,11 +1,8 @@
package com.drmangotea.tfmg.content.electricity.utilities.fuse_block;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.content.electricity.base.IVoltageChanger;
import com.drmangotea.tfmg.content.electricity.utilities.diode.ElectricDiodeBlockEntity;
import com.drmangotea.tfmg.content.electricity.utilities.transformer.TransformerBlockEntity;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.drmangotea.tfmg.registry.TFMGItems;
import com.simibubi.create.foundation.block.IBE;
@@ -14,17 +11,11 @@ import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
public class FuseBlock extends TFMGHorizontalDirectionalBlock implements IBE<FuseBlockEntity>, IVoltageChanger {

View File

@@ -38,18 +38,7 @@ public class FuseBlockEntity extends ElectricDiodeBlockEntity {
super(type, pos, state);
}
@Override
public boolean makeElectricityTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
if(!fuse.isEmpty())
CreateLang.text("RATING "+TFMGUtils.formatUnits(fuse.getOrCreateTag().getInt("AmpRating"), "A"))
.style(ChatFormatting.RED)
.forGoggles(tooltip, 1);
super.makeElectricityTooltip(tooltip, isPlayerSneaking);
return true;
}
public void updateInFront() {

View File

@@ -1,6 +1,6 @@
package com.drmangotea.tfmg.content.electricity.utilities.polarizer;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;

View File

@@ -6,11 +6,13 @@ import com.drmangotea.tfmg.config.TFMGConfigs;
import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity;
import com.drmangotea.tfmg.recipes.PolarizingRecipe;
import com.drmangotea.tfmg.registry.TFMGRecipeTypes;
import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation;
import com.simibubi.create.content.processing.sequenced.SequencedAssemblyRecipe;
import com.simibubi.create.foundation.item.SmartInventory;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.animation.LerpedFloat;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
@@ -31,7 +33,7 @@ import java.util.Optional;
import static net.minecraft.world.level.block.HorizontalDirectionalBlock.FACING;
public class PolarizerBlockEntity extends ElectricBlockEntity {
public class PolarizerBlockEntity extends ElectricBlockEntity implements IHaveGoggleInformation {
public SmartInventory inventory = new SmartInventory(1, this, 1, false)
.whenContentsChanged(this::onInventoryChanged);
@@ -86,13 +88,16 @@ public class PolarizerBlockEntity extends ElectricBlockEntity {
//
@Override
public boolean addToTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
CreateLang.number((double) capacitorPercentage / 2f).forGoggles(tooltip);
if (chargeCapacitors)
CreateLang.text("CAPACITOR").forGoggles(tooltip);
CreateLang.translate("goggles.polarizer.header")
.style(ChatFormatting.GRAY)
.forGoggles(tooltip, 1);
super.addToTooltip(tooltip, isPlayerSneaking);
CreateLang.translate("goggles.polarizer.charge")
.add(CreateLang.text(capacitorPercentage/2f+"%"))
.style(ChatFormatting.DARK_AQUA)
.forGoggles(tooltip);
return true;
}

View File

@@ -1,6 +1,6 @@
package com.drmangotea.tfmg.content.electricity.utilities.potentiometer;
import com.drmangotea.tfmg.base.TFMGDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGDirectionalBlock;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.content.electricity.base.IVoltageChanger;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
@@ -17,7 +17,6 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;

View File

@@ -1,6 +1,6 @@
package com.drmangotea.tfmg.content.electricity.utilities.potentiometer;
import com.drmangotea.tfmg.base.TFMGDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGDirectionalBlock;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.content.electricity.base.IVoltageChanger;

View File

@@ -1,7 +1,6 @@
package com.drmangotea.tfmg.content.electricity.utilities.potentiometer;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.content.electricity.utilities.diode.ElectricDiodeBlockEntity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.content.kinetics.base.DirectionalKineticBlock;
@@ -22,8 +21,6 @@ import net.minecraft.world.phys.Vec3;
import java.util.List;
import static net.minecraft.world.level.block.DirectionalBlock.FACING;
public class PotentiometerBlockEntity extends ElectricDiodeBlockEntity {

View File

@@ -1,8 +1,7 @@
package com.drmangotea.tfmg.content.electricity.utilities.resistor;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.base.WallMountBlock;
import com.drmangotea.tfmg.base.blocks.WallMountBlock;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.drmangotea.tfmg.registry.TFMGBlocks;

View File

@@ -9,7 +9,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import static com.drmangotea.tfmg.base.WallMountBlock.FACING;
import static com.drmangotea.tfmg.base.blocks.WallMountBlock.FACING;
public class ResistorBlockEntity extends ElectricBlockEntity {

View File

@@ -1,11 +1,9 @@
package com.drmangotea.tfmg.content.electricity.utilities.segmented_display;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.content.electricity.base.ConnectNeightborsPacket;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.drmangotea.tfmg.registry.TFMGPackets;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
@@ -25,7 +23,6 @@ import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.network.PacketDistributor;
import java.util.function.BiConsumer;

View File

@@ -1,12 +1,10 @@
package com.drmangotea.tfmg.content.electricity.utilities.traffic_light;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.content.electricity.base.ConnectNeightborsPacket;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.drmangotea.tfmg.registry.TFMGPackets;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
@@ -15,7 +13,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.network.PacketDistributor;
public class TrafficLightBlock extends TFMGHorizontalDirectionalBlock implements IBE<TrafficLightBlockEntity> {
public TrafficLightBlock(Properties p_54120_) {

View File

@@ -1,6 +1,6 @@
package com.drmangotea.tfmg.content.electricity.utilities.transformer;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.content.electricity.base.IVoltageChanger;

View File

@@ -1,6 +1,6 @@
package com.drmangotea.tfmg.content.electricity.utilities.transformer;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.content.electricity.base.VoltageAlteringBlockEntity;
@@ -64,25 +64,7 @@ public class TransformerBlockEntity extends VoltageAlteringBlockEntity {
}
@Override
public boolean makeElectricityTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
super.makeElectricityTooltip(tooltip, isPlayerSneaking);
CreateLang.text(" Ráčio: ")
.add(CreateLang.number(coilRatio))
.style(ChatFormatting.LIGHT_PURPLE)
.forGoggles(tooltip, 1);
CreateLang.text(" Primary: ")
.add(CreateLang.number(primaryCoil.getOrCreateTag().getFloat("Turns")))
.style(ChatFormatting.LIGHT_PURPLE)
.forGoggles(tooltip, 1);
CreateLang.text(" Secondary: ")
.add(CreateLang.number(secondaryCoil.getOrCreateTag().getFloat("Turns")))
.style(ChatFormatting.LIGHT_PURPLE)
.forGoggles(tooltip, 1);
return true;
}
public void updateCoils(){

View File

@@ -1,11 +1,10 @@
package com.drmangotea.tfmg.content.electricity.utilities.voltage_observer;
import com.drmangotea.tfmg.base.WallMountBlock;
import com.drmangotea.tfmg.base.blocks.WallMountBlock;
import com.drmangotea.tfmg.content.electricity.base.ConnectNeightborsPacket;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.drmangotea.tfmg.registry.TFMGPackets;
import com.simibubi.create.content.equipment.armor.BacktankBlockEntity;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;

View File

@@ -1,9 +1,8 @@
package com.drmangotea.tfmg.content.electricity.utilities.voltage_observer;
import com.drmangotea.tfmg.base.WallMountBlock;
import com.drmangotea.tfmg.base.blocks.WallMountBlock;
import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity;
import com.simibubi.create.content.equipment.armor.BacktankUtil;
import com.simibubi.create.foundation.blockEntity.ComparatorUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;

View File

@@ -2,7 +2,7 @@ package com.drmangotea.tfmg.content.electricity.utilities.voltage_observer;
import com.drmangotea.tfmg.base.WallMountBlock;
import com.drmangotea.tfmg.base.blocks.WallMountBlock;
import com.simibubi.create.foundation.data.AssetLookup;
import com.simibubi.create.foundation.data.SpecialBlockStateGen;
import com.tterrag.registrate.providers.DataGenContext;

View File

@@ -151,7 +151,7 @@ public abstract class AbstractEngineBlockEntity extends KineticElectricBlockEnti
@Override
public boolean makeElectricityTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
public boolean makeMultimeterTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
return false;
}

View File

@@ -54,8 +54,7 @@ public class EngineBlock extends HorizontalKineticBlock {
if (be.hasUpgrade()) {
if (be.upgrade.isPresent()) {
be.playRemovalSound();
be.dropItem(be.upgrade.get().getItem().getDefaultInstance());
if (be.upgrade.get() instanceof TransmissionUpgrade) {
if (be.getControllerBE().controller != null){
if (level.getBlockEntity(be.getControllerBE().controller) instanceof EngineControllerBlockEntity engineController) {
@@ -71,6 +70,9 @@ public class EngineBlock extends HorizontalKineticBlock {
}
be.playRemovalSound();
be.dropItem(be.upgrade.get().getItem().getDefaultInstance());
}
be.upgrade = Optional.empty();
be.updateRotation();

View File

@@ -1,19 +1,24 @@
package com.drmangotea.tfmg.content.engines.engine_controller;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.drmangotea.tfmg.registry.TFMGItems;
import com.simibubi.create.AllItems;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.content.redstone.link.controller.LecternControllerBlockEntity;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
public class EngineControllerBlock extends TFMGHorizontalDirectionalBlock implements IBE<EngineControllerBlockEntity>, IWrenchable {
public EngineControllerBlock(Properties p_54120_) {
@@ -22,9 +27,19 @@ public class EngineControllerBlock extends TFMGHorizontalDirectionalBlock implem
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand,
BlockHitResult hit) {
if (!player.isShiftKeyDown() && EngineControllerBlockEntity.playerInRange(player, world, pos)) {
if (!world.isClientSide)
withBlockEntityDo(world, pos, be -> be.tryStartUsing(player));
if (!player.isShiftKeyDown() && EngineControllerBlockEntity.playerInRange(player, world, pos)&&player.getItemInHand(hand).getItem()!= AllItems.WRENCH.get()&&player.getItemInHand(hand).getItem()!= TFMGItems.TRANSMISSION.get()) {
if (!world.isClientSide) {
withBlockEntityDo(world, pos, be -> {
if(be.isUsedBy(player)){
be.tryStopUsing(player);
}else
be.tryStartUsing(player);
});
}
return InteractionResult.SUCCESS;
}
@@ -32,6 +47,11 @@ public class EngineControllerBlock extends TFMGHorizontalDirectionalBlock implem
return InteractionResult.PASS;
}
@Override
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
return TFMGShapes.ENGINE_CONTROLLER.get(p_60555_.getValue(FACING));
}
@Override
public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) {
IBE.onRemove(state, level, pos, newState);

View File

@@ -352,17 +352,7 @@ public class EngineControllerBlockEntity extends SmartBlockEntity implements IHa
public void tryStartUsing(Player player) {
TFMG.LOGGER.debug("TRY START USING");
if (!playerInRange(player, level, worldPosition))
TFMG.LOGGER.debug("Not in Range");
if (playerIsUsingEngineController(player))
TFMG.LOGGER.debug("Already Using");
if (deactivatedThisTick)
TFMG.LOGGER.debug("Deactivated");
if (hasUser())
TFMG.LOGGER.debug("Already has user");
if (!deactivatedThisTick && !hasUser() && !playerIsUsingEngineController(player) && playerInRange(player, level, worldPosition)) {
TFMG.LOGGER.debug("START USING");
startUsing(player);
}
}

View File

@@ -19,7 +19,6 @@ public class EngineControllerStopControllerPacket extends EngineControllerPacket
@Override
protected void handleController(ServerPlayer player, EngineControllerBlockEntity lectern) {
TFMG.LOGGER.debug("Packet- Stop Using");
lectern.tryStopUsing(player);
}

View File

@@ -31,7 +31,7 @@ public class EngineStartPacket extends EngineControllerPacketBase {
@Override
protected void handleController(ServerPlayer player, EngineControllerBlockEntity controller) {
TFMG.LOGGER.debug("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
controller.toggleEngine();
//controller.engineStarted = !controller.engineStarted;
//controller.accelerationRate = controller.engineStarted ? 4 : 0;

View File

@@ -232,7 +232,7 @@ public class LargeEngineBlockEntity extends AbstractEngineBlockEntity {
TFMGUtils.createFluidTooltip(this,tooltip);
return super.addToGoggleTooltip(tooltip, isPlayerSneaking);
return true;
}
@Override

View File

@@ -1,14 +1,18 @@
package com.drmangotea.tfmg.content.engines.types.radial_engine;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.content.engines.types.regular_engine.RegularEngineBlock;
import com.drmangotea.tfmg.content.engines.types.regular_engine.RegularEngineBlockEntity;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
public class RadialEngineBlock extends RegularEngineBlock {
public RadialEngineBlock(Properties properties) {
@@ -19,15 +23,21 @@ public class RadialEngineBlock extends RegularEngineBlock {
@Override
public boolean hasShaftTowards(LevelReader world, BlockPos pos, BlockState state, Direction face) {
//if(state.getValue(ENGINE_STATE)==EngineState.NORMAL)
// return false;
if(state.getValue(ENGINE_STATE)==EngineState.SINGLE)
return face.getAxis() == state.getValue(SHAFT_FACING).getAxis();
return face==state.getValue(SHAFT_FACING);
}
@Override
public VoxelShape getShape(BlockState state, BlockGetter p_60556_, BlockPos pos, CollisionContext p_60558_) {
return switch (state.getValue(ENGINE_STATE)){
case NORMAL -> TFMGShapes.RADIAL_ENGINE_MIDDLE.get(state.getValue(HORIZONTAL_FACING));
case SHAFT -> TFMGShapes.RADIAL_ENGINE_SIDE.get(state.getValue(HORIZONTAL_FACING).getOpposite());
case BACK -> TFMGShapes.RADIAL_ENGINE_SIDE.get(state.getValue(HORIZONTAL_FACING));
case SINGLE -> TFMGShapes.RADIAL_ENGINE_SINGLE.get(state.getValue(HORIZONTAL_FACING));
};
}
@Override
public BlockEntityType<? extends RegularEngineBlockEntity> getBlockEntityType() {

View File

@@ -0,0 +1,75 @@
package com.drmangotea.tfmg.content.engines.types.regular_engine;
import com.drmangotea.tfmg.content.engines.base.AbstractEngineBlockEntity;
import com.drmangotea.tfmg.content.engines.base.EngineBlock;
import com.drmangotea.tfmg.content.engines.types.AbstractSmallEngineBlockEntity;
import com.drmangotea.tfmg.content.machinery.vat.industrial_mixer.IndustrialMixerBlockEntity;
import com.simibubi.create.AllPartialModels;
import com.simibubi.create.content.kinetics.base.IRotate;
import com.simibubi.create.content.kinetics.base.KineticBlockEntityVisual;
import com.simibubi.create.content.kinetics.base.RotatingInstance;
import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockEntityRenderer;
import com.simibubi.create.foundation.render.AllInstanceTypes;
import dev.engine_room.flywheel.api.instance.Instance;
import dev.engine_room.flywheel.api.visualization.VisualizationContext;
import dev.engine_room.flywheel.lib.model.Models;
import net.createmod.catnip.data.Iterate;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.Block;
import org.jetbrains.annotations.Nullable;
import java.util.function.Consumer;
public class RegularEngineVisual extends KineticBlockEntityVisual<AbstractSmallEngineBlockEntity> {
@Nullable
protected final RotatingInstance shaft;
public RegularEngineVisual(VisualizationContext context, AbstractSmallEngineBlockEntity blockEntity, float partialTick) {
super(context, blockEntity, partialTick);
RotatingInstance shaft = null;
Block block = blockState.getBlock();
if (block instanceof IRotate def) {
for (Direction d : Iterate.directionsInAxis(rotationAxis())) {
if (!def.hasShaftTowards(blockEntity.getLevel(), blockEntity.getBlockPos(), blockState, d))
continue;
RotatingInstance instance = instancerProvider().instancer(AllInstanceTypes.ROTATING, Models.partial(AllPartialModels.SHAFT_HALF))
.createInstance();
instance.setup(blockEntity)
.setPosition(getVisualPosition())
.rotateToFace(Direction.SOUTH, d)
.setChanged();
shaft = instance;
}
}
this.shaft = shaft;
}
@Override
public void update(float pt) {
if (shaft != null)shaft.setup(blockEntity)
.setChanged();
}
@Override
public void updateLight(float partialTick) {
BlockPos behind = pos.relative(Direction.UP);
if (shaft != null)relight(behind, shaft);
}
@Override
protected void _delete() {
if (shaft != null)shaft.delete();
}
@Override
public void collectCrumblingInstances(Consumer<Instance> consumer) {
consumer.accept(shaft);
}
}

View File

@@ -1,6 +1,6 @@
package com.drmangotea.tfmg.content.machinery.metallurgy.blast_furnace;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;

View File

@@ -1,8 +1,7 @@
package com.drmangotea.tfmg.content.machinery.metallurgy.blast_furnace.reinforcement;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import com.drmangotea.tfmg.registry.TFMGTags;
import net.minecraft.core.Direction;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.context.BlockPlaceContext;

View File

@@ -1,7 +1,6 @@
package com.drmangotea.tfmg.content.machinery.metallurgy.blast_furnace.reinforcement;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import net.minecraft.core.BlockPos;

View File

@@ -1,9 +1,8 @@
package com.drmangotea.tfmg.content.machinery.metallurgy.casting_basin;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;

View File

@@ -1,15 +1,12 @@
package com.drmangotea.tfmg.content.machinery.metallurgy.coke_oven;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntityType;

View File

@@ -1,13 +1,11 @@
package com.drmangotea.tfmg.content.machinery.misc.concrete_hose;
import com.simibubi.create.AllSpriteShifts;
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
import com.simibubi.create.AllPartialModels;
import com.simibubi.create.AllSpriteShifts;
import com.simibubi.create.content.contraptions.pulley.AbstractPulleyRenderer;
import com.simibubi.create.content.fluids.hosePulley.HosePulleyBlock;
import com.simibubi.create.content.fluids.hosePulley.HosePulleyBlockEntity;
import net.createmod.catnip.render.CachedBuffers;
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
import net.createmod.catnip.render.CachedBuffers;
import net.createmod.catnip.render.SpriteShiftEntry;
import net.createmod.catnip.render.SuperByteBuffer;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
@@ -22,7 +20,7 @@ public class ConcreteHoseRenderer extends AbstractPulleyRenderer<ConcreteHoseBlo
@Override
protected Axis getShaftAxis(ConcreteHoseBlockEntity be) {
return be.getBlockState()
.getValue(HosePulleyBlock.HORIZONTAL_FACING)
.getValue(ConcreteHoseBlock.HORIZONTAL_FACING)
.getClockWise()
.getAxis();
}
@@ -46,10 +44,12 @@ public class ConcreteHoseRenderer extends AbstractPulleyRenderer<ConcreteHoseBlo
protected float getOffset(ConcreteHoseBlockEntity be, float partialTicks) {
return be.getInterpolatedOffset(partialTicks);
}
@Override
protected SpriteShiftEntry getCoilShift() {
return AllSpriteShifts.HOSE_PULLEY_COIL;
}
@Override
protected boolean isRunning(ConcreteHoseBlockEntity be) {
return true;

View File

@@ -2,33 +2,24 @@ package com.drmangotea.tfmg.content.machinery.misc.exhaust;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.base.WallMountBlock;
import com.drmangotea.tfmg.base.blocks.WallMountBlock;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.simibubi.create.Create;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.foundation.block.IBE;
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.RodBlock;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import java.util.Random;
public class ExhaustBlock extends WallMountBlock implements IBE<ExhaustBlockEntity>, IWrenchable, ProperWaterloggedBlock {
public ExhaustBlock(Properties p_55926_) {

View File

@@ -124,33 +124,25 @@ public class WindingMachineBlockEntity extends KineticBlockEntity implements IHa
@Override
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
CreateLang.translate("goggles.winding_machine.header")
.style(ChatFormatting.WHITE)
.style(ChatFormatting.GRAY)
.forGoggles(tooltip, 1);
if (!spool.isEmpty())
CreateLang.text(" ")
.add(Component.translatable("recipe.winding_machine.wire_left"))
.style(ChatFormatting.WHITE)
.add(Component.literal(" " + spool.getOrCreateTag().getInt("Amount")))
if (!spool.isEmpty()) {
CreateLang.text(spool.getDisplayName().getString().replace("[","").replace("]",""))
.color(spool.getBarColor())
.forGoggles(tooltip);
CreateLang.translate("goggles.winding_machine.turns")
.add(CreateLang.number(spool.getOrCreateTag().getInt("Amount")))
.color(spool.getBarColor())
.add(Component.literal("/1000"))
.style(ChatFormatting.WHITE)
.forGoggles(tooltip);
if (inventory.getItem(0).is(TFMGItems.ELECTROMAGNETIC_COIL.get())) {
CreateLang.text(" ")
.add(Component.translatable("goggles.winding_machine.coil_turns"))
.style(ChatFormatting.WHITE)
.add(Component.literal(" " + inventory.getItem(0).getOrCreateTag().getInt("Turns")))
.forGoggles(tooltip);
} else if (recipe != null)
CreateLang.text(" ")
.add(Component.translatable("goggles.winding_machine.wire_needed"))
.style(ChatFormatting.WHITE)
.add(Component.literal(" " + amountWinded))
.color(spool.getBarColor())
if (recipe != null)
CreateLang.text("")
.add(CreateLang.translate("goggles.winding_machine.progress"))
.add(CreateLang.number(amountWinded))
.add(Component.literal("/" + recipe.getProcessingDuration()))
.style(ChatFormatting.WHITE)
.color(spool.getBarColor())
.forGoggles(tooltip);
}
return true;
}

View File

@@ -84,7 +84,7 @@ public class WindingMachineRenderer extends KineticBlockEntityRenderer<WindingMa
ms.pushPose();
TransformStack.of(ms)
.center()
.rotateY(blockState.getValue(HORIZONTAL_FACING).getAxis() == Direction.Axis.Z ? Math.abs(blockState.getValue(FACING).toYRot() - 180) : blockState.getValue(FACING).toYRot())
.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.33f)
.rotateXDegrees(be.angle)

View File

@@ -1,6 +1,6 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.controller;
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlock;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.simibubi.create.content.equipment.wrench.IWrenchable;

View File

@@ -22,6 +22,7 @@ import com.simibubi.create.foundation.utility.CreateLang;
import com.simibubi.create.infrastructure.config.AllConfigs;
import net.createmod.catnip.animation.LerpedFloat;
import net.createmod.catnip.lang.LangBuilder;
import net.createmod.ponder.api.level.PonderLevel;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@@ -154,7 +155,7 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor
}
updateTemperature();
if (level.isClientSide) {
if (level.isClientSide&&!(level instanceof PonderLevel)) {
int tankNumber = 0;
for (int i = 0; i < 8; i++) {
IFluidHandler fluidHandler = this.getCapability(ForgeCapabilities.FLUID_HANDLER).orElse(null);
@@ -211,8 +212,6 @@ public class VatBlockEntity extends SmartBlockEntity implements IHaveGoggleInfor
if (!Objects.equals(testedRecipe.machines, machines)) {
continue;
}
if (!testedRecipe.getRollableResultsAsItemStacks().isEmpty())
TFMG.LOGGER.debug("AAAAAAAAAAAAA " + testedRecipe.getRollableResultsAsItemStacks().get(0).toString());
if (!testedRecipe.allowedVatTypes.contains(((VatBlock) getBlockState().getBlock()).vatType)) {

View File

@@ -66,9 +66,7 @@ public class IndustrialMixerBlockEntity extends KineticBlockEntity implements IV
}
public static BlockEntityVisual<? super IndustrialMixerBlockEntity> createVisual(VisualizationContext visualizationContext, IndustrialMixerBlockEntity be, float partialTick) {
return new OrientedRotatingVisual<>(visualizationContext, be, partialTick, Direction.UP, Direction.UP, Models.partial(TFMGPartialModels.MIXER_SHAFT));
}

View File

@@ -0,0 +1,57 @@
package com.drmangotea.tfmg.content.machinery.vat.industrial_mixer;
import com.simibubi.create.AllPartialModels;
import com.simibubi.create.content.kinetics.base.KineticBlockEntityVisual;
import com.simibubi.create.content.kinetics.base.RotatingInstance;
import com.simibubi.create.content.kinetics.fan.EncasedFanBlockEntity;
import com.simibubi.create.foundation.render.AllInstanceTypes;
import dev.engine_room.flywheel.api.instance.Instance;
import dev.engine_room.flywheel.api.visualization.VisualizationContext;
import dev.engine_room.flywheel.lib.model.Models;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.Mth;
import java.util.function.Consumer;
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.FACING;
public class IndustrialMixerVisual extends KineticBlockEntityVisual<IndustrialMixerBlockEntity> {
protected final RotatingInstance shaft;
public IndustrialMixerVisual(VisualizationContext context, IndustrialMixerBlockEntity blockEntity, float partialTick) {
super(context, blockEntity, partialTick);
shaft = instancerProvider().instancer(AllInstanceTypes.ROTATING, Models.partial(AllPartialModels.SHAFT_HALF))
.createInstance();
shaft.setup(blockEntity)
.setPosition(getVisualPosition())
.rotateToFace(Direction.SOUTH, Direction.UP)
.setChanged();
}
@Override
public void update(float pt) {
shaft.setup(blockEntity)
.setChanged();
}
@Override
public void updateLight(float partialTick) {
BlockPos behind = pos.relative(Direction.UP);
relight(behind, shaft);
}
@Override
protected void _delete() {
shaft.delete();
}
@Override
public void collectCrumblingInstances(Consumer<Instance> consumer) {
consumer.accept(shaft);
}
}

View File

@@ -1,14 +1,23 @@
package com.drmangotea.tfmg.datagen;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.base.TFMGRegistrateTags;
import com.drmangotea.tfmg.datagen.recipes.TFMGProcessingRecipeGen;
import com.drmangotea.tfmg.datagen.recipes.TFMGRecipeProvider;
import com.drmangotea.tfmg.datagen.recipes.values.*;
import com.drmangotea.tfmg.datagen.recipes.values.create.TFMGMechanicalCraftingRecipeGen;
import com.drmangotea.tfmg.datagen.recipes.values.create.TFMGSequencedAssemblyRecipeGen;
import com.drmangotea.tfmg.datagen.recipes.values.tfmg.CastingRecipeGen;
import com.drmangotea.tfmg.datagen.recipes.values.tfmg.IndustrialBlastingRecipeGen;
import com.drmangotea.tfmg.datagen.recipes.values.tfmg.VatRecipeGen;
import com.drmangotea.tfmg.ponder.TFMGPonderPlugin;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.simibubi.create.foundation.data.recipe.MechanicalCraftingRecipeGen;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.ponder.CreatePonderPlugin;
import com.simibubi.create.foundation.utility.FilesHelper;
import com.tterrag.registrate.providers.ProviderType;
import net.createmod.ponder.foundation.PonderIndex;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.CachedOutput;
import net.minecraft.data.DataGenerator;
@@ -39,7 +48,7 @@ public class TFMGDatagen {
// generator.addProvider(true, new DamageTypeTagGen(output, lookupProvider, existingFileHelper));
RECIPE_GENERATORS.add(new TFMGIndustrialBlastingRecipeGen(output));
RECIPE_GENERATORS.add(new IndustrialBlastingRecipeGen(output));
RECIPE_GENERATORS.add(new CastingRecipeGen(output));
RECIPE_GENERATORS.add(new VatRecipeGen(output));
RECIPE_GENERATORS.add(new TFMGStandardRecipeGen(output));
@@ -86,11 +95,9 @@ public class TFMGDatagen {
}
private static void providePonderLang(BiConsumer<String, String> consumer) {
//TFMGPonderIndex.registerTags();
//TFMGPonderIndex.register();
//PonderLocalization.generateSceneLang();
//
//PonderLocalization.provideLang(TFMG.MOD_ID, consumer);
PonderIndex.addPlugin(new TFMGPonderPlugin());
PonderIndex.getLangAccess().provideLang(TFMG.MOD_ID, consumer);
}
private static void provideDefaultLang(String fileName, BiConsumer<String, String> consumer) {

View File

@@ -1,7 +1,8 @@
package com.drmangotea.tfmg.datagen.recipes;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.datagen.recipes.values.*;
import com.drmangotea.tfmg.datagen.recipes.values.create.*;
import com.drmangotea.tfmg.datagen.recipes.values.tfmg.*;
import com.simibubi.create.content.processing.recipe.ProcessingRecipe;
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder;
import com.simibubi.create.content.processing.recipe.ProcessingRecipeSerializer;
@@ -36,6 +37,9 @@ public abstract class TFMGProcessingRecipeGen extends TFMGRecipeProvider {
GENERATORS.add(new HotBlastRecipeGen(output));
GENERATORS.add(new TFMGItemApplicationRecipeGen(output));
GENERATORS.add(new TFMGFillingRecipeGen(output));
GENERATORS.add(new TFMGMixingRecipeGen(output));
GENERATORS.add(new TFMGCompactingRecipeGen(output));
GENERATORS.add(new TFMGCrushingRecipeGen(output));
gen.addProvider(true, new DataProvider() {

View File

@@ -301,6 +301,9 @@ public class TFMGRecipeProvider extends RecipeProvider {
public static ItemLike concreteMixture() {
return TFMGItems.CONCRETE_MIXTURE.get();
}
public static ItemLike asphaltMixture() {
return TFMGItems.ASPHALT_MIXTURE.get();
}
public static ItemLike slag() {
return TFMGItems.SLAG.get();
}
@@ -316,12 +319,12 @@ public class TFMGRecipeProvider extends RecipeProvider {
public static ItemLike circuitBoard() {
return TFMGItems.CIRCUIT_BOARD;
}
public static ItemLike cement() {
return TFMGBlocks.CEMENT;
}
public static ItemLike aluminumTank() {
return TFMGBlocks.ALUMINUM_FLUID_TANK;
}
public static ItemLike zincSulfate() {
return TFMGItems.ZINC_SULFATE.get();
}
public static ItemLike syntheticLeather() {
return TFMGItems.SYNTHETIC_LEATHER.get();
}
@@ -514,7 +517,7 @@ public class TFMGRecipeProvider extends RecipeProvider {
return AllTags.forgeItemTag("dusts/iron");
}
public static TagKey<Item> zinc() {
public static TagKey<Item> zincIngot() {
return AllTags.forgeItemTag("ingots/zinc");
}
@@ -595,18 +598,18 @@ public class TFMGRecipeProvider extends RecipeProvider {
}
public static Ingredient resistor100Ohms(){
public static Ingredient resistor10Ohms(){
ItemStack stack = TFMGBlocks.RESISTOR.asStack();
stack.getOrCreateTag().putInt("Resistance",100);
stack.getOrCreateTag().putInt("Resistance",10);
return Ingredient.of(stack);
}
public static Ingredient coil1000Turns(){
public static ItemStack coil100Turns(){
ItemStack stack = TFMGItems.ELECTROMAGNETIC_COIL.asStack();
stack.getOrCreateTag().putInt("Turns",1000);
return Ingredient.of(stack);
stack.getOrCreateTag().putInt("Turns",100);
return stack;
}
@@ -617,7 +620,7 @@ public class TFMGRecipeProvider extends RecipeProvider {
public static Fluid air() {
return TFMGFluids.AIR.get();
}
public static Fluid heatedAir() {
public static Fluid hotAir() {
return TFMGFluids.HOT_AIR.get();
}
public static Fluid carbonDioxide() {
@@ -632,6 +635,9 @@ public class TFMGRecipeProvider extends RecipeProvider {
public static Fluid propane() {
return TFMGFluids.PROPANE.get();
}
public static Fluid hydrogen() {
return TFMGFluids.HYDROGEN.get();
}
public static Fluid butane() {
return TFMGFluids.BUTANE.get();
}
@@ -655,9 +661,9 @@ public class TFMGRecipeProvider extends RecipeProvider {
public static Fluid lubricationOil() {
return TFMGFluids.LUBRICATION_OIL.get();
}
//public static Fluid napalm() {
// return TFMGFluids.NAPALM.get();
//}
public static Fluid napalm() {
return TFMGFluids.NAPALM.get();
}
public static Fluid naphtha() {
return TFMGFluids.NAPHTHA.get();
}
@@ -681,9 +687,9 @@ public class TFMGRecipeProvider extends RecipeProvider {
public static Fluid coolingFluid() {
return TFMGFluids.COOLING_FLUID.get();
}
// public static Fluid sulfuricAcid() {
// return TFMGFluids.SULFURIC_ACID.get();
// }
public static Fluid sulfuricAcid() {
return TFMGFluids.SULFURIC_ACID.get();
}
public static Fluid liquidConcrete() {
return TFMGFluids.LIQUID_CONCRETE.get();
}
@@ -707,8 +713,8 @@ public class TFMGRecipeProvider extends RecipeProvider {
public static ItemLike airTank() {
return TFMGRegistrate.getBucket("air");
}
public static ItemLike heatedAirTank() {
return TFMGRegistrate.getBucket("heated_air");
public static ItemLike hotAirTank() {
return TFMGRegistrate.getBucket("hot_air");
}
public static ItemLike carbonDioxideTank() {
return TFMGRegistrate.getBucket("carbon_dioxide");
@@ -722,6 +728,9 @@ public class TFMGRecipeProvider extends RecipeProvider {
public static ItemLike propaneTank() {
return TFMGRegistrate.getBucket("propane");
}
public static ItemLike hydrogenTank() {
return TFMGRegistrate.getBucket("hydrogen");
}
public static ItemLike butaneTank() {
return TFMGRegistrate.getBucket("butane");
}
@@ -731,8 +740,8 @@ public class TFMGRecipeProvider extends RecipeProvider {
public static ItemLike neonTank() {
return TFMGRegistrate.getBucket("neon");
}
public static ItemLike blastFurnaceGasTank() {
return TFMGRegistrate.getBucket("blast_furnace_gas");
public static ItemLike furnaceGasTank() {
return TFMGRegistrate.getBucket("furnace_gas");
}
public static ItemLike crudeOilBucket() {
return TFMGRegistrate.getBucket("crude_oil");

View File

@@ -1,27 +0,0 @@
package com.drmangotea.tfmg.datagen.recipes.values;
import com.drmangotea.tfmg.datagen.recipes.TFMGProcessingRecipeGen;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import com.drmangotea.tfmg.registry.TFMGFluids;
import com.simibubi.create.AllRecipeTypes;
import net.minecraft.data.PackOutput;
public class TFMGFillingRecipeGen extends TFMGProcessingRecipeGen {
GeneratedRecipe
HARDENED_PLANKS = create("hardened_planks", b -> b
.require(TFMGFluids.CREOSOTE.getSource(), 250)
.output(TFMGBlocks.HARDENED_PLANKS));
public TFMGFillingRecipeGen(PackOutput output) {
super(output);
}
@Override
protected AllRecipeTypes getRecipeType() {
return AllRecipeTypes.FILLING;
}
}

View File

@@ -151,7 +151,7 @@ public class TFMGStandardRecipeGen extends TFMGRecipeProvider {
.define('P', TFMGPipes.TFMG_PIPES.get(TFMGPipes.PipeMaterial.STEEL).get(3))
.define('W', copperWire())
.define('Q', capacitor())
.define('K', coil1000Turns())
.define('K', TFMGItems.ELECTROMAGNETIC_COIL)
.define('M', magnet())
.pattern("MQK")
.pattern("CPW")
@@ -1126,7 +1126,7 @@ public class TFMGStandardRecipeGen extends TFMGRecipeProvider {
.define('W', copperWire())
.define('V', TFMGBlocks.VOLTMETER)
.define('S', steelCasing())
.define('R', resistor100Ohms())
.define('R', TFMGBlocks.RESISTOR)
.define('C', capacitor())
.pattern("BWB")
.pattern("CVC")
@@ -1285,10 +1285,55 @@ public class TFMGStandardRecipeGen extends TFMGRecipeProvider {
.viaCooking(() -> TFMGItems.RAW_LITHIUM)
.inFurnace(),
THERMITE_GRENADE = create(TFMGItems.THERMITE_GRENADE)
.unlockedBy(TFMGItems.ALUMINUM_INGOT::get)
.viaShaped(b -> b
.define('A', aluminumIngot())
.define('T', thermitePowder())
.pattern(" T ")
.pattern("TAT")
.pattern(" T ")),
COPPER_GRENADE = create(TFMGItems.COPPER_GRENADE)
.unlockedBy(TFMGItems.ALUMINUM_INGOT::get)
.viaShaped(b -> b
.define('A', TFMGItems.THERMITE_GRENADE)
.define('T', copperIngot())
.pattern(" ")
.pattern("TAT")
.pattern(" ")),
ZINC_GRENADE = create(TFMGItems.ZINC_GRENADE)
.unlockedBy(TFMGItems.ALUMINUM_INGOT::get)
.viaShaped(b -> b
.define('A', TFMGItems.THERMITE_GRENADE)
.define('T', zincIngot())
.pattern(" ")
.pattern("TAT")
.pattern(" ")),
LITHIUM_BLADE = create(TFMGItems.LITHIUM_BLADE)
.unlockedBy(TFMGItems.LITHIUM_INGOT::get)
.viaShaped(b -> b
.define('P', heavyPlate())
.define('M', TFMGItems.STEEL_TOOLS.get(0))
.define('C', circuitBoard())
.define('W', copperWire())
.define('A', aluminumSheet())
.define('S', TFMGItems.SPARK_PLUG)
.pattern(" P ")
.pattern("AMS")
.pattern("ACW")),
LITHIUM_CHARGE = create(TFMGItems.LITHIUM_CHARGE)
.unlockedBy(TFMGItems.LITHIUM_INGOT::get)
.viaShaped(b -> b
.define('P', plasticSheet())
.define('A', aluminumSheet())
.define('L', lithiumIngot())
.pattern(" P ")
.pattern("LLL")
.pattern(" A ")),
STEEL_TRUSS = create(steelTruss()::asItem).returns(4)
.unlockedBy(TFMGItems.STEEL_INGOT::get)
@@ -1576,7 +1621,7 @@ public class TFMGStandardRecipeGen extends TFMGRecipeProvider {
FIREPROOF_BRICK_REINFORCEMENT = create(TFMGBlocks.FIREPROOF_BRICK_REINFORCEMENT).returns(6)
.unlockedBy(TFMGBlocks.FIREPROOF_BRICKS::get)
.viaShaped(b -> b
.define('F', fireproofBricks())
.define('W', fireproofBricks())
.pattern(" ")
.pattern("WWW")
.pattern("WWW")),

View File

@@ -1,32 +0,0 @@
package com.drmangotea.tfmg.datagen.recipes.values;
import com.drmangotea.tfmg.datagen.recipes.TFMGProcessingRecipeGen;
import com.drmangotea.tfmg.registry.TFMGFluids;
import com.drmangotea.tfmg.registry.TFMGItems;
import com.drmangotea.tfmg.registry.TFMGRecipeTypes;
import net.minecraft.data.PackOutput;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Blocks;
public class WindingRecipeGen extends TFMGProcessingRecipeGen {
GeneratedRecipe
COPPER_COIL = create("copper_coil", b ->b
.require(Blocks.GOLD_BLOCK.asItem())
.require(TFMGItems.COPPER_SPOOL)
.output(TFMGItems.COAL_COKE)
.duration(200))
;
public WindingRecipeGen(PackOutput output) {
super(output);
}
@Override
protected TFMGRecipeTypes getRecipeType() {
return TFMGRecipeTypes.WINDING;
}
}

View File

@@ -0,0 +1,46 @@
package com.drmangotea.tfmg.datagen.recipes.values.create;
import com.drmangotea.tfmg.registry.TFMGItems;
import com.simibubi.create.AllRecipeTypes;
import com.simibubi.create.content.processing.recipe.HeatCondition;
import net.minecraft.data.PackOutput;
import net.minecraft.world.item.Items;
import static com.drmangotea.tfmg.datagen.recipes.TFMGRecipeProvider.F.*;
import static com.drmangotea.tfmg.datagen.recipes.TFMGRecipeProvider.I.*;
public class TFMGCompactingRecipeGen extends TFMGPressingRecipeGen {
GeneratedRecipe
BITUMEN = create("bitumen", b -> b
.require(heavyOil(),1000)
.output(bitumen(), 1)
.requiresHeat(HeatCondition.HEATED)
),
PLASTIC_SHEET = create("plastic_sheet", b -> b
.require(liquidPlastic(),200)
.output(plasticSheet(), 1)
),
CINDERFLOURBLOCK = create("cinderflourblock", b -> b
.require(cinderFlour())
.require(cinderFlour())
.require(cinderFlour())
.require(cinderFlour())
.output(TFMGItems.CINDERFLOURBLOCK)
),
CAST_IRON = create("cast_iron", b -> b
.require(ironIngot())
.require(coal())
.output(TFMGItems.CAST_IRON_INGOT, 2)
.requiresHeat(HeatCondition.HEATED)
);
public TFMGCompactingRecipeGen(PackOutput output) {
super(output);
}
@Override
protected AllRecipeTypes getRecipeType() {
return AllRecipeTypes.COMPACTING;
}
}

View File

@@ -0,0 +1,78 @@
package com.drmangotea.tfmg.datagen.recipes.values.create;
import com.drmangotea.tfmg.datagen.recipes.TFMGProcessingRecipeGen;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import com.drmangotea.tfmg.registry.TFMGFluids;
import com.simibubi.create.AllRecipeTypes;
import net.minecraft.data.PackOutput;
import static com.drmangotea.tfmg.datagen.recipes.TFMGRecipeProvider.F.*;
public class TFMGFillingRecipeGen extends TFMGProcessingRecipeGen {
GeneratedRecipe
HARDENED_PLANKS = create("hardened_planks", b -> b
.require(TFMGFluids.CREOSOTE.getSource(), 250)
.output(TFMGBlocks.HARDENED_PLANKS)),
//GAS TANKS
LPG_TANK = create("lpg_tank", b -> b
.require(lpg(), 1000)
.output(lpgTank())
),
BUTANE_TANK = create("butane_tank", b -> b
.require(butane(), 1000)
.output(butaneTank())
),
PROPANE_TANK = create("propane_tank", b -> b
.require(propane(), 1000)
.output(propaneTank())
),
HYDROGEN_TANK = create("hydrogen_tank", b -> b
.require(hydrogen(), 1000)
.output(hydrogenTank())
),
FURNACE_GAS_TANK = create("furnace_gas_tank", b -> b
.require(blastFurnaceGas(), 1000)
.output(furnaceGasTank())
),
ETHYLENE_TANK = create("ethylene_tank", b -> b
.require(ethylene(), 1000)
.output(ethyleneTank())
),
PROPYLENE_TANK = create("propylene_tank", b -> b
.require(propylene(), 1000)
.output(propyleneTank())
),
NEON_TANK = create("neon_tank", b -> b
.require(neon(), 1000)
.output(neonTank())
),
CARBON_DIOXIDE_TANK = create("carbon_dioxide_tank", b -> b
.require(carbonDioxide(), 1000)
.output(carbonDioxideTank())
),
AIR_TANK = create("air_tank", b -> b
.require(air(), 1000)
.output(airTank())
),
HOT_AIR_TANK = create("hot_air_tank", b -> b
.require(hotAir(), 1000)
.output(hotAirTank())
);
public TFMGFillingRecipeGen(PackOutput output) {
super(output);
}
@Override
protected AllRecipeTypes getRecipeType() {
return AllRecipeTypes.FILLING;
}
}

Some files were not shown because too many files have changed in this diff Show More