stuff
This commit is contained in:
@@ -1,19 +1,20 @@
|
||||
package com.drmangotea.tfmg;
|
||||
|
||||
import com.drmangotea.tfmg.base.TFMGBoilerHeaters;
|
||||
import com.drmangotea.tfmg.base.TFMGContraptions;
|
||||
import com.drmangotea.tfmg.base.TFMGCreativeTabs;
|
||||
import com.drmangotea.tfmg.base.TFMGRegistrate;
|
||||
import com.drmangotea.tfmg.content.electricity.base.ElectricNetworkManager;
|
||||
import com.drmangotea.tfmg.content.engines.fuels.BaseFuelTypes;
|
||||
import com.drmangotea.tfmg.content.items.weapons.explosives.thermite_grenades.fire.TFMGColoredFires;
|
||||
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.DepositManager;
|
||||
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.TestSavedDataManager;
|
||||
import com.drmangotea.tfmg.datagen.TFMGDatagen;
|
||||
import com.drmangotea.tfmg.base.fluid.TFMGFluidInteractions;
|
||||
import com.drmangotea.tfmg.config.TFMGConfigs;
|
||||
import com.drmangotea.tfmg.content.decoration.pipes.TFMGPipes;
|
||||
import com.drmangotea.tfmg.registry.*;
|
||||
import com.drmangotea.tfmg.worldgen.TFMGFeatures;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import com.simibubi.create.content.processing.burner.BlazeBurnerBlock;
|
||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@@ -27,9 +28,9 @@ import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.registries.RegisterEvent;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import static com.simibubi.create.content.fluids.tank.BoilerHeaters.registerHeater;
|
||||
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@@ -38,19 +39,22 @@ public class TFMG {
|
||||
|
||||
public static final String MOD_ID = "tfmg";
|
||||
public static final ElectricNetworkManager NETWORK_MANAGER = new ElectricNetworkManager();
|
||||
public static final DepositManager DEPOSITS = new DepositManager();
|
||||
|
||||
public static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
||||
public static final TFMGRegistrate REGISTRATE = TFMGRegistrate.create();
|
||||
public static final TestSavedDataManager DEPOSITS = new TestSavedDataManager();
|
||||
|
||||
|
||||
|
||||
public static final TFMGRegistrate REGISTRATE = TFMGRegistrate.create();
|
||||
|
||||
|
||||
public TFMG() {
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
|
||||
REGISTRATE.registerEventListeners(modEventBus);
|
||||
|
||||
|
||||
|
||||
TFMGBlocks.init();
|
||||
TFMGBlockEntities.init();
|
||||
TFMGItems.init();
|
||||
@@ -58,6 +62,7 @@ public class TFMG {
|
||||
TFMGPartialModels.init();
|
||||
TFMGPipes.init();
|
||||
TFMGFluids.init();
|
||||
TFMGMenuTypes.init();
|
||||
TFMGEncasedBlocks.init();
|
||||
TFMGPaletteBlocks.init();
|
||||
|
||||
@@ -67,9 +72,9 @@ public class TFMG {
|
||||
TFMGMobEffects.register(modEventBus);
|
||||
TFMGRecipeTypes.register(modEventBus);
|
||||
TFMGColoredFires.register(modEventBus);
|
||||
TFMGFeatures.register(modEventBus);
|
||||
|
||||
|
||||
TFMGContraptions.prepare();
|
||||
modEventBus.addListener(TFMG::onRegister);
|
||||
TFMGPackets.registerPackets();
|
||||
TFMGConfigs.register(ModLoadingContext.get());
|
||||
modEventBus.addListener(EventPriority.LOWEST, TFMGDatagen::gatherData);
|
||||
@@ -80,6 +85,7 @@ public class TFMG {
|
||||
modEventBus.addListener(TFMGCreativeTabs::addCreative);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private void clientSetup(final FMLClientSetupEvent event) {
|
||||
ItemBlockRenderTypes.setRenderLayer(TFMGColoredFires.GREEN_FIRE.get(), RenderType.cutout());
|
||||
@@ -94,20 +100,14 @@ public class TFMG {
|
||||
|
||||
event.enqueueWork(() -> {
|
||||
BaseFuelTypes.register();
|
||||
registerHeater(TFMGBlocks.FIREBOX.get(), (level, pos, state) -> {
|
||||
BlazeBurnerBlock.HeatLevel value = state.getValue(BlazeBurnerBlock.HEAT_LEVEL);
|
||||
if (value == BlazeBurnerBlock.HeatLevel.NONE) {
|
||||
return -1;
|
||||
}
|
||||
if (value.isAtLeast(BlazeBurnerBlock.HeatLevel.FADING)) {
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
});
|
||||
TFMGBoilerHeaters.registerDefaults();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public static void onRegister(final RegisterEvent event) {
|
||||
TFMGContraptions.prepare();
|
||||
}
|
||||
|
||||
|
||||
public static ResourceLocation asResource(String path) {
|
||||
|
||||
@@ -3,7 +3,6 @@ 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.TFMGPonderIndex;
|
||||
import com.drmangotea.tfmg.registry.TFMGParticleTypes;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
@@ -37,7 +36,7 @@ public class TFMGClient {
|
||||
|
||||
@SubscribeEvent
|
||||
public void setup(final FMLClientSetupEvent event) {
|
||||
TFMGPonderIndex.register();
|
||||
TFMGPonderIndex.registerTags();
|
||||
//TFMGPonderIndex.register();
|
||||
//TFMGPonderIndex.registerTags();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.content.kinetics.base.DirectionalKineticBlock;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import net.createmod.catnip.render.CachedBuffers;
|
||||
import net.createmod.catnip.render.SuperByteBuffer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
@@ -18,7 +18,7 @@ public class HalfShaftRenderer<T extends KineticBlockEntity> extends KineticBloc
|
||||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(T be, BlockState state) {
|
||||
return CachedBufferer.partialFacing(AllPartialModels.SHAFT_HALF, state, state
|
||||
return CachedBuffers.partialFacing(AllPartialModels.SHAFT_HALF, state, state
|
||||
.getValue(DirectionalKineticBlock.FACING));
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.drmangotea.tfmg.base;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.config.TFMGStress;
|
||||
import com.drmangotea.tfmg.content.decoration.FrameBlock;
|
||||
import com.drmangotea.tfmg.content.decoration.TrussBlock;
|
||||
import com.drmangotea.tfmg.content.decoration.doors.TFMGSlidingDoorBlock;
|
||||
@@ -17,17 +18,16 @@ 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.BlockStressDefaults;
|
||||
import com.simibubi.create.content.kinetics.base.RotatedPillarKineticBlock;
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.encased.EncasedCogCTBehaviour;
|
||||
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.data.*;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.tterrag.registrate.builders.BlockBuilder;
|
||||
import com.tterrag.registrate.providers.DataGenContext;
|
||||
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
|
||||
import com.tterrag.registrate.util.DataIngredient;
|
||||
import com.tterrag.registrate.util.entry.BlockEntry;
|
||||
import com.tterrag.registrate.util.nullness.NonNullFunction;
|
||||
import com.tterrag.registrate.util.nullness.NonNullUnaryOperator;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.core.Direction;
|
||||
@@ -44,8 +44,8 @@ import java.nio.channels.Pipe;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.drmangotea.tfmg.TFMG.REGISTRATE;
|
||||
import static com.simibubi.create.AllInteractionBehaviours.interactionBehaviour;
|
||||
import static com.simibubi.create.AllMovementBehaviours.movementBehaviour;
|
||||
import static com.simibubi.create.api.behaviour.interaction.MovingInteractionBehaviour.interactionBehaviour;
|
||||
import static com.simibubi.create.api.behaviour.movement.MovementBehaviour.movementBehaviour;
|
||||
import static com.simibubi.create.foundation.data.BlockStateGen.axisBlock;
|
||||
import static com.simibubi.create.foundation.data.BlockStateGen.simpleCubeAll;
|
||||
import static com.simibubi.create.foundation.data.ModelGen.customItemModel;
|
||||
@@ -181,7 +181,7 @@ public class TFMGBuilderTransformers {
|
||||
Supplier<ItemLike> drop) {
|
||||
return b.initialProperties(SharedProperties::stone)
|
||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||
.transform(BlockStressDefaults.setNoImpact())
|
||||
.transform(TFMGStress.setNoImpact())
|
||||
.loot((p, lb) -> p.dropOther(lb, drop.get()));
|
||||
}
|
||||
public static <B extends CopycatCableBlock, P> NonNullUnaryOperator<BlockBuilder<B, P>> copycatCable() {
|
||||
@@ -199,12 +199,12 @@ public class TFMGBuilderTransformers {
|
||||
}
|
||||
|
||||
///////////////
|
||||
public static BlockEntry<TFMGFlywheelBlock> flywheel(String name) {
|
||||
return REGISTRATE.block(name + "_flywheel", TFMGFlywheelBlock::new)
|
||||
public static BlockEntry<TFMGFlywheelBlock> flywheel(String name, NonNullFunction<BlockBehaviour.Properties, TFMGFlywheelBlock> block) {
|
||||
return REGISTRATE.block(name + "_flywheel", block)
|
||||
.initialProperties(SharedProperties::softMetal)
|
||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||
.transform(axeOrPickaxe())
|
||||
.transform(BlockStressDefaults.setNoImpact())
|
||||
.transform(TFMGStress.setNoImpact())
|
||||
.blockstate(BlockStateGen.axisBlockProvider(true))
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.drmangotea.tfmg.base;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.utility.WorldAttached;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraftforge.event.level.LevelEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
@@ -4,12 +4,25 @@ package com.drmangotea.tfmg.base;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackContraption;
|
||||
import com.simibubi.create.content.contraptions.ContraptionType;
|
||||
import com.simibubi.create.api.contraption.ContraptionType;
|
||||
import com.simibubi.create.api.registry.CreateBuiltInRegistries;
|
||||
import com.simibubi.create.content.contraptions.Contraption;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.simibubi.create.AllContraptionTypes.BY_LEGACY_NAME;
|
||||
|
||||
public class TFMGContraptions {
|
||||
|
||||
public static final ContraptionType
|
||||
PUMPJACK_CONTRAPTION = ContraptionType.register(TFMG.asResource("pumpjack").toString(), PumpjackContraption::new);
|
||||
public static final Holder.Reference<ContraptionType>
|
||||
PUMPJACK_CONTRAPTION = register("pumpjack", PumpjackContraption::new);
|
||||
private static Holder.Reference<ContraptionType> register(String name, Supplier<? extends Contraption> factory) {
|
||||
ContraptionType type = new ContraptionType(factory);
|
||||
BY_LEGACY_NAME.put(name, type);
|
||||
|
||||
return Registry.registerForHolder(CreateBuiltInRegistries.CONTRAPTION_TYPE, TFMG.asResource(name), type);
|
||||
}
|
||||
public static void prepare() {}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class TFMGCreativeTabs {
|
||||
public static final RegistryObject<CreativeModeTab> TFMG_MAIN = CREATIVE_MODE_TABS.register("tfmg_main", () -> CreativeModeTab.builder()
|
||||
.withTabsBefore(AllCreativeModeTabs.BASE_CREATIVE_TAB.getId())
|
||||
.title(Component.translatable("creative_tab.tfmg_main"))
|
||||
.icon(()-> TFMGItems.STEEL_INGOT.get().asItem().getDefaultInstance())
|
||||
.icon(()-> TFMGItems.STEEL_MECHANISM.get().asItem().getDefaultInstance())
|
||||
.build());
|
||||
|
||||
public static final RegistryObject<CreativeModeTab> TFMG_DECORATION = CREATIVE_MODE_TABS.register("tfmg_decoration", () -> CreativeModeTab.builder()
|
||||
|
||||
@@ -5,8 +5,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.foundation.gui.AllIcons;
|
||||
import com.simibubi.create.foundation.gui.element.DelegatedStencilElement;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
import net.createmod.catnip.gui.element.DelegatedStencilElement;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
@@ -17,6 +16,8 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class TFMGIcons extends AllIcons {
|
||||
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ public class TFMGRegistrate extends CreateRegistrate {
|
||||
|
||||
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::new));
|
||||
return entry(name, c -> new VirtualFluidBuilder<>(self(),self(), name, c, still, flow,
|
||||
GasFluidType.create(),VirtualFluid::createSource,VirtualFluid::createFlowing));
|
||||
}
|
||||
|
||||
protected TFMGRegistrate() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.drmangotea.tfmg.base;
|
||||
|
||||
|
||||
import com.simibubi.create.foundation.utility.VoxelShaper;
|
||||
import net.createmod.catnip.math.VoxelShaper;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
@@ -6,8 +6,8 @@ import com.simibubi.create.foundation.block.connected.AllCTTypes;
|
||||
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.block.connected.CTSpriteShifter;
|
||||
import com.simibubi.create.foundation.block.connected.CTType;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShifter;
|
||||
import net.createmod.catnip.render.SpriteShiftEntry;
|
||||
import net.createmod.catnip.render.SpriteShifter;
|
||||
|
||||
public class TFMGSpriteShifts {
|
||||
|
||||
@@ -26,6 +26,10 @@ public class TFMGSpriteShifts {
|
||||
public static final CTSpriteShiftEntry ALUMINUM_FLUID_TANK = getCT(AllCTTypes.RECTANGLE, "aluminum_fluid_tank"), ALUMINUM_FLUID_TANK_TOP = getCT(AllCTTypes.RECTANGLE, "aluminum_fluid_tank_top"), ALUMINUM_FLUID_TANK_INNER = getCT(AllCTTypes.RECTANGLE, "aluminum_fluid_tank_inner");
|
||||
public static final CTSpriteShiftEntry CAST_IRON_FLUID_TANK = getCT(AllCTTypes.RECTANGLE, "cast_iron_fluid_tank"), CAST_IRON_FLUID_TANK_TOP = getCT(AllCTTypes.RECTANGLE, "cast_iron_fluid_tank_top"), CAST_IRON_FLUID_TANK_INNER = getCT(AllCTTypes.RECTANGLE, "cast_iron_fluid_tank_inner");
|
||||
|
||||
public static final CTSpriteShiftEntry STEEL_VAT = getCT(AllCTTypes.RECTANGLE, "steel_vat"), STEEL_VAT_TOP = getCT(AllCTTypes.RECTANGLE, "steel_vat_top"), STEEL_VAT_INNER = getCT(AllCTTypes.RECTANGLE, "steel_vat_inner");
|
||||
public static final CTSpriteShiftEntry CAST_IRON_VAT = getCT(AllCTTypes.RECTANGLE, "cast_iron_vat"), CAST_IRON_VAT_TOP = getCT(AllCTTypes.RECTANGLE, "cast_iron_vat_top"), CAST_IRON_VAT_INNER = getCT(AllCTTypes.RECTANGLE, "cast_iron_vat_inner");
|
||||
public static final CTSpriteShiftEntry FIREPROOF_VAT = getCT(AllCTTypes.RECTANGLE, "fireproof_vat"), FIREPROOF_VAT_TOP = getCT(AllCTTypes.RECTANGLE, "fireproof_vat_top"), FIREPROOF_VAT_INNER = getCT(AllCTTypes.RECTANGLE, "fireproof_vat_inner");
|
||||
|
||||
public static final CTSpriteShiftEntry BLAST_FURNACE_REINFORCEMENT = vertical("blast_furnace_reinforcement");
|
||||
public static final CTSpriteShiftEntry RUSTED_BLAST_FURNACE_REINFORCEMENT = vertical("rusted_blast_furnace_reinforcement");
|
||||
public static final CTSpriteShiftEntry SEGMENTED_DISPLAY_SCREEN = horizontal("segmented_display_screen");
|
||||
|
||||
@@ -12,14 +12,15 @@ import com.simibubi.create.AllSoundEvents;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.fluids.tank.FluidTankBlockEntity;
|
||||
import com.simibubi.create.foundation.fluid.SmartFluidTank;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.LangBuilder;
|
||||
import com.simibubi.create.foundation.utility.CreateLang;
|
||||
import net.createmod.catnip.lang.LangBuilder;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
@@ -53,7 +54,16 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class TFMGUtils {
|
||||
|
||||
|
||||
public static float toYRot(Direction facing) {
|
||||
return switch (facing){
|
||||
case DOWN -> 0.0F;
|
||||
case UP -> 0.0F;
|
||||
case NORTH -> 0.0F;
|
||||
case SOUTH -> 180F;
|
||||
case WEST -> 90;
|
||||
case EAST -> 270F;
|
||||
};
|
||||
}
|
||||
public static void createFireExplosion(Level level, Entity entity, BlockPos pos, int sparkAmount, float radius) {
|
||||
|
||||
if (level.isClientSide && entity != null) level.broadcastEntityEvent(entity, (byte) 3);
|
||||
@@ -159,7 +169,7 @@ public class TFMGUtils {
|
||||
}
|
||||
|
||||
public static boolean createFluidTooltip(BlockEntity be, List<Component> tooltip) {
|
||||
LangBuilder mb = Lang.translate("generic.unit.millibuckets");
|
||||
LangBuilder mb = CreateLang.translate("generic.unit.millibuckets");
|
||||
|
||||
/////////
|
||||
LazyOptional<IFluidHandler> handler = be.getCapability(ForgeCapabilities.FLUID_HANDLER);
|
||||
@@ -169,15 +179,15 @@ public class TFMGUtils {
|
||||
IFluidHandler tank = resolve.get();
|
||||
if (tank.getTanks() == 0) return false;
|
||||
|
||||
Lang.translate("goggles.fluid_storage").style(ChatFormatting.GRAY).forGoggles(tooltip);
|
||||
CreateLang.translate("goggles.fluid_storage").style(ChatFormatting.GRAY).forGoggles(tooltip);
|
||||
|
||||
|
||||
boolean isEmpty = true;
|
||||
for (int i = 0; i < tank.getTanks(); i++) {
|
||||
FluidStack fluidStack = tank.getFluidInTank(i);
|
||||
if (fluidStack.isEmpty()) continue;
|
||||
Lang.fluidName(fluidStack).style(ChatFormatting.GRAY).forGoggles(tooltip, 1);
|
||||
Lang.builder().add(Lang.number(fluidStack.getAmount()).add(mb).style(ChatFormatting.DARK_GREEN)).text(ChatFormatting.GRAY, " / ").add(Lang.number(tank.getTankCapacity(i)).add(mb).style(ChatFormatting.DARK_GRAY)).forGoggles(tooltip, 1);
|
||||
CreateLang.fluidName(fluidStack).style(ChatFormatting.GRAY).forGoggles(tooltip, 1);
|
||||
CreateLang.builder().add(CreateLang.number(fluidStack.getAmount()).add(mb).style(ChatFormatting.DARK_GREEN)).text(ChatFormatting.GRAY, " / ").add(CreateLang.number(tank.getTankCapacity(i)).add(mb).style(ChatFormatting.DARK_GRAY)).forGoggles(tooltip, 1);
|
||||
isEmpty = false;
|
||||
}
|
||||
if (tank.getTanks() > 1) {
|
||||
@@ -186,7 +196,7 @@ public class TFMGUtils {
|
||||
}
|
||||
if (!isEmpty) return true;
|
||||
|
||||
Lang.translate("gui.goggles.fluid_container.capacity").add(Lang.number(tank.getTankCapacity(0)).add(mb).style(ChatFormatting.DARK_GREEN)).style(ChatFormatting.DARK_GRAY).forGoggles(tooltip, 1);
|
||||
CreateLang.translate("gui.goggles.fluid_container.capacity").add(CreateLang.number(tank.getTankCapacity(0)).add(mb).style(ChatFormatting.DARK_GREEN)).style(ChatFormatting.DARK_GRAY).forGoggles(tooltip, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -198,13 +208,13 @@ public class TFMGUtils {
|
||||
if (!resolve.isPresent()) return false;
|
||||
IItemHandlerModifiable inventory = (IItemHandlerModifiable) resolve.get();
|
||||
if (inventory.getSlots() == 0) return false;
|
||||
Lang.translate("goggles.item_storage").style(ChatFormatting.GRAY).forGoggles(tooltip);
|
||||
CreateLang.translate("goggles.item_storage").style(ChatFormatting.GRAY).forGoggles(tooltip);
|
||||
boolean isEmpty = true;
|
||||
for (int i = 0; i < inventory.getSlots(); i++) {
|
||||
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||
|
||||
if (itemStack.isEmpty()) continue;
|
||||
Lang.itemName(itemStack).style(ChatFormatting.DARK_GREEN).add(Component.literal(" x " + itemStack.getCount())).style(ChatFormatting.DARK_GREEN).forGoggles(tooltip, 1);
|
||||
CreateLang.itemName(itemStack).style(ChatFormatting.DARK_GREEN).add(Component.literal(" x " + itemStack.getCount())).style(ChatFormatting.DARK_GREEN).forGoggles(tooltip, 1);
|
||||
isEmpty = false;
|
||||
}
|
||||
if (inventory.getSlots() > 1) {
|
||||
@@ -213,7 +223,7 @@ public class TFMGUtils {
|
||||
}
|
||||
if (!isEmpty) return true;
|
||||
|
||||
Lang.translate("gui.goggles.item_storage_empty").style(ChatFormatting.DARK_GRAY).forGoggles(tooltip, 1);
|
||||
CreateLang.translate("gui.goggles.item_storage_empty").style(ChatFormatting.DARK_GRAY).forGoggles(tooltip, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.drmangotea.tfmg.base.events;
|
||||
|
||||
import com.drmangotea.tfmg.content.engines.engine_controller.EngineControllerClientHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.ConfigScreenHandler;
|
||||
import net.minecraftforge.client.event.*;
|
||||
@@ -19,7 +20,8 @@ import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
|
||||
|
||||
import static com.jozufozu.flywheel.backend.Backend.isGameActive;
|
||||
|
||||
|
||||
|
||||
@EventBusSubscriber(Dist.CLIENT)
|
||||
public class TFMGClientEvents {
|
||||
@@ -36,4 +38,7 @@ public class TFMGClientEvents {
|
||||
}
|
||||
|
||||
}
|
||||
protected static boolean isGameActive() {
|
||||
return !(Minecraft.getInstance().level == null || Minecraft.getInstance().player == null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,15 +5,10 @@ import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.content.electricity.base.IElectric;
|
||||
import com.drmangotea.tfmg.content.engines.fuels.EngineFuelTypeManager;
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.api.event.BlockEntityBehaviourEvent;
|
||||
import com.simibubi.create.content.equipment.toolbox.ToolboxHandler;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraftforge.event.AddReloadListenerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.level.BlockEvent;
|
||||
import net.minecraftforge.event.level.LevelEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
@@ -23,16 +18,18 @@ import net.minecraftforge.fml.common.Mod;
|
||||
public class TFMGCommonEvents {
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public static void playerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) {
|
||||
Player player = event.getEntity();
|
||||
TFMG.DEPOSITS.playerLogin(player);
|
||||
}
|
||||
//@SubscribeEvent
|
||||
//public static void playerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) {
|
||||
// Player player = event.getEntity();
|
||||
// TFMG.DEPOSITS.playerLogin(player);
|
||||
// TFMG.LOGGER.debug("PLAYER LOG");
|
||||
//}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onLoadWorld(LevelEvent.Load event) {
|
||||
LevelAccessor world = event.getLevel();
|
||||
TFMG.DEPOSITS.levelLoaded(world);
|
||||
TFMG.LOGGER.debug("WORLD LOAD");
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.drmangotea.tfmg.base.fluid;
|
||||
|
||||
import com.simibubi.create.AllFluids;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
import com.tterrag.registrate.builders.FluidBuilder;
|
||||
import net.createmod.catnip.theme.Color;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class AcidFluidType extends AllFluids.TintedFluidType {
|
||||
|
||||
@@ -1,16 +1,7 @@
|
||||
package com.drmangotea.tfmg.base.fluid;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
|
||||
import com.tterrag.registrate.builders.FluidBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.drmangotea.tfmg.base.fluid;
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import com.simibubi.create.AllFluids;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
import com.tterrag.registrate.builders.FluidBuilder;
|
||||
import net.createmod.catnip.theme.Color;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.drmangotea.tfmg.base.palettes;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.base.TFMGCreativeTabs;
|
||||
import com.drmangotea.tfmg.registry.TFMGPaletteStoneTypes;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.data.CreateRegistrate;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import com.simibubi.create.foundation.utility.CreateLang;
|
||||
import com.tterrag.registrate.builders.BlockBuilder;
|
||||
import com.tterrag.registrate.builders.ItemBuilder;
|
||||
import com.tterrag.registrate.providers.DataGenContext;
|
||||
@@ -57,7 +59,7 @@ public abstract class TFMGPaletteBlockPartial<B extends Block> {
|
||||
|
||||
public @NonnullType BlockBuilder<B, CreateRegistrate> create(String variantName, TFMGPaletteBlockPattern pattern,
|
||||
BlockEntry<? extends Block> block, TFMGPaletteStoneTypes variant) {
|
||||
String patternName = Lang.nonPluralId(pattern.createName(variantName));
|
||||
String patternName = CreateLang.nonPluralId(pattern.createName(variantName));
|
||||
String blockName = patternName + "_" + this.name;
|
||||
|
||||
BlockBuilder<B, CreateRegistrate> blockBuilder = REGISTRATE
|
||||
@@ -196,7 +198,7 @@ public abstract class TFMGPaletteBlockPartial<B extends Block> {
|
||||
.requires(ingredient)
|
||||
.requires(ingredient)
|
||||
.unlockedBy("has_" + c.getName(), ingredient.getCritereon(p))
|
||||
.save(p, Create.ID + ":" + c.getName() + "_recycling");
|
||||
.save(p, TFMG.MOD_ID + ":" + c.getName() + "_recycling");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.drmangotea.tfmg.config;
|
||||
|
||||
import com.simibubi.create.foundation.config.ConfigBase;
|
||||
|
||||
import net.createmod.catnip.config.ConfigBase;
|
||||
|
||||
public class DepositConfig extends ConfigBase {
|
||||
|
||||
|
||||
@@ -1,25 +1,17 @@
|
||||
package com.drmangotea.tfmg.config;
|
||||
|
||||
import com.simibubi.create.foundation.config.ConfigBase;
|
||||
|
||||
import net.createmod.catnip.config.ConfigBase;
|
||||
|
||||
public class MachineConfig extends ConfigBase {
|
||||
|
||||
public final ConfigFloat largeGeneratorFeModifier = f(4, 0, "largeGeneratorFEModifier", Comments.largeGenerator);
|
||||
public final ConfigFloat smallGeneratorFeModifier = f(0.4f, 0, "smallGeneratorFEModifier", Comments.generator);
|
||||
public final ConfigInt blastFurnaceMaxHeight = i(10, 3, "blastFurnaceMaxHeight", Comments.blastFurnaceHeight);
|
||||
public final ConfigFloat blastFurnaceHeightSpeedModifier = f(1f, 0.1f, "blastFurnaceHeightSpeedModifier", Comments.blastFurnaceHeightSpeedModifier);
|
||||
public final ConfigInt blastFurnaceFuelConsumption = i(600, 1, "blastFurnaceFuelConsumption", Comments.blastFurnaceFuelConsumption);
|
||||
|
||||
public final ConfigInt electricMotorMinimumPower = i(250, 1, "electricMotorMinimumPower", Comments.electricMotorMinimumPower);
|
||||
public final ConfigInt electricMotorMinimumVoltage = i(150, 1, "electricMotorMinimumVoltage", Comments.electricMotorMinimumVoltage);
|
||||
public final ConfigFloat electricMotorInternalResistance = f(100, 0, "electricMotorInternalResistance", Comments.electricMotorInternalResistance);
|
||||
public final ConfigInt cokeOvenMaxSize = i(5, 1, "cokeOvenMaxSize", Comments.cokeOvenMaxSize);
|
||||
public final ConfigInt accumulatorStorage = i(100000, 1, "accumulatorStorage", Comments.accumulatorStorage);
|
||||
public final ConfigInt accumulatorVoltage = i(12, 1, "accumulatorVoltage", Comments.accumulatorVoltage);
|
||||
public final ConfigInt accumulatorMaxAmpOutput = i(20, 1, "accumulatorMaxAmpOutput", Comments.accumulatorMaxAmpOutput);
|
||||
public final ConfigInt accumulatorChargingRate = i(100, 1, "accumulatorChargingRate", Comments.accumulatorChargingRate);
|
||||
public final ConfigFloat FEtoWattTickConversionRate = f(1, 0, "FEtoWattTickConversionRate", Comments.FEtoWattTickConversionRate);
|
||||
public final ConfigBool fireboxExhaustRequirement = b(true, "fireboxExhaustRequirement", Comments.fireboxExhaustRequirement);
|
||||
public final ConfigInt fireboxFuelConsumption = i(100, 1, "fireboxFuelConsumption", Comments.fireboxFuelConsumption);
|
||||
public final ConfigFloat FEtoWattTickConversionRate = f(1, 0, "FEtoWattTickConversionRate", Comments.FEtoWattTickConversionRate);
|
||||
|
||||
public final ConfigInt graphiteElectrodeCurrent = i(10, 1, "graphiteElectrodeCurrent", Comments.graphiteElectrodeCurrent);
|
||||
public final ConfigInt electrolysisMinimumCurrent = i(5, 1, "electrolysisMinimumCurrent", Comments.electrolysisMinimumCurrent);
|
||||
public final ConfigInt engineMaxLength = i(5, 1, "engineMaxLength", Comments.engineMaxLength);
|
||||
@@ -27,6 +19,28 @@ public class MachineConfig extends ConfigBase {
|
||||
public final ConfigInt polarizerItemChargingRate = i(1000, 1, "polarizerItemChargingRate", Comments.polarizerItemChargingRate);
|
||||
|
||||
|
||||
public final ConfigGroup accumulator = group(1, "accumulator", "Accumulator");
|
||||
public final ConfigInt accumulatorStorage = i(100000, 1, "accumulatorStorage", Comments.accumulatorStorage);
|
||||
public final ConfigInt accumulatorVoltage = i(12, 1, "accumulatorVoltage", Comments.accumulatorVoltage);
|
||||
public final ConfigInt accumulatorMaxAmpOutput = i(20, 1, "accumulatorMaxAmpOutput", Comments.accumulatorMaxAmpOutput);
|
||||
public final ConfigInt accumulatorChargingRate = i(100, 1, "accumulatorChargingRate", Comments.accumulatorChargingRate);
|
||||
|
||||
public final ConfigGroup firebox = group(1, "firebox", "Firebox");
|
||||
public final ConfigBool fireboxExhaustRequirement = b(true, "fireboxExhaustRequirement", Comments.fireboxExhaustRequirement);
|
||||
public final ConfigInt fireboxFuelConsumption = i(100, 1, "fireboxFuelConsumption", Comments.fireboxFuelConsumption);
|
||||
|
||||
public final ConfigGroup generators = group(1, "generators", "Generators");
|
||||
public final ConfigFloat largeGeneratorModifier = f(4, 0, "largeGeneratorModifier", Comments.largeGenerator);
|
||||
public final ConfigFloat largeGeneratorMinSpeed = f(70, 0, "largeGeneratorMinSpeed", Comments.largeGeneratorMinSpeed);
|
||||
//
|
||||
public final ConfigFloat generatorModifier = f(1.4f, 0, "GeneratorModifier", Comments.generator);
|
||||
public final ConfigFloat generatorMinSpeed = f(40, 0, "generatorMinSpeed", Comments.generatorMinSpeed);
|
||||
|
||||
public final ConfigGroup blast_furnace = group(1, "blast_furnace", "Blast Furnace");
|
||||
public final ConfigInt blastFurnaceMaxHeight = i(10, 3, "blastFurnaceMaxHeight", Comments.blastFurnaceHeight);
|
||||
public final ConfigFloat blastFurnaceHeightSpeedModifier = f(1f, 0.1f, "blastFurnaceHeightSpeedModifier", Comments.blastFurnaceHeightSpeedModifier);
|
||||
public final ConfigInt blastFurnaceFuelConsumption = i(600, 1, "blastFurnaceFuelConsumption", Comments.blastFurnaceFuelConsumption);
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "machines";
|
||||
@@ -34,8 +48,10 @@ public class MachineConfig extends ConfigBase {
|
||||
|
||||
|
||||
private static class Comments {
|
||||
static String largeGenerator = "Changes the FE production of large generators.";
|
||||
static String generator = "Changes the FE production of small generators.";
|
||||
static String largeGenerator = "Determines how powerful the large generator is.";
|
||||
static String generator = "Determines how powerful the generator is.";
|
||||
static String largeGeneratorMinSpeed = "Changes the lowest speed the large generator can work on.";
|
||||
static String generatorMinSpeed = "Changes the lowest speed the generator can work on.";
|
||||
static String blastFurnaceHeight = "Changes the maximum height of the blast furnace.";
|
||||
static String blastFurnaceHeightSpeedModifier = "Sets the maximum time that can be saved by increasing blast furnace height.";
|
||||
static String blastFurnaceFuelConsumption = "Determines how many ticks does it take to consume one fuel.";
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
package com.drmangotea.tfmg.config;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.simibubi.create.content.kinetics.BlockStressDefaults;
|
||||
import com.simibubi.create.content.kinetics.BlockStressValues.IStressValueProvider;
|
||||
import com.simibubi.create.foundation.config.ConfigBase;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
import com.simibubi.create.foundation.utility.RegisteredObjects;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraftforge.common.ForgeConfigSpec.Builder;
|
||||
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class StressConfig extends ConfigBase implements IStressValueProvider {
|
||||
|
||||
private final Map<ResourceLocation, ConfigValue<Double>> capacities = new HashMap<>();
|
||||
private final Map<ResourceLocation, ConfigValue<Double>> impacts = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void registerAll(Builder builder) {
|
||||
builder.comment(".", Comments.su, Comments.impact)
|
||||
.push("impact");
|
||||
BlockStressDefaults.DEFAULT_IMPACTS.forEach((r, i) -> {
|
||||
if (r.getNamespace()
|
||||
.equals(TFMG.MOD_ID))
|
||||
getImpacts().put(r, builder.define(r.getPath(), i));
|
||||
});
|
||||
builder.pop();
|
||||
|
||||
builder.comment(".", Comments.su, Comments.capacity)
|
||||
.push("capacity");
|
||||
BlockStressDefaults.DEFAULT_CAPACITIES.forEach((r, i) -> {
|
||||
if (r.getNamespace()
|
||||
.equals(TFMG.MOD_ID))
|
||||
getCapacities().put(r, builder.define(r.getPath(), i));
|
||||
});
|
||||
builder.pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "stressValues";
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getImpact(Block block) {
|
||||
block = redirectValues(block);
|
||||
ResourceLocation key = RegisteredObjects.getKeyOrThrow(block);
|
||||
ConfigValue<Double> value = getImpacts().get(key);
|
||||
if (value != null) return value.get();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCapacity(Block block) {
|
||||
block = redirectValues(block);
|
||||
ResourceLocation key = RegisteredObjects.getKeyOrThrow(block);
|
||||
ConfigValue<Double> value = getCapacities().get(key);
|
||||
if (value != null) return value.get();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasImpact(Block block) {
|
||||
block = redirectValues(block);
|
||||
ResourceLocation key = RegisteredObjects.getKeyOrThrow(block);
|
||||
return getImpacts().containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapacity(Block block) {
|
||||
block = redirectValues(block);
|
||||
ResourceLocation key = RegisteredObjects.getKeyOrThrow(block);
|
||||
return getCapacities().containsKey(key);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Couple<Integer> getGeneratedRPM(Block block) {
|
||||
block = redirectValues(block);
|
||||
ResourceLocation key = RegisteredObjects.getKeyOrThrow(block);
|
||||
Supplier<Couple<Integer>> supplier = BlockStressDefaults.GENERATOR_SPEEDS.get(key);
|
||||
if (supplier == null) return null;
|
||||
return supplier.get();
|
||||
}
|
||||
|
||||
protected Block redirectValues(Block block) {
|
||||
return block;
|
||||
}
|
||||
|
||||
public Map<ResourceLocation, ConfigValue<Double>> getImpacts() {
|
||||
return impacts;
|
||||
}
|
||||
|
||||
public Map<ResourceLocation, ConfigValue<Double>> getCapacities() {
|
||||
return capacities;
|
||||
}
|
||||
|
||||
private static class Comments {
|
||||
static String su = "[in Stress Units]";
|
||||
static String impact = "Configure the individual stress impact of mechanical blocks. Note that this cost is doubled for every speed increase it receives";
|
||||
static String capacity = "Configure how much stress a source can accommodate for.";
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.drmangotea.tfmg.config;
|
||||
|
||||
import com.simibubi.create.foundation.config.ConfigBase;
|
||||
|
||||
public class TFMGCommonConfig extends ConfigBase {
|
||||
|
||||
public class TFMGCommonConfig extends net.createmod.catnip.config.ConfigBase {
|
||||
|
||||
public final MachineConfig machines = nested(0, MachineConfig::new, "Config options for TFMG's machinery");
|
||||
public final DepositConfig deposits = nested(1, DepositConfig::new, "Oil Deposit Config");
|
||||
public final DepositConfig worldgen = nested(1, DepositConfig::new, "Worldgen Settings");
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.drmangotea.tfmg.config;
|
||||
|
||||
import com.simibubi.create.content.kinetics.BlockStressValues;
|
||||
import com.simibubi.create.foundation.config.ConfigBase;
|
||||
import com.simibubi.create.api.stress.BlockStressValues;
|
||||
import com.simibubi.create.infrastructure.config.CCommon;
|
||||
import net.createmod.catnip.config.ConfigBase;
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
@@ -18,7 +18,7 @@ import java.util.function.Supplier;
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class TFMGConfigs {
|
||||
|
||||
private static final Map<ModConfig.Type, ConfigBase> CONFIGS = new EnumMap<>(ModConfig.Type.class);
|
||||
private static final Map<ModConfig.Type, net.createmod.catnip.config.ConfigBase> CONFIGS = new EnumMap<>(ModConfig.Type.class);
|
||||
|
||||
private static TFMGServerConfig server;
|
||||
private static TFMGCommonConfig common;
|
||||
@@ -55,8 +55,9 @@ public class TFMGConfigs {
|
||||
common = register(TFMGCommonConfig::new, ModConfig.Type.COMMON);
|
||||
for (Map.Entry<ModConfig.Type, ConfigBase> pair : CONFIGS.entrySet())
|
||||
context.registerConfig(pair.getKey(), pair.getValue().specification);
|
||||
|
||||
BlockStressValues.registerProvider(context.getActiveNamespace(), server().stressValues);
|
||||
TFMGStress stress = TFMGConfigs.server().stressValues;
|
||||
BlockStressValues.IMPACTS.registerProvider(stress::getImpact);
|
||||
BlockStressValues.CAPACITIES.registerProvider(stress::getCapacity);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.drmangotea.tfmg.config;
|
||||
|
||||
import com.simibubi.create.foundation.config.ConfigBase;
|
||||
|
||||
import net.createmod.catnip.config.ConfigBase;
|
||||
|
||||
public class TFMGServerConfig extends ConfigBase {
|
||||
|
||||
|
||||
|
||||
public final StressConfig stressValues = nested(0, StressConfig::new, "Fine tune the kinetic stats of individual components");
|
||||
public final TFMGStress stressValues = nested(0, TFMGStress::new, "Fine tune the kinetic stats of individual components");
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
||||
100
src/main/java/com/drmangotea/tfmg/config/TFMGStress.java
Normal file
100
src/main/java/com/drmangotea/tfmg/config/TFMGStress.java
Normal file
@@ -0,0 +1,100 @@
|
||||
package com.drmangotea.tfmg.config;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.tterrag.registrate.builders.BlockBuilder;
|
||||
import com.tterrag.registrate.util.nullness.NonNullUnaryOperator;
|
||||
import it.unimi.dsi.fastutil.objects.Object2DoubleMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2DoubleOpenHashMap;
|
||||
import net.createmod.catnip.config.ConfigBase;
|
||||
import net.createmod.catnip.platform.CatnipServices;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraftforge.common.ForgeConfigSpec.Builder;
|
||||
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.DoubleSupplier;
|
||||
|
||||
public class TFMGStress extends ConfigBase {
|
||||
// bump this version to reset configured values.
|
||||
private static final int VERSION = 2;
|
||||
|
||||
// IDs need to be used since configs load before registration
|
||||
|
||||
private static final Object2DoubleMap<ResourceLocation> DEFAULT_IMPACTS = new Object2DoubleOpenHashMap<>();
|
||||
private static final Object2DoubleMap<ResourceLocation> DEFAULT_CAPACITIES = new Object2DoubleOpenHashMap<>();
|
||||
|
||||
protected final Map<ResourceLocation, ConfigValue<Double>> capacities = new HashMap<>();
|
||||
protected final Map<ResourceLocation, ConfigValue<Double>> impacts = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void registerAll(Builder builder) {
|
||||
builder.comment(".", Comments.su, Comments.impact)
|
||||
.push("impact");
|
||||
DEFAULT_IMPACTS.forEach((id, value) -> this.impacts.put(id, builder.define(id.getPath(), value)));
|
||||
builder.pop();
|
||||
|
||||
builder.comment(".", Comments.su, Comments.capacity)
|
||||
.push("capacity");
|
||||
DEFAULT_CAPACITIES.forEach((id, value) -> this.capacities.put(id, builder.define(id.getPath(), value)));
|
||||
builder.pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "stressValues.v" + VERSION;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public DoubleSupplier getImpact(Block block) {
|
||||
ResourceLocation id = CatnipServices.REGISTRIES.getKeyOrThrow(block);
|
||||
ConfigValue<Double> value = this.impacts.get(id);
|
||||
return value == null ? null : value::get;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public DoubleSupplier getCapacity(Block block) {
|
||||
ResourceLocation id = CatnipServices.REGISTRIES.getKeyOrThrow(block);
|
||||
ConfigValue<Double> value = this.capacities.get(id);
|
||||
return value == null ? null : value::get;
|
||||
}
|
||||
|
||||
public static <B extends Block, P> NonNullUnaryOperator<BlockBuilder<B, P>> setNoImpact() {
|
||||
return setImpact(0);
|
||||
}
|
||||
|
||||
public static <B extends Block, P> NonNullUnaryOperator<BlockBuilder<B, P>> setImpact(double value) {
|
||||
return builder -> {
|
||||
assertFromCreate(builder);
|
||||
ResourceLocation id = TFMG.asResource(builder.getName());
|
||||
DEFAULT_IMPACTS.put(id, value);
|
||||
return builder;
|
||||
};
|
||||
}
|
||||
|
||||
public static <B extends Block, P> NonNullUnaryOperator<BlockBuilder<B, P>> setCapacity(double value) {
|
||||
return builder -> {
|
||||
assertFromCreate(builder);
|
||||
ResourceLocation id = TFMG.asResource(builder.getName());
|
||||
DEFAULT_CAPACITIES.put(id, value);
|
||||
return builder;
|
||||
};
|
||||
}
|
||||
|
||||
private static void assertFromCreate(BlockBuilder<?, ?> builder) {
|
||||
if (!builder.getOwner().getModid().equals(TFMG.MOD_ID)) {
|
||||
throw new IllegalStateException("Skibidi Sigma Error");
|
||||
}
|
||||
}
|
||||
|
||||
private static class Comments {
|
||||
static String su = "[in Stress Units]";
|
||||
static String impact =
|
||||
"Configure the individual stress impact of mechanical blocks. Note that this cost is doubled for every speed increase it receives.";
|
||||
static String capacity = "Configure how much stress a source can accommodate for.";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
package com.drmangotea.tfmg.content.decoration.cogs;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.api.InstanceData;
|
||||
import com.jozufozu.flywheel.api.Instancer;
|
||||
import com.jozufozu.flywheel.api.Material;
|
||||
import com.jozufozu.flywheel.api.MaterialManager;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
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.KineticBlockEntityInstance;
|
||||
import com.simibubi.create.content.kinetics.base.flwdata.RotatingData;
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.AllMaterialSpecs;
|
||||
import com.simibubi.create.foundation.utility.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 java.util.Optional;
|
||||
|
||||
public class EncasedAluminumCogInstance extends KineticBlockEntityInstance<KineticBlockEntity> {
|
||||
|
||||
private boolean large;
|
||||
|
||||
protected RotatingData rotatingModel;
|
||||
protected Optional<RotatingData> rotatingTopShaft;
|
||||
protected Optional<RotatingData> rotatingBottomShaft;
|
||||
|
||||
public static EncasedAluminumCogInstance small(MaterialManager modelManager, KineticBlockEntity blockEntity) {
|
||||
return new EncasedAluminumCogInstance(modelManager, blockEntity, false);
|
||||
}
|
||||
|
||||
public static EncasedAluminumCogInstance large(MaterialManager modelManager, KineticBlockEntity blockEntity) {
|
||||
return new EncasedAluminumCogInstance(modelManager, blockEntity, true);
|
||||
}
|
||||
|
||||
public EncasedAluminumCogInstance(MaterialManager modelManager, KineticBlockEntity blockEntity, boolean large) {
|
||||
super(modelManager, blockEntity);
|
||||
this.large = large;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
rotatingModel = setup(getCogModel().createInstance());
|
||||
|
||||
Block block = blockState.getBlock();
|
||||
if (!(block instanceof IRotate))
|
||||
return;
|
||||
|
||||
IRotate def = (IRotate) block;
|
||||
rotatingTopShaft = Optional.empty();
|
||||
rotatingBottomShaft = Optional.empty();
|
||||
|
||||
for (Direction d : Iterate.directionsInAxis(axis)) {
|
||||
if (!def.hasShaftTowards(blockEntity.getLevel(), blockEntity.getBlockPos(), blockState, d))
|
||||
continue;
|
||||
RotatingData data = setup(getRotatingMaterial().getModel(AllPartialModels.SHAFT_HALF, blockState, d)
|
||||
.createInstance());
|
||||
if (large)
|
||||
data.setRotationOffset(BracketedKineticBlockEntityRenderer.getShaftAngleOffset(axis, pos));
|
||||
if (d.getAxisDirection() == Direction.AxisDirection.POSITIVE)
|
||||
rotatingTopShaft = Optional.of(data);
|
||||
else
|
||||
rotatingBottomShaft = Optional.of(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
updateRotation(rotatingModel);
|
||||
rotatingTopShaft.ifPresent(this::updateRotation);
|
||||
rotatingBottomShaft.ifPresent(this::updateRotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLight() {
|
||||
relight(pos, rotatingModel);
|
||||
rotatingTopShaft.ifPresent(d -> relight(pos, d));
|
||||
rotatingBottomShaft.ifPresent(d -> relight(pos, d));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
rotatingModel.delete();
|
||||
rotatingTopShaft.ifPresent(InstanceData::delete);
|
||||
rotatingBottomShaft.ifPresent(InstanceData::delete);
|
||||
}
|
||||
|
||||
protected Instancer<RotatingData> getCogModel() {
|
||||
BlockState referenceState = blockEntity.getBlockState();
|
||||
Direction facing =
|
||||
Direction.fromAxisAndDirection(referenceState.getValue(BlockStateProperties.AXIS), Direction.AxisDirection.POSITIVE);
|
||||
PartialModel partial = large ? TFMGPartialModels.LARGE_ALUMINUM_COGHWEEL : TFMGPartialModels.ALUMINUM_COGHWEEL;
|
||||
|
||||
return getCutoutRotatingMaterial().getModel(partial, referenceState, facing, () -> {
|
||||
PoseStack poseStack = new PoseStack();
|
||||
TransformStack.cast(poseStack)
|
||||
.centre()
|
||||
.rotateToFace(facing)
|
||||
.multiply(Axis.XN.rotationDegrees(90))
|
||||
.unCentre();
|
||||
return poseStack;
|
||||
});
|
||||
}
|
||||
|
||||
protected Material<RotatingData> getCutoutRotatingMaterial() {
|
||||
return materialManager.defaultCutout()
|
||||
.material(AllMaterialSpecs.ROTATING);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.drmangotea.tfmg.content.decoration.cogs;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.content.kinetics.base.IRotate;
|
||||
@@ -9,9 +8,10 @@ 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 com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
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;
|
||||
@@ -41,7 +41,7 @@ public class EncasedAluminumCogRenderer extends KineticBlockEntityRenderer<Simpl
|
||||
protected void renderSafe(SimpleKineticBlockEntity be, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
super.renderSafe(be, partialTicks, ms, buffer, light, overlay);
|
||||
if (Backend.canUseInstancing(be.getLevel()))
|
||||
if (VisualizationManager.supportsVisualization(be.getLevel()))
|
||||
return;
|
||||
|
||||
BlockState blockState = be.getBlockState();
|
||||
@@ -53,12 +53,12 @@ public class EncasedAluminumCogRenderer extends KineticBlockEntityRenderer<Simpl
|
||||
Direction.Axis axis = getRotationAxisOf(be);
|
||||
BlockPos pos = be.getBlockPos();
|
||||
float angle = large ? BracketedKineticBlockEntityRenderer.getAngleForLargeCogShaft(be, axis)
|
||||
: getAngleForTe(be, pos, axis);
|
||||
: getAngleForBe(be, pos, axis);
|
||||
|
||||
for (Direction d : Iterate.directionsInAxis(getRotationAxisOf(be))) {
|
||||
if (!def.hasShaftTowards(be.getLevel(), be.getBlockPos(), blockState, d))
|
||||
continue;
|
||||
SuperByteBuffer shaft = CachedBufferer.partialFacing(AllPartialModels.SHAFT_HALF, be.getBlockState(), d);
|
||||
SuperByteBuffer shaft = CachedBuffers.partialFacing(AllPartialModels.SHAFT_HALF, be.getBlockState(), d);
|
||||
kineticRotationTransform(shaft, be, axis, angle, light);
|
||||
shaft.renderInto(ms, buffer.getBuffer(RenderType.cutoutMipped()));
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class EncasedAluminumCogRenderer extends KineticBlockEntityRenderer<Simpl
|
||||
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(SimpleKineticBlockEntity be, BlockState state) {
|
||||
return CachedBufferer.partialFacingVertical(
|
||||
return CachedBuffers.partialFacingVertical(
|
||||
large ? TFMGPartialModels.LARGE_ALUMINUM_COGHWEEL : TFMGPartialModels.ALUMINUM_COGHWEEL, state,
|
||||
Direction.fromAxisAndDirection(state.getValue(EncasedCogwheelBlock.AXIS), Direction.AxisDirection.POSITIVE));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
package com.drmangotea.tfmg.content.decoration.cogs;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.api.InstanceData;
|
||||
import com.jozufozu.flywheel.api.Instancer;
|
||||
import com.jozufozu.flywheel.api.MaterialManager;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
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.KineticBlockEntityInstance;
|
||||
import com.simibubi.create.content.kinetics.base.flwdata.RotatingData;
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.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 java.util.Optional;
|
||||
|
||||
public class EncasedSteelCogInstance extends KineticBlockEntityInstance<KineticBlockEntity> {
|
||||
|
||||
private boolean large;
|
||||
|
||||
protected RotatingData rotatingModel;
|
||||
protected Optional<RotatingData> rotatingTopShaft;
|
||||
protected Optional<RotatingData> rotatingBottomShaft;
|
||||
|
||||
public static EncasedSteelCogInstance small(MaterialManager modelManager, KineticBlockEntity blockEntity) {
|
||||
return new EncasedSteelCogInstance(modelManager, blockEntity, false);
|
||||
}
|
||||
|
||||
public static EncasedSteelCogInstance large(MaterialManager modelManager, KineticBlockEntity blockEntity) {
|
||||
return new EncasedSteelCogInstance(modelManager, blockEntity, true);
|
||||
}
|
||||
|
||||
public EncasedSteelCogInstance(MaterialManager modelManager, KineticBlockEntity blockEntity, boolean large) {
|
||||
super(modelManager, blockEntity);
|
||||
this.large = large;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
rotatingModel = setup(getCogModel().createInstance());
|
||||
|
||||
Block block = blockState.getBlock();
|
||||
if (!(block instanceof IRotate))
|
||||
return;
|
||||
|
||||
IRotate def = (IRotate) block;
|
||||
rotatingTopShaft = Optional.empty();
|
||||
rotatingBottomShaft = Optional.empty();
|
||||
|
||||
for (Direction d : Iterate.directionsInAxis(axis)) {
|
||||
if (!def.hasShaftTowards(blockEntity.getLevel(), blockEntity.getBlockPos(), blockState, d))
|
||||
continue;
|
||||
RotatingData data = setup(getRotatingMaterial().getModel(AllPartialModels.SHAFT_HALF, blockState, d)
|
||||
.createInstance());
|
||||
if (large)
|
||||
data.setRotationOffset(BracketedKineticBlockEntityRenderer.getShaftAngleOffset(axis, pos));
|
||||
if (d.getAxisDirection() == Direction.AxisDirection.POSITIVE)
|
||||
rotatingTopShaft = Optional.of(data);
|
||||
else
|
||||
rotatingBottomShaft = Optional.of(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
updateRotation(rotatingModel);
|
||||
rotatingTopShaft.ifPresent(this::updateRotation);
|
||||
rotatingBottomShaft.ifPresent(this::updateRotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLight() {
|
||||
relight(pos, rotatingModel);
|
||||
rotatingTopShaft.ifPresent(d -> relight(pos, d));
|
||||
rotatingBottomShaft.ifPresent(d -> relight(pos, d));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
rotatingModel.delete();
|
||||
rotatingTopShaft.ifPresent(InstanceData::delete);
|
||||
rotatingBottomShaft.ifPresent(InstanceData::delete);
|
||||
}
|
||||
|
||||
protected Instancer<RotatingData> getCogModel() {
|
||||
BlockState referenceState = blockEntity.getBlockState();
|
||||
Direction facing =
|
||||
Direction.fromAxisAndDirection(referenceState.getValue(BlockStateProperties.AXIS), Direction.AxisDirection.POSITIVE);
|
||||
PartialModel partial = large ? TFMGPartialModels.LARGE_STEEL_COGHWEEL : TFMGPartialModels.STEEL_COGHWEEL;
|
||||
|
||||
return getRotatingMaterial().getModel(partial, referenceState, facing, () -> {
|
||||
PoseStack poseStack = new PoseStack();
|
||||
TransformStack.cast(poseStack)
|
||||
.centre()
|
||||
.rotateToFace(facing)
|
||||
.multiply(Axis.XN.rotationDegrees(90))
|
||||
.unCentre();
|
||||
return poseStack;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.drmangotea.tfmg.content.decoration.cogs;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.content.kinetics.base.IRotate;
|
||||
@@ -9,9 +8,10 @@ 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 com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
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;
|
||||
@@ -41,7 +41,7 @@ public class EncasedSteelCogRenderer extends KineticBlockEntityRenderer<SimpleKi
|
||||
protected void renderSafe(SimpleKineticBlockEntity be, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
super.renderSafe(be, partialTicks, ms, buffer, light, overlay);
|
||||
if (Backend.canUseInstancing(be.getLevel()))
|
||||
if (VisualizationManager.supportsVisualization(be.getLevel()))
|
||||
return;
|
||||
|
||||
BlockState blockState = be.getBlockState();
|
||||
@@ -53,18 +53,18 @@ public class EncasedSteelCogRenderer extends KineticBlockEntityRenderer<SimpleKi
|
||||
Direction.Axis axis = getRotationAxisOf(be);
|
||||
BlockPos pos = be.getBlockPos();
|
||||
float angle = large ? BracketedKineticBlockEntityRenderer.getAngleForLargeCogShaft(be, axis)
|
||||
: getAngleForTe(be, pos, axis);
|
||||
: getAngleForBe(be, pos, axis);
|
||||
for (Direction d : Iterate.directionsInAxis(getRotationAxisOf(be))) {
|
||||
if (!def.hasShaftTowards(be.getLevel(), be.getBlockPos(), blockState, d))
|
||||
continue;
|
||||
SuperByteBuffer shaft = CachedBufferer.partialFacing(AllPartialModels.SHAFT_HALF, be.getBlockState(), d);
|
||||
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 CachedBufferer.partialFacingVertical(
|
||||
return CachedBuffers.partialFacingVertical(
|
||||
large ? TFMGPartialModels.LARGE_STEEL_COGHWEEL : TFMGPartialModels.STEEL_COGHWEEL, state,
|
||||
Direction.fromAxisAndDirection(state.getValue(EncasedCogwheelBlock.AXIS), Direction.AxisDirection.POSITIVE));
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.simibubi.create.content.kinetics.simpleRelays.AbstractSimpleShaftBloc
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.ICogWheel;
|
||||
import com.simibubi.create.content.kinetics.speedController.SpeedControllerBlock;
|
||||
import com.simibubi.create.foundation.advancement.AllAdvancements;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
||||
@@ -6,10 +6,10 @@ import com.simibubi.create.content.kinetics.base.HorizontalKineticBlock;
|
||||
import com.simibubi.create.content.kinetics.base.IRotate;
|
||||
import com.simibubi.create.content.kinetics.base.RotatedPillarKineticBlock;
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.ICogWheel;
|
||||
import com.simibubi.create.foundation.placement.IPlacementHelper;
|
||||
import com.simibubi.create.foundation.placement.PlacementHelpers;
|
||||
import com.simibubi.create.foundation.placement.PlacementOffset;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.createmod.catnip.placement.IPlacementHelper;
|
||||
import net.createmod.catnip.placement.PlacementHelpers;
|
||||
import net.createmod.catnip.placement.PlacementOffset;
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
package com.drmangotea.tfmg.content.decoration.cogs;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.api.Instancer;
|
||||
import com.jozufozu.flywheel.api.Material;
|
||||
import com.jozufozu.flywheel.api.MaterialManager;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
|
||||
import com.simibubi.create.content.kinetics.base.SingleRotatingInstance;
|
||||
import com.simibubi.create.content.kinetics.base.flwdata.RotatingData;
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockEntityRenderer;
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.ICogWheel;
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.SimpleKineticBlockEntity;
|
||||
import com.simibubi.create.foundation.render.AllMaterialSpecs;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.core.Direction.AxisDirection;
|
||||
|
||||
public class TFMGCogwheelInstance extends SingleRotatingInstance<SimpleKineticBlockEntity> {
|
||||
|
||||
protected RotatingData additionalShaft;
|
||||
|
||||
public TFMGCogwheelInstance(MaterialManager materialManager, SimpleKineticBlockEntity blockEntity) {
|
||||
super(materialManager, blockEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
if (!ICogWheel.isLargeCog(blockEntity.getBlockState()))
|
||||
return;
|
||||
|
||||
// Large cogs sometimes have to offset their teeth by 11.25 degrees in order to
|
||||
// mesh properly
|
||||
|
||||
float speed = blockEntity.getSpeed();
|
||||
Axis axis = KineticBlockEntityRenderer.getRotationAxisOf(blockEntity);
|
||||
BlockPos pos = blockEntity.getBlockPos();
|
||||
float offset = BracketedKineticBlockEntityRenderer.getShaftAngleOffset(axis, pos);
|
||||
Direction facing = Direction.fromAxisAndDirection(axis, AxisDirection.POSITIVE);
|
||||
Instancer<RotatingData> half = getRotatingMaterial().getModel(AllPartialModels.COGWHEEL_SHAFT, blockState,
|
||||
facing, () -> this.rotateToAxis(axis));
|
||||
|
||||
additionalShaft = setup(half.createInstance(), speed);
|
||||
additionalShaft.setRotationOffset(offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Instancer<RotatingData> getModel() {
|
||||
|
||||
Axis axis = KineticBlockEntityRenderer.getRotationAxisOf(blockEntity);
|
||||
Direction facing = Direction.fromAxisAndDirection(axis, AxisDirection.POSITIVE);
|
||||
|
||||
|
||||
if (!ICogWheel.isLargeCog(blockEntity.getBlockState()))
|
||||
return getCutoutRotatingMaterial().getModel(blockState);
|
||||
//return super.getModel();
|
||||
|
||||
PartialModel model = blockEntity.getBlockState().is(TFMGBlocks.LARGE_ALUMINUM_COGWHEEL.get()) ? TFMGPartialModels.LARGE_ALUMINUM_COGHWEEL : TFMGPartialModels.LARGE_STEEL_COGHWEEL;
|
||||
|
||||
return getCutoutRotatingMaterial().getModel(model, blockState, facing,
|
||||
() -> this.rotateToAxis(axis));
|
||||
}
|
||||
|
||||
protected Material<RotatingData> getCutoutRotatingMaterial() {
|
||||
return materialManager.defaultCutout()
|
||||
.material(AllMaterialSpecs.ROTATING);
|
||||
}
|
||||
|
||||
private PoseStack rotateToAxis(Axis axis) {
|
||||
Direction facing = Direction.fromAxisAndDirection(axis, AxisDirection.POSITIVE);
|
||||
PoseStack poseStack = new PoseStack();
|
||||
TransformStack.cast(poseStack)
|
||||
.centre()
|
||||
.rotateToFace(facing)
|
||||
.multiply(com.mojang.math.Axis.XN.rotationDegrees(-90))
|
||||
.unCentre();
|
||||
return poseStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (additionalShaft != null) {
|
||||
updateRotation(additionalShaft);
|
||||
additionalShaft.setRotationOffset(TFMGCogwheelRenderer.getShaftAngleOffset(axis, pos));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLight() {
|
||||
super.updateLight();
|
||||
if (additionalShaft != null)
|
||||
relight(pos, additionalShaft);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
super.remove();
|
||||
if (additionalShaft != null)
|
||||
additionalShaft.delete();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,16 +2,16 @@ package com.drmangotea.tfmg.content.decoration.cogs;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.SimpleKineticBlockEntity;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import dev.engine_room.flywheel.api.visualization.VisualizationManager;
|
||||
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
|
||||
import net.createmod.catnip.animation.AnimationTickHolder;
|
||||
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.Context;
|
||||
@@ -30,7 +30,7 @@ public class TFMGCogwheelRenderer extends KineticBlockEntityRenderer<SimpleKinet
|
||||
protected void renderSafe(SimpleKineticBlockEntity be, float partialTicks, PoseStack ms,
|
||||
MultiBufferSource buffer, int light, int overlay) {
|
||||
|
||||
if (Backend.canUseInstancing(be.getLevel()))
|
||||
if (VisualizationManager.supportsVisualization(be.getLevel()))
|
||||
return;
|
||||
|
||||
if (!AllBlocks.LARGE_COGWHEEL.has(be.getBlockState())) {
|
||||
@@ -40,16 +40,14 @@ public class TFMGCogwheelRenderer extends KineticBlockEntityRenderer<SimpleKinet
|
||||
|
||||
Axis axis = getRotationAxisOf(be);
|
||||
Direction facing = Direction.fromAxisAndDirection(axis, AxisDirection.POSITIVE);
|
||||
|
||||
PartialModel model = be.getBlockState().is(TFMGBlocks.LARGE_ALUMINUM_COGWHEEL.get()) ? TFMGPartialModels.LARGE_ALUMINUM_COGHWEEL : TFMGPartialModels.LARGE_STEEL_COGHWEEL;
|
||||
|
||||
renderRotatingBuffer(be,
|
||||
CachedBufferer.partialFacingVertical(model, be.getBlockState(), facing),
|
||||
CachedBuffers.partialFacingVertical(model, be.getBlockState(), facing),
|
||||
ms, buffer.getBuffer(RenderType.cutoutMipped()), light);
|
||||
|
||||
float angle = getAngleForLargeCogShaft(be, axis);
|
||||
SuperByteBuffer shaft =
|
||||
CachedBufferer.partialFacingVertical(AllPartialModels.COGWHEEL_SHAFT, be.getBlockState(), facing);
|
||||
CachedBuffers.partialFacingVertical(AllPartialModels.COGWHEEL_SHAFT, be.getBlockState(), facing);
|
||||
kineticRotationTransform(shaft, be, axis, angle, light);
|
||||
shaft.renderInto(ms, buffer.getBuffer(RenderType.solid()));
|
||||
}
|
||||
|
||||
@@ -2,8 +2,7 @@ package com.drmangotea.tfmg.content.decoration.doors;
|
||||
|
||||
import com.simibubi.create.content.decoration.slidingDoor.SlidingDoorBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
|
||||
import net.createmod.catnip.animation.LerpedFloat;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
@@ -36,7 +35,7 @@ public class TFMGSlidingDoorBlockEntity extends SlidingDoorBlockEntity {
|
||||
super.tick();
|
||||
boolean open = isOpen(getBlockState());
|
||||
boolean wasSettled = animation.settled();
|
||||
animation.chase(open ? 1 : 0, .15f, Chaser.LINEAR);
|
||||
animation.chase(open ? 1 : 0, .15f, LerpedFloat.Chaser.LINEAR);
|
||||
animation.tickChaser();
|
||||
|
||||
if (level.isClientSide()) {
|
||||
|
||||
@@ -2,15 +2,15 @@ package com.drmangotea.tfmg.content.decoration.doors;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
|
||||
import net.createmod.catnip.data.Couple;
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.createmod.catnip.math.AngleHelper;
|
||||
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.Context;
|
||||
@@ -52,21 +52,21 @@ public class TFMGSlidingDoorRenderer extends SafeBlockEntityRenderer<TFMGSliding
|
||||
return;
|
||||
boolean flip = blockState.getValue(DoorBlock.HINGE) == DoorHingeSide.RIGHT;
|
||||
for (boolean left : Iterate.trueAndFalse) {
|
||||
SuperByteBuffer partial = CachedBufferer.partial(partials.get(left ^ flip), blockState);
|
||||
SuperByteBuffer partial = CachedBuffers.partial(partials.get(left ^ flip), blockState);
|
||||
float f = flip ? -1 : 1;
|
||||
partial.translate(0, -1 / 512f, 0)
|
||||
.translate(Vec3.atLowerCornerOf(facing.getNormal())
|
||||
.scale(value2 * 1 / 32f));
|
||||
partial.rotateCentered(Direction.UP,
|
||||
Mth.DEG_TO_RAD * AngleHelper.horizontalAngle(facing.getClockWise()));
|
||||
partial.rotateCenteredDegrees(
|
||||
Mth.DEG_TO_RAD * AngleHelper.horizontalAngle(facing.getClockWise()), Direction.UP);
|
||||
|
||||
if (flip)
|
||||
partial.translate(0, 0, 1);
|
||||
partial.rotateY(91 * f * value * value);
|
||||
partial.rotateYDegrees(91 * f * value * value);
|
||||
|
||||
if (!left)
|
||||
partial.translate(0, 0, f / 2f)
|
||||
.rotateY(-181 * f * value * value);
|
||||
.rotateYDegrees(-181 * f * value * value);
|
||||
|
||||
if (flip)
|
||||
partial.translate(0, 0, -1 / 2f);
|
||||
@@ -79,7 +79,7 @@ public class TFMGSlidingDoorRenderer extends SafeBlockEntityRenderer<TFMGSliding
|
||||
}
|
||||
|
||||
for (DoubleBlockHalf half : DoubleBlockHalf.values()) {
|
||||
CachedBufferer.block(blockState.setValue(DoorBlock.OPEN, false)
|
||||
CachedBuffers.block(blockState.setValue(DoorBlock.OPEN, false)
|
||||
.setValue(DoorBlock.HALF, half))
|
||||
.translate(0, half == DoubleBlockHalf.UPPER ? 1 - 1 / 512f : 0, 0)
|
||||
.translate(offset)
|
||||
|
||||
@@ -3,22 +3,23 @@ package com.drmangotea.tfmg.content.decoration.encased;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.simibubi.create.content.contraptions.ITransformableBlock;
|
||||
import com.simibubi.create.api.contraption.transformable.TransformableBlock;
|
||||
import com.simibubi.create.api.schematic.requirement.SpecialBlockItemRequirement;
|
||||
import com.simibubi.create.content.contraptions.StructureTransform;
|
||||
import com.simibubi.create.content.decoration.encasing.EncasedBlock;
|
||||
import com.simibubi.create.content.equipment.wrench.IWrenchable;
|
||||
import com.simibubi.create.content.kinetics.base.IRotate;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
|
||||
import com.simibubi.create.content.kinetics.base.RotatedPillarKineticBlock;
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.CogWheelBlock;
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.ICogWheel;
|
||||
import com.simibubi.create.content.kinetics.simpleRelays.SimpleKineticBlockEntity;
|
||||
import com.simibubi.create.content.schematics.requirement.ISpecialBlockItemRequirement;
|
||||
import com.simibubi.create.content.schematics.requirement.ItemRequirement;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.VoxelShaper;
|
||||
import com.tterrag.registrate.util.entry.BlockEntityEntry;
|
||||
import com.tterrag.registrate.util.entry.BlockEntry;
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.createmod.catnip.math.VoxelShaper;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
@@ -44,7 +45,7 @@ import net.minecraft.world.phys.HitResult;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class TFMGEncasedCogwheelBlock extends RotatedPillarKineticBlock
|
||||
implements ICogWheel, IBE<SimpleKineticBlockEntity>, ISpecialBlockItemRequirement, ITransformableBlock, EncasedBlock {
|
||||
implements ICogWheel, IBE<SimpleKineticBlockEntity>, SpecialBlockItemRequirement, TransformableBlock, EncasedBlock {
|
||||
public static final BooleanProperty TOP_SHAFT = BooleanProperty.create("top_shaft");
|
||||
public static final BooleanProperty BOTTOM_SHAFT = BooleanProperty.create("bottom_shaft");
|
||||
protected final boolean isLarge;
|
||||
@@ -55,6 +56,7 @@ public class TFMGEncasedCogwheelBlock extends RotatedPillarKineticBlock
|
||||
private final BlockEntityEntry<SimpleKineticBlockEntity> beLarge;
|
||||
|
||||
public static TFMGEncasedCogwheelBlock steel(Properties properties, boolean large, Supplier<Block> casing) {
|
||||
|
||||
return new TFMGEncasedCogwheelBlock(properties, large, casing, TFMGBlocks.STEEL_COGWHEEL, TFMGBlocks.LARGE_STEEL_COGWHEEL, TFMGBlockEntities.ENCASED_STEEL_COGWHEEL, TFMGBlockEntities.ENCASED_LARGE_STEEL_COGWHEEL);
|
||||
}
|
||||
|
||||
@@ -124,7 +126,7 @@ public class TFMGEncasedCogwheelBlock extends RotatedPillarKineticBlock
|
||||
BlockPos pos = context.getClickedPos();
|
||||
KineticBlockEntity.switchToBlockState(level, pos, state.cycle(context.getClickedFace()
|
||||
.getAxisDirection() == Direction.AxisDirection.POSITIVE ? TOP_SHAFT : BOTTOM_SHAFT));
|
||||
playRotateSound(level, pos);
|
||||
IWrenchable.playRotateSound(level, pos);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ package com.drmangotea.tfmg.content.decoration.encased;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.api.schematic.requirement.SpecialBlockItemRequirement;
|
||||
import com.simibubi.create.content.decoration.encasing.EncasedBlock;
|
||||
import com.simibubi.create.content.kinetics.base.AbstractEncasedShaftBlock;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
|
||||
import com.simibubi.create.content.kinetics.base.RotatedPillarKineticBlock;
|
||||
import com.simibubi.create.content.schematics.requirement.ISpecialBlockItemRequirement;
|
||||
import com.simibubi.create.content.schematics.requirement.ItemRequirement;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -28,7 +28,7 @@ import net.minecraft.world.phys.HitResult;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class TFMGEncasedShaftBlock extends AbstractEncasedShaftBlock
|
||||
implements IBE<KineticBlockEntity>, ISpecialBlockItemRequirement, EncasedBlock {
|
||||
implements IBE<KineticBlockEntity>, SpecialBlockItemRequirement, EncasedBlock {
|
||||
|
||||
private final Supplier<Block> casing;
|
||||
|
||||
|
||||
@@ -2,9 +2,11 @@ package com.drmangotea.tfmg.content.decoration.flywheels;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.content.kinetics.base.RotatedPillarKineticBlock;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
@@ -18,8 +20,29 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
public class TFMGFlywheelBlock extends RotatedPillarKineticBlock implements IBE<TFMGFlywheelBlockEntity> {
|
||||
|
||||
public TFMGFlywheelBlock(Properties properties) {
|
||||
|
||||
public final PartialModel model;
|
||||
|
||||
public static TFMGFlywheelBlock steel(Properties properties){
|
||||
return new TFMGFlywheelBlock(properties, TFMGPartialModels.STEEL_FLYWHEEL);
|
||||
}
|
||||
public static TFMGFlywheelBlock aluminum(Properties properties){
|
||||
return new TFMGFlywheelBlock(properties, TFMGPartialModels.ALUMINUM_FLYWHEEL);
|
||||
}
|
||||
public static TFMGFlywheelBlock cast_iron(Properties properties){
|
||||
return new TFMGFlywheelBlock(properties, TFMGPartialModels.CAST_IRON_FLYWHEEL);
|
||||
}
|
||||
public static TFMGFlywheelBlock lead(Properties properties){
|
||||
return new TFMGFlywheelBlock(properties, TFMGPartialModels.LEAD_FLYWHEEL);
|
||||
}
|
||||
public static TFMGFlywheelBlock nickel(Properties properties){
|
||||
return new TFMGFlywheelBlock(properties, TFMGPartialModels.NICKEL_FLYWHEEL);
|
||||
}
|
||||
|
||||
|
||||
public TFMGFlywheelBlock(Properties properties,PartialModel model) {
|
||||
super(properties);
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.drmangotea.tfmg.content.decoration.flywheels;
|
||||
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
|
||||
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
|
||||
import net.createmod.catnip.animation.LerpedFloat;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
@@ -14,6 +14,8 @@ public class TFMGFlywheelBlockEntity extends KineticBlockEntity {
|
||||
LerpedFloat visualSpeed = LerpedFloat.linear();
|
||||
float angle;
|
||||
|
||||
|
||||
|
||||
public TFMGFlywheelBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
@@ -32,7 +34,7 @@ public class TFMGFlywheelBlockEntity extends KineticBlockEntity {
|
||||
protected void read(CompoundTag compound, boolean clientPacket) {
|
||||
super.read(compound, clientPacket);
|
||||
if (clientPacket)
|
||||
visualSpeed.chase(getGeneratedSpeed(), 1 / 64f, Chaser.EXP);
|
||||
visualSpeed.chase(getGeneratedSpeed(), 1 / 64f, LerpedFloat.Chaser.EXP);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.drmangotea.tfmg.content.decoration.flywheels;
|
||||
|
||||
import com.jozufozu.flywheel.api.MaterialManager;
|
||||
import com.jozufozu.flywheel.api.instance.DynamicInstance;
|
||||
import com.jozufozu.flywheel.core.materials.model.ModelData;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityInstance;
|
||||
import com.simibubi.create.content.kinetics.base.flwdata.RotatingData;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import net.minecraft.core.Direction;
|
||||
|
||||
public class TFMGFlywheelInstance extends KineticBlockEntityInstance<TFMGFlywheelBlockEntity> implements DynamicInstance {
|
||||
|
||||
protected final RotatingData shaft;
|
||||
protected final ModelData wheel;
|
||||
protected float lastAngle = Float.NaN;
|
||||
|
||||
public TFMGFlywheelInstance(MaterialManager materialManager, TFMGFlywheelBlockEntity blockEntity) {
|
||||
super(materialManager, blockEntity);
|
||||
|
||||
shaft = setup(getRotatingMaterial().getModel(shaft())
|
||||
.createInstance());
|
||||
wheel = getTransformMaterial().getModel(blockState)
|
||||
.createInstance();
|
||||
|
||||
animate(blockEntity.angle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginFrame() {
|
||||
|
||||
float partialTicks = AnimationTickHolder.getPartialTicks();
|
||||
|
||||
float speed = blockEntity.visualSpeed.getValue(partialTicks) * 3 / 10f;
|
||||
float angle = blockEntity.angle + speed * partialTicks;
|
||||
|
||||
if (Math.abs(angle - lastAngle) < 0.001)
|
||||
return;
|
||||
|
||||
animate(angle);
|
||||
|
||||
lastAngle = angle;
|
||||
}
|
||||
|
||||
private void animate(float angle) {
|
||||
PoseStack ms = new PoseStack();
|
||||
TransformStack msr = TransformStack.cast(ms);
|
||||
|
||||
msr.translate(getInstancePosition());
|
||||
msr.centre()
|
||||
.rotate(Direction.get(Direction.AxisDirection.POSITIVE, axis), AngleHelper.rad(angle))
|
||||
.unCentre();
|
||||
|
||||
wheel.setTransform(ms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
updateRotation(shaft);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLight() {
|
||||
relight(pos, shaft, wheel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
shaft.delete();
|
||||
wheel.delete();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.drmangotea.tfmg.content.decoration.flywheels;
|
||||
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import dev.engine_room.flywheel.api.visualization.VisualizationManager;
|
||||
import net.createmod.catnip.math.AngleHelper;
|
||||
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;
|
||||
@@ -23,7 +23,7 @@ public class TFMGFlywheelRenderer extends KineticBlockEntityRenderer<TFMGFlywhee
|
||||
int light, int overlay) {
|
||||
super.renderSafe(be, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
if (Backend.canUseInstancing(be.getLevel()))
|
||||
if (VisualizationManager.supportsVisualization(be.getLevel()))
|
||||
return;
|
||||
|
||||
BlockState blockState = be.getBlockState();
|
||||
@@ -37,7 +37,7 @@ public class TFMGFlywheelRenderer extends KineticBlockEntityRenderer<TFMGFlywhee
|
||||
|
||||
private void renderFlywheel(TFMGFlywheelBlockEntity be, PoseStack ms, int light, BlockState blockState, float angle,
|
||||
VertexConsumer vb) {
|
||||
SuperByteBuffer wheel = CachedBufferer.block(blockState);
|
||||
SuperByteBuffer wheel = CachedBuffers.block(blockState);
|
||||
kineticRotationTransform(wheel, be, getRotationAxisOf(be), AngleHelper.rad(angle), light);
|
||||
wheel.renderInto(ms, vb);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public class SteelGearboxBlock extends RotatedPillarKineticBlock implements IBE<
|
||||
Player player) {
|
||||
if (state.getValue(AXIS).isVertical())
|
||||
return super.getCloneItemStack(state, target, world, pos, player);
|
||||
|
||||
return new ItemStack(TFMGItems.STEEL_VERTICAL_GEARBOX.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.drmangotea.tfmg.content.decoration.gearbox;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.simibubi.create.content.kinetics.base.IRotate;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
|
||||
@@ -4,7 +4,8 @@ import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.content.fluids.FluidTransportBehaviour;
|
||||
import com.simibubi.create.content.fluids.pipes.EncasedPipeBlock;
|
||||
import com.simibubi.create.content.fluids.pipes.FluidPipeBlockEntity;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.simibubi.create.content.fluids.pipes.FluidPipeBlock;
|
||||
import com.simibubi.create.content.fluids.pipes.GlassFluidPipeBlock;
|
||||
import com.simibubi.create.content.fluids.pipes.StraightPipeBlockEntity;
|
||||
import com.simibubi.create.content.schematics.requirement.ItemRequirement;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.simibubi.create.content.fluids.FluidTransportBehaviour;
|
||||
import com.simibubi.create.content.fluids.pipes.FluidPipeBlock;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.model.BakedModelWrapperWithData;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.simibubi.create.content.fluids.pipes.FluidPipeBlockEntity;
|
||||
import com.simibubi.create.content.fluids.pipes.GlassFluidPipeBlock;
|
||||
import com.simibubi.create.foundation.advancement.AllAdvancements;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.drmangotea.tfmg.content.decoration.pipes;
|
||||
|
||||
import com.drmangotea.tfmg.config.TFMGStress;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllSpriteShifts;
|
||||
import com.simibubi.create.content.decoration.encasing.EncasedCTBehaviour;
|
||||
@@ -7,7 +8,6 @@ import com.simibubi.create.content.decoration.encasing.EncasingRegistry;
|
||||
import com.simibubi.create.content.fluids.PipeAttachmentModel;
|
||||
import com.simibubi.create.content.fluids.pipes.SmartFluidPipeGenerator;
|
||||
import com.simibubi.create.content.fluids.pipes.valve.FluidValveBlock;
|
||||
import com.simibubi.create.content.kinetics.BlockStressDefaults;
|
||||
import com.simibubi.create.foundation.data.AssetLookup;
|
||||
import com.simibubi.create.foundation.data.BlockStateGen;
|
||||
import com.simibubi.create.foundation.data.CreateRegistrate;
|
||||
@@ -63,13 +63,14 @@ public class TFMGPipes {
|
||||
.onRegister(CreateRegistrate.connectedTextures(() -> new EncasedCTBehaviour(AllSpriteShifts.COPPER_CASING)))
|
||||
.onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, AllSpriteShifts.COPPER_CASING,
|
||||
(s, f) -> !s.getValue(TFMGEncasedPipeBlock.FACING_TO_PROPERTY_MAP.get(f)))))
|
||||
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::new))
|
||||
.onRegister(CreateRegistrate.blockModel(() -> PipeAttachmentModel::withoutAO))
|
||||
.loot((p, b) -> p.dropOther(b, pipe.get()))
|
||||
.transform(EncasingRegistry.addVariantTo(AllBlocks.FLUID_PIPE))
|
||||
.transform(EncasingRegistry.addVariantTo(pipe))
|
||||
.register();
|
||||
|
||||
pipes.add(copper_encased_pipe);
|
||||
|
||||
//if(true)
|
||||
// break;
|
||||
BlockEntry<TFMGGlassPipeBlock> glass_pipe =
|
||||
REGISTRATE.block("glass_" + pipeType.name + "_pipe", p -> new TFMGGlassPipeBlock(p, pipeType))
|
||||
.initialProperties(SharedProperties::copperMetal)
|
||||
@@ -100,7 +101,7 @@ public class TFMGPipes {
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(BlockStateGen.directionalBlockProviderIgnoresWaterlogged(true))
|
||||
.onRegister(CreateRegistrate.blockModel(() -> t -> new TFMGPipeAttachmentModel(t, pipeType)))
|
||||
.transform(BlockStressDefaults.setImpact(4.0))
|
||||
.transform(TFMGStress.setImpact(4.0))
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.content.fluids.tank.FluidTankBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.fluid.FluidRenderer;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
import net.createmod.catnip.animation.LerpedFloat;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.util.Mth;
|
||||
@@ -59,7 +59,7 @@ public class TFMGFluidTankRenderer extends SafeBlockEntityRenderer<FluidTankBloc
|
||||
|
||||
ms.pushPose();
|
||||
ms.translate(0, clampedLevel - totalHeight, 0);
|
||||
FluidRenderer.renderFluidBox(fluidStack, xMin, yMin, zMin, xMax, yMax, zMax, buffer, ms, light, false);
|
||||
FluidRenderer.renderFluidBox(fluidStack.getFluid(),fluidStack.getAmount(), xMin, yMin, zMin, xMax, yMax, zMax, buffer, ms, light, false, true, fluidStack.getTag());
|
||||
ms.popPose();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.simibubi.create.api.connectivity.ConnectivityHandler;
|
||||
import com.simibubi.create.content.fluids.tank.FluidTankCTBehaviour;
|
||||
import com.simibubi.create.foundation.block.connected.CTModel;
|
||||
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.simibubi.create.api.connectivity.ConnectivityHandler;
|
||||
import com.simibubi.create.content.fluids.tank.FluidTankCTBehaviour;
|
||||
import com.simibubi.create.foundation.block.connected.CTModel;
|
||||
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.simibubi.create.api.connectivity.ConnectivityHandler;
|
||||
import com.simibubi.create.content.fluids.tank.FluidTankCTBehaviour;
|
||||
import com.simibubi.create.foundation.block.connected.CTModel;
|
||||
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
@@ -32,6 +32,19 @@ public class SteelFluidTankModel extends CTModel {
|
||||
TFMGSpriteShifts.STEEL_FLUID_TANK_INNER);
|
||||
}
|
||||
|
||||
public static SteelFluidTankModel steelVat(BakedModel originalModel) {
|
||||
return new SteelFluidTankModel(originalModel, TFMGSpriteShifts.STEEL_VAT, TFMGSpriteShifts.STEEL_VAT_TOP,
|
||||
TFMGSpriteShifts.STEEL_VAT_INNER);
|
||||
}
|
||||
public static SteelFluidTankModel castIronVat(BakedModel originalModel) {
|
||||
return new SteelFluidTankModel(originalModel, TFMGSpriteShifts.CAST_IRON_VAT, TFMGSpriteShifts.CAST_IRON_VAT_TOP,
|
||||
TFMGSpriteShifts.CAST_IRON_VAT_INNER);
|
||||
}
|
||||
public static SteelFluidTankModel fireproofVat(BakedModel originalModel) {
|
||||
return new SteelFluidTankModel(originalModel, TFMGSpriteShifts.FIREPROOF_VAT, TFMGSpriteShifts.FIREPROOF_VAT_TOP,
|
||||
TFMGSpriteShifts.FIREPROOF_VAT_INNER);
|
||||
}
|
||||
|
||||
|
||||
private SteelFluidTankModel(BakedModel originalModel, CTSpriteShiftEntry side, CTSpriteShiftEntry top,
|
||||
CTSpriteShiftEntry inner) {
|
||||
|
||||
@@ -2,15 +2,15 @@ package com.drmangotea.tfmg.content.decoration.tanks.steel;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.fluid.FluidRenderer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
import dev.engine_room.flywheel.lib.transform.TransformStack;
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.createmod.catnip.animation.LerpedFloat;
|
||||
import net.createmod.catnip.render.CachedBuffers;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
@@ -71,35 +71,37 @@ public class SteelFluidTankRenderer extends SafeBlockEntityRenderer<SteelTankBlo
|
||||
|
||||
ms.pushPose();
|
||||
ms.translate(0, clampedLevel - totalHeight, 0);
|
||||
FluidRenderer.renderFluidBox(fluidStack, xMin, yMin, zMin, xMax, yMax, zMax, buffer, ms, light, false);
|
||||
FluidRenderer.renderFluidBox(fluidStack.getFluid(),fluidStack.getAmount(), xMin, yMin, zMin, xMax, yMax, zMax, buffer, ms, light, false,true,fluidStack.getTag());
|
||||
ms.popPose();
|
||||
}
|
||||
|
||||
protected void renderAsDistillationTower(SteelTankBlockEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
protected void renderAsDistillationTower(SteelTankBlockEntity be, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
BlockState blockState = te.getBlockState();
|
||||
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
|
||||
BlockState blockState = be.getBlockState();
|
||||
VertexConsumer vb = buffer.getBuffer(RenderType.cutoutMipped());
|
||||
ms.pushPose();
|
||||
TransformStack msr = TransformStack.cast(ms);
|
||||
msr.translate(te.width / 2f, 0.5, te.width / 2f);
|
||||
var msr = TransformStack.of(ms);
|
||||
msr.translate(be.width / 2f, 0.5, be.width / 2f);
|
||||
|
||||
float dialPivot = 5.75f / 16;
|
||||
|
||||
for (Direction d : Iterate.horizontalDirections) {
|
||||
ms.pushPose();
|
||||
CachedBufferer.partial(TFMGPartialModels.TOWER_GAUGE, blockState)
|
||||
.rotateY(d.toYRot())
|
||||
.unCentre()
|
||||
.translate(te.width / 2f - 6 / 16f, 0, 0)
|
||||
CachedBuffers.partial(TFMGPartialModels.TOWER_GAUGE, blockState)
|
||||
.rotateYDegrees(d.toYRot())
|
||||
.uncenter()
|
||||
.translate(be.width / 2f - 6 / 16f, 0, 0)
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
CachedBufferer.partial(AllPartialModels.BOILER_GAUGE_DIAL, blockState)
|
||||
.rotateY(d.toYRot())
|
||||
.unCentre()
|
||||
.translate(te.width / 2f - 6 / 16f, 0, 0)
|
||||
.translate(0, dialPivot, dialPivot)
|
||||
.rotateX(-te.visualGaugeRotation.getValue(partialTicks))
|
||||
.translate(0, -dialPivot, -dialPivot)
|
||||
float dialPivotY = 6f / 16;
|
||||
float dialPivotZ = 8f / 16;
|
||||
CachedBuffers.partial(AllPartialModels.BOILER_GAUGE_DIAL, blockState)
|
||||
.rotateYDegrees(d.toYRot())
|
||||
.uncenter()
|
||||
.translate(be.width / 2f - 6 / 16f, 0, 0)
|
||||
.translate(0, dialPivotY, dialPivotZ)
|
||||
.rotateXDegrees(-be.visualGaugeRotation.getValue(partialTicks) + 90)
|
||||
.translate(0, -dialPivotY, -dialPivotZ)
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
ms.popPose();
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.simibubi.create.foundation.block.IBE;
|
||||
import com.simibubi.create.foundation.blockEntity.ComparatorUtil;
|
||||
import com.simibubi.create.foundation.fluid.FluidHelper;
|
||||
import com.simibubi.create.foundation.fluid.FluidHelper.FluidExchange;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.particles.BlockParticleOption;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.drmangotea.tfmg.content.decoration.tanks.steel;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.simibubi.create.api.boiler.BoilerHeater;
|
||||
import com.simibubi.create.api.connectivity.ConnectivityHandler;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.content.fluids.tank.BoilerHeaters;
|
||||
import com.simibubi.create.content.fluids.tank.FluidTankBlock;
|
||||
import com.simibubi.create.content.fluids.tank.FluidTankBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.IMultiBlockEntityContainer;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.fluid.SmartFluidTank;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.createmod.catnip.animation.LerpedFloat;
|
||||
import com.simibubi.create.infrastructure.config.AllConfigs;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
@@ -90,7 +90,7 @@ public class SteelTankBlockEntity extends FluidTankBlockEntity implements IHaveG
|
||||
public void tick() {
|
||||
super.tick();
|
||||
getGaugeRotation();
|
||||
visualGaugeRotation.chase(gaugeRotation, 0.2f, Chaser.EXP);
|
||||
visualGaugeRotation.chase(gaugeRotation, 0.2f, LerpedFloat.Chaser.EXP);
|
||||
visualGaugeRotation.tickChaser();
|
||||
if (syncCooldown > 0) {
|
||||
syncCooldown--;
|
||||
@@ -169,7 +169,7 @@ public class SteelTankBlockEntity extends FluidTankBlockEntity implements IHaveG
|
||||
if (fluidLevel == null)
|
||||
fluidLevel = LerpedFloat.linear()
|
||||
.startWithValue(getFillState());
|
||||
fluidLevel.chase(getFillState(), .5f, Chaser.EXP);
|
||||
fluidLevel.chase(getFillState(), .5f, LerpedFloat.Chaser.EXP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ public class SteelTankBlockEntity extends FluidTankBlockEntity implements IHaveG
|
||||
for (int zOffset = 0; zOffset < be.width; zOffset++) {
|
||||
BlockPos pos = pos1.offset(xOffset, -1, zOffset);
|
||||
BlockState blockState = level.getBlockState(pos);
|
||||
float heat = BoilerHeaters.getActiveHeat(level, pos, blockState);
|
||||
float heat = BoilerHeater.findHeat(level, pos, blockState);
|
||||
if (heat > 0) {
|
||||
activeHeat += heat;
|
||||
}
|
||||
@@ -468,7 +468,7 @@ public class SteelTankBlockEntity extends FluidTankBlockEntity implements IHaveG
|
||||
if (compound.contains("ForceFluidLevel") || fluidLevel == null)
|
||||
fluidLevel = LerpedFloat.linear()
|
||||
.startWithValue(fillState);
|
||||
fluidLevel.chase(fillState, 0.5f, Chaser.EXP);
|
||||
fluidLevel.chase(fillState, 0.5f, LerpedFloat.Chaser.EXP);
|
||||
}
|
||||
if (luminosity != prevLum && hasLevel())
|
||||
level.getChunkSource()
|
||||
@@ -476,7 +476,7 @@ public class SteelTankBlockEntity extends FluidTankBlockEntity implements IHaveG
|
||||
.checkBlock(worldPosition);
|
||||
|
||||
if (compound.contains("LazySync"))
|
||||
fluidLevel.chase(fluidLevel.getChaseTarget(), 0.125f, Chaser.EXP);
|
||||
fluidLevel.chase(fluidLevel.getChaseTarget(), 0.125f, LerpedFloat.Chaser.EXP);
|
||||
}
|
||||
public void getGaugeRotation() {
|
||||
|
||||
@@ -531,7 +531,7 @@ public class SteelTankBlockEntity extends FluidTankBlockEntity implements IHaveG
|
||||
//registerAwardables(behaviours, AllAdvancements.STEAM_ENGINE_MAXED, AllAdvancements.PIPE_ORGAN);
|
||||
}
|
||||
|
||||
public IFluidTank getTankInventory() {
|
||||
public FluidTank getTankInventory() {
|
||||
return tankInventory;
|
||||
}
|
||||
public int getTotalTankSize() {
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.drmangotea.tfmg.content.electricity.base;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.registry.TFMGPackets;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveHoveringInformation;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveHoveringInformation;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -240,7 +240,6 @@ public class ElectricBlockEntity extends SmartBlockEntity implements IElectric,
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (data.connectNextTick) {
|
||||
TFMG.LOGGER.debug("AAAAAAA");
|
||||
onPlaced();
|
||||
data.connectNextTick = false;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@ package com.drmangotea.tfmg.content.electricity.base;
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.registry.TFMGPackets;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import com.simibubi.create.foundation.utility.CreateLang;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
@@ -35,29 +36,30 @@ public interface IElectric {
|
||||
ElectricalNetwork network = TFMG.NETWORK_MANAGER.getOrCreateNetworkFor(this);
|
||||
setNetwork(getPos());
|
||||
getData().electricalNetworkId = getPos();
|
||||
network.add(this);
|
||||
|
||||
//BlockPos pos = BlockPos.of(getPos());
|
||||
///// ////
|
||||
BlockPos pos = BlockPos.of(getPos());
|
||||
/// ////
|
||||
|
||||
|
||||
// for (Direction d : Direction.values()) {
|
||||
// if (hasElectricitySlot(d))
|
||||
// if (getLevelAccessor().getBlockEntity(pos.relative(d)) instanceof IElectric be) {
|
||||
// if (be.hasElectricitySlot(d.getOpposite())) {
|
||||
// if (!be.destroyed()) {
|
||||
//
|
||||
//
|
||||
//for (Direction d : Direction.values()) {
|
||||
// if (hasElectricitySlot(d))
|
||||
// if (getLevelAccessor().getBlockEntity(pos.relative(d)) instanceof IElectric be) {
|
||||
// if (be.hasElectricitySlot(d.getOpposite())) {
|
||||
// if (!be.destroyed()) {
|
||||
// for(IElectric member : be.getOrCreateElectricNetwork().members){
|
||||
// network.add(member);
|
||||
// member.setNetwork(this.getData().electricalNetworkId);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// for(IElectric member : be.getOrCreateElectricNetwork().members){
|
||||
// network.add(member);
|
||||
// member.setNetwork(this.getData().electricalNetworkId);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//updateNextTick();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
updateNextTick();
|
||||
|
||||
onConnected();
|
||||
sendStuff();
|
||||
@@ -101,53 +103,53 @@ public interface IElectric {
|
||||
|
||||
|
||||
default boolean makeElectricityTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
Lang.number(getOrCreateElectricNetwork().members.size()).forGoggles(tooltip, 1);
|
||||
CreateLang.number(getOrCreateElectricNetwork().members.size()).forGoggles(tooltip, 1);
|
||||
if (getData().failTimer > 0)
|
||||
Lang.text("Skill issue: " + getData().failTimer).forGoggles(tooltip, 1);
|
||||
Lang.text("X " + BlockPos.of(getData().electricalNetworkId).getX() + " Y " + BlockPos.of(getData().electricalNetworkId).getY() + " Z " + BlockPos.of(getData().electricalNetworkId).getZ()).forGoggles(tooltip, 1);
|
||||
Lang.translate("multimeter.header")
|
||||
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);
|
||||
CreateLang.translate("multimeter.header")
|
||||
.style(ChatFormatting.WHITE)
|
||||
.forGoggles(tooltip, 1);
|
||||
Lang.text(" R = " + TFMGUtils.formatUnits(voltageGeneration() > 0 ? getGeneratorResistance() : resistance(), "Ω"))
|
||||
CreateLang.text(" R = " + TFMGUtils.formatUnits(voltageGeneration() > 0 ? getGeneratorResistance() : resistance(), "Ω"))
|
||||
.style(ChatFormatting.GOLD)
|
||||
.forGoggles(tooltip, 1);
|
||||
Lang.text(" P = " + TFMGUtils.formatUnits(getPowerUsage(), "W"))
|
||||
CreateLang.text(" P = " + TFMGUtils.formatUnits(getPowerUsage(), "W"))
|
||||
.style(ChatFormatting.GOLD)
|
||||
.forGoggles(tooltip, 1);
|
||||
Lang.text(" U = " + TFMGUtils.formatUnits(getData().getVoltage(), "V"))
|
||||
CreateLang.text(" U = " + TFMGUtils.formatUnits(getData().getVoltage(), "V"))
|
||||
.style(ChatFormatting.AQUA)
|
||||
.forGoggles(tooltip, 1);
|
||||
Lang.text(" I = " + TFMGUtils.formatUnits(getCurrent(), "A"))
|
||||
CreateLang.text(" I = " + TFMGUtils.formatUnits(getCurrent(), "A"))
|
||||
.style(ChatFormatting.GREEN)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
////////
|
||||
Lang.text(" Network Resistance: " + TFMGUtils.formatUnits(getNetworkResistance(), "Ω"))
|
||||
CreateLang.text(" Network Resistance: " + TFMGUtils.formatUnits(getNetworkResistance(), "Ω"))
|
||||
.style(ChatFormatting.YELLOW)
|
||||
.forGoggles(tooltip, 1);
|
||||
Lang.text(" Max Current: " + TFMGUtils.formatUnits(getData().highestCurrent, "A"))
|
||||
CreateLang.text(" Max Current: " + TFMGUtils.formatUnits(getData().highestCurrent, "A"))
|
||||
.style(ChatFormatting.AQUA)
|
||||
.forGoggles(tooltip, 1);
|
||||
Lang.text(" Network Power Usage: " + TFMGUtils.formatUnits(getNetworkPowerUsage(), "W"))
|
||||
CreateLang.text(" Network Power Usage: " + TFMGUtils.formatUnits(getNetworkPowerUsage(), "W"))
|
||||
.style(ChatFormatting.YELLOW)
|
||||
.forGoggles(tooltip, 1);
|
||||
Lang.text(" Group: " + getData().group.id)
|
||||
CreateLang.text(" Group: " + getData().group.id)
|
||||
.style(ChatFormatting.DARK_PURPLE)
|
||||
.forGoggles(tooltip, 1);
|
||||
Lang.text(" Group Resistance: " + getData().group.resistance)
|
||||
CreateLang.text(" Group Resistance: " + getData().group.resistance)
|
||||
.style(ChatFormatting.DARK_PURPLE)
|
||||
.forGoggles(tooltip, 1);
|
||||
Lang.text(" Voltage Supply: " + getData().voltageSupply)
|
||||
CreateLang.text(" Voltage Supply: " + getData().voltageSupply)
|
||||
.style(ChatFormatting.DARK_PURPLE)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
|
||||
if (voltageGeneration() > 0) {
|
||||
Lang.translate("multimeter.power_generated")
|
||||
CreateLang.translate("multimeter.power_generated")
|
||||
.add(Component.literal(TFMGUtils.formatUnits(powerGeneration(), "W")))
|
||||
.style(ChatFormatting.BLUE)
|
||||
.forGoggles(tooltip, 1);
|
||||
Lang.translate("multimeter.voltage_generated")
|
||||
CreateLang.translate("multimeter.voltage_generated")
|
||||
.add(Component.literal(TFMGUtils.formatUnits(voltageGeneration(), "V")))
|
||||
.style(ChatFormatting.BLUE)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.drmangotea.tfmg.content.electricity.base;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.registry.TFMGPackets;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveHoveringInformation;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveHoveringInformation;
|
||||
import com.simibubi.create.content.kinetics.base.GeneratingKineticBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
||||
@@ -3,9 +3,10 @@ package com.drmangotea.tfmg.content.electricity.connection.cables;
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveHoveringInformation;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveHoveringInformation;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
|
||||
import net.createmod.catnip.animation.LerpedFloat;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
@@ -6,8 +6,7 @@ import com.drmangotea.tfmg.content.machinery.misc.winding_machine.SpoolItem;
|
||||
import com.drmangotea.tfmg.registry.TFMGTags;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.Pair;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
import net.createmod.catnip.animation.LerpedFloat;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.drmangotea.tfmg.content.electricity.connection.cables;
|
||||
|
||||
import com.simibubi.create.content.contraptions.behaviour.dispenser.SimplePos;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Vec3i;
|
||||
|
||||
|
||||
public class CablePos extends SimplePos {
|
||||
public CablePos(double x, double y, double z) {
|
||||
|
||||
@@ -7,8 +7,8 @@ import com.drmangotea.tfmg.registry.TFMGPackets;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.decoration.copycat.CopycatBlock;
|
||||
import com.simibubi.create.content.decoration.copycat.CopycatBlockEntity;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveHoveringInformation;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveHoveringInformation;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.decoration.copycat.CopycatSpecialCases;
|
||||
import com.simibubi.create.foundation.model.BakedModelHelper;
|
||||
import com.simibubi.create.foundation.model.BakedQuadHelper;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.createmod.catnip.data.Iterate;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
|
||||
|
||||
@@ -85,7 +85,7 @@ public class DiagonalCableBlock extends DirectionalBlock implements SimpleWaterl
|
||||
context.getLevel().setBlock(context.getClickedPos(),state.setValue(FACING_UP,!state.getValue(FACING_UP)),2);
|
||||
|
||||
withBlockEntityDo(context.getLevel(),context.getClickedPos(), IElectric::onPlaced);
|
||||
playRotateSound(context.getLevel(), context.getClickedPos());
|
||||
IWrenchable.playRotateSound(context.getLevel(), context.getClickedPos());
|
||||
return onWrenched;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,10 @@ 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 com.simibubi.create.foundation.block.ProperWaterloggedBlock;
|
||||
import com.simibubi.create.foundation.placement.IPlacementHelper;
|
||||
import com.simibubi.create.foundation.placement.PlacementHelpers;
|
||||
import com.simibubi.create.foundation.placement.PlacementOffset;
|
||||
import com.simibubi.create.foundation.placement.PoleHelper;
|
||||
import net.createmod.catnip.placement.IPlacementHelper;
|
||||
import net.createmod.catnip.placement.PlacementHelpers;
|
||||
import net.createmod.catnip.placement.PlacementOffset;
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
||||
@@ -5,9 +5,6 @@ import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.content.electricity.base.IElectric;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnection;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnectorBlockEntity;
|
||||
import com.drmangotea.tfmg.content.electricity.generators.GeneratorBlockEntity;
|
||||
import com.drmangotea.tfmg.content.electricity.storage.AccumulatorBlockEntity;
|
||||
import com.drmangotea.tfmg.content.electricity.utilities.electric_motor.ElectricMotorBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.base.AbstractEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.engine_controller.EngineControllerBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.regular_engine.RegularEngineBlockEntity;
|
||||
@@ -15,28 +12,20 @@ import com.drmangotea.tfmg.content.machinery.metallurgy.blast_stove.BlastStoveBl
|
||||
import com.drmangotea.tfmg.content.machinery.metallurgy.casting_basin.CastingBasinBlockEntity;
|
||||
import com.drmangotea.tfmg.content.machinery.metallurgy.coke_oven.CokeOvenBlockEntity;
|
||||
import com.drmangotea.tfmg.content.machinery.misc.concrete_hose.ConcreteHoseBlockEntity;
|
||||
import com.drmangotea.tfmg.content.machinery.misc.vat_machines.base.VatBlockEntity;
|
||||
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.FluidReservoir;
|
||||
import com.drmangotea.tfmg.content.machinery.vat.base.VatBlockEntity;
|
||||
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.PumpjackBaseBlockEntity;
|
||||
import com.drmangotea.tfmg.content.machinery.oil_processing.surface_scanner.SurfaceScannerBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
import com.simibubi.create.content.fluids.FluidPropagator;
|
||||
import com.simibubi.create.content.fluids.pipes.FluidPipeBlockEntity;
|
||||
import com.simibubi.create.content.fluids.tank.FluidTankBlockEntity;
|
||||
import com.simibubi.create.content.kinetics.mixer.MechanicalMixerBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.protocol.game.DebugPackets;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.ticks.TickPriority;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.simibubi.create.content.fluids.pipes.FluidPipeBlock.isOpenAt;
|
||||
|
||||
public class DebugCinderBlockItem extends Item {
|
||||
public DebugCinderBlockItem(Properties p_41383_) {
|
||||
@@ -53,13 +42,27 @@ public class DebugCinderBlockItem extends Item {
|
||||
|
||||
BlockPos pos = context.getClickedPos();
|
||||
Level level = context.getLevel();
|
||||
|
||||
if(level.getBlockEntity(pos) instanceof EngineControllerBlockEntity be){
|
||||
context.getPlayer().getPersistentData().remove("IsUsingEngineController");
|
||||
TFMG.LOGGER.debug("REMOVED PERSISTENT DATA");
|
||||
if (level.getBlockEntity(pos) instanceof VatBlockEntity be) {
|
||||
if (!level.isClientSide)
|
||||
return InteractionResult.SUCCESS;
|
||||
TFMG.LOGGER.debug("////////////////////////////////////////");
|
||||
for (int i = 0; i < 8; i++) {
|
||||
TFMG.LOGGER.debug("fluid " + i + ": " + be.fluidLevel[i].getValue());
|
||||
}
|
||||
TFMG.LOGGER.debug("////////////////////////////////////////");
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
if(level.getBlockEntity(pos) instanceof RegularEngineBlockEntity be){
|
||||
if (level.getBlockEntity(pos) instanceof EngineControllerBlockEntity be) {
|
||||
|
||||
if (context.getPlayer().isCrouching()) {
|
||||
context.getPlayer().getPersistentData().remove("IsUsingEngineController");
|
||||
|
||||
} else {
|
||||
TFMG.LOGGER.debug(be.shift.name());
|
||||
}
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
if (level.getBlockEntity(pos) instanceof RegularEngineBlockEntity be) {
|
||||
be.updateRotation();
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
@@ -72,83 +75,101 @@ public class DebugCinderBlockItem extends Item {
|
||||
// return InteractionResult.SUCCESS;
|
||||
//}
|
||||
|
||||
if(level.getBlockEntity(pos) instanceof ConcreteHoseBlockEntity be){
|
||||
if (level.getBlockEntity(pos) instanceof ConcreteHoseBlockEntity be) {
|
||||
|
||||
be.filler.reset();
|
||||
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
if(level.getBlockEntity(pos) instanceof CableConnectorBlockEntity be){
|
||||
if(context.getPlayer().isShiftKeyDown()) {
|
||||
if (level.getBlockEntity(pos) instanceof CableConnectorBlockEntity be) {
|
||||
if (context.getPlayer().isShiftKeyDown()) {
|
||||
TFMG.LOGGER.debug("///////////////////////////////");
|
||||
for(CableConnection connection : be.connections) {
|
||||
TFMG.LOGGER.debug("Primary Pos "+connection.blockPos1.getX()+" "+connection.blockPos1.getY()+" "+connection.blockPos1.getZ());
|
||||
for (CableConnection connection : be.connections) {
|
||||
TFMG.LOGGER.debug("Primary Pos " + connection.blockPos1.getX() + " " + connection.blockPos1.getY() + " " + connection.blockPos1.getZ());
|
||||
}
|
||||
TFMG.LOGGER.debug("///////////////////////////////");
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
TFMG.LOGGER.debug("///////////////////////////////");
|
||||
TFMG.LOGGER.debug("Connector Count "+be.getConnectedWires().size());
|
||||
TFMG.LOGGER.debug("Wire Count "+be.connections.size());
|
||||
TFMG.LOGGER.debug("Member Count "+be.getOrCreateElectricNetwork().members.size());
|
||||
TFMG.LOGGER.debug("Id "+"X "+BlockPos.of(be.getData().electricalNetworkId).getX()+" Y "+BlockPos.of(be.getData().electricalNetworkId).getY()+" Z "+BlockPos.of(be.getData().electricalNetworkId).getZ());
|
||||
TFMG.LOGGER.debug("Connector Count " + be.getConnectedWires().size());
|
||||
TFMG.LOGGER.debug("Wire Count " + be.connections.size());
|
||||
TFMG.LOGGER.debug("Member Count " + be.getOrCreateElectricNetwork().members.size());
|
||||
TFMG.LOGGER.debug("Id " + "X " + BlockPos.of(be.getData().electricalNetworkId).getX() + " Y " + BlockPos.of(be.getData().electricalNetworkId).getY() + " Z " + BlockPos.of(be.getData().electricalNetworkId).getZ());
|
||||
TFMG.LOGGER.debug("///////////////////////////////");
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
if(level.getBlockEntity(pos) instanceof IElectric be){
|
||||
if (level.getBlockEntity(pos) instanceof IElectric be) {
|
||||
|
||||
be.onPlaced();
|
||||
|
||||
|
||||
if(context.getPlayer().isShiftKeyDown()) {
|
||||
if (context.getPlayer().isShiftKeyDown()) {
|
||||
TFMG.LOGGER.debug("///////////////////////////////");
|
||||
TFMG.LOGGER.debug("Group Resistance "+be.getData().group.resistance);
|
||||
TFMG.LOGGER.debug("Resistance "+be.resistance());
|
||||
TFMG.LOGGER.debug("Voltage Supply "+be.getData().voltageSupply);
|
||||
TFMG.LOGGER.debug("Higherst Current "+be.getData().highestCurrent);
|
||||
TFMG.LOGGER.debug("Group "+be.getData().group.id);
|
||||
TFMG.LOGGER.debug("Group Resistance " + be.getData().group.resistance);
|
||||
TFMG.LOGGER.debug("Resistance " + be.resistance());
|
||||
TFMG.LOGGER.debug("Voltage Supply " + be.getData().voltageSupply);
|
||||
TFMG.LOGGER.debug("Higherst Current " + be.getData().highestCurrent);
|
||||
TFMG.LOGGER.debug("Group " + be.getData().group.id);
|
||||
TFMG.LOGGER.debug("///////////////////////////////");
|
||||
}else {
|
||||
} else {
|
||||
|
||||
TFMGUtils.debugMessage(level, "Power "+be.getNetworkPowerUsage());
|
||||
TFMGUtils.debugMessage(level, "Voltage "+be.getData().getVoltage());
|
||||
TFMGUtils.debugMessage(level, "Power " + be.getNetworkPowerUsage());
|
||||
TFMGUtils.debugMessage(level, "Voltage " + be.getData().getVoltage());
|
||||
|
||||
};
|
||||
}
|
||||
;
|
||||
}
|
||||
if(level.getBlockEntity(pos) instanceof CokeOvenBlockEntity be){
|
||||
if (level.getBlockEntity(pos) instanceof CokeOvenBlockEntity be) {
|
||||
be.controller = be.getBlockPos();
|
||||
}
|
||||
if(level.getBlockEntity(pos) instanceof BlastStoveBlockEntity be){
|
||||
if (level.getBlockEntity(pos) instanceof BlastStoveBlockEntity be) {
|
||||
be.notifyMultiUpdated();
|
||||
}
|
||||
if(level.getBlockEntity(pos) instanceof VatBlockEntity be){
|
||||
be.evaluate();
|
||||
if (level.getBlockEntity(pos) instanceof VatBlockEntity be) {
|
||||
be.evaluate();
|
||||
|
||||
}
|
||||
if(level.getBlockEntity(pos) instanceof FluidTankBlockEntity be){
|
||||
if (level.getBlockEntity(pos) instanceof FluidTankBlockEntity be) {
|
||||
TFMGUtils.blowUpTank(be, 5);
|
||||
}
|
||||
if(level.getBlockEntity(pos) instanceof RegularEngineBlockEntity be){
|
||||
if (level.getBlockEntity(pos) instanceof MechanicalMixerBlockEntity be) {
|
||||
TFMG.LOGGER.debug("Reservoir Count " + TFMG.DEPOSITS.list.size());
|
||||
if (context.getPlayer().isCrouching()) {
|
||||
TFMG.DEPOSITS.list = new ArrayList<>();
|
||||
TFMG.DEPOSITS.markDirty();
|
||||
} else {
|
||||
// TFMG.DEPOSITS.list.add(new FluidReservoir(758441445444L));
|
||||
// TFMG.DEPOSITS.markDirty();
|
||||
if (!TFMG.DEPOSITS.list.isEmpty()) {
|
||||
FluidReservoir reservoir = TFMG.DEPOSITS.list.get(0);
|
||||
TFMG.LOGGER.debug("////////////////////");
|
||||
for (long deposit : reservoir.deposits)
|
||||
TFMG.LOGGER.debug("Deposit " + deposit);
|
||||
TFMG.LOGGER.debug("Size " + reservoir.oilReserves);
|
||||
TFMG.LOGGER.debug("ID " + reservoir.id);
|
||||
TFMG.LOGGER.debug("////////////////////");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (level.getBlockEntity(pos) instanceof RegularEngineBlockEntity be) {
|
||||
|
||||
}
|
||||
if(level.getBlockEntity(pos) instanceof AbstractEngineBlockEntity be){
|
||||
if (level.getBlockEntity(pos) instanceof AbstractEngineBlockEntity be) {
|
||||
be.connect();
|
||||
}
|
||||
if(level.getBlockEntity(pos) instanceof CastingBasinBlockEntity be){
|
||||
if (level.getBlockEntity(pos) instanceof CastingBasinBlockEntity be) {
|
||||
be.findRecipe();
|
||||
}
|
||||
if(level.getBlockEntity(pos) instanceof SurfaceScannerBlockEntity be){
|
||||
if (level.getBlockEntity(pos) instanceof SurfaceScannerBlockEntity be) {
|
||||
be.findDeposits();
|
||||
}
|
||||
if(level.getBlockEntity(pos) instanceof PumpjackBaseBlockEntity be){
|
||||
if(TFMG.DEPOSITS.depositData !=null) {
|
||||
if(context.getPlayer().isShiftKeyDown()){
|
||||
TFMG.DEPOSITS.depositData.removeData();
|
||||
return InteractionResult.SUCCESS;
|
||||
} else TFMG.DEPOSITS.depositData.removeEmptyDeposits();
|
||||
|
||||
|
||||
if (level.getBlockEntity(pos) instanceof PumpjackBaseBlockEntity be) {
|
||||
if (!context.getPlayer().isCrouching()) {
|
||||
be.process();
|
||||
} else {
|
||||
if (context.getPlayer().getServer() != null)
|
||||
TFMG.DEPOSITS.levelLoaded(context.getPlayer().level());
|
||||
}
|
||||
}
|
||||
return InteractionResult.SUCCESS;
|
||||
|
||||
@@ -5,10 +5,10 @@ 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.content.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.drmangotea.tfmg.content.electricity.base.IElectric;
|
||||
import com.drmangotea.tfmg.content.engines.base.AbstractEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGPackets;
|
||||
import com.simibubi.create.content.equipment.symmetryWand.SymmetryWandScreen;
|
||||
import com.simibubi.create.foundation.gui.ScreenOpener;
|
||||
import net.createmod.catnip.gui.ScreenOpener;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
|
||||
@@ -2,10 +2,10 @@ package com.drmangotea.tfmg.content.electricity.electrians_wrench;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGGuiTextures;
|
||||
import com.drmangotea.tfmg.registry.TFMGPackets;
|
||||
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
|
||||
import com.simibubi.create.foundation.gui.AllIcons;
|
||||
import com.simibubi.create.foundation.gui.element.GuiGameElement;
|
||||
import com.simibubi.create.foundation.gui.widget.IconButton;
|
||||
import net.createmod.catnip.gui.AbstractSimiScreen;
|
||||
import net.createmod.catnip.gui.element.GuiGameElement;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.drmangotea.tfmg.content.electricity.generators;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.config.TFMGConfigs;
|
||||
import com.drmangotea.tfmg.content.electricity.base.KineticElectricBlockEntity;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
@@ -34,12 +32,12 @@ public class GeneratorBlockEntity extends KineticElectricBlockEntity {
|
||||
@Override
|
||||
public float calculateStressApplied() {
|
||||
if(getData().voltageSupply == 0)
|
||||
return 0;
|
||||
return super.calculateStressApplied();
|
||||
|
||||
if(getNetworkResistance() ==0)
|
||||
return super.calculateStressApplied();
|
||||
|
||||
return (super.calculateStressApplied()*getGeneratorLoad()*0.0001f);
|
||||
return (int)(Math.min(super.calculateStressApplied()+(getGeneratorLoad() * 0.01f), 1000));
|
||||
}
|
||||
|
||||
|
||||
@@ -59,9 +57,10 @@ public class GeneratorBlockEntity extends KineticElectricBlockEntity {
|
||||
}
|
||||
|
||||
public int generation() {
|
||||
float modifier = TFMGConfigs.common().machines.smallGeneratorFeModifier.getF();
|
||||
float modifier = TFMGConfigs.common().machines.generatorModifier.getF();
|
||||
float maxSpeed = TFMGConfigs.common().machines.generatorMinSpeed.getF();
|
||||
|
||||
return (int) (((Math.log(Math.abs(getSpeed()))/Math.log(1.026))-22)*modifier*3.5f);
|
||||
return (int) Math.max(0,((Math.abs(getSpeed())-maxSpeed)* modifier));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,10 +7,12 @@ import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.ValueBoxTransform;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.scrollValue.ScrollValueBehaviour;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import com.simibubi.create.foundation.utility.CreateLang;
|
||||
import net.createmod.catnip.math.VecHelper;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
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.Vec3;
|
||||
@@ -28,7 +30,7 @@ public class CreativeGeneratorBlockEntity extends ElectricBlockEntity {
|
||||
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
|
||||
super.addBehaviours(behaviours);
|
||||
int max = 250;
|
||||
outputVoltage = new ScrollValueBehaviour(Lang.translateDirect("creative_generator.voltage_generation"),
|
||||
outputVoltage = new ScrollValueBehaviour(CreateLang.translateDirect("creative_generator.voltage_generation"),
|
||||
this, new CreativeGeneratorValueBox());
|
||||
outputVoltage.between(0, max);
|
||||
outputVoltage.value = 50;
|
||||
@@ -58,14 +60,10 @@ public class CreativeGeneratorBlockEntity extends ElectricBlockEntity {
|
||||
return VecHelper.voxelSpace(8, 8, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getLocalOffset(BlockState state) {
|
||||
return super.getLocalOffset(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotate(BlockState state, PoseStack ms) {
|
||||
super.rotate(state, ms);
|
||||
public void rotate(LevelAccessor level, BlockPos pos, BlockState state, PoseStack ms) {
|
||||
super.rotate(level,pos,state, ms);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,9 +3,8 @@ package com.drmangotea.tfmg.content.electricity.generators.large_generator;
|
||||
|
||||
import com.drmangotea.tfmg.config.TFMGConfigs;
|
||||
import com.drmangotea.tfmg.content.electricity.base.KineticElectricBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
import net.createmod.catnip.animation.LerpedFloat;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
@@ -73,8 +72,10 @@ public class RotorBlockEntity extends KineticElectricBlockEntity {
|
||||
}
|
||||
|
||||
public int generation() {
|
||||
float modifier = TFMGConfigs.common().machines.largeGeneratorFeModifier.getF();
|
||||
return (int) (((Math.log(Math.abs(getSpeed()))/Math.log(1.026))-22)*modifier*3.5f);
|
||||
float modifier = TFMGConfigs.common().machines.largeGeneratorModifier.getF();
|
||||
float maxSpeed = TFMGConfigs.common().machines.largeGeneratorMinSpeed.getF();
|
||||
|
||||
return (int) Math.max(0,((Math.abs(getSpeed())-maxSpeed)*modifier));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -126,7 +127,9 @@ public class RotorBlockEntity extends KineticElectricBlockEntity {
|
||||
|
||||
public static Map<Axis,Map<StatorOffset, BlockState>> setStatorPositons(){
|
||||
Map<Axis,Map<StatorOffset, BlockState>> statorPositions = new HashMap<>();
|
||||
|
||||
BlockState defaultState = TFMGBlocks.STATOR.getDefaultState();
|
||||
|
||||
BlockState cornerState = defaultState.setValue(STATOR_STATE,StatorState.CORNER);
|
||||
BlockState horizontal = defaultState.setValue(STATOR_STATE,StatorState.CORNER_HORIZONTAL);
|
||||
BlockState sideState = defaultState.setValue(STATOR_STATE,StatorState.SIDE);
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
package com.drmangotea.tfmg.content.electricity.generators.large_generator;
|
||||
|
||||
|
||||
import com.jozufozu.flywheel.api.MaterialManager;
|
||||
import com.jozufozu.flywheel.api.instance.DynamicInstance;
|
||||
import com.jozufozu.flywheel.core.materials.model.ModelData;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityInstance;
|
||||
import com.simibubi.create.content.kinetics.base.flwdata.RotatingData;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import net.minecraft.core.Direction;
|
||||
|
||||
import static com.simibubi.create.content.kinetics.base.RotatedPillarKineticBlock.AXIS;
|
||||
|
||||
public class RotorInstance extends KineticBlockEntityInstance<RotorBlockEntity> implements DynamicInstance {
|
||||
|
||||
protected final RotatingData shaft;
|
||||
protected final ModelData wheel;
|
||||
|
||||
|
||||
protected float lastAngle = Float.NaN;
|
||||
|
||||
public RotorInstance(MaterialManager materialManager, RotorBlockEntity blockEntity) {
|
||||
super(materialManager, blockEntity);
|
||||
|
||||
shaft = setup(getRotatingMaterial().getModel(shaft())
|
||||
.createInstance());
|
||||
wheel = getTransformMaterial().getModel(blockState)
|
||||
.createInstance();
|
||||
|
||||
animate(blockEntity.angle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginFrame() {
|
||||
|
||||
float partialTicks = AnimationTickHolder.getPartialTicks();
|
||||
|
||||
float speed = blockEntity.visualSpeed.getValue(partialTicks) * 3 / 10f;
|
||||
float angle = blockEntity.angle + speed * partialTicks;
|
||||
|
||||
if (Math.abs(angle - lastAngle) < 0.001)
|
||||
return;
|
||||
|
||||
animate(angle);
|
||||
|
||||
lastAngle = angle;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void animate(float angle) {
|
||||
PoseStack ms = new PoseStack();
|
||||
TransformStack msr = TransformStack.cast(ms);
|
||||
|
||||
msr.translate(getInstancePosition());
|
||||
msr.centre()
|
||||
.rotate(Direction.get(Direction.AxisDirection.POSITIVE, axis), AngleHelper.rad(angle))
|
||||
.unCentre();
|
||||
|
||||
wheel.setTransform(ms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
updateRotation(shaft);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLight() {
|
||||
relight(pos, shaft, wheel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
shaft.delete();
|
||||
wheel.delete();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.drmangotea.tfmg.content.electricity.generators.large_generator;
|
||||
|
||||
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import dev.engine_room.flywheel.api.visualization.VisualizationManager;
|
||||
import net.createmod.catnip.math.AngleHelper;
|
||||
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;
|
||||
@@ -27,7 +27,7 @@ public class RotorRenderer extends KineticBlockEntityRenderer<RotorBlockEntity>
|
||||
int light, int overlay) {
|
||||
super.renderSafe(be, partialTicks, ms, buffer, light, overlay);
|
||||
|
||||
if (Backend.canUseInstancing(be.getLevel()))
|
||||
if (VisualizationManager.supportsVisualization(be.getLevel()))
|
||||
return;
|
||||
|
||||
BlockState blockState = be.getBlockState();
|
||||
@@ -46,7 +46,7 @@ public class RotorRenderer extends KineticBlockEntityRenderer<RotorBlockEntity>
|
||||
|
||||
private void renderRotor(RotorBlockEntity be, PoseStack ms, int light, BlockState blockState, float angle,
|
||||
VertexConsumer vb) {
|
||||
SuperByteBuffer wheel = CachedBufferer.block(blockState);
|
||||
SuperByteBuffer wheel = CachedBuffers.block(blockState);
|
||||
kineticRotationTransform(wheel, be, getRotationAxisOf(be), AngleHelper.rad(angle), light);
|
||||
wheel.renderInto(ms, vb);
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ public class StatorBlock extends DirectionalBlock implements IBE<StatorBlockEnti
|
||||
boolean rotated = state.getValue(VALUE);
|
||||
Direction direction = state.getValue(FACING);
|
||||
|
||||
if(direction == Direction.UP)
|
||||
direction = Direction.NORTH;
|
||||
if(statorState == StatorState.CORNER){
|
||||
return rotated ? TFMGShapes.STATOR_ROTATED.get(direction) : TFMGShapes.STATOR.get(direction);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.drmangotea.tfmg.content.electricity.generators.large_generator;
|
||||
|
||||
import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
||||
@@ -9,8 +9,8 @@ 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.simibubi.create.foundation.utility.VoxelShaper;
|
||||
import com.tterrag.registrate.util.entry.BlockEntityEntry;
|
||||
import net.createmod.catnip.math.VoxelShaper;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
|
||||
@@ -4,8 +4,8 @@ package com.drmangotea.tfmg.content.electricity.lights;
|
||||
|
||||
import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity;
|
||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
import net.createmod.catnip.animation.LerpedFloat;
|
||||
import net.createmod.catnip.nbt.NBTHelper;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
@@ -71,15 +71,15 @@ public class LightBulbBlockEntity extends ElectricBlockEntity {
|
||||
TFMGUtils.playSound(level,getBlockPos(), SoundEvents.GLASS_BREAK, SoundSource.BLOCKS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxVoltage() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxCurrent() {
|
||||
return 4;
|
||||
}
|
||||
//@Override
|
||||
//public int getMaxVoltage() {
|
||||
// return 500;
|
||||
//}
|
||||
//
|
||||
//@Override
|
||||
//public int getMaxCurrent() {
|
||||
// return 4;
|
||||
//}
|
||||
|
||||
@Override
|
||||
public void setVoltage(int newVoltage) {
|
||||
|
||||
@@ -4,13 +4,12 @@ package com.drmangotea.tfmg.content.electricity.lights;
|
||||
|
||||
import com.drmangotea.tfmg.base.WallMountBlock;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.RenderTypes;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
|
||||
import net.createmod.catnip.render.CachedBuffers;
|
||||
import net.createmod.catnip.render.SuperByteBuffer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.world.item.DyeColor;
|
||||
@@ -34,7 +33,7 @@ public class LightBulbRenderer extends SafeBlockEntityRenderer<LightBulbBlockEnt
|
||||
int color = Math.min(100,(int) (glow/0.2f));
|
||||
if(be.glow.getValue()!=0) {
|
||||
|
||||
SuperByteBuffer lightModel = CachedBufferer.partialFacing(getLightModel(), blockState, blockState.getValue(WallMountBlock.FACING))
|
||||
SuperByteBuffer lightModel = CachedBuffers.partialFacing(getLightModel(), blockState, blockState.getValue(WallMountBlock.FACING))
|
||||
.light((int) glow * 3 + 40)
|
||||
.color(color, color, (int) (color * 0.8), 255)
|
||||
.disableDiffuse();
|
||||
@@ -42,7 +41,7 @@ public class LightBulbRenderer extends SafeBlockEntityRenderer<LightBulbBlockEnt
|
||||
lightModel.color(color, color, (int) (color * 0.8), 255);
|
||||
}else lightModel.color(be.color.getTextColor());
|
||||
|
||||
lightModel.renderInto(ms, buffer.getBuffer(RenderTypes.getAdditive()));
|
||||
lightModel.renderInto(ms, buffer.getBuffer(RenderTypes.additive()));
|
||||
}
|
||||
ms.popPose();
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ package com.drmangotea.tfmg.content.electricity.lights.neon_tube;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.content.electricity.base.IElectric;
|
||||
import com.drmangotea.tfmg.content.electricity.connection.cables.SimplePos;
|
||||
import com.drmangotea.tfmg.content.electricity.lights.LightBulbBlock;
|
||||
import com.drmangotea.tfmg.content.electricity.lights.LightBulbBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.simibubi.create.content.contraptions.behaviour.dispenser.SimplePos;
|
||||
import com.simibubi.create.content.equipment.wrench.IWrenchable;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -131,6 +131,7 @@ public class NeonTubeBlock extends PipeBlock implements IBE<NeonTubeBlockEntity>
|
||||
@Override
|
||||
public void onPlace(BlockState state, Level level, BlockPos pos, BlockState p_60569_, boolean p_60570_) {
|
||||
|
||||
|
||||
if(!p_60569_.is(TFMGBlocks.NEON_TUBE.get()))
|
||||
for(Direction facing : Direction.values()) {
|
||||
BlockState neighbourState = level.getBlockState(pos.relative(facing));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.drmangotea.tfmg.content.electricity.lights.neon_tube;
|
||||
|
||||
import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity;
|
||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
import net.createmod.catnip.animation.LerpedFloat;
|
||||
import net.createmod.catnip.nbt.NBTHelper;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
@@ -4,12 +4,11 @@ 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.jozufozu.flywheel.core.PartialModel;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.RenderTypes;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import net.createmod.catnip.render.CachedBuffers;
|
||||
import net.createmod.catnip.render.SuperByteBuffer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.core.Direction;
|
||||
@@ -35,7 +34,7 @@ public class NeonTubeRenderer extends SafeBlockEntityRenderer<NeonTubeBlockEntit
|
||||
int color = Math.min(100, (int) (glow / 0.2f));
|
||||
if (be.glow.getValue() != 0) {
|
||||
|
||||
SuperByteBuffer lightModel = CachedBufferer.partial(TFMGPartialModels.NEON_TUBE_LIGHT_CENTER, blockState)
|
||||
SuperByteBuffer lightModel = CachedBuffers.partial(TFMGPartialModels.NEON_TUBE_LIGHT_CENTER, blockState)
|
||||
.light((int) glow * 3 + 40)
|
||||
.color(color, color, (int) (color * 0.8), 255)
|
||||
.disableDiffuse();
|
||||
@@ -52,11 +51,11 @@ public class NeonTubeRenderer extends SafeBlockEntityRenderer<NeonTubeBlockEntit
|
||||
yRotation = 270;
|
||||
if(d==Direction.EAST)
|
||||
yRotation = 90;
|
||||
SuperByteBuffer sideModel = CachedBufferer.partial(TFMGPartialModels.NEON_TUBE_LIGHT_SIDE, blockState)
|
||||
.centre()
|
||||
.rotateY(yRotation)
|
||||
.rotateX(xRotation)
|
||||
.unCentre()
|
||||
SuperByteBuffer sideModel = CachedBuffers.partial(TFMGPartialModels.NEON_TUBE_LIGHT_SIDE, blockState)
|
||||
.center()
|
||||
.rotateYDegrees(yRotation)
|
||||
.rotateXDegrees(xRotation)
|
||||
.uncenter()
|
||||
.light((int) glow * 3 + 40)
|
||||
.color(color, color, (int) (color * 0.8), 255)
|
||||
.disableDiffuse();
|
||||
@@ -65,7 +64,7 @@ public class NeonTubeRenderer extends SafeBlockEntityRenderer<NeonTubeBlockEntit
|
||||
if (be.color == DyeColor.WHITE) {
|
||||
sideModel.color(color, color, (int) (color * 0.8), 255);
|
||||
} else sideModel.color(be.color.getTextColor());
|
||||
sideModel.renderInto(ms, buffer.getBuffer(RenderTypes.getAdditive()));
|
||||
sideModel.renderInto(ms, buffer.getBuffer(RenderTypes.additive()));
|
||||
|
||||
}
|
||||
});
|
||||
@@ -74,7 +73,7 @@ public class NeonTubeRenderer extends SafeBlockEntityRenderer<NeonTubeBlockEntit
|
||||
lightModel.color(color, color, (int) (color * 0.8), 255);
|
||||
} else lightModel.color(be.color.getTextColor());
|
||||
|
||||
lightModel.renderInto(ms, buffer.getBuffer(RenderTypes.getAdditive()));
|
||||
lightModel.renderInto(ms, buffer.getBuffer(RenderTypes.additive()));
|
||||
}
|
||||
ms.popPose();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.drmangotea.tfmg.content.electricity.lights.variants;
|
||||
|
||||
import com.drmangotea.tfmg.content.electricity.lights.LightBulbRenderer;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
|
||||
public class AluminumLampRenderer extends LightBulbRenderer {
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.drmangotea.tfmg.content.electricity.lights.variants;
|
||||
|
||||
import com.drmangotea.tfmg.content.electricity.lights.LightBulbRenderer;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
|
||||
public class CircularLightRenderer extends LightBulbRenderer {
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.drmangotea.tfmg.content.electricity.lights.variants;
|
||||
|
||||
import com.drmangotea.tfmg.content.electricity.lights.LightBulbRenderer;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
|
||||
public class ModernLightRenderer extends LightBulbRenderer {
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
package com.drmangotea.tfmg.content.electricity.measurement;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.base.TFMGHorizontalDirectionalBlock;
|
||||
import com.drmangotea.tfmg.base.TFMGShapes;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.content.equipment.wrench.IWrenchable;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
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.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
|
||||
public class AmmeterBlock extends TFMGHorizontalDirectionalBlock implements IBE<AmmeterBlockEntity>, IWrenchable {
|
||||
|
||||
public AmmeterBlock(Properties p_54120_) {
|
||||
super(p_54120_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState pState, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
|
||||
|
||||
return TFMGShapes.VOLTMETER.get(pState.getValue(FACING));
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult onWrenched(BlockState state, UseOnContext context) {
|
||||
|
||||
Level level = context.getLevel();
|
||||
BlockPos pos = context.getClickedPos();
|
||||
|
||||
|
||||
return onBlockEntityUse(level, pos, be -> {
|
||||
|
||||
be.range = be.getRange() + 100;
|
||||
|
||||
if(be.getRange() > 2000)
|
||||
be.range = 100;
|
||||
|
||||
return InteractionResult.SUCCESS;
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<AmmeterBlockEntity> getBlockEntityClass() {
|
||||
return AmmeterBlockEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<? extends AmmeterBlockEntity> getBlockEntityType() {
|
||||
return TFMGBlockEntities.AMMETER.get();
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.drmangotea.tfmg.content.electricity.measurement;
|
||||
|
||||
import com.drmangotea.tfmg.content.electricity.base.IElectric;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class AmmeterBlockEntity extends VoltMeterBlockEntity {
|
||||
|
||||
|
||||
public AmmeterBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUnit(IElectric be) {
|
||||
return (int) be.getData().highestCurrent;
|
||||
}
|
||||
@Override
|
||||
@SuppressWarnings("removal")
|
||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
|
||||
Lang.translate("goggles.ammeter")
|
||||
.style(ChatFormatting.DARK_GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
Lang.translate("goggles.ammeter.amps", Math.min(value,range))
|
||||
.style(ChatFormatting.AQUA)
|
||||
.forGoggles(tooltip, 1);
|
||||
Lang.translate("goggles.voltmeter.range", range)
|
||||
.style(ChatFormatting.DARK_AQUA)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -42,16 +42,40 @@ public class VoltMeterBlock extends TFMGHorizontalDirectionalBlock implements IB
|
||||
|
||||
return onBlockEntityUse(level, pos, be -> {
|
||||
|
||||
be.range = be.getRange() + 100;
|
||||
boolean shouldChange = false;
|
||||
|
||||
if(be.getRange() > 2000)
|
||||
be.range = 100;
|
||||
for(VoltMeterBlockEntity.MeasureMode mode : VoltMeterBlockEntity.MeasureMode.values()){
|
||||
|
||||
if(mode == VoltMeterBlockEntity.MeasureMode.POWER){
|
||||
be.mode = VoltMeterBlockEntity.MeasureMode.VOLTAGE;
|
||||
break;
|
||||
}
|
||||
|
||||
if(shouldChange) {
|
||||
be.mode = mode;
|
||||
break;
|
||||
}
|
||||
if(mode == be.mode)
|
||||
shouldChange = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
return InteractionResult.SUCCESS;
|
||||
|
||||
|
||||
});
|
||||
|
||||
//return onBlockEntityUse(level, pos, be -> {
|
||||
//
|
||||
// be.range = be.getRange() + 100;
|
||||
//
|
||||
// if(be.getRange() > 2000)
|
||||
// be.range = 100;
|
||||
//
|
||||
// return InteractionResult.SUCCESS;
|
||||
//
|
||||
//
|
||||
//});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.drmangotea.tfmg.content.electricity.measurement;
|
||||
|
||||
import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.content.electricity.base.ElectricalNetwork;
|
||||
import com.drmangotea.tfmg.base.TFMGUtils;
|
||||
import com.drmangotea.tfmg.content.electricity.base.IElectric;
|
||||
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
|
||||
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.nbt.CompoundTag;
|
||||
@@ -27,9 +27,11 @@ public class VoltMeterBlockEntity extends SmartBlockEntity implements IHaveGoggl
|
||||
public LerpedFloat angle = LerpedFloat.angular();
|
||||
|
||||
|
||||
public int value = 0;
|
||||
public float value = 0;
|
||||
|
||||
public int range = 500;
|
||||
// public int range = 500;
|
||||
|
||||
public MeasureMode mode = MeasureMode.VOLTAGE;
|
||||
|
||||
public VoltMeterBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
@@ -53,13 +55,18 @@ public class VoltMeterBlockEntity extends SmartBlockEntity implements IHaveGoggl
|
||||
// TFMG.LOGGER.debug("A "+ ElectricalNetwork.getCableCurrent(be));
|
||||
// TFMG.LOGGER.debug("id group "+be.getData().group.id);
|
||||
// TFMG.LOGGER.debug("resistance group "+be.getData().group.resistance);
|
||||
value = Math.min(getUnit(be), range );
|
||||
value = Math.min(getUnit(be), mode.defaultRange );
|
||||
|
||||
} else value = 0;
|
||||
|
||||
}
|
||||
public int getUnit(IElectric be){
|
||||
return be.getData().getVoltage();
|
||||
public float getUnit(IElectric be){
|
||||
return switch (mode){
|
||||
case VOLTAGE,HIGH_VOLTAGE -> be.getData().getVoltage();
|
||||
case CURRENT -> be.getCurrent();
|
||||
case RESISTANCE,HIGH_RESISTANCE -> be.resistance();
|
||||
case POWER -> be.powerGeneration() > 0 ? be.powerGeneration() : be.getPowerUsage();
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,70 +75,61 @@ public class VoltMeterBlockEntity extends SmartBlockEntity implements IHaveGoggl
|
||||
if(!level.isClientSide)
|
||||
return;
|
||||
|
||||
|
||||
|
||||
float value = (float) Math.abs(this.value) / getRange();
|
||||
|
||||
if(value>1)
|
||||
value = 1;
|
||||
|
||||
float targetAngle = Math.abs(value*180);
|
||||
|
||||
|
||||
|
||||
angle.chase(Math.abs(targetAngle),0.05f, LerpedFloat.Chaser.EXP);
|
||||
angle.tickChaser();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getRange(){
|
||||
return range;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(CompoundTag compound, boolean clientPacket) {
|
||||
super.write(compound, clientPacket);
|
||||
|
||||
|
||||
compound.putInt("range",range);
|
||||
compound.putFloat("angle", (float) Math.abs(value) / getRange());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void read(CompoundTag compound, boolean clientPacket) {
|
||||
super.read(compound, clientPacket);
|
||||
range = compound.getInt("range");
|
||||
|
||||
angle.setValue(compound.getFloat("angle"));
|
||||
|
||||
|
||||
|
||||
|
||||
return mode.defaultRange;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("removal")
|
||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
|
||||
Lang.translate("goggles.voltmeter")
|
||||
CreateLang.text(mode.displayName)
|
||||
.style(ChatFormatting.DARK_GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
Lang.translate("goggles.voltmeter.voltage", Math.min(value,range))
|
||||
CreateLang.translate("goggles.gauge.value")
|
||||
.add(CreateLang.text(TFMGUtils.formatUnits(value,mode.unit)))
|
||||
.style(ChatFormatting.AQUA)
|
||||
.forGoggles(tooltip, 1);
|
||||
Lang.translate("goggles.voltmeter.range", range)
|
||||
CreateLang.translate("goggles.voltmeter.range", mode.defaultRange)
|
||||
.style(ChatFormatting.DARK_AQUA)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public enum MeasureMode{
|
||||
|
||||
VOLTAGE("Voltage","V",500),
|
||||
HIGH_VOLTAGE("Voltage (High)","V",10000),
|
||||
CURRENT("Current","A",16),
|
||||
RESISTANCE("Resistance","A",500),
|
||||
HIGH_RESISTANCE("Resistance (High)","Ω",500),
|
||||
POWER("Power","A",5000)
|
||||
|
||||
|
||||
;
|
||||
public final String displayName;
|
||||
public final String unit;
|
||||
public final int defaultRange;
|
||||
|
||||
MeasureMode(String displayName, String unit, int defaultRange){
|
||||
this.unit = unit;
|
||||
this.displayName = displayName;
|
||||
this.defaultRange = defaultRange;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ package com.drmangotea.tfmg.content.electricity.measurement;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import dev.engine_room.flywheel.lib.transform.TransformStack;
|
||||
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;
|
||||
@@ -28,14 +28,14 @@ public class VoltMeterRenderer extends SafeBlockEntityRenderer<VoltMeterBlockEnt
|
||||
BlockState blockState = be.getBlockState();
|
||||
VertexConsumer vb = bufferSource.getBuffer(RenderType.solid());
|
||||
ms.pushPose();
|
||||
TransformStack msr = TransformStack.cast(ms);
|
||||
var msr = TransformStack.of(ms);
|
||||
msr.translate(0.5, 0.5, 0.5);
|
||||
|
||||
float dialPivot = 5.75f / 16;
|
||||
|
||||
float dialPivot2 = 5.75f / 12;
|
||||
|
||||
SuperByteBuffer dial = CachedBufferer.partial(TFMGPartialModels.VOLTMETER_DIAL, blockState);
|
||||
SuperByteBuffer dial = CachedBuffers.partial(TFMGPartialModels.VOLTMETER_DIAL, blockState);
|
||||
|
||||
Direction direction = blockState.getValue(FACING).getCounterClockWise();
|
||||
|
||||
@@ -43,10 +43,10 @@ public class VoltMeterRenderer extends SafeBlockEntityRenderer<VoltMeterBlockEnt
|
||||
direction = direction.getOpposite();
|
||||
|
||||
dial
|
||||
.rotateY(direction.toYRot())
|
||||
.unCentre()
|
||||
.rotateYDegrees(direction.toYRot())
|
||||
.uncenter()
|
||||
.translate(0, dialPivot, dialPivot2)
|
||||
.rotateX(Math.abs(Math.min( be.angle.getValue(partialTicks),180)))
|
||||
.rotateXDegrees(Math.abs(Math.min( be.angle.getValue(partialTicks),180)))
|
||||
.translate(0, -dialPivot, -dialPivot2)
|
||||
.light(light);
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ import com.drmangotea.tfmg.content.electricity.base.IElectric;
|
||||
import com.drmangotea.tfmg.content.electricity.utilities.converter.ConverterBlockEntity;
|
||||
import com.drmangotea.tfmg.content.engines.base.AbstractEngineBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import com.simibubi.create.foundation.utility.CreateLang;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
@@ -69,24 +70,24 @@ public class AccumulatorBlockEntity extends ElectricBlockEntity {
|
||||
@Override
|
||||
public boolean makeElectricityTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
if (isController())
|
||||
Lang.text("Controller").forGoggles(tooltip);
|
||||
Lang.text("Energy").add(Lang.number(getCapability(ForgeCapabilities.ENERGY).orElseGet(null).getEnergyStored())).forGoggles(tooltip);
|
||||
Lang.number(energy.getMaxEnergyStored()).forGoggles(tooltip);
|
||||
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);
|
||||
Lang.number(length).forGoggles(tooltip);
|
||||
Lang.translate("multimeter.energy_stored")
|
||||
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);
|
||||
/////
|
||||
Lang.text(" Usage: ")
|
||||
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();
|
||||
Lang.text(" Power Usage: ")
|
||||
.add(Lang.number(energyToExtract))
|
||||
CreateLang.text(" Power Usage: ")
|
||||
.add(CreateLang.number(energyToExtract))
|
||||
.style(ChatFormatting.LIGHT_PURPLE)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ConverterBlock extends TFMGHorizontalDirectionalBlock implements IB
|
||||
@Override
|
||||
public InteractionResult onWrenched(BlockState state, UseOnContext context) {
|
||||
context.getLevel().setBlockAndUpdate(context.getClickedPos(), state.setValue(INPUT, !state.getValue(INPUT)));
|
||||
playRotateSound(context.getLevel(), context.getClickedPos());
|
||||
IWrenchable.playRotateSound(context.getLevel(), context.getClickedPos());
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,9 @@ import com.drmangotea.tfmg.content.machinery.misc.winding_machine.WindingMachine
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.ValueBoxTransform;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.scrollValue.ScrollValueBehaviour;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import com.simibubi.create.foundation.utility.CreateLang;
|
||||
import net.createmod.catnip.math.VecHelper;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
@@ -62,7 +63,7 @@ public class ConverterBlockEntity extends ElectricBlockEntity {
|
||||
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
|
||||
super.addBehaviours(behaviours);
|
||||
int max = 250;
|
||||
voltageGenerated = new ScrollValueBehaviour(Lang.translateDirect("creative_generator.voltage_generation"),
|
||||
voltageGenerated = new ScrollValueBehaviour(CreateLang.translateDirect("creative_generator.voltage_generation"),
|
||||
this, new ConverterValueBox());
|
||||
voltageGenerated.between(1, max);
|
||||
voltageGenerated.value = 20;
|
||||
@@ -98,25 +99,25 @@ public class ConverterBlockEntity extends ElectricBlockEntity {
|
||||
public boolean makeElectricityTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
|
||||
|
||||
Lang.text("Energy").add(Lang.number(getCapability(ForgeCapabilities.ENERGY).orElseGet(null).getEnergyStored())).forGoggles(tooltip);
|
||||
Lang.number(energy.getMaxEnergyStored()).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);
|
||||
|
||||
|
||||
Lang.translate("multimeter.energy_stored")
|
||||
CreateLang.translate("multimeter.energy_stored")
|
||||
.add(Component.literal(TFMGUtils.formatUnits((int) energy.getEnergyStored(), "FE")))
|
||||
.style(ChatFormatting.GOLD)
|
||||
.forGoggles(tooltip, 1);
|
||||
/////
|
||||
Lang.text(" Usage: ")
|
||||
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();
|
||||
Lang.text(" Power Usage: ")
|
||||
.add(Lang.number(energyToExtract))
|
||||
CreateLang.text(" Power Usage: ")
|
||||
.add(CreateLang.number(energyToExtract))
|
||||
.style(ChatFormatting.LIGHT_PURPLE)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ 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;
|
||||
@@ -81,6 +82,8 @@ public class EncasedDiodeBlock extends TFMGDirectionalBlock implements IBE<Elect
|
||||
|
||||
@Override
|
||||
public Block getCasing() {
|
||||
|
||||
|
||||
return TFMGBlocks.HEAVY_MACHINERY_CASING.get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,18 +4,18 @@ import com.drmangotea.tfmg.TFMG;
|
||||
import com.drmangotea.tfmg.config.MachineConfig;
|
||||
import com.drmangotea.tfmg.config.TFMGConfigs;
|
||||
import com.drmangotea.tfmg.content.electricity.base.KineticElectricBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.content.kinetics.motor.KineticScrollValueBehaviour;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.ValueBoxTransform;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.scrollValue.ScrollValueBehaviour;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import com.simibubi.create.foundation.utility.CreateLang;
|
||||
import dev.engine_room.flywheel.lib.transform.TransformStack;
|
||||
import net.createmod.catnip.math.AngleHelper;
|
||||
import net.createmod.catnip.math.VecHelper;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
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.Vec3;
|
||||
@@ -39,7 +39,7 @@ public class ElectricMotorBlockEntity extends KineticElectricBlockEntity {
|
||||
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
|
||||
super.addBehaviours(behaviours);
|
||||
int max = MAX_SPEED;
|
||||
generatedSpeed = new KineticScrollValueBehaviour(Lang.translateDirect("kinetics.creative_motor.rotation_speed"),
|
||||
generatedSpeed = new KineticScrollValueBehaviour(CreateLang.translateDirect("kinetics.creative_motor.rotation_speed"),
|
||||
this, new MotorValueBox());
|
||||
generatedSpeed.between(-max, max);
|
||||
generatedSpeed.value = DEFAULT_SPEED;
|
||||
@@ -109,21 +109,21 @@ public class ElectricMotorBlockEntity extends KineticElectricBlockEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getLocalOffset(BlockState state) {
|
||||
public Vec3 getLocalOffset(LevelAccessor level, BlockPos pos, BlockState state) {
|
||||
Direction facing = state.getValue(FACING);
|
||||
return super.getLocalOffset(state).add(Vec3.atLowerCornerOf(facing.getNormal())
|
||||
return super.getLocalOffset(level,pos,state).add(Vec3.atLowerCornerOf(facing.getNormal())
|
||||
.scale(-1 / 16f));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotate(BlockState state, PoseStack ms) {
|
||||
super.rotate(state, ms);
|
||||
public void rotate(LevelAccessor level, BlockPos pos, BlockState state, PoseStack ms) {
|
||||
super.rotate(level,pos,state, ms);
|
||||
Direction facing = state.getValue(FACING);
|
||||
if (facing.getAxis() == Direction.Axis.Y)
|
||||
return;
|
||||
if (getSide() != Direction.UP)
|
||||
return;
|
||||
TransformStack.cast(ms)
|
||||
TransformStack.of(ms)
|
||||
.rotateZ(-AngleHelper.horizontalAngle(facing) + 180);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ import com.simibubi.create.content.fluids.pump.PumpBlockEntity;
|
||||
import com.simibubi.create.foundation.advancement.AllAdvancements;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
|
||||
import com.simibubi.create.foundation.utility.BlockFace;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
import com.simibubi.create.foundation.utility.Pair;
|
||||
import net.createmod.catnip.data.Couple;
|
||||
import net.createmod.catnip.data.Pair;
|
||||
import net.createmod.catnip.math.BlockFace;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
@@ -6,7 +6,8 @@ import com.drmangotea.tfmg.content.electricity.base.IElectric;
|
||||
import com.drmangotea.tfmg.content.electricity.base.UpdateInFrontPacket;
|
||||
import com.drmangotea.tfmg.content.electricity.utilities.diode.ElectricDiodeBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGPackets;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import com.simibubi.create.foundation.utility.CreateLang;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
@@ -41,7 +42,7 @@ public class FuseBlockEntity extends ElectricDiodeBlockEntity {
|
||||
public boolean makeElectricityTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
|
||||
if(!fuse.isEmpty())
|
||||
Lang.text("RATING "+TFMGUtils.formatUnits(fuse.getOrCreateTag().getInt("AmpRating"), "A"))
|
||||
CreateLang.text("RATING "+TFMGUtils.formatUnits(fuse.getOrCreateTag().getInt("AmpRating"), "A"))
|
||||
.style(ChatFormatting.RED)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.drmangotea.tfmg.content.electricity.utilities.fuse_block;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import net.createmod.catnip.render.CachedBuffers;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
@@ -23,7 +23,7 @@ public class FuseBlockRenderer extends SafeBlockEntityRenderer<FuseBlockEntity>
|
||||
BlockState blockState = be.getBlockState();
|
||||
|
||||
if(!be.fuse.isEmpty())
|
||||
CachedBufferer.partialFacing(TFMGPartialModels.FUSE, blockState, blockState.getValue(FACING).getOpposite())
|
||||
CachedBuffers.partialFacing(TFMGPartialModels.FUSE, blockState, blockState.getValue(FACING).getOpposite())
|
||||
.light(light)
|
||||
.renderInto(ms, bufferSource.getBuffer(RenderType.cutoutMipped()));
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.drmangotea.tfmg.content.electricity.utilities.fuse_block;
|
||||
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import com.simibubi.create.foundation.utility.CreateLang;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.item.Item;
|
||||
@@ -23,7 +24,7 @@ public class FuseItem extends Item{
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void appendHoverText(ItemStack stack, Level world, List<Component> tooltip, TooltipFlag flag) {
|
||||
|
||||
tooltip.add(Lang.translateDirect("tooltip.fuse", stack.getOrCreateTag().getInt("AmpRating")).append("A")
|
||||
tooltip.add(CreateLang.translateDirect("tooltip.fuse", stack.getOrCreateTag().getInt("AmpRating")).append("A")
|
||||
.withStyle(ChatFormatting.GREEN)
|
||||
);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user