code optimization & distillation fix

This commit is contained in:
DrMangoTea
2025-07-26 22:35:12 +02:00
parent f910904992
commit 5d31947f7d
89 changed files with 324 additions and 1312 deletions

View File

@@ -4,7 +4,7 @@ import com.drmangotea.tfmg.base.*;
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.TestSavedDataManager;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base.TestSavedDataManager;
import com.drmangotea.tfmg.datagen.TFMGDatagen;
import com.drmangotea.tfmg.base.fluid.TFMGFluidInteractions;
import com.drmangotea.tfmg.config.TFMGConfigs;
@@ -12,28 +12,20 @@ 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.AllSoundEvents;
import com.simibubi.create.foundation.data.CreateRegistrate;
import com.simibubi.create.foundation.item.ItemDescription;
import com.simibubi.create.foundation.item.KineticStats;
import com.simibubi.create.foundation.item.TooltipModifier;
import com.simibubi.create.infrastructure.data.CreateDatagen;
import net.createmod.catnip.lang.FontHelper;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.CreativeModeTab;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.EventPriority;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.IModBusEvent;
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.registries.RegisterEvent;
import org.slf4j.Logger;
@@ -102,8 +94,7 @@ public class TFMG {
modEventBus.addListener(TFMGCreativeTabs::addCreative);
}
@SuppressWarnings("removal")
@SuppressWarnings("deprecation")
private void clientSetup(final FMLClientSetupEvent event) {
ItemBlockRenderTypes.setRenderLayer(TFMGColoredFires.GREEN_FIRE.get(), RenderType.cutout());
ItemBlockRenderTypes.setRenderLayer(TFMGColoredFires.BLUE_FIRE.get(), RenderType.cutout());

View File

@@ -3,7 +3,7 @@ package com.drmangotea.tfmg.base;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackContraption;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackContraption;
import com.simibubi.create.api.contraption.ContraptionType;
import com.simibubi.create.api.registry.CreateBuiltInRegistries;
import com.simibubi.create.content.contraptions.Contraption;

View File

@@ -112,7 +112,6 @@ public class TFMGCreativeTabs {
list.add(TFMGItems.LIT_LITHIUM_BLADE);
list.add(TFMGItems.GOLDEN_TURBO);
list.add(TFMGItems.DEPOSIT_ITEM);
list.add(TFMGItems.ALUMINUM_SPOOL);
list.add(TFMGItems.COPPER_SPOOL);
list.add(TFMGItems.CONSTANTAN_SPOOL);

View File

@@ -1,5 +0,0 @@
package com.drmangotea.tfmg.base;
public class TFMGSharedProperties {}

View File

@@ -12,8 +12,8 @@ import net.createmod.catnip.render.SpriteShifter;
public class TFMGSpriteShifts {
public static final CTSpriteShiftEntry CAST_IRON_BLOCK = omni("cast_iron_block"), LEAD_BLOCK = omni("lead_block"), STEEL_BLOCK = omni("steel_block");
public static final CTSpriteShiftEntry HEAVY_MACHINERY_CASING = omni("heavy_machinery_casing"), ELECTRIC_CASING = omni("electric_casing"), STEEL_CASING = omni("steel_casing"), INDUSTRIAL_ALUMINUM_CASING = omni("industrial_aluminum_casing");
public static final CTSpriteShiftEntry CAPACITOR = getCT(AllCTTypes.RECTANGLE, "capacitor_side"), ACCUMULATOR = getCT(AllCTTypes.RECTANGLE, "accumulator_side");
public static final CTSpriteShiftEntry HEAVY_MACHINERY_CASING = omni("heavy_machinery_casing"), INDUSTRIAL_ALUMINUM_CASING = omni("industrial_aluminum_casing");
public static final CTSpriteShiftEntry ACCUMULATOR = getCT(AllCTTypes.RECTANGLE, "accumulator_side");
public static final CTSpriteShiftEntry STEEL_SCAFFOLD = horizontal("scaffold/steel_scaffold"), ALUMINUM_SCAFFOLD = horizontal("scaffold/aluminum_scaffold");
public static final CTSpriteShiftEntry ALUMINUM_SCAFFOLD_TOP = omni("aluminum_casing");
public static final CTSpriteShiftEntry STEEL_SCAFFOLD_INSIDE = horizontal("scaffold/steel_scaffold_inside"), ALUMINUM_SCAFFOLD_INSIDE = horizontal("scaffold/aluminum_scaffold_inside");
@@ -46,7 +46,7 @@ public class TFMGSpriteShifts {
REGULAR_ENGINE_TOP = vertical("engines/engine_top"),
REGULAR_ENGINE_BOTTOM = vertical("engines/engine_bottom"),
REGULAR_ENGINE_SIDE = horizontal("engines/engine_side");
public static final SpriteShiftEntry WINDING_MACHINE_COPPER_WIRE = get("block/winding_machine_copper_wire", "block/winding_machine_copper_wire_scroll");
///////////////////////

View File

@@ -169,8 +169,7 @@ public class TFMGUtils {
/////////
IFluidHandler handler = Capabilities.FluidHandler.BLOCK.getCapability(be.getLevel(),be.getBlockPos(),be.getBlockState(),be,null);
//Optional<IFluidHandler> resolve = handler.resolve();
//if (!resolve.isPresent()) return false;
if(handler == null)
return true;

View File

@@ -0,0 +1,46 @@
package com.drmangotea.tfmg.base.debug;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlock;
import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlockEntity;
import net.minecraft.core.BlockPos;
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;
public class DebugCinderBlockItem extends Item {
public DebugCinderBlockItem(Properties p_41383_) {
super(p_41383_);
}
@Override
public boolean isFoil(ItemStack pStack) {
return true;
}
@Override
public InteractionResult useOn(UseOnContext context) {
BlockPos pos = context.getClickedPos();
Level level = context.getLevel();
if (level.getBlockEntity(pos) instanceof SteelTankBlockEntity be) {
if(!context.getPlayer().isCrouching()) {
//SteelTankBlock.updateTowerState(be.getLevel(), be.getBlockPos(), true, false);
// be.updateTemperature();
TFMG.LOGGER.debug(String.valueOf(be.isDistillationTower));
//be.sendData();
//be.getControllerBE().sendData();
}else {
SteelTankBlock.updateTowerState(be.getLevel(), be.getBlockPos(), false, false);
TFMG.LOGGER.debug(String.valueOf(be.isDistillationTower));
}
}
return InteractionResult.PASS;
}
}

View File

@@ -25,7 +25,7 @@ import com.drmangotea.tfmg.content.machinery.misc.flarestack.FlarestackBlockEnti
import com.drmangotea.tfmg.content.machinery.misc.smokestack.SmokestackBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.controller.DistillationControllerBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.output.DistillationOutputBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.PumpjackBaseBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base.PumpjackBaseBlockEntity;
import com.drmangotea.tfmg.content.machinery.vat.base.VatBlockEntity;
import com.drmangotea.tfmg.registry.TFMGDataComponents;
import com.drmangotea.tfmg.registry.TFMGItems;

View File

@@ -58,10 +58,7 @@ public class AcidFluidType extends AllFluids.TintedFluidType {
@Override
public boolean move(FluidState state, LivingEntity entity, Vec3 movementVector, double gravity)
{
public boolean move(FluidState state, LivingEntity entity, Vec3 movementVector, double gravity) {
if(Create.RANDOM.nextInt(2)==0)
entity.hurt(TFMGDamageSources.acid(entity.level()),2);

View File

@@ -5,14 +5,11 @@ import net.createmod.catnip.config.ConfigBase;
public class MachineConfig extends ConfigBase {
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 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);
public final ConfigInt surfaceScannerScanDepth = i(-64, -512, "surfaceScannerScanDepth", Comments.surfaceScannerScanDepth);
@@ -59,8 +56,6 @@ public class MachineConfig extends ConfigBase {
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.";
static String electricMotorMinimumPower = "Determines the minimum power an electric motor can run on.";
static String electricMotorMinimumVoltage = "Determines the minimum voltage an electric motor can run on.";
static String electricMotorInternalResistance = "Sets the internal resistance of the electric motor.";
static String cokeOvenMaxSize = "Determines the maximum size of coke ovens.";
static String accumulatorStorage = "Determines the storage space of accumulators.";
@@ -69,7 +64,6 @@ public class MachineConfig extends ConfigBase {
static String accumulatorChargingRate = "Sets the maximum charging rate of accumulators.";
static String fireboxExhaustRequirement = "If set to true,fireboxes will require exhaust management.";
static String fireboxFuelConsumption = "Determines the amount of fuel a firebox needs to run for 3 seconds.";
static String graphiteElectrodeCurrent = "The minimum electric current that will make graphite electrodes superheated.";
static String electrolysisMinimumCurrent = "The minimum electric current that will make electrolyzers operational.";
static String engineMaxLength = "The maximum length of engines.";
static String surfaceScannerScanDepth = "Y level surface scanner scan at.";

View File

@@ -353,6 +353,7 @@ public class SteelTankBlock extends Block implements IWrenchable, IBE<SteelTankB
tankBE.isDistillationTower = assemble;
tankBE.refreshCapability();
tankBE.sendData();
tankBE.getControllerBE().sendData();
}
return true;
}

View File

@@ -25,7 +25,6 @@ public class ConnectNeightborsPacket extends BlockEntityDataPacket<SmartBlockEnt
}
@Override
protected void handlePacket(SmartBlockEntity blockEntity) {
@@ -33,11 +32,10 @@ public class ConnectNeightborsPacket extends BlockEntityDataPacket<SmartBlockEnt
be.onPlaced();
}
}
@Override
public PacketTypeProvider getTypeProvider() {
return TFMGPackets.CONNECT_NEIGHBORS;
}
}
}

View File

@@ -19,8 +19,6 @@ public class ConnectionPacket extends BlockEntityDataPacket<SmartBlockEntity> {
public ConnectionPacket(BlockPos pos) {
super(pos);
}
@@ -30,10 +28,8 @@ public class ConnectionPacket extends BlockEntityDataPacket<SmartBlockEntity> {
if(blockEntity instanceof IElectric be) {
be.onConnected();
}
}
@Override
public PacketTypeProvider getTypeProvider() {
return TFMGPackets.CONNECTION_PACKET;

View File

@@ -1,23 +1,15 @@
package com.drmangotea.tfmg.content.electricity.base;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.registry.TFMGPackets;
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.createmod.catnip.platform.CatnipServices;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import java.util.ArrayList;
import java.util.List;
public class ElectricBlockEntity extends SmartBlockEntity implements IElectric, IHaveHoveringInformation {
@@ -60,7 +52,6 @@ public class ElectricBlockEntity extends SmartBlockEntity implements IElectric,
}
@Override
public long getPos() {
return getBlockPos().asLong();
@@ -82,15 +73,15 @@ public class ElectricBlockEntity extends SmartBlockEntity implements IElectric,
@Override
protected void write(CompoundTag compound, HolderLookup.Provider registries, boolean clientPacket) {
super.write(compound,registries , clientPacket);
writeElectricity(compound,clientPacket);
super.write(compound, registries, clientPacket);
writeElectricity(compound, clientPacket);
}
@Override
protected void read(CompoundTag compound, HolderLookup.Provider registries, boolean clientPacket) {
super.read(compound,registries , clientPacket);
readElectricity(compound,clientPacket);
super.read(compound, registries, clientPacket);
readElectricity(compound, clientPacket);
}
}

View File

@@ -12,12 +12,11 @@ public class ElectricBlockValues {
public boolean getsOutsidePower = false;
public int networkResistance = 0;
public int voltage = 0;
public int frequency = 0;
public int voltageSupply = 0;
public int networkPowerGeneration =0;
public float highestCurrent=0;
public int networkPowerGeneration = 0;
public float highestCurrent = 0;
public boolean notEnoughtPower=false;
public boolean notEnoughtPower = false;
public boolean setVoltageNextTick = false;
@@ -25,17 +24,19 @@ public class ElectricBlockValues {
public ElectricalGroup group = new ElectricalGroup(0);
public ElectricBlockValues(long pos){
public ElectricBlockValues(long pos) {
this.electricalNetworkId = pos;
}
public long getId(){
public long getId() {
return electricalNetworkId;
}
public boolean destroyed(){
public boolean destroyed() {
return destroyed;
}
public int getVoltage(){
public int getVoltage() {
return voltage;
}
}

View File

@@ -1,16 +1,13 @@
package com.drmangotea.tfmg.content.electricity.base;
import java.util.List;
public class ElectricalGroup {
public int id;
public float resistance=0;
public ElectricalGroup(int id){
this.id = id;
}
}

View File

@@ -1,14 +1,14 @@
package com.drmangotea.tfmg.content.electricity.base;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.content.electricity.utilities.diode.ElectricDiodeBlockEntity;
import com.drmangotea.tfmg.content.electricity.utilities.electric_motor.ElectricMotorBlockEntity;
import com.drmangotea.tfmg.content.electricity.utilities.transformer.TransformerBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.Blocks;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ElectricalNetwork {
@@ -18,7 +18,6 @@ public class ElectricalNetwork {
public List<IElectric> members = new ArrayList<>();
public long id;
public long getId() {
@@ -36,8 +35,6 @@ public class ElectricalNetwork {
public void updateNetwork() {
int maxVoltage = 0;
int power = 0;
int resistance = 0;
@@ -58,11 +55,8 @@ public class ElectricalNetwork {
groups.put(groupId, groups.containsKey(groupId) ? groups.get(groupId) + member.resistance() : member.resistance());
}
int powerPercentage = resistance > 0 ? (int) (Math.min(((float) power / (float) resistance * 100f), 100)) : 100;
List<IElectric> list = new ArrayList<>(members);
if(!members.isEmpty()) {
float powerUsage = members.get(0).getNetworkPowerUsage();
if (!members.isEmpty()) {
for (IElectric member : list) {
@@ -76,7 +70,6 @@ public class ElectricalNetwork {
member.setNetworkResistance(resistance);
member.onNetworkChanged(oldVoltage, oldPower);
if (groups.containsKey(member.getData().group.id))
member.getData().group.resistance = groups.get(member.getData().group.id);
}
@@ -86,33 +79,29 @@ public class ElectricalNetwork {
member.getData().highestCurrent = getCableCurrent(member);
member.updateNearbyNetworks(member);
if(member instanceof ElectricDiodeBlockEntity be) {
if (member instanceof ElectricDiodeBlockEntity be) {
be.updateInFront();
}
if(member instanceof TransformerBlockEntity be) {
if (member instanceof TransformerBlockEntity be) {
be.updateInFront();
}
// if (member instanceof KineticElectricBlockEntity be) {
// be.updateGeneratedRotation();
// }
}
handleInsufficientPower();
}
public void handleInsufficientPower(){
public void handleInsufficientPower() {
if (!members.isEmpty())
if (members.get(0).getNetworkPowerUsage() > members.get(0).getNetworkPowerGeneration()) {
// members.get(0).updateUnpowered(new ArrayList<>());
for (IElectric member : members) {
member.getData().notEnoughtPower = true;
if (member instanceof ElectricMotorBlockEntity be) {
be.updateGeneratedRotation();
}
if (member instanceof ElectricDiodeBlockEntity be)
be.updateInFront=true;
be.updateInFront = true;
if (member instanceof TransformerBlockEntity be)
be.updateInFront();
}
@@ -140,36 +129,36 @@ public class ElectricalNetwork {
return current;
}
public void checkForLoops(BlockPos pos ){
public void checkForLoops(BlockPos pos) {
members.forEach(member->{
if(member instanceof VoltageAlteringBlockEntity be){
if(be.getControlledBlock() !=null){
members.forEach(member -> {
if (member instanceof VoltageAlteringBlockEntity be) {
if (be.getControlledBlock() != null) {
List<ElectricalNetwork> list = new ArrayList<>();
list.add(this);
be.getControlledBlock().getOrCreateElectricNetwork().checkForLoops(list, pos);
}
}});
}
});
}
public void checkForLoops(List<ElectricalNetwork> network, BlockPos pos){
public void checkForLoops(List<ElectricalNetwork> network, BlockPos pos) {
if(network.contains(this)) {
if(!members.isEmpty())
members.get(0).getLevelAccessor().destroyBlock(pos,false);
if (network.contains(this)) {
if (!members.isEmpty())
members.get(0).getLevelAccessor().destroyBlock(pos, false);
return;
}
network.add(this);
members.forEach(member->{
if(member instanceof VoltageAlteringBlockEntity be){
if(be.getControlledBlock() !=null){
members.forEach(member -> {
if (member instanceof VoltageAlteringBlockEntity be) {
if (be.getControlledBlock() != null) {
be.getControlledBlock().getOrCreateElectricNetwork().checkForLoops(network, pos);
}
}});
}
});
}
public List<IElectric> getMembers() {

View File

@@ -4,14 +4,12 @@ import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.base.TFMGUtils;
import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnection;
import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnectorBlockEntity;
import com.drmangotea.tfmg.registry.TFMGPackets;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.platform.CatnipServices;
import net.createmod.catnip.theme.Color;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
@@ -28,7 +26,7 @@ public interface IElectric {
LevelAccessor getLevelAccessor();
default boolean destroyed(){
default boolean destroyed() {
return getData().destroyed();
}
@@ -49,7 +47,7 @@ public interface IElectric {
default void onPlaced() {
if (getLevelAccessor() instanceof ServerLevel serverLevel)
CatnipServices.NETWORK.sendToClientsTrackingChunk(serverLevel, new ChunkPos(BlockPos.of(getPos())),new ConnectNeightborsPacket(BlockPos.of(getPos())));
CatnipServices.NETWORK.sendToClientsTrackingChunk(serverLevel, new ChunkPos(BlockPos.of(getPos())), new ConnectNeightborsPacket(BlockPos.of(getPos())));
ElectricalNetwork network = TFMG.NETWORK_MANAGER.getOrCreateNetworkFor(this);
setNetwork(getPos());
getData().electricalNetworkId = getPos();
@@ -67,7 +65,8 @@ public interface IElectric {
sendStuff();
}
default void onRemoved(){
default void onRemoved() {
this.getData().destroyed = true;
for (Direction d : Direction.values()) {
if (hasElectricitySlot(d))
@@ -87,19 +86,19 @@ public interface IElectric {
.remove(getData().getId());
}
default void readElectricity(CompoundTag compound, boolean clientPacket){
default void readElectricity(CompoundTag compound, boolean clientPacket) {
getData().group = new ElectricalGroup(compound.getInt("GroupId"));
getData().group.resistance = compound.getFloat("GroupResistance");
if (!clientPacket)
getData().connectNextTick = true;
}
default void writeElectricity(CompoundTag compound, boolean clientPacket){
default void writeElectricity(CompoundTag compound, boolean clientPacket) {
compound.putInt("GroupId", getData().group.id);
compound.putFloat("GroupResistance", getData().group.resistance);
}
default void tickElectricity(){
default void tickElectricity() {
if (getData().checkForLoopsNextTick) {
getOrCreateElectricNetwork().checkForLoops(getBlockPos());
getData().checkForLoopsNextTick = false;
@@ -122,12 +121,13 @@ public interface IElectric {
getData().setVoltageNextTick = false;
}
}
default void lazyTickElectricity(){
default void lazyTickElectricity() {
if (getData().failTimer >= 4) {
this.blockFail();
getData().failTimer = 0;
sendStuff();
} else if ((getData().voltage > getMaxVoltage() && getMaxVoltage() > 0) || (getCurrent() > getMaxCurrent()&&getMaxCurrent()>0)) {
} else if ((getData().voltage > getMaxVoltage() && getMaxVoltage() > 0) || (getCurrent() > getMaxCurrent() && getMaxCurrent() > 0)) {
getData().failTimer++;
}
}
@@ -165,7 +165,7 @@ public interface IElectric {
}
default BlockPos getBlockPos(){
default BlockPos getBlockPos() {
return BlockPos.of(getPos());
}
@@ -173,21 +173,19 @@ public interface IElectric {
alreadyChecked.add(BlockPos.of(getPos()));
updateNextTick();
if(this instanceof CableConnectorBlockEntity connectorBE){
for(CableConnection connection : connectorBE.connections){
if (this instanceof CableConnectorBlockEntity connectorBE) {
for (CableConnection connection : connectorBE.connections) {
if(getLevelAccessor().getBlockEntity(connection.blockPos1) instanceof CableConnectorBlockEntity be2 &&!alreadyChecked.contains(BlockPos.of(be2.getPos()))
){
// this.getLevelAccessor().setBlock(connection.blockPos1.above(2),Blocks.NETHER_BRICKS.defaultBlockState(),3);
if (getLevelAccessor().getBlockEntity(connection.blockPos1) instanceof CableConnectorBlockEntity be2 && !alreadyChecked.contains(BlockPos.of(be2.getPos()))
) {
be2.updateUnpowered(alreadyChecked);
}
}
}
for (Direction direction : Direction.values()) {
if(getLevelAccessor().getBlockEntity(BlockPos.of(getPos()).relative(direction)) instanceof IElectric be&&!alreadyChecked.contains(BlockPos.of(be.getPos()))){
if (getLevelAccessor().getBlockEntity(BlockPos.of(getPos()).relative(direction)) instanceof IElectric be && !alreadyChecked.contains(BlockPos.of(be.getPos()))) {
be.updateUnpowered(alreadyChecked);
// be.getLevelAccessor().setBlock(BlockPos.of(getPos()).above(2),Blocks.NETHERRACK.defaultBlockState(),3);
}
}
}
@@ -202,15 +200,8 @@ public interface IElectric {
.color(Color.RED)
.forGoggles(tooltip, 1);
// return true;
}
//CreateLang.text("Network Power ")
// .color(Color.RED)
// .forGoggles(tooltip, 1);
if (voltageGeneration() > 0) {
CreateLang.translate("multimeter.power_generated")
.add(Component.literal(TFMGUtils.formatUnits(powerGeneration(), "W")))
@@ -267,7 +258,7 @@ public interface IElectric {
default void updateNearbyNetworks(IElectric member) {
if (true)
return;
//if (member.getData().getsOutsidePower) {
for (Direction direction : Direction.values()) {
if (member.getLevelAccessor().getBlockEntity(BlockPos.of(member.getPos()).relative(direction)) instanceof IElectric be && be.getData().getId() != member.getData().getId()) {
@@ -275,7 +266,7 @@ public interface IElectric {
be.updateNextTick();
}
}
// }
}
ElectricBlockValues getData();
@@ -310,7 +301,6 @@ public interface IElectric {
}
default int getNetworkPowerGeneration() {
int power = 0;
for (IElectric member : getOrCreateElectricNetwork().members)
@@ -339,7 +329,7 @@ public interface IElectric {
}
default float resistance(){
default float resistance() {
return 0;
}
@@ -368,7 +358,6 @@ public interface IElectric {
}
default int powerGeneration() {
int powerGeneration = 0;
@@ -376,15 +365,15 @@ public interface IElectric {
for (Direction direction : Direction.values()) {
if (hasElectricitySlot(direction)) {
if (getLevelAccessor().getBlockEntity(getBlockPos().relative(direction)) instanceof VoltageAlteringBlockEntity be&&be.canWork()) {
if (getLevelAccessor().getBlockEntity(getBlockPos().relative(direction)) instanceof VoltageAlteringBlockEntity be && be.canWork()) {
if (be.getData().getId() != getData().getId())
if (be.getData().getVoltage() != 0)
if (be.hasElectricitySlot(direction)) {
powerGeneration = Math.max(powerGeneration, be.getPowerUsage()) + 1;
if(powerGeneration>be.getNetworkPowerGeneration()) {
if (powerGeneration > be.getNetworkPowerGeneration()) {
powerGeneration = 0;
be.data.updatePowerNextTick=true;
be.data.updatePowerNextTick = true;
}
}
}
@@ -411,27 +400,14 @@ public interface IElectric {
return getData().getVoltage() == 0 || resistance() == 0 ? 0 : ((float) getData().getVoltage() / (float) resistance());
}
default float getCableCurrent() {
float current = 0;
List<Integer> groups = new ArrayList<>();
for (IElectric member : getOrCreateElectricNetwork().members) {
if (member.canBeInGroups())
if (!groups.contains(member.getData().group.id)) {
current += member.getCurrent();
groups.add(member.getData().group.id);
}
}
return current;
}
default void updateNextTick(){
default void updateNextTick() {
getData().updateNextTick = true;
}
default void updateNetwork() {
getOrCreateElectricNetwork().updateNetwork();
if (getLevelAccessor() instanceof ServerLevel serverLevel)
CatnipServices.NETWORK.sendToClientsTrackingChunk(serverLevel, new ChunkPos(getBlockPos()),new NetworkUpdatePacket(BlockPos.of(getPos())));
CatnipServices.NETWORK.sendToClientsTrackingChunk(serverLevel, new ChunkPos(getBlockPos()), new NetworkUpdatePacket(BlockPos.of(getPos())));
sendStuff();
}
@@ -441,7 +417,6 @@ public interface IElectric {
default void setVoltage(int newVoltage) {
if (canBeInGroups()) {
getData().voltage = (int) (((float) resistance() / getData().group.resistance) * (float) getData().voltageSupply);
return;
@@ -450,12 +425,11 @@ public interface IElectric {
}
default void setNetworkResistance(int newUsage){
default void setNetworkResistance(int newUsage) {
getData().networkResistance = newUsage;
}
default void setNetwork(long network) {
getData().electricalNetworkId = network;
if (network != getPos())

View File

@@ -1,13 +1,11 @@
package com.drmangotea.tfmg.content.electricity.base;
import com.drmangotea.tfmg.content.electricity.utilities.diode.ElectricDiodeBlockEntity;
import com.drmangotea.tfmg.registry.TFMGPackets;
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
import com.simibubi.create.foundation.networking.BlockEntityDataPacket;
import io.netty.buffer.ByteBuf;
import net.minecraft.core.BlockPos;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
public class NetworkUpdatePacket extends BlockEntityDataPacket<SmartBlockEntity> {
@@ -20,22 +18,16 @@ public class NetworkUpdatePacket extends BlockEntityDataPacket<SmartBlockEntity>
public NetworkUpdatePacket(BlockPos pos) {
super(pos);
}
@Override
protected void handlePacket(SmartBlockEntity blockEntity) {
if(blockEntity instanceof IElectric be) {
if (blockEntity instanceof IElectric be) {
be.updateNetwork();
}
}
@Override
public PacketTypeProvider getTypeProvider() {
return TFMGPackets.NETWORK_UPDATE;

View File

@@ -7,7 +7,6 @@ import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
import com.simibubi.create.foundation.networking.BlockEntityDataPacket;
import io.netty.buffer.ByteBuf;
import net.minecraft.core.BlockPos;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
public class UpdateInFrontPacket extends BlockEntityDataPacket<SmartBlockEntity> {
@@ -19,22 +18,17 @@ public class UpdateInFrontPacket extends BlockEntityDataPacket<SmartBlockEntity>
public UpdateInFrontPacket(BlockPos pos) {
super(pos);
}
@Override
protected void handlePacket(SmartBlockEntity blockEntity) {
if(blockEntity instanceof ElectricDiodeBlockEntity be) {
if (blockEntity instanceof ElectricDiodeBlockEntity be) {
be.updateInFrontNextTick();
}
}
@Override
public PacketTypeProvider getTypeProvider() {
return TFMGPackets.UPDATE_IN_FRONT_PACKET;

View File

@@ -1,32 +0,0 @@
package com.drmangotea.tfmg.content.electricity.configuration_wrench;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.registry.TFMGDataComponents;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
public class ElectricBlockItem extends BlockItem {
public ElectricBlockItem(Block p_40565_, Properties p_40566_) {
super(p_40565_, p_40566_);
}
@Override
public InteractionResult place(BlockPlaceContext context) {
Level level = context.getLevel();
BlockPos pos = context.getClickedPos();
if(level.getBlockEntity(pos) instanceof IElectric be&&be.canBeInGroups()){
be.getData().group.id = context.getItemInHand().get(TFMGDataComponents.CONFIGURATION_WRENCH_NUMBER);
be.updateNextTick();
be.sendStuff();
}
return super.place(context);
}
}

View File

@@ -1,21 +1,10 @@
package com.drmangotea.tfmg.content.electricity.configuration_wrench;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.registry.TFMGDataComponents;
import com.drmangotea.tfmg.registry.TFMGPackets;
import com.simibubi.create.content.equipment.zapper.PlacementPatterns;
import com.simibubi.create.content.equipment.zapper.terrainzapper.ConfigureWorldshaperPacket;
import com.simibubi.create.content.equipment.zapper.terrainzapper.PlacementOptions;
import com.simibubi.create.content.equipment.zapper.terrainzapper.TerrainBrushes;
import com.simibubi.create.content.equipment.zapper.terrainzapper.TerrainTools;
import com.simibubi.create.content.logistics.stockTicker.StockKeeperCategoryEditPacket;
import io.netty.buffer.ByteBuf;
import net.createmod.catnip.codecs.stream.CatnipLargerStreamCodecs;
import net.createmod.catnip.codecs.stream.CatnipStreamCodecs;
import net.createmod.catnip.net.base.ServerboundPacketPayload;
import net.minecraft.core.BlockPos;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
@@ -29,11 +18,6 @@ public class ElectriciansWrenchPacket implements ServerboundPacketPayload {
CatnipStreamCodecs.HAND, packet -> packet.hand,
ElectriciansWrenchPacket::new
);
public final int group;
public final InteractionHand hand;
@@ -43,24 +27,23 @@ public class ElectriciansWrenchPacket implements ServerboundPacketPayload {
}
@Override
public void handle(ServerPlayer player) {
if (player == null) {
return;
}
ItemStack stack = player.getItemInHand(hand);
if (stack.getItem() instanceof ElectriciansWrenchItem) {
applyGroup(stack);
}
if (player == null) {
return;
}
ItemStack stack = player.getItemInHand(hand);
if (stack.getItem() instanceof ElectriciansWrenchItem) {
applyGroup(stack);
}
}
public void applyGroup(ItemStack stack){
public void applyGroup(ItemStack stack) {
stack.set(TFMGDataComponents.CONFIGURATION_WRENCH_NUMBER,group);
stack.set(TFMGDataComponents.CONFIGURATION_WRENCH_NUMBER, group);
}
@Override

View File

@@ -70,14 +70,6 @@ public class ElectriciansWrenchScreen extends AbstractSimiScreen {
public void addNumber() {
group++;
// CompoundTag tag = wrench.getOrCreateTag();
//
// int number = tag.getInt("Number");
// tag.putInt("Number", number+1);
//
// ElectritiansWrenchPacket packet = new ElectritiansWrenchPacket(tag.getInt("Number"), hand);
// packet.applyGroup(wrench);
// TFMGPackets.getChannel().sendToServer(packet);
}
@Override
@@ -95,16 +87,6 @@ public class ElectriciansWrenchScreen extends AbstractSimiScreen {
public void substractNumber() {
if (group > 0)
group--;
//CompoundTag tag = wrench.getOrCreateTag();
//
//int number = tag.getInt("Number");
//if(number>0)
// tag.putInt("Number", number-1);
//
//ElectritiansWrenchPacket packet = new ElectritiansWrenchPacket(tag.getInt("Number"), hand);
//packet.applyGroup(wrench);
//TFMGPackets.getChannel().sendToServer(packet);
}
public TFMGGuiTextures background() {

View File

@@ -1,4 +1,4 @@
package com.drmangotea.tfmg.content.electricity.connection.cable_hub;
package com.drmangotea.tfmg.content.electricity.connection;
import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
@@ -11,7 +11,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
public class CableHubBlock extends Block implements IBE<CableHubBlockEntity>, IWrenchable {
public class CableHubBlock extends Block implements IBE<ElectricBlockEntity>, IWrenchable {
public CableHubBlock(Properties p_49795_) {
super(p_49795_);
}
@@ -26,11 +26,11 @@ public class CableHubBlock extends Block implements IBE<CableHubBlockEntity>, IW
IBE.onRemove(state, level, pos, newState);
}
@Override
public Class<CableHubBlockEntity> getBlockEntityClass() {
return CableHubBlockEntity.class;
public Class<ElectricBlockEntity> getBlockEntityClass() {
return ElectricBlockEntity.class;
}
@Override
public BlockEntityType<? extends CableHubBlockEntity> getBlockEntityType() {
public BlockEntityType<? extends ElectricBlockEntity> getBlockEntityType() {
return TFMGBlockEntities.CABLE_HUB.get();
}
}

View File

@@ -1,14 +0,0 @@
package com.drmangotea.tfmg.content.electricity.connection.cable_hub;
import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
public class CableHubBlockEntity extends ElectricBlockEntity {
public CableHubBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
}
}

View File

@@ -38,8 +38,6 @@ public class CableConnection {
compoundTag.putDouble("Y2", pos2.y());
compoundTag.putDouble("Z2", pos2.z());
//compoundTag.putLong("BlockPos1", blockPos1.asLong());
//compoundTag.putLong("BlockPos2", blockPos2.asLong());
compoundTag.putLong("Pos", blockPos1.asLong());
@@ -59,8 +57,6 @@ public class CableConnection {
CablePos pos1 = new CablePos(compoundTag.getDouble("X1"),compoundTag.getDouble("Y1"),compoundTag.getDouble("Z1"));
CablePos pos2 = new CablePos(compoundTag.getDouble("X2"),compoundTag.getDouble("Y2"),compoundTag.getDouble("Z2"));
//BlockPos blockPos1 = BlockPos.of(compoundTag.getLong("BlockPos1"));
//BlockPos blockPos2 = BlockPos.of(compoundTag.getLong("BlockPos2"));
BlockPos blockPos1 = BlockPos.of(compoundTag.getLong("Pos"));

View File

@@ -1,58 +0,0 @@
package com.drmangotea.tfmg.content.electricity.debug;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.base.TFMGUtils;
import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlock;
import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlockEntity;
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.engines.base.AbstractEngineBlockEntity;
import com.drmangotea.tfmg.content.engines.engine_controller.EngineControllerBlockEntity;
import com.drmangotea.tfmg.content.engines.types.AbstractSmallEngineBlockEntity;
import com.drmangotea.tfmg.content.engines.types.large_engine.LargeEngineBlockEntity;
import com.drmangotea.tfmg.content.engines.types.regular_engine.RegularEngineBlockEntity;
import com.drmangotea.tfmg.content.machinery.metallurgy.blast_stove.BlastStoveBlockEntity;
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.oil_processing.pumpjack.pumpjack.base.FluidReservoir;
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.content.machinery.vat.base.VatBlockEntity;
import com.drmangotea.tfmg.registry.TFMGFluids;
import com.simibubi.create.content.fluids.tank.FluidTankBlockEntity;
import com.simibubi.create.content.kinetics.mixer.MechanicalMixerBlockEntity;
import net.minecraft.core.BlockPos;
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;
public class DebugCinderBlockItem extends Item {
public DebugCinderBlockItem(Properties p_41383_) {
super(p_41383_);
}
@Override
public boolean isFoil(ItemStack pStack) {
return true;
}
@Override
public InteractionResult useOn(UseOnContext context) {
BlockPos pos = context.getClickedPos();
Level level = context.getLevel();
if (level.getBlockEntity(pos) instanceof SteelTankBlockEntity be) {
if(!context.getPlayer().isCrouching()) {
SteelTankBlock.updateTowerState(be.getLevel(), be.getBlockPos(), true, false);
be.updateTemperature();
TFMG.LOGGER.debug(String.valueOf(be.activeHeat));
}else SteelTankBlock.updateTowerState(be.getLevel(), be.getBlockPos(), false, false);
}
return InteractionResult.PASS;
}
}

View File

@@ -38,17 +38,7 @@ public class GeneratorBlockEntity extends KineticElectricBlockEntity {
public void updateNetwork() {
super.updateNetwork();
}
//
// @Override
// public float calculateStressApplied() {
// if(getData().voltageSupply == 0)
// return super.calculateStressApplied();
//
// if(getNetworkResistance() ==0)
// return super.calculateStressApplied();
//
// return (int)(Math.min(super.calculateStressApplied()+(getGeneratorLoad() * 0.01f), 1000));
// }
@Override
public void onSpeedChanged(float previousSpeed) {

View File

@@ -52,9 +52,6 @@ public class RotorVisual extends KineticBlockEntityVisual<RotorBlockEntity> impl
.rotate(new Quaternionf().rotateTo(0, 1, 0, align.getStepX(), align.getStepY(), align.getStepZ()));
//wheel.rotateX((float) Math.PI/2);
//wheel.rotateY((float) Math.PI/2);
//wheel.rotateZ((float) Math.PI/2);
baseTransform.set(wheel.pose);

View File

@@ -30,8 +30,6 @@ public class LightBulbBlockEntity extends ElectricBlockEntity {
public DyeColor color= DyeColor.WHITE;
public LightBulbBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
}
@@ -64,15 +62,6 @@ public class LightBulbBlockEntity extends ElectricBlockEntity {
notifyUpdate();
}
// @Override
// public int getMaxVoltage() {
// return 500;
// }
//
// @Override
// public int getMaxAmps() {
// return 5;
// }
@Override
public void blockFail() {
@@ -80,15 +69,6 @@ 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 void setVoltage(int newVoltage) {

View File

@@ -98,17 +98,6 @@ public class MultimeterOverlayRenderer {
((IElectric)be).makeMultimeterTooltip(tooltip,isShifting);
// break early if goggle or hover returned false when present
// if ((!isElectricBlock)||!holdsMultimeter) {
// hoverTicks = 0;
// return;
// }
//
//
//if (tooltip.isEmpty()) {
// hoverTicks = 0;
// return;
//}
PoseStack poseStack = graphics.pose();
poseStack.pushPose();
@@ -161,14 +150,6 @@ public class MultimeterOverlayRenderer {
return;
}
/*
* special handling for modernUI
*
* their tooltip handler causes the overlay to jiggle each frame,
* if the mouse is moving, guiScale is anything but 1 and exactPositioning is enabled
*
* this is a workaround to fix this behavior
*/
MouseHandler mouseHandler = Minecraft.getInstance().mouseHandler;
Window window = Minecraft.getInstance().getWindow();
double guiScale = window.getGuiScale();

View File

@@ -64,17 +64,7 @@ public class VoltMeterBlock extends TFMGHorizontalDirectionalBlock implements IB
return InteractionResult.SUCCESS;
});
//return onBlockEntityUse(level, pos, be -> {
//
// be.range = be.getRange() + 100;
//
// if(be.getRange() > 2000)
// be.range = 100;
//
// return InteractionResult.SUCCESS;
//
//
//});
}

View File

@@ -84,7 +84,6 @@ public class VoltMeterBlockEntity extends SmartBlockEntity implements IHaveGoggl
float targetAngle = Math.abs(value * 180);
// TFMG.LOGGER.debug(String.valueOf(value));
angle.chase(Math.min(Math.abs(targetAngle),180), 0.05f, LerpedFloat.Chaser.EXP);
angle.tickChaser();
@@ -121,7 +120,6 @@ public class VoltMeterBlockEntity extends SmartBlockEntity implements IHaveGoggl
HIGH_VOLTAGE("Voltage (High)", "V", 10000),
CURRENT("Current", "A", 16),
RESISTANCE("Resistance", "Ω", 500),
// HIGH_RESISTANCE("Resistance (High)", "Ω", 500),
POWER("Power", "W", 5000),
NETWORK_POWER_USAGE("Network Power Usage", "W", 50000),
NETWORK_POWER_GENERATION("Network Power Generation", "W", 50000),

View File

@@ -24,8 +24,6 @@ public class VoltMeterRenderer extends SafeBlockEntityRenderer<VoltMeterBlockEnt
@Override
protected void renderSafe(VoltMeterBlockEntity be, float partialTicks, PoseStack ms, MultiBufferSource bufferSource, int light, int overlay) {
BlockState blockState = be.getBlockState();
VertexConsumer vb = bufferSource.getBuffer(RenderType.solid());
ms.pushPose();
@@ -42,7 +40,6 @@ public class VoltMeterRenderer extends SafeBlockEntityRenderer<VoltMeterBlockEnt
if(direction.getAxis() == Direction.Axis.X)
direction = direction.getOpposite();
// TFMG.LOGGER.debug(String.valueOf(be.angle.getValue(partialTicks)));
dial
.rotateYDegrees(direction.toYRot())
.uncenter()

View File

@@ -24,9 +24,6 @@ import java.util.List;
public class AccumulatorBlock extends TFMGDirectionalBlock implements IBE<AccumulatorBlockEntity> {
public AccumulatorBlock(Properties p_49795_) {
super(p_49795_);
}
@@ -82,7 +79,7 @@ public class AccumulatorBlock extends TFMGDirectionalBlock implements IBE<Accumu
BlockPos neighborPos = pos.relative(direction);
if(level.getBlockState(pos).is(TFMGBlocks.ACCUMULATOR.get()))
withBlockEntityDo(level,neighborPos,AccumulatorBlockEntity::refreshMultiblock);
//
}
IBE.onRemove(state, level, pos, newState);
}

View File

@@ -1,45 +0,0 @@
package com.drmangotea.tfmg.content.electricity.utilities.fuse_block;
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.content.electricity.base.IElectric;
import com.drmangotea.tfmg.content.electricity.base.IVoltageChanger;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.drmangotea.tfmg.registry.TFMGItems;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
public class FuseBlock extends TFMGHorizontalDirectionalBlock implements IBE<FuseBlockEntity>, IVoltageChanger {
public FuseBlock(Properties p_54120_) {
super(p_54120_);
}
@Override
public void onPlace(BlockState pState, Level level, BlockPos pos, BlockState pOldState, boolean pIsMoving) {
withBlockEntityDo(level,pos, IElectric::onPlaced);
}
@Override
public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) {
IBE.onRemove(state, level, pos, newState);
}
@Override
public Class<FuseBlockEntity> getBlockEntityClass() {
return FuseBlockEntity.class;
}
@Override
public BlockEntityType<? extends FuseBlockEntity> getBlockEntityType() {
return TFMGBlockEntities.FUSE_BLOCK.get();
}
}

View File

@@ -1,209 +0,0 @@
package com.drmangotea.tfmg.content.electricity.utilities.fuse_block;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.base.TFMGUtils;
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.CreateLang;
import net.createmod.catnip.platform.CatnipServices;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.DirectionalBlock;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import java.util.List;
import static net.minecraft.world.level.block.HorizontalDirectionalBlock.FACING;
public class FuseBlockEntity extends ElectricDiodeBlockEntity {
public ItemStack fuse = ItemStack.EMPTY;
boolean testFuse = false;
public FuseBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
}
public void updateInFront() {
if (level instanceof ServerLevel serverLevel)
CatnipServices.NETWORK.sendToClientsTrackingChunk(serverLevel, new ChunkPos(worldPosition),new UpdateInFrontPacket(BlockPos.of(getPos())));
Direction facing = getBlockState().hasProperty(DirectionalBlock.FACING) ? getBlockState().getValue(DirectionalBlock.FACING) : getBlockState().getValue(FACING).getCounterClockWise();
if (level.getBlockEntity(getBlockPos().relative(facing)) instanceof IElectric be && be.getData().getId() != data.getId()) {
if (be.hasElectricitySlot(facing.getOpposite())) {
be.updateNextTick();
}
}
sendStuff();
setChanged();
}
@Override
public float resistance() {
if(!hasFuse())
return 0;
Direction facing = getBlockState().getValue(FACING).getCounterClockWise();
if (level.getBlockEntity(getBlockPos().relative(facing)) instanceof IElectric be && be.getData().getId() != data.getId()) {
if (be.hasElectricitySlot(facing.getOpposite()))
return Math.max(be.getNetworkResistance(), 0);
}
return 0;
}
//@Override
//public void onNetworkChanged(int oldVoltage, int oldPower) {
// super.onNetworkChanged(oldVoltage, oldPower);
//
// if (hasFuse() && getData().highestCurrent >= (float) fuse.getOrCreateTag().getInt("AmpRating")) {
// blowFuse();
// updateNetwork();
// updateInFront();
//
// }
// Direction facing = getBlockState().getValue(FACING).getCounterClockWise();
// if (level.getBlockEntity(getBlockPos().relative(facing)) instanceof IElectric be) {
//
// if (hasFuse() && be.getData().highestCurrent >= (float) fuse.getOrCreateTag().getInt("AmpRating")) {
// blowFuse();
// updateNetwork();
// updateInFront();
//
// }
// }
//}
//@Override
//public void setVoltage(int newVoltage) {
// super.setVoltage(newVoltage);
// Direction facing = getBlockState().getValue(FACING).getCounterClockWise();
// if (level.getBlockEntity(getBlockPos().relative(facing)) instanceof IElectric be) {
//
// if (hasFuse() && be.getData().highestCurrent >= (float) fuse.getOrCreateTag().getInt("AmpRating")) {
// blowFuse();
// updateNetwork();
// updateInFront();
//
// }
// }
// if (hasFuse() && getData().highestCurrent >= (float) fuse.getOrCreateTag().getInt("AmpRating")) {
// blowFuse();
// updateNetwork();
// updateInFront();
//
// }
// testFuse = true;
//
//}
//
//public void testFuse(){
// Direction facing = getBlockState().getValue(FACING).getCounterClockWise();
// if (level.getBlockEntity(getBlockPos().relative(facing)) instanceof IElectric be) {
//
// if (hasFuse() && be.getData().highestCurrent >= (float) fuse.getOrCreateTag().getInt("AmpRating")) {
// blowFuse();
// updateNetwork();
// updateInFront();
//
// }
// }
// if (hasFuse() && getData().highestCurrent >= (float) fuse.getOrCreateTag().getInt("AmpRating")) {
// blowFuse();
// updateNetwork();
// updateInFront();
//
// }
// testFuse = true;
//}
@Override
public void tick() {
super.tick();
//if(testFuse){
// testFuse();
// testFuse = false;
//}
Direction facing = getBlockState().getValue(FACING).getCounterClockWise();
}
@Override
public void updateNextTick() {
super.updateNextTick();
}
@Override
public int getOutputVoltage() {
return fuse.isEmpty() ? 0 : super.getOutputVoltage();
}
@Override
public int getOutputPower() {
return fuse.isEmpty() ? 0 : super.getOutputPower();
}
public boolean hasFuse(){
return !fuse.isEmpty();
}
public void blowFuse(){
level.playSound(null, getBlockPos(), SoundEvents.GLASS_BREAK, SoundSource.BLOCKS, 2.0F,
level.random.nextFloat() * 0.4F + 0.8F);
fuse = ItemStack.EMPTY;
TFMGUtils.spawnElectricParticles(level,getBlockPos());
sendStuff();
}
@Override
public boolean hasElectricitySlot(Direction direction) {
return direction == getBlockState().getValue(FACING).getClockWise();
}
@Override
public boolean addToTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
super.addToTooltip(tooltip, isPlayerSneaking);
return true;
}
//
// @Override
// protected void write(CompoundTag compound, HolderLookup.Provider registries, boolean clientPacket) {
// super.write(compound,registries , clientPacket);
// compound.put("Fuse", fuse.serializeNBT());
// }
//
// @Override
// protected void read(CompoundTag compound, HolderLookup.Provider registries, boolean clientPacket) {
// super.read(compound,registries , clientPacket);
// fuse = ItemStack.of(compound.getCompound("Fuse"));
// }
}

View File

@@ -1,32 +0,0 @@
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 net.createmod.catnip.render.CachedBuffers;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.state.BlockState;
import static com.simibubi.create.content.kinetics.base.HorizontalKineticBlock.HORIZONTAL_FACING;
import static net.minecraft.world.level.block.HorizontalDirectionalBlock.FACING;
public class FuseBlockRenderer extends SafeBlockEntityRenderer<FuseBlockEntity> {
public FuseBlockRenderer(BlockEntityRendererProvider.Context context){}
@Override
protected void renderSafe(FuseBlockEntity be, float partialTicks, PoseStack ms, MultiBufferSource bufferSource, int light, int overlay) {
BlockState blockState = be.getBlockState();
if(!be.fuse.isEmpty())
CachedBuffers.partialFacing(TFMGPartialModels.FUSE, blockState, blockState.getValue(FACING).getOpposite())
.light(light)
.renderInto(ms, bufferSource.getBuffer(RenderType.cutoutMipped()));
}
}

View File

@@ -1,25 +0,0 @@
package com.drmangotea.tfmg.content.electricity.utilities.fuse_block;
import com.simibubi.create.foundation.utility.CreateLang;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import java.util.List;
public class FuseItem extends Item{
public FuseItem(Properties p_41383_) {
super(p_41383_);
}
}

View File

@@ -52,8 +52,6 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave
protected BlockPos controller;
protected BlockPos lastKnownPos;
public boolean updateConnectivity;
public int width;
public int height;
private static final Object HotBlastRecipesKey = new Object();
private static final int SYNC_RATE = 8;
protected int syncCooldown;
@@ -266,8 +264,6 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave
}
public void refreshCapability() {
IFluidHandler oldCap = primaryCapability;
IFluidHandler oldSecondaryCap = secondaryCapability;
primaryCapability = handlerForCapability();
secondaryCapability = handlerForSecondaryCapability();
invalidateCapabilities();
@@ -313,7 +309,6 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave
controller = null;
lastKnownPos = null;
if (compound.contains("LastKnownPos"))
lastKnownPos = NbtUtils.readBlockPos(compound, "LastKnownPos").get();
if (compound.contains("Controller"))
@@ -401,12 +396,6 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave
.add(mb)
.style(ChatFormatting.DARK_GRAY))
.forGoggles(tooltip, 1);
return true;
}
@@ -439,31 +428,6 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave
}
//@Nonnull
//@Override
//public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
// if (!primaryCapability.isPresent())
// refreshCapability();
// if (!secondaryCapability.isPresent())
// refreshCapability();
// if(side==null)
// return LazyOptional.empty();
//
//
//
// if (cap == ForgeCapabilities.FLUID_HANDLER) {
// if(side.getAxis() == Direction.Axis.Y) {
// return primaryCapability.cast();
// }else
// if(getController().getY()==getBlockPos().getY()){
// return secondaryCapability.cast();
// }
// }else
// return super.getCapability(cap, side);
//
// return LazyOptional.empty();
//}
public static void registerCapabilities(RegisterCapabilitiesEvent event) {
event.registerBlockEntity(
Capabilities.FluidHandler.BLOCK,
@@ -491,13 +455,6 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave
return primaryOutputInventory;
}
public int getTotalTankSize() {
return width * width * height;
}
public static int getMaxSize() {
return MAX_SIZE;
}
public static int getCapacityMultiplier() {
return AllConfigs.server().fluids.fluidTankCapacity.get() * 1000;
@@ -518,31 +475,12 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave
onFluidStackChanged(primaryOutputInventory.getFluid());
updateBoilerState();
setChanged();
updateConnectivity = true;
//if(isController())
// for (int yOffset = 0; yOffset < height; yOffset++)
// for (int xOffset = 0; xOffset < width; xOffset++)
// for (int zOffset = 0; zOffset < width; zOffset++)
// if (level.getBlockEntity(
// worldPosition.offset(xOffset, yOffset, zOffset)) instanceof BlastStoveBlockEntity fbe)
// fbe.refreshCapability();
sendData();
setChanged();
}
@Override
public void setExtraData(@Nullable Object data) {
if (data instanceof Boolean)
window = (boolean) data;
}
@Override
@Nullable
public Object getExtraData() {
return window;
}
@Override
public Object modifyExtraData(Object data) {
if (data instanceof Boolean windows) {
@@ -563,42 +501,5 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave
return getMaxHeight();
return getMaxWidth();
}
@Override
public int getMaxWidth() {
return MAX_SIZE;
}
@Override
public int getHeight() {
return height;
}
@Override
public void setHeight(int height) {
this.height = height;
}
@Override
public int getWidth() {
return width;
}
@Override
public void setWidth(int width) {
this.width = width;
}
@Override
public boolean hasTank() {
return true;
}
@Override
public void setTankSize(int tank, int blocks) {
applyFluidTankSize(blocks);
}
}

View File

@@ -92,7 +92,7 @@ public class BlastStoveItem extends BlockItem {
if (controllerTE == null)
return;
int width = controllerTE.width;
int width = controllerTE.getWidth();
if (width == 1)
return;
@@ -100,7 +100,7 @@ public class BlastStoveItem extends BlockItem {
BlockPos startPos = face == Direction.DOWN ? controllerTE.getBlockPos()
.below()
: controllerTE.getBlockPos()
.above(controllerTE.height);
.above(controllerTE.getHeight());
if (startPos.getY() != pos.getY())
return;

View File

@@ -1,76 +0,0 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import net.createmod.catnip.placement.IPlacementHelper;
import net.createmod.catnip.placement.PlacementOffset;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import java.util.function.Predicate;
@MethodsReturnNonnullByDefault
public abstract class VerticalPlacementHelper implements IPlacementHelper {
protected final Predicate<BlockState> statePredicate;
public VerticalPlacementHelper(Predicate<BlockState> statePredicate) {
this.statePredicate = statePredicate;
}
public boolean matchesAxis(BlockState state, Direction.Axis axis) {
return axis == Direction.Axis.Y;
}
public int attachedPoles(Level world, BlockPos pos, Direction direction) {
BlockPos checkPos = pos.relative(direction);
BlockState state = world.getBlockState(checkPos);
int count = 0;
while (matchesAxis(state, direction.getAxis())) {
count++;
checkPos = checkPos.relative(direction);
state = world.getBlockState(checkPos);
}
return count;
}
@Override
public Predicate<BlockState> getStatePredicate() {
return this.statePredicate;
}
@Override
public PlacementOffset getOffset(Player player, Level world, BlockState state, BlockPos pos, BlockHitResult ray) {
BlockPos posToPlace = pos;
for(int i = 0;i<15;i++){
posToPlace = posToPlace.below();
if(world.getBlockState(posToPlace).is(TFMGBlocks.INDUSTRIAL_PIPE.get()))
continue;
if(!world.getBlockState(posToPlace).isAir()) {
return PlacementOffset.fail();
}else break;
}
if(posToPlace!=pos)
return PlacementOffset.success(posToPlace, bState -> bState);
return PlacementOffset.fail();
}
}

View File

@@ -2,11 +2,15 @@ package com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.
import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock;
import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlock;
import com.drmangotea.tfmg.content.machinery.metallurgy.coke_oven.CokeOvenPacket;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.foundation.block.IBE;
import net.createmod.catnip.platform.CatnipServices;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.entity.BlockEntityType;
@@ -18,16 +22,20 @@ public class DistillationControllerBlock extends TFMGHorizontalDirectionalBlock
}
@Override
public void onPlace(BlockState pState, Level pLevel, BlockPos pPos, BlockState pOldState, boolean pIsMoving) {
SteelTankBlock.updateTowerState(pLevel, pPos.relative(getFacing(pState).getOpposite()),true,false);
public void onPlace(BlockState pState, Level level, BlockPos pPos, BlockState pOldState, boolean pIsMoving) {
super.onPlace(pState,level,pPos,pOldState,pIsMoving);
SteelTankBlock.updateTowerState(level, pPos.relative(getFacing(pState).getOpposite()),true,false);
if (level instanceof ServerLevel serverLevel)
CatnipServices.NETWORK.sendToClientsTrackingChunk(serverLevel, new ChunkPos(pPos),new DistillationTowerPacket(pPos,pPos.relative(getFacing(pState).getOpposite()),true));
}
@Override
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean pIsMoving) {
if (state.hasBlockEntity() && (!state.is(newState.getBlock()) || !newState.hasBlockEntity()))
world.removeBlockEntity(pos);
SteelTankBlock.updateTowerState(world, pos.relative(getFacing(state).getOpposite()),false,false);
super.onRemove(state,world,pos,newState,pIsMoving);
IBE.onRemove(state,world,pos,newState);
}

View File

@@ -2,6 +2,7 @@ package com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.base.TFMGUtils;
import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlock;
import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.output.DistillationOutputBlockEntity;
import com.drmangotea.tfmg.mixin.accessor.FluidTankBlockEntityAccessor;
@@ -18,13 +19,16 @@ import com.simibubi.create.foundation.recipe.RecipeFinder;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.animation.LerpedFloat;
import net.createmod.catnip.platform.CatnipServices;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.RecipeHolder;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
@@ -38,6 +42,8 @@ import net.neoforged.neoforge.fluids.capability.templates.FluidTank;
import java.util.ArrayList;
import java.util.List;
import static com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.controller.DistillationControllerBlock.getFacing;
public class DistillationControllerBlockEntity extends SmartBlockEntity implements IHaveGoggleInformation {
private static final Object DistillationRecipesKey = new Object();
@@ -45,6 +51,7 @@ public class DistillationControllerBlockEntity extends SmartBlockEntity implemen
public DistillationRecipe recipe;
LerpedFloat angle = LerpedFloat.angular();
protected IFluidHandler fluidCapability;
public final FluidTank tank = new SmartFluidTank(8000, this::onFluidStackChanged);
@@ -62,41 +69,47 @@ public class DistillationControllerBlockEntity extends SmartBlockEntity implemen
);
}
@Override
public void remove() {
super.remove();
SteelTankBlock.updateTowerState(level, getBlockPos().relative(getFacing(getBlockState()).getOpposite()),false,false);
}
@Override
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
}
@Override
public void tick() {
super.tick();
public void manageDialRendering(){
if (level.isClientSide) {
angle.chase(180 * ((float) tank.getFluidAmount() / tank.getCapacity()), 0.2f, LerpedFloat.Chaser.EXP);
angle.tickChaser();
}
}
//
ArrayList<DistillationOutputBlockEntity> outputs = getOutputs();
BlockEntity beBehind = level.getBlockEntity(getBlockPos().relative(DistillationControllerBlock.getFacing(getBlockState()).getOpposite()));
if (!(beBehind instanceof SteelTankBlockEntity be))
return;
if (outputs.isEmpty() || be.activeHeat == 0)
return;
///
public void findRecipe(ArrayList<DistillationOutputBlockEntity> outputs){
if (recipe == null || !recipe.matches(tank, outputs.toArray().length)) {
DistillationRecipe recipe = getMatchingRecipes();
if (recipe != null) {
this.recipe = recipe;
sendData();
}
}
}
public void manageRecipe(){
ArrayList<DistillationOutputBlockEntity> outputs = getOutputs();
BlockEntity beBehind = level.getBlockEntity(getBlockPos().relative(getFacing(getBlockState()).getOpposite()));
if (!(beBehind instanceof SteelTankBlockEntity be))
return;
if (outputs.isEmpty() || be.activeHeat == 0)
return;
findRecipe(outputs);
if (recipe == null)
return;
@@ -135,6 +148,14 @@ public class DistillationControllerBlockEntity extends SmartBlockEntity implemen
numero++;
}
}
@Override
public void tick() {
super.tick();
manageDialRendering();
manageRecipe();
}
protected void onFluidStackChanged(FluidStack newFluidStack) {
if (!hasLevel())
@@ -149,7 +170,7 @@ public class DistillationControllerBlockEntity extends SmartBlockEntity implemen
@Override
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
BlockEntity beBehind = level.getBlockEntity(getBlockPos().relative(DistillationControllerBlock.getFacing(getBlockState()).getOpposite()));
BlockEntity beBehind = level.getBlockEntity(getBlockPos().relative(getFacing(getBlockState()).getOpposite()));
if (beBehind instanceof SteelTankBlockEntity be) {
CreateLang.translate("goggles.distillation_tower.status")

View File

@@ -0,0 +1,47 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.controller;
import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlock;
import com.drmangotea.tfmg.content.machinery.metallurgy.coke_oven.CokeOvenBlockEntity;
import com.drmangotea.tfmg.registry.TFMGPackets;
import com.simibubi.create.compat.computercraft.AttachedComputerPacket;
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
import com.simibubi.create.foundation.networking.BlockEntityDataPacket;
import io.netty.buffer.ByteBuf;
import net.minecraft.core.BlockPos;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
public class DistillationTowerPacket extends BlockEntityDataPacket<SmartBlockEntity> {
public boolean assemble;
public BlockPos posToUpdate;
public static final StreamCodec<ByteBuf, DistillationTowerPacket> STREAM_CODEC = StreamCodec.composite(
BlockPos.STREAM_CODEC, packet -> packet.pos,
BlockPos.STREAM_CODEC, packet -> packet.posToUpdate,
ByteBufCodecs.BOOL, packet -> packet.assemble,
DistillationTowerPacket::new
);
public DistillationTowerPacket(BlockPos pos,BlockPos posToUpdate,boolean assemble) {
super(pos);
this.assemble = assemble;
this.posToUpdate = posToUpdate;
}
@Override
protected void handlePacket(SmartBlockEntity blockEntity) {
if(blockEntity instanceof DistillationControllerBlockEntity be) {
SteelTankBlock.updateTowerState(be.getLevel(), posToUpdate, assemble, false);
}
}
@Override
public PacketTypeProvider getTypeProvider() {
return TFMGPackets.DISTILLATION_PACKET;
}
}

View File

@@ -28,7 +28,9 @@ import net.neoforged.neoforge.fluids.capability.IFluidHandler;
import net.neoforged.neoforge.fluids.capability.templates.FluidTank;
import java.util.List;
/**
this block doesn't do anything, it only holds fluids create in the distillation tower
*/
public class DistillationOutputBlockEntity extends SmartBlockEntity implements IHaveGoggleInformation {
@@ -44,7 +46,7 @@ public class DistillationOutputBlockEntity extends SmartBlockEntity implements I
@Override
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
mode = new ScrollOptionBehaviour<DistillationOutputMode>(DistillationOutputMode.class,
mode = new ScrollOptionBehaviour<>(DistillationOutputMode.class,
CreateLang.translateDirect("distillation_output.when_tank_is_full"), this, new DistillationOutputValueBox());
behaviours.add(mode);
}
@@ -64,13 +66,6 @@ public class DistillationOutputBlockEntity extends SmartBlockEntity implements I
(be, context) -> be.fluidCapability
);
}
//@Nonnull
//@Override
//public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
// if (cap == ForgeCapabilities.FLUID_HANDLER)
// return fluidCapability.cast();
// return super.getCapability(cap, side);
//}
@Override
protected void read(CompoundTag compound, HolderLookup.Provider registries, boolean clientPacket) {
super.read(compound,registries , clientPacket);
@@ -79,22 +74,15 @@ public class DistillationOutputBlockEntity extends SmartBlockEntity implements I
}
@Override
public void write(CompoundTag compound, HolderLookup.Provider registries, boolean clientPacket) {
super.write(compound,registries,clientPacket);
compound.put("TankContent", tank.writeToNBT(registries,new CompoundTag()));
}
@Override
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
return containedFluidTooltip(tooltip, isPlayerSneaking,
fluidCapability);
return containedFluidTooltip(tooltip, isPlayerSneaking, fluidCapability);
}
public static class DistillationOutputValueBox extends ValueBoxTransform.Sided {

View File

@@ -1,4 +1,4 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base;
import java.util.ArrayList;
import java.util.List;

View File

@@ -1,4 +1,4 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base;
import com.drmangotea.tfmg.base.TFMGShapes;

View File

@@ -1,10 +1,10 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.base.TFMGUtils;
import com.drmangotea.tfmg.config.TFMGConfigs;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank.PumpjackCrankBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank.PumpjackCrankBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackBlockEntity;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import com.drmangotea.tfmg.registry.TFMGFluids;
@@ -17,7 +17,6 @@ import com.simibubi.create.foundation.fluid.SmartFluidTank;
import com.simibubi.create.foundation.utility.CreateLang;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
@@ -30,7 +29,6 @@ import net.neoforged.neoforge.fluids.FluidStack;
import net.neoforged.neoforge.fluids.capability.IFluidHandler;
import net.neoforged.neoforge.fluids.capability.templates.FluidTank;
import javax.annotation.Nonnull;
import java.util.List;
public class PumpjackBaseBlockEntity extends SmartBlockEntity implements IHaveGoggleInformation {

View File

@@ -1,7 +1,6 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base;
import com.drmangotea.tfmg.TFMG;
import com.simibubi.create.content.trains.RailwaySavedData;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.MinecraftServer;

View File

@@ -1,4 +1,4 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base;
import com.drmangotea.tfmg.TFMG;
import com.drmangotea.tfmg.config.TFMGConfigs;

View File

@@ -1,7 +1,6 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank;
import com.drmangotea.tfmg.content.engines.types.large_engine.LargeEngineBlock;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.mojang.serialization.MapCodec;
import com.simibubi.create.AllShapes;

View File

@@ -1,4 +1,4 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank;
import com.drmangotea.tfmg.content.machinery.misc.machine_input.MachineInputBlockEntity;
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;

View File

@@ -1,4 +1,4 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank;
@@ -8,11 +8,9 @@ import com.drmangotea.tfmg.registry.TFMGPartialModels;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
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;

View File

@@ -1,4 +1,4 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
@@ -10,7 +10,6 @@ import net.createmod.catnip.data.Iterate;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
@@ -38,51 +37,11 @@ public class PumpjackBlock extends BearingBlock implements IBE<PumpjackBlockEnti
super.createBlockStateDefinition(builder);
}
@Override
protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
if (!player.mayBuild())
return ItemInteractionResult.FAIL;
if (player.isShiftKeyDown())
return ItemInteractionResult.FAIL;
if (player.getItemInHand(hand)
.isEmpty()) {
if (level.isClientSide)
return ItemInteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
}
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
}
@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
boolean wide = context.getLevel().getBlockState(context.getClickedPos().above()).is(TFMGBlocks.LARGE_PUMPJACK_HAMMER_PART.get());
Direction preferredDirection = getPreferredHorizontalFacing(context);
if (preferredDirection != null)
return this.defaultBlockState().setValue(FACING, preferredDirection).setValue(WIDE,wide);
return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection()).setValue(WIDE,wide);
}
public static Direction getPreferredHorizontalFacing(BlockPlaceContext context) {
Direction prefferedSide = null;
for (Direction side : Iterate.horizontalDirections) {
BlockState blockState = context.getLevel().getBlockState(context.getClickedPos().relative(side));
if (blockState.getBlock() instanceof IRotate) {
if (((IRotate) blockState.getBlock()).hasShaftTowards(context.getLevel(), context.getClickedPos().relative(side),
blockState, side.getOpposite()))
if (prefferedSide != null && prefferedSide.getAxis() != side.getAxis()) {
prefferedSide = null;
break;
} else {
prefferedSide = side;
}
}
}
return prefferedSide == null ? null : prefferedSide;
}
@Override
public Class<PumpjackBlockEntity> getBlockEntityClass() {
return PumpjackBlockEntity.class;

View File

@@ -1,11 +1,8 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.PumpjackBaseBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank.PumpjackCrankBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.PumpjackHammerConnectorBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.large.LargePumpjackHammerConnectorBlock;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base.PumpjackBaseBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank.PumpjackCrankBlockEntity;
import com.drmangotea.tfmg.registry.TFMGTags;
import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.content.contraptions.AbstractContraptionEntity;
@@ -34,7 +31,7 @@ import net.minecraft.world.phys.AABB;
import java.util.List;
import static com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackBlock.WIDE;
import static com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackBlock.WIDE;
import static net.minecraft.world.level.block.DirectionalBlock.FACING;
public class PumpjackBlockEntity extends GeneratingKineticBlockEntity

View File

@@ -1,4 +1,4 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer;
@@ -9,11 +9,6 @@ import com.simibubi.create.content.contraptions.bearing.BearingContraption;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
import org.apache.commons.lang3.tuple.Pair;
public class PumpjackContraption extends BearingContraption {

View File

@@ -1,4 +1,4 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer;
import com.simibubi.create.content.contraptions.bearing.BearingBlock;
import com.simibubi.create.foundation.data.SpecialBlockStateGen;
@@ -10,7 +10,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.neoforged.neoforge.client.model.generators.ModelFile;
import static com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackBlock.WIDE;
import static com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackBlock.WIDE;
import static com.simibubi.create.foundation.data.AssetLookup.partialBaseModel;
public class PumpjackGenerator extends SpecialBlockStateGen {

View File

@@ -1,12 +1,8 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank.PumpjackCrankBlockEntity;
import com.drmangotea.tfmg.registry.TFMGPartialModels;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
import net.createmod.catnip.render.CachedBuffers;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;

View File

@@ -1,4 +1,4 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.mojang.serialization.MapCodec;

View File

@@ -1,4 +1,4 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts;
import com.drmangotea.tfmg.base.TFMGShapes;

View File

@@ -1,4 +1,4 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts;
import com.drmangotea.tfmg.base.TFMGShapes;
@@ -11,7 +11,6 @@ import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.BlockItem;

View File

@@ -1,9 +1,9 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.large;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.large;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.PumpjackHammerConnectorBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.PumpjackHammerConnectorBlock;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.state.BlockState;

View File

@@ -1,8 +1,8 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.large;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.large;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.PumpjackHammerHeadBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.PumpjackHammerHeadBlock;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.state.BlockState;

View File

@@ -1,8 +1,8 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.large;
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.large;
import com.drmangotea.tfmg.base.TFMGShapes;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.PumpjackHammerPartBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.PumpjackHammerPartBlock;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.state.BlockState;

View File

@@ -1,37 +0,0 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base;
import com.drmangotea.tfmg.config.TFMGConfigs;
import com.drmangotea.tfmg.registry.TFMGBlocks;
import net.minecraft.core.BlockPos;
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;
public class DepositItem extends Item {
public DepositItem(Properties p_41383_) {
super(p_41383_);
}
@Override
public boolean isFoil(ItemStack p_41453_) {
return true;
}
@Override
public InteractionResult useOn(UseOnContext context) {
Level level = context.getLevel();
BlockPos pos = context.getClickedPos();
if(level.getServer()==null)
return InteractionResult.PASS;
if(level.getBlockState(pos).is(TFMGBlocks.OIL_DEPOSIT.get())) {
//DepositSavedData data = DepositSavedData.load(level.getServer());
// if(data.getReservoirFor(pos.asLong())!=null) {
// data.getReservoirFor(pos.asLong()).oilReserves = level.getRandom().nextInt(1000, TFMGConfigs.common().deposits.depositMaxReserves.get());
// return InteractionResult.SUCCESS;
// }
}
return InteractionResult.PASS;
}
}

View File

@@ -1 +0,0 @@
package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base;

View File

@@ -30,10 +30,6 @@ import java.util.function.Function;
public class IndustrialBlastingRecipe extends ProcessingRecipe<RecipeInput, IndustrialBlastingRecipeParams> {
public int hotAirUsage;
public IndustrialBlastingRecipe(IndustrialBlastingRecipeParams params) {
@@ -72,15 +68,6 @@ public class IndustrialBlastingRecipe extends ProcessingRecipe<RecipeInput, Indu
}else return FluidStack.EMPTY;
}
//public void readAdditional(JsonObject json) {
// super.readAdditional(json);
// this.hotAirUsage = GsonHelper.getAsInt(json, "hotAirUsage", 0);
//}
//public void writeAdditional(JsonObject json) {
// super.writeAdditional(json);
// json.addProperty("hotAirUsage", this.hotAirUsage);
//}
@FunctionalInterface
public interface Factory<R extends IndustrialBlastingRecipe> extends ProcessingRecipe.Factory<IndustrialBlastingRecipeParams, R> {
@@ -138,7 +125,4 @@ public class IndustrialBlastingRecipe extends ProcessingRecipe<RecipeInput, Indu
}
}

View File

@@ -30,9 +30,6 @@ import java.util.function.Function;
public class VatMachineRecipe extends ProcessingRecipe<RecipeInput, VatRecipeParams> {
public List<String> machines;
public List<String> allowedVatTypes;
public int minSize;
@@ -46,8 +43,6 @@ public class VatMachineRecipe extends ProcessingRecipe<RecipeInput, VatRecipePar
heatLevel = params.heat_level;
}
@Override
protected int getMaxInputCount() {
return 4;
@@ -65,52 +60,6 @@ public class VatMachineRecipe extends ProcessingRecipe<RecipeInput, VatRecipePar
return 4;
}
//@Override
//public void readAdditional(FriendlyByteBuf buffer) {
// super.readAdditional(buffer);
// JsonArray machineArray = json.getAsJsonArray("machines");
// if (machineArray != null) {
// for (int i = 0; i < machineArray.size(); i++) {
//
//
//
// machines.add(machineArray.get(i).getAsString());
// }
// }
// //
// JsonArray vatTypeArray = json.getAsJsonArray("allowedVatTypes");
// if (vatTypeArray != null) {
// for (int i = 0; i < vatTypeArray.size(); i++) {
// allowedVatTypes.add(vatTypeArray.get(i).getAsString());
// }
// }
// //
// this.minSize = GsonHelper.getAsInt(json, "minSize", 1);
//}
//
//
//
//
//
//public void writeAdditional(FriendlyByteBuf buffer) {
// super.writeAdditional(buffer);
// JsonArray machineArray = new JsonArray();
//
// for (String string : machines) {
// machineArray.add(string);
//
// }
// json.add("machines", machineArray);
// //
// JsonArray vatTypeArray = new JsonArray();
// for (String string : allowedVatTypes) {
// vatTypeArray.add(string);
// }
// json.add("allowedVatTypes", vatTypeArray);
// //
// json.addProperty("minSize", this.minSize);
//
//}
@Override
public boolean matches(RecipeInput inv, Level worldIn) {

View File

@@ -39,12 +39,7 @@ public class CastingCategory extends CreateRecipeCategory<CastingRecipe> {
.addItemStack(recipe.getResultItem(registryAccess));
addFluidSlot(builder,15,20,recipe.getFluidIngredients().get(0));
//builder
// .addSlot(RecipeIngredientRole.INPUT, 15, 20)
// .setBackground(getRenderedSlot(), -1, -1)
// .addIngredients(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getFluidIngredients().get(0).getMatchingFluidStacks()))
// .addRichTooltipCallback(addFluidTooltip(recipe.getFluidIngredients().get(0).getRequiredAmount()));
//
}

View File

@@ -33,9 +33,6 @@ public class ChemicalVatCategory extends CreateRecipeCategory<VatMachineRecipe>
}
public void setRecipe(IRecipeLayoutBuilder builder, VatMachineRecipe recipe, IFocusGroup focuses) {
//builder.addSlot(RecipeIngredientRole.INPUT, 15, 9).setBackground(getRenderedSlot(), -1, -1).addIngredients(recipe.getIngredients().get(0));
//builder.addSlot(RecipeIngredientRole.OUTPUT, 140, 28).setBackground(getRenderedSlot(), -1, -1).addItemStack(recipe.getResultItem(Minecraft.getInstance().level.registryAccess()));
int fluidCount = recipe.getFluidIngredients().size();
int pos = 55;
int width = ((fluidCount) * 20) / 2;

View File

@@ -17,15 +17,10 @@ import javax.annotation.ParametersAreNonnullByDefault;
@ParametersAreNonnullByDefault
public class DistillationCategory extends CreateRecipeCategory<DistillationRecipe> {
public DistillationCategory(Info<DistillationRecipe> info) {
super(info);
}
@Override
public void setRecipe(IRecipeLayoutBuilder builder, DistillationRecipe recipe, IFocusGroup focuses) {
FluidIngredient fluidIngredient=recipe.getInputFluid();
@@ -34,13 +29,6 @@ public class DistillationCategory extends CreateRecipeCategory<DistillationRecip
int yModifier = 60 -(outputCount*10);
int y = 147-yModifier;
//builder
// .addSlot(RecipeIngredientRole.INPUT, 18, 130-yModifier)
// .setBackground(getRenderedSlot(), -1, -1)
// .addIngredients(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getInputFluid().getMatchingFluidStacks()))
// .addRichTooltipCallback(addFluidTooltip(recipe.getInputFluid().getRequiredAmount()));
addFluidSlot(builder,18,130-yModifier,recipe.getInputFluid());
@@ -48,11 +36,6 @@ public class DistillationCategory extends CreateRecipeCategory<DistillationRecip
y -= 24;
addFluidSlot(builder,105,y,recipe.getFluidResults().get(i));
//builder
// .addSlot(RecipeIngredientRole.OUTPUT, 105, y)
// .setBackground(getRenderedSlot(), -1, -1)
// .addIngredient(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getFluidResults().get(i)))
// .addRichTooltipCallback(addFluidTooltip(recipe.getFluidResults().get(i).getAmount()));
}
}
@@ -77,5 +60,4 @@ public class DistillationCategory extends CreateRecipeCategory<DistillationRecip
TFMGGuiTextures.DISTILLATION_TOWER_TOP.render(graphics,10,y);
}
}

View File

@@ -23,7 +23,6 @@ public class HotBlastCategory extends CreateRecipeCategory<HotBlastRecipe> {
super(info);
}
@Override
public void setRecipe(IRecipeLayoutBuilder builder, HotBlastRecipe recipe, IFocusGroup focuses) {
@@ -32,31 +31,6 @@ public class HotBlastCategory extends CreateRecipeCategory<HotBlastRecipe> {
addFluidSlot(builder,105,51,recipe.getFluidResults().get(0));
addFluidSlot(builder,105,75,recipe.getFluidResults().get(1));
//builder
// .addSlot(RecipeIngredientRole.INPUT, 18, 52)
// .setBackground(getRenderedSlot(), -1, -1)
// .addIngredients(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getFluidIngredients().get(0).getMatchingFluidStacks()))
// .addRichTooltipCallback(addFluidTooltip(recipe.getFluidIngredients().get(0).getRequiredAmount()));
//
//builder
// .addSlot(RecipeIngredientRole.INPUT, 18, 74)
// .setBackground(getRenderedSlot(), -1, -1)
// .addIngredients(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getFluidIngredients().get(1).getMatchingFluidStacks()))
// .addRichTooltipCallback(addFluidTooltip(recipe.getFluidIngredients().get(1).getRequiredAmount()));
//
///// /
//builder
// .addSlot(RecipeIngredientRole.OUTPUT, 105, 51)
// .setBackground(getRenderedSlot(), -1, -1)
// .addIngredient(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getFluidResults().get(0)))
// .addRichTooltipCallback(addFluidTooltip(recipe.getFluidResults().get(0).getAmount()));
//
//builder
// .addSlot(RecipeIngredientRole.OUTPUT, 105, 75)
// .setBackground(getRenderedSlot(), -1, -1)
// .addIngredient(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getFluidResults().get(1)))
// .addRichTooltipCallback(addFluidTooltip(recipe.getFluidResults().get(1).getAmount()));
}

View File

@@ -27,7 +27,6 @@ public class IndustrialBlastingCategory extends CreateRecipeCategory<IndustrialB
@Override
public void setRecipe(IRecipeLayoutBuilder builder, IndustrialBlastingRecipe recipe, IFocusGroup focuses) {
builder
.addSlot(RecipeIngredientRole.INPUT, 25, 13)
.setBackground(getRenderedSlot(), -1, -1)

View File

@@ -37,7 +37,6 @@ public class PolarizingCategory extends CreateRecipeCategory<PolarizingRecipe> {
AllGuiTextures.JEI_DOWN_ARROW.render(graphics, 43, 4);
this.polarizer.draw(graphics, 48, 27);
}
public static class AssemblyPolarizing extends SequencedAssemblySubCategory {

View File

@@ -196,14 +196,6 @@ public class TFMGJei implements IModPlugin {
Collection<FluidStack> potionFluids = new ArrayList<>(potions.size() * 3);
Set<Set<Holder<MobEffect>>> visitedEffects = new HashSet<>();
for (Holder.Reference<Potion> potion : potions) {
// @goshante: Ingame potion fluids always have Bottle tag that specifies
// to what bottle type this potion belongs
// Potion fluid without this tag wouldn't be recognized by other mods
// for (PotionFluid.BottleType bottleType : PotionFluid.BottleType.values()) {
// FluidStack potionFluid = PotionFluid.of(1000, new PotionContents(potion), bottleType);
// potionFluids.add(potionFluid);
// }
PotionContents potionContents = new PotionContents(potion);
@@ -302,6 +294,5 @@ public class TFMGJei implements IModPlugin {
TFMGJei.runtime = runtime;
}
}

View File

@@ -32,8 +32,6 @@ public class WindingCategory extends CreateRecipeCategory<WindingRecipe> {
super(info);
}
public void setRecipe(IRecipeLayoutBuilder builder, WindingRecipe recipe, IFocusGroup focuses) {
builder.addSlot(RecipeIngredientRole.INPUT, 15, 9).setBackground(getRenderedSlot(), -1, -1).addIngredients(recipe.getIngredients().get(0));
@@ -87,7 +85,6 @@ public class WindingCategory extends CreateRecipeCategory<WindingRecipe> {
this.windingMachine.draw(graphics, this.getWidth() / 2, 0,coilColor,false);
ms.popPose();
}
}
}

View File

@@ -7,15 +7,13 @@ import com.drmangotea.tfmg.content.decoration.doors.TFMGSlidingDoorRenderer;
import com.drmangotea.tfmg.content.decoration.flywheels.TFMGFlywheelBlockEntity;
import com.drmangotea.tfmg.content.decoration.flywheels.TFMGFlywheelRenderer;
import com.drmangotea.tfmg.content.decoration.flywheels.TFMGFlywheelVisual;
import com.drmangotea.tfmg.content.decoration.pipes.TFMGPipeBlock;
import com.drmangotea.tfmg.content.decoration.pipes.TFMGPipeBlockEntity;
import com.drmangotea.tfmg.content.decoration.pipes.TFMGPipeEntry;
import com.drmangotea.tfmg.content.decoration.pipes.TFMGPipes;
import com.drmangotea.tfmg.content.decoration.tanks.TFMGFluidTankBlockEntity;
import com.drmangotea.tfmg.content.decoration.tanks.TFMGFluidTankRenderer;
import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelFluidTankRenderer;
import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlockEntity;
import com.drmangotea.tfmg.content.electricity.connection.cable_hub.CableHubBlockEntity;
import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity;
import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnectorBlockEntity;
import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnectorRenderer;
import com.drmangotea.tfmg.content.electricity.connection.copycat_cable.CopycatCableBlockEntity;
@@ -50,6 +48,8 @@ import com.drmangotea.tfmg.content.electricity.utilities.potentiometer.Potentiom
import com.drmangotea.tfmg.content.electricity.utilities.resistor.ResistorBlockEntity;
import com.drmangotea.tfmg.content.electricity.utilities.segmented_display.SegmentedDisplayBlockEntity;
import com.drmangotea.tfmg.content.electricity.utilities.segmented_display.SegmentedDisplayRenderer;
import com.drmangotea.tfmg.content.electricity.utilities.segmented_display.SegmentedDisplaySource;
import com.drmangotea.tfmg.content.electricity.utilities.segmented_display.SegmentedDisplayTarget;
import com.drmangotea.tfmg.content.electricity.utilities.traffic_light.TrafficLightBlockEntity;
import com.drmangotea.tfmg.content.electricity.utilities.traffic_light.TrafficLightRenderer;
import com.drmangotea.tfmg.content.electricity.utilities.transformer.TransformerBlockEntity;
@@ -59,7 +59,6 @@ import com.drmangotea.tfmg.content.engines.base.EngineRenderer;
import com.drmangotea.tfmg.content.engines.engine_controller.EngineControllerBlockEntity;
import com.drmangotea.tfmg.content.engines.engine_controller.EngineControllerRenderer;
import com.drmangotea.tfmg.content.engines.engine_gearbox.EngineGearboxBlockEntity;
import com.drmangotea.tfmg.content.engines.engine_gearbox.EngineGearboxRenderer;
import com.drmangotea.tfmg.content.engines.types.large_engine.LargeEngineBlockEntity;
import com.drmangotea.tfmg.content.engines.types.large_engine.LargeEngineRenderer;
import com.drmangotea.tfmg.content.engines.types.radial_engine.RadialEngineBlockEntity;
@@ -90,11 +89,11 @@ import com.drmangotea.tfmg.content.machinery.misc.winding_machine.WindingMachine
import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.controller.DistillationControllerBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.controller.DistillationControllerRenderer;
import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.output.DistillationOutputBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.PumpjackBaseBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank.PumpjackCrankBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank.PumpjackCrankRenderer;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackRenderer;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base.PumpjackBaseBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank.PumpjackCrankBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank.PumpjackCrankRenderer;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackRenderer;
import com.drmangotea.tfmg.content.machinery.oil_processing.surface_scanner.SurfaceScannerBlockEntity;
import com.drmangotea.tfmg.content.machinery.oil_processing.surface_scanner.SurfaceScannerRenderer;
import com.drmangotea.tfmg.content.machinery.vat.base.VatBlockEntity;
@@ -114,7 +113,6 @@ import com.simibubi.create.content.fluids.pipes.valve.FluidValveRenderer;
import com.simibubi.create.content.fluids.pipes.valve.FluidValveVisual;
import com.simibubi.create.content.fluids.pump.PumpBlockEntity;
import com.simibubi.create.content.fluids.pump.PumpRenderer;
import com.simibubi.create.content.fluids.tank.FluidTankBlockEntity;
import com.simibubi.create.content.kinetics.base.*;
import com.simibubi.create.content.kinetics.gearbox.GearboxBlockEntity;
import com.simibubi.create.content.kinetics.gearbox.GearboxRenderer;
@@ -123,13 +121,6 @@ import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockEn
import com.simibubi.create.content.kinetics.simpleRelays.SimpleKineticBlockEntity;
import com.simibubi.create.foundation.blockEntity.renderer.SmartBlockEntityRenderer;
import com.tterrag.registrate.util.entry.BlockEntityEntry;
import com.tterrag.registrate.util.entry.BlockEntry;
import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.world.level.block.Block;
import java.util.List;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import static com.drmangotea.tfmg.TFMG.REGISTRATE;
@@ -382,11 +373,6 @@ public class TFMGBlockEntities {
.validBlocks(TFMGBlocks.TRANSFORMER)
.renderer(() -> TransformerRenderer::new)
.register();
public static final BlockEntityEntry<FuseBlockEntity> FUSE_BLOCK = REGISTRATE
.blockEntity("fuse_block", FuseBlockEntity::new)
// .validBlocks(TFMGBlocks.FUSE_BLOCK)
.renderer(() -> FuseBlockRenderer::new)
.register();
public static final BlockEntityEntry<SegmentedDisplayBlockEntity> SEGMENTED_DISPLAY = REGISTRATE
.blockEntity("segmented_display", SegmentedDisplayBlockEntity::new)
.validBlocks(TFMGBlocks.SEGMENTED_DISPLAY)
@@ -498,8 +484,8 @@ public class TFMGBlockEntities {
public static final BlockEntityEntry<CableHubBlockEntity> CABLE_HUB = REGISTRATE
.blockEntity("cable_hub", CableHubBlockEntity::new)
public static final BlockEntityEntry<ElectricBlockEntity> CABLE_HUB = REGISTRATE
.blockEntity("cable_hub", ElectricBlockEntity::new)
.validBlocks(TFMGBlocks.BRASS_CABLE_HUB,
TFMGBlocks.COPPER_CABLE_HUB,
TFMGBlocks.STEEL_CABLE_HUB,

View File

@@ -22,7 +22,7 @@ import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelFluidTankModel;
import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlock;
import com.drmangotea.tfmg.content.decoration.tanks.TFMGTankGenerator;
import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankItem;
import com.drmangotea.tfmg.content.electricity.connection.cable_hub.CableHubBlock;
import com.drmangotea.tfmg.content.electricity.connection.CableHubBlock;
import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnectorBlock;
import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnectorGenerator;
import com.drmangotea.tfmg.content.electricity.connection.copycat_cable.CopycatCableBlock;
@@ -49,7 +49,6 @@ import com.drmangotea.tfmg.content.electricity.utilities.diode.EncasedDiodeBlock
import com.drmangotea.tfmg.content.electricity.utilities.electric_motor.ElectricMotorBlock;
import com.drmangotea.tfmg.content.electricity.utilities.electric_pump.ElectricPumpBlock;
import com.drmangotea.tfmg.content.electricity.utilities.electric_switch.ElectricSwitchBlock;
import com.drmangotea.tfmg.content.electricity.utilities.fuse_block.FuseBlock;
import com.drmangotea.tfmg.content.electricity.utilities.polarizer.PolarizerBlock;
import com.drmangotea.tfmg.content.electricity.utilities.potentiometer.PotentiometerBlock;
import com.drmangotea.tfmg.content.electricity.utilities.potentiometer.EncasedPotentiometerBlock;
@@ -97,23 +96,21 @@ import com.drmangotea.tfmg.content.machinery.misc.winding_machine.WindingMachine
import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.IndustrialPipeBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.controller.DistillationControllerBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.output.DistillationOutputBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.PumpjackBaseBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank.PumpjackCrankBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackGenerator;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.PumpjackHammerConnectorBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.PumpjackHammerHeadBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.PumpjackHammerPartBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.large.LargePumpjackHammerConnectorBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.large.LargePumpjackHammerHeadBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.large.LargePumpjackHammerPartBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base.PumpjackBaseBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank.PumpjackCrankBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackGenerator;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.PumpjackHammerConnectorBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.PumpjackHammerHeadBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.PumpjackHammerPartBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.large.LargePumpjackHammerConnectorBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.large.LargePumpjackHammerHeadBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.large.LargePumpjackHammerPartBlock;
import com.drmangotea.tfmg.content.machinery.oil_processing.surface_scanner.SurfaceScannerBlock;
import com.drmangotea.tfmg.content.machinery.vat.base.VatBlock;
import com.drmangotea.tfmg.content.machinery.vat.base.VatGenerator;
import com.drmangotea.tfmg.content.machinery.vat.electrode_holder.ElectrodeHolderBlock;
import com.drmangotea.tfmg.content.machinery.vat.industrial_mixer.IndustrialMixerBlock;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllMountedStorageTypes;
import com.simibubi.create.AllTags;
import com.simibubi.create.api.stress.BlockStressValues;
import com.simibubi.create.content.contraptions.bearing.StabilizedBearingMovementBehaviour;
@@ -130,7 +127,6 @@ import com.simibubi.create.content.kinetics.motor.CreativeMotorGenerator;
import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockModel;
import com.simibubi.create.foundation.block.connected.HorizontalCTBehaviour;
import com.simibubi.create.foundation.data.*;
import com.tterrag.registrate.providers.loot.RegistrateBlockLootTables;
import com.tterrag.registrate.util.DataIngredient;
import com.tterrag.registrate.util.entry.BlockEntry;
import net.minecraft.client.renderer.RenderType;
@@ -179,7 +175,7 @@ public class TFMGBlocks {
//------------------ENGINES------------------//
public static final BlockEntry<TurbineEngineBlock> TURBINE_ENGINE = REGISTRATE.block("turbine_engine", TurbineEngineBlock::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.properties(BlockBehaviour.Properties::noOcclusion)
.addLayer(() -> RenderType::cutoutMipped)
@@ -189,7 +185,7 @@ public class TFMGBlocks {
.transform(customItemModel())
.register();
public static final BlockEntry<RegularEngineBlock> REGULAR_ENGINE = REGISTRATE.block("regular_engine", RegularEngineBlock::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.properties(BlockBehaviour.Properties::noOcclusion)
.onRegister(connectedTextures(() -> new EngineCTBehavior(TFMGSpriteShifts.REGULAR_ENGINE_TOP, TFMGSpriteShifts.REGULAR_ENGINE_BOTTOM, TFMGSpriteShifts.REGULAR_ENGINE_SIDE)))
@@ -199,7 +195,7 @@ public class TFMGBlocks {
.transform(customItemModel())
.register();
public static final BlockEntry<RadialEngineBlock> RADIAL_ENGINE = REGISTRATE.block("radial_engine", RadialEngineBlock::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.initialProperties(SharedProperties::softMetal)
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.properties(BlockBehaviour.Properties::noOcclusion)
.transform(TFMGStress.setCapacity(100))
@@ -774,7 +770,7 @@ public class TFMGBlocks {
//------------------METALLURGY------------------//
public static final BlockEntry<BlastFurnaceOutputBlock> BLAST_FURNACE_OUTPUT = REGISTRATE.block("blast_furnace_output", BlastFurnaceOutputBlock::new)
.initialProperties(() -> Blocks.NETHER_BRICKS)
.properties(p -> p.requiresCorrectToolForDrops())
.properties(BlockBehaviour.Properties::requiresCorrectToolForDrops)
.transform(pickaxeOnly())
.blockstate(BlockStateGen.horizontalBlockProvider(true))
.tag(BlockTags.NEEDS_STONE_TOOL)
@@ -784,7 +780,7 @@ public class TFMGBlocks {
public static final BlockEntry<BlastFurnaceHatchBlock> BLAST_FURNACE_HATCH = REGISTRATE.block("blast_furnace_hatch", BlastFurnaceHatchBlock::new)
.initialProperties(() -> Blocks.NETHER_BRICKS)
.properties(p -> p.requiresCorrectToolForDrops())
.properties(BlockBehaviour.Properties::requiresCorrectToolForDrops)
.transform(pickaxeOnly())
.tag(TFMGTags.TFMGBlockTags.BLAST_FURNACE_WALL.tag)
.tag(TFMGTags.TFMGBlockTags.REINFORCED_BLAST_FURNACE_WALL.tag)
@@ -793,7 +789,7 @@ public class TFMGBlocks {
.register();
public static final BlockEntry<Block> FIREPROOF_BRICKS = REGISTRATE.block("fireproof_bricks", Block::new)
.initialProperties(() -> Blocks.NETHER_BRICKS)
.properties(p -> p.requiresCorrectToolForDrops())
.properties(BlockBehaviour.Properties::requiresCorrectToolForDrops)
.transform(pickaxeOnly())
.tag(TFMGTags.TFMGBlockTags.BLAST_FURNACE_WALL.tag)
.tag(BlockTags.NEEDS_STONE_TOOL)
@@ -803,7 +799,7 @@ public class TFMGBlocks {
public static final BlockEntry<Block> REINFORCED_FIREPROOF_BRICKS = REGISTRATE.block("reinforced_fireproof_bricks", Block::new)
.initialProperties(() -> Blocks.NETHER_BRICKS)
.properties(p -> p.requiresCorrectToolForDrops())
.properties(BlockBehaviour.Properties::requiresCorrectToolForDrops)
.transform(pickaxeOnly())
.tag(TFMGTags.TFMGBlockTags.REINFORCED_BLAST_FURNACE_WALL.tag)
.tag(BlockTags.NEEDS_STONE_TOOL)
@@ -813,7 +809,7 @@ public class TFMGBlocks {
public static final BlockEntry<Block> BLAST_FURNACE_REINFORCEMENT = REGISTRATE.block("blast_furnace_reinforcement", Block::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.properties(p -> p.requiresCorrectToolForDrops())
.properties(BlockBehaviour.Properties::requiresCorrectToolForDrops)
.transform(pickaxeOnly())
.onRegister(connectedTextures(() -> new HorizontalCTBehaviour(TFMGSpriteShifts.BLAST_FURNACE_REINFORCEMENT)))
.tag(TFMGTags.TFMGBlockTags.REINFORCED_BLAST_FURNACE_SUPPORT.tag)
@@ -824,7 +820,7 @@ public class TFMGBlocks {
public static final BlockEntry<BlastFurnaceReinforcementWallBlock> BLAST_FURNACE_REINFORCEMENT_WALL = REGISTRATE.block("blast_furnace_reinforcement_wall", BlastFurnaceReinforcementWallBlock::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.properties(p -> p.requiresCorrectToolForDrops())
.properties(BlockBehaviour.Properties::requiresCorrectToolForDrops)
.transform(pickaxeOnly())
.properties(BlockBehaviour.Properties::noOcclusion)
.onRegister(connectedTextures(() -> new HorizontalCTBehaviour(TFMGSpriteShifts.BLAST_FURNACE_REINFORCEMENT)))
@@ -835,7 +831,7 @@ public class TFMGBlocks {
//
public static final BlockEntry<Block> RUSTED_BLAST_FURNACE_REINFORCEMENT = REGISTRATE.block("rusted_blast_furnace_reinforcement", Block::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.properties(p -> p.requiresCorrectToolForDrops())
.properties(BlockBehaviour.Properties::requiresCorrectToolForDrops)
.transform(pickaxeOnly())
.onRegister(connectedTextures(() -> new HorizontalCTBehaviour(TFMGSpriteShifts.RUSTED_BLAST_FURNACE_REINFORCEMENT)))
.tag(TFMGTags.TFMGBlockTags.REINFORCED_BLAST_FURNACE_SUPPORT.tag)
@@ -846,7 +842,7 @@ public class TFMGBlocks {
public static final BlockEntry<BlastFurnaceReinforcementWallBlock> RUSTED_BLAST_FURNACE_REINFORCEMENT_WALL = REGISTRATE.block("rusted_blast_furnace_reinforcement_wall", BlastFurnaceReinforcementWallBlock::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.properties(p -> p.requiresCorrectToolForDrops())
.properties(BlockBehaviour.Properties::requiresCorrectToolForDrops)
.transform(pickaxeOnly())
.properties(BlockBehaviour.Properties::noOcclusion)
.onRegister(connectedTextures(() -> new HorizontalCTBehaviour(TFMGSpriteShifts.RUSTED_BLAST_FURNACE_REINFORCEMENT)))
@@ -858,7 +854,7 @@ public class TFMGBlocks {
public static final BlockEntry<WallBlock> FIREPROOF_BRICK_REINFORCEMENT = REGISTRATE.block("fireproof_brick_reinforcement", WallBlock::new)
.initialProperties(() -> Blocks.NETHER_BRICKS)
.properties(p -> p.requiresCorrectToolForDrops())
.properties(BlockBehaviour.Properties::requiresCorrectToolForDrops)
.transform(pickaxeOnly())
.tag(BlockTags.WALLS)
.tag(TFMGTags.TFMGBlockTags.BLAST_FURNACE_SUPPORT.tag)
@@ -878,7 +874,7 @@ public class TFMGBlocks {
.item()
.transform(customItemModel())
.register();
@SuppressWarnings("'addLayer(java.util.function.Supplier<java.util.function.Supplier<net.minecraft.client.renderer.RenderType>>)' is deprecated and marked for removal ")
public static final BlockEntry<BlastStoveBlock> BLAST_STOVE =
REGISTRATE.block("blast_stove", BlastStoveBlock::new)
.initialProperties(SharedProperties::copperMetal)
@@ -892,9 +888,8 @@ public class TFMGBlocks {
public static final BlockEntry<CastingBasinBlock> CASTING_BASIN = REGISTRATE.block("casting_basin", CastingBasinBlock::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.properties(p -> p.requiresCorrectToolForDrops())
.properties(p -> p.requiresCorrectToolForDrops().noOcclusion())
.transform(pickaxeOnly())
.properties(BlockBehaviour.Properties::noOcclusion)
.blockstate(BlockStateGen.horizontalBlockProvider(true))
.item()
.transform(customItemModel())

View File

@@ -39,7 +39,7 @@ public class TFMGCableTypes {
.transform(TFMGResistivity.setResistivity(1f))
.register();
// Why is this a thing? I'll leave it her in case you do need it. - Krystal
// Why is this a thing? I'll leave it here in case you do need it. - Krystal
//public static final CableTypeEntry<CableType> steelReinforcedAluminum = REGISTRATE.cableType("steel_reinforced_aluminum", CableType::new)
// .properties((p) -> p.color(0xB8A08D).spool(TFMGItems.COPPER_SPOOL))
// .transform(TFMGResistivity.setResistivity(0.0027f))

View File

@@ -29,11 +29,6 @@ import net.minecraft.world.entity.MobCategory;
public class TFMGEntityTypes {
public static final EntityEntry<PipeBomb> PIPE_BOMB =
register("pipe_bomb", PipeBomb::new, () -> PipeBombRenderer::new,
MobCategory.MISC, 4, 20, true, true, PipeBomb::build).register();
@@ -70,9 +65,6 @@ public class TFMGEntityTypes {
MobCategory.MISC, 80, 20, true, true, LithiumSpark::build).register();
private static <T extends Entity> CreateEntityBuilder<T, ?> register(String name, EntityType.EntityFactory<T> factory,
NonNullSupplier<NonNullFunction<EntityRendererProvider.Context, EntityRenderer<? super T>>> renderer,
MobCategory group, int range, int updateFrequency, boolean sendVelocity, boolean immuneToFire,
@@ -91,8 +83,6 @@ public class TFMGEntityTypes {
.renderer(renderer);
}
public static void init(){
}

View File

@@ -6,7 +6,7 @@ import com.drmangotea.tfmg.base.TFMGRegistrate;
import com.drmangotea.tfmg.base.TFMGTiers;
import com.drmangotea.tfmg.content.decoration.gearbox.SteelVerticalGearboxItem;
import com.drmangotea.tfmg.content.electricity.configuration_wrench.ElectriciansWrenchItem;
import com.drmangotea.tfmg.content.electricity.debug.DebugCinderBlockItem;
import com.drmangotea.tfmg.base.debug.DebugCinderBlockItem;
import com.drmangotea.tfmg.content.electricity.measurement.MultimeterItem;
import com.drmangotea.tfmg.content.electricity.utilities.polarizer.MagnetItem;
import com.drmangotea.tfmg.content.electricity.utilities.resistor.ResistorItem;
@@ -28,7 +28,6 @@ import com.drmangotea.tfmg.content.items.weapons.lithium_blade.LithiumBladeItem;
import com.drmangotea.tfmg.content.items.weapons.quad_potato_cannon.QuadPotatoCannonItem;
import com.drmangotea.tfmg.content.machinery.misc.winding_machine.SpoolItem;
import com.drmangotea.tfmg.content.machinery.oil_processing.OilHammerItem;
import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.DepositItem;
import com.simibubi.create.AllTags;
import com.simibubi.create.content.processing.sequenced.SequencedAssemblyItem;
import com.simibubi.create.foundation.data.AssetLookup;
@@ -87,6 +86,7 @@ public class TFMGItems {
SYNTHETIC_LEATHER = taggedIngredient("synthetic_leather", Tags.Items.LEATHERS, AllTags.commonItemTag("leather")),
LIMESAND = taggedIngredient("limesand", TFMGTags.TFMGItemTags.FLUX.tag),
SULFUR_DUST = taggedIngredient("sulfur_dust", commonItemTag("dusts/sulfur"), commonItemTag("dusts")),
NITRATE_DUST = taggedIngredient("nitrate_dust", commonItemTag("dusts/saltpeter"), commonItemTag("dusts")),
RUBBER_SHEET = taggedIngredient("rubber_sheet", commonItemTag("ingots/rubber"), commonItemTag("dusts")),
SILICON_INGOT = taggedIngredient("silicon_ingot", commonItemTag("ingots/silicon"), commonItemTag("dusts")),
CRUSHED_LITHIUM = taggedIngredient("crushed_raw_lithium", AllTags.AllItemTags.CRUSHED_RAW_MATERIALS.tag)
@@ -123,7 +123,6 @@ public class TFMGItems {
.register(),
THERMITE_POWDER = REGISTRATE.item("thermite_powder", Item::new).register(),
STEEL_MECHANISM = REGISTRATE.item("steel_mechanism", Item::new).register(),
NITRATE_DUST = REGISTRATE.item("nitrate_dust", Item::new).register(),
CONCRETE_MIXTURE = REGISTRATE.item("concrete_mixture", Item::new).register(),
ASPHALT_MIXTURE = REGISTRATE.item("asphalt_mixture", Item::new).register(),
MAGNETIC_ALLOY_INGOT = REGISTRATE.item("magnetic_alloy_ingot", Item::new).register(),
@@ -224,10 +223,8 @@ public class TFMGItems {
.durability(256))
.register();
public static final ItemEntry<DepositItem> DEPOSIT_ITEM = REGISTRATE.item("deposit_item", DepositItem::new)
.properties(p -> p.stacksTo(1)
.durability(1))
.register();
// public static final ItemEntry<ArmorItem>
// STEEL_HELMET = armor("steel_helmet", TFMGArmorMaterials.STEEL, ArmorItem.Type.HELMET),
// STEEL_CHESTPLATE = armor("steel_chestplate", TFMGArmorMaterials.STEEL, ArmorItem.Type.CHESTPLATE),

View File

@@ -31,10 +31,6 @@ public enum TFMGKeys {
private final int key;
private final boolean modifiable;
TFMGKeys(int defaultKey) {
this("", defaultKey, "");
}
TFMGKeys(String description, int defaultKey, String translation) {
this.description = TFMG.MOD_ID + ".keyinfo." + description;
this.key = defaultKey;

View File

@@ -15,6 +15,9 @@ import net.neoforged.neoforge.registries.DeferredRegister;
import java.awt.*;
public class TFMGMobEffects {
/**
registers the hellfire effect
*/
public static final DeferredRegister<MobEffect> MOB_EFFECTS = DeferredRegister.create(Registries.MOB_EFFECT, TFMG.MOD_ID);
public static final DeferredHolder<MobEffect, HellFireEffect> HELLFIRE = MOB_EFFECTS.register("hellfire", () -> new HellFireEffect(MobEffectCategory.HARMFUL, new Color(150, 0, 0, 200).getRGB()));

View File

@@ -12,11 +12,9 @@ public class TFMGMountedStorageTypes {
public static final RegistryEntry<MountedFluidStorageType<?>,FluidTankMountedStorageType> TFMG_FLUID_TANK = simpleFluid("tfmg_fluid_tank", FluidTankMountedStorageType::new);
private static <T extends MountedFluidStorageType<?>> RegistryEntry<MountedFluidStorageType<?>, T> simpleFluid(String name, Supplier<T> supplier) {
return REGISTRATE.mountedFluidStorage(name, supplier).register();
}
public static void register() {
}
public static void register() {}
}

View File

@@ -11,6 +11,7 @@ import com.drmangotea.tfmg.content.engines.engine_controller.TransmissionRemoveP
import com.drmangotea.tfmg.content.engines.engine_controller.packets.*;
import com.drmangotea.tfmg.content.items.weapons.advanced_potato_cannon.AdvancedPotatoCannonPacket;
import com.drmangotea.tfmg.content.machinery.metallurgy.coke_oven.CokeOvenPacket;
import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.controller.DistillationTowerPacket;
import com.drmangotea.tfmg.content.machinery.vat.base.VatEvaluationPacket;
import com.simibubi.create.AllPackets;
import com.simibubi.create.Create;
@@ -32,6 +33,7 @@ public enum TFMGPackets implements BasePacketPayload.PacketTypeProvider {
CONNECTION_PACKET(ConnectionPacket.class, ConnectionPacket.STREAM_CODEC),
VAT_EVALUATION(VatEvaluationPacket.class, VatEvaluationPacket.STREAM_CODEC),
COKE_OVEN_PACKET(CokeOvenPacket.class, CokeOvenPacket.STREAM_CODEC),
DISTILLATION_PACKET(DistillationTowerPacket.class, DistillationTowerPacket.STREAM_CODEC),
UPDATE_IN_FRONT_PACKET(UpdateInFrontPacket.class, UpdateInFrontPacket.STREAM_CODEC),
TRANSMISSION_REMOVE(TransmissionRemovePacket.class, TransmissionRemovePacket.STREAM_CODEC),
CABLE_PLACE_PACKET(CablePlacePacket.class, CablePlacePacket.STREAM_CODEC),

View File

@@ -18,7 +18,6 @@ import java.util.*;
public class TFMGPartialModels {
public static final PartialModel
AIR_INTAKE_FAN = block("air_intake/fan"),
AIR_INTAKE_FAN_MEDIUM = block("air_intake/fan_medium"),
AIR_INTAKE_FAN_LARGE = block("air_intake/fan_large"),
AIR_INTAKE_FRAME = block("air_intake/frame"),
@@ -41,19 +40,9 @@ public class TFMGPartialModels {
LEAD_FLYWHEEL = block("lead_flywheel/block"),
NICKEL_FLYWHEEL = block("nickel_flywheel/block"),
DISTILLATION_CONTROLLER_DIAL = block("steel_distillation_controller/dial"),
PUMPJACK_HAMMER = block("pumpjack/hammer_holder"),
PUMPJACK_FRONT_ROPE = block("pumpjack/pumpjack_front_rope"),
PUMPJACK_CONNECTOR = block("pumpjack/pumpjack_connector"),
PUMPJACK_CRANK_BLOCK = block("pumpjack/pumpjack_crank_block"),
PUMPJACK_CRANK = block("pumpjack_crank/crank"),
PUMPJACK_CONNECTORS = block("pumpjack_crank/connectors"),
TOWER_GAUGE = block("distillation_tower/gauge"),
SURFACE_SCANNER_DIAL = block("surface_scanner/dial"),
SURFACE_SCANNER_FLAG = block("surface_scanner/flag"),
ROTOR = block("rotor/block"),
INGOT_MOLD = block("casting_basin/mold_base"),
BlOCK_MOLD = block("casting_basin/block_mold"),
STATOR_OUTPUT = block("stator/output"),
VOLTMETER_DIAL = block("voltmeter/dial"),
LIGHT_BULB = block("light_bulb/light"),
ALUMINUM_LAMP = block("aluminum_lamp/light"),
@@ -76,9 +65,6 @@ public class TFMGPartialModels {
SHAFTLESS_LARGE_STEEL_COGHWEEL = block("large_steel_cogwheel_shaftless"),
SPOOL = block("winding_machine/spool"),
SPOOL_WIRE = block("winding_machine/spool_wire"),
COPPER_SPOOL = block("winding_machine/copper_spool"),
ALUMINUM_SPOOL = block("winding_machine/aluminum_spool"),
CONSTANTAN_SPOOL = block("winding_machine/constantan_spool"),
CYLINDER = block("regular_engine/cylinder"),
RADIAL_ENGINE_CYLINDER = block("radial_engine/cylinder"),
SMALL_CYLINDER = block("regular_engine/cylinder_small"),
@@ -107,10 +93,6 @@ public class TFMGPartialModels {
LARGE_CENTRIFUGE_MIDDLE = block("industrial_mixer/large_centrifuge_middle"),
LARGE_CENTRIFUGE_TOP = block("industrial_mixer/large_centrifuge_top"),
LARGE_CENTRIFUGE_ALONE = block("industrial_mixer/large_centrifuge_alone"),
COPPER_ELECTRODE = block("electrode_holder/copper_electrode"),
ZINC_ELECTRODE = block("electrode_holder/zinc_electrode"),
GRAPHITE_ELECTRODE = block("electrode_holder/graphite_electrode"),
GRAPHITE_ELECTRODE_SUPERHEATED = block("electrode_holder/superheated_graphite_electrode"),
SURFACE_SCANNER_LIGHT = block("surface_scanner/light");
//Display Segments

View File

@@ -56,20 +56,6 @@ public enum TFMGRecipeTypes implements IRecipeTypeInfo, StringRepresentable {
public static final Codec<AllRecipeTypes> CODEC = StringRepresentable.fromEnum(AllRecipeTypes::values);
TFMGRecipeTypes(Supplier<RecipeSerializer<?>> serializerSupplier, Supplier<RecipeType<?>> typeSupplier, boolean registerType) {
String name = Lang.asId(name());
id = Create.asResource(name);
this.serializerSupplier = serializerSupplier;
serializerObject = Registers.SERIALIZER_REGISTER.register(name, serializerSupplier);
if (registerType) {
typeObject = Registers.TYPE_REGISTER.register(name, typeSupplier);
type = typeObject;
} else {
typeObject = null;
type = typeSupplier;
}
isProcessingRecipe = false;
}
TFMGRecipeTypes(Supplier<RecipeSerializer<?>> serializerSupplier) {
String name = Lang.asId(name());

View File

@@ -31,8 +31,6 @@ public class TFMGTags {
MOD(TFMG.MOD_ID, false, true),
COMMON("c")
;
public final String id;
@@ -74,10 +72,6 @@ public class TFMGTags {
this(namespace, namespace.optionalDefault, namespace.alwaysDatagenDefault);
}
TFMGBlockTags(NameSpace namespace, String path) {
this(namespace, path, namespace.optionalDefault, namespace.alwaysDatagenDefault);
}
TFMGBlockTags(NameSpace namespace, boolean optional, boolean alwaysDatagen) {
this(namespace, null, optional, alwaysDatagen);
}
@@ -191,17 +185,12 @@ public class TFMGTags {
public final TagKey<Fluid> tag;
public final boolean alwaysDatagen;
TFMGFluidTags() {
this(MOD);
}
TFMGFluidTags(NameSpace namespace) {
this(namespace, namespace.optionalDefault, namespace.alwaysDatagenDefault);
}
TFMGFluidTags(NameSpace namespace, String path) {
this(namespace, path, namespace.optionalDefault, namespace.alwaysDatagenDefault);
}
TFMGFluidTags(NameSpace namespace, boolean optional, boolean alwaysDatagen) {
this(namespace, null, optional, alwaysDatagen);