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

Commit

Permalink
finished reactor models, for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Aug 11, 2024
1 parent 0f303c9 commit 72eb05b
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 7 deletions.
6 changes: 5 additions & 1 deletion common/src/main/java/muramasa/gregtech/GregTech.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import muramasa.antimatter.tool.IAntimatterTool;
import muramasa.antimatter.util.AntimatterPlatformUtils;
import muramasa.gregtech.block.BlockAsphalt;
import muramasa.gregtech.client.GregTechModelManager;
import muramasa.gregtech.data.Machines;
import muramasa.gregtech.data.*;
import muramasa.gregtech.datagen.*;
Expand Down Expand Up @@ -242,7 +243,10 @@ public void onRegistrationEvent(RegistrationEvent event, Side side) {
// if (side == Dist.CLIENT) StructureInfo.init();
TierMaps.providerInit();
}
case CLIENT_DATA_INIT -> ClientData.init();
case CLIENT_DATA_INIT -> {
ClientData.init();
GregTechModelManager.init();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package muramasa.gregtech.client;

import muramasa.antimatter.Ref;
import muramasa.gregtech.GTIRef;
import net.minecraft.resources.ResourceLocation;

public class GregTechModelManager {

public static final ResourceLocation LOADER_REACTOR = new ResourceLocation(GTIRef.ID, "reactor");

public static void init(){
new ReactorModelLoader(LOADER_REACTOR);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ReactorBakedModel(TextureAtlasSprite particle, ImmutableMap<MachineState,
@Override
public List<BakedQuad> getBlockQuads(BlockState state, Direction side, Random rand, BlockAndTintGetter level, @NotNull BlockPos pos) {
List<BakedQuad> superBlockQuads = super.getBlockQuads(state, side, rand, level, pos);
if (side == null){
if (side == Direction.UP){
List<BakedQuad> list = new ArrayList<>();
BlockEntity tile = level.getBlockEntity(pos);
if (!(tile instanceof BlockEntityNuclearReactorCore core)) return Collections.emptyList();
Expand All @@ -46,6 +46,7 @@ public List<BakedQuad> getBlockQuads(BlockState state, Direction side, Random ra
}
list.addAll(ModelUtils.getQuadsFromBaked(model, state, null, rand, level, pos));
}
list.addAll(superBlockQuads);
return list;
}
return superBlockQuads;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonObject;
import muramasa.antimatter.AntimatterAPI;
import muramasa.antimatter.client.ModelUtils;
import muramasa.antimatter.client.model.loader.AntimatterModelLoader;
import muramasa.antimatter.machine.MachineState;
import muramasa.gregtech.GTIRef;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite;
import net.minecraft.client.resources.model.UnbakedModel;
Expand Down Expand Up @@ -37,9 +39,9 @@ public ReactorModel readModel(JsonDeserializationContext context, JsonObject jso
String[] array = new String[]{"north-west", "south-west", "north-east", "south-east"};
//northwest is 0, southwest is 1, northeast is 2, southeast is 3
for (int i = 0; i < 4; i++) {
//rods[i] = context.deserialize(J)
ResourceLocation modelLocation = new ResourceLocation(GTIRef.ID, "block/machine/overlay/nuclear_reactor_core/"+ array[i] + "-rod");
rods[i] = ModelUtils.getModel(modelLocation);
}

return null;
return new ReactorModel(m, particle, rods);
}
}
3 changes: 2 additions & 1 deletion common/src/main/java/muramasa/gregtech/data/Machines.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import muramasa.gregtech.blockentity.miniportals.BlockEntityMiniTwilightPortal;
import muramasa.gregtech.blockentity.multi.*;
import muramasa.gregtech.blockentity.single.*;
import muramasa.gregtech.client.GregTechModelManager;
import muramasa.gregtech.items.IItemReactorRod;
import muramasa.gregtech.machine.MiniPortalMachine;
import muramasa.gregtech.machine.MultiblockTankMachine;
Expand Down Expand Up @@ -204,7 +205,7 @@ public class Machines {
tooltip.add(Utils.translatable("machine.power.capacity").append(": ").append(Utils.literal("" + 80).withStyle(ChatFormatting.BLUE)));
}
});
public static BasicMachine NUCLEAR_REACTOR_CORE = new SecondaryOutputMachine(GTIRef.ID, "nuclear_reactor_core").setSecondaryOutputCover(COVER_REACTOR_OUTPUT_SECONDARY).removeFlags(EU).setTiers(NONE).addFlags(GUI, ITEM, FLUID).custom().overlayTexture(Textures.REACTOR_CORE_OVERLAY_HANDLER).baseTexture(new Texture(GTIRef.ID, "block/machine/base/nuclear_reactor_core")).setTile(BlockEntityNuclearReactorCore::new).blockColorHandler(Machines::getBlockColorNuclear).frontCovers().allowFrontIO().setNoTextureRotation(true).setOutputCover(GregTechCovers.COVER_REACTOR_OUTPUT).covers(ICover.emptyFactory, ICover.emptyFactory, GregTechCovers.COVER_REACTOR_OUTPUT, GregTechCovers.COVER_REACTOR_OUTPUT_SECONDARY, ICover.emptyFactory, ICover.emptyFactory);
public static BasicMachine NUCLEAR_REACTOR_CORE = new SecondaryOutputMachine(GTIRef.ID, "nuclear_reactor_core").setSecondaryOutputCover(COVER_REACTOR_OUTPUT_SECONDARY).removeFlags(EU).setTiers(NONE).addFlags(GUI, ITEM, FLUID, UNCULLED).custom().overlayTexture(Textures.REACTOR_CORE_OVERLAY_HANDLER).baseTexture(new Texture(GTIRef.ID, "block/machine/base/nuclear_reactor_core")).modelLoader(GregTechModelManager.LOADER_REACTOR).setTile(BlockEntityNuclearReactorCore::new).blockColorHandler(Machines::getBlockColorNuclear).frontCovers().allowFrontIO().setNoTextureRotation(true).setOutputCover(GregTechCovers.COVER_REACTOR_OUTPUT).covers(ICover.emptyFactory, ICover.emptyFactory, GregTechCovers.COVER_REACTOR_OUTPUT, GregTechCovers.COVER_REACTOR_OUTPUT_SECONDARY, ICover.emptyFactory, ICover.emptyFactory);
public static BasicMachine SMALL_HEAT_EXCHANGER = new SecondaryOutputMachine(GTIRef.ID, "small_heat_exchanger").setSecondaryOutputCover(COVER_OUTPUT_SECONDARY).removeFlags(EU).covers(ICover.emptyFactory, ICover.emptyFactory, ICover.emptyFactory, COVEROUTPUT, COVER_OUTPUT_SECONDARY, ICover.emptyFactory).setTiers(NONE).baseTexture(new Texture(GTIRef.ID, "block/machine/base/small_heat_exchanger")).setMap(HEAT_EXCHANGER).addFlags(GUI, ITEM, FLUID).setTile(BlockEntitySmallHeatExchanger::new).frontCovers().allowFrontIO();

/**
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 72eb05b

Please sign in to comment.