Skip to content

Commit

Permalink
Add centrifuge block + model
Browse files Browse the repository at this point in the history
  • Loading branch information
Rearth committed Mar 5, 2024
1 parent ea13c32 commit 010dc37
Show file tree
Hide file tree
Showing 19 changed files with 1,206 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
// 1.20.4 2024-03-05T14:01:10.7834685 Oritech/Model Definitions
// 1.20.4 2024-03-05T16:03:25.4504393 Oritech/Model Definitions
ee822d455f99c8c53c789fdb744979f678ca2729 assets\oritech\blockstates\fertilizer_block.json
46af77abe62b29d232feadccde429fd59d5603fc assets\oritech\blockstates\placer_block.json
3d6f377b938592ac22aca17bd64561a6579ad217 assets\oritech\blockstates\grinder_block.json
8ede0997449fd1c3f65a07df184768a843b473ed assets\oritech\models\item\centrifuge_block.json
90e28b721796ff7ee21c8eefe4525f03a251d2fb assets\oritech\models\block\machine_extender.json
3fcaea2f05319816f7904137763182c4106c91a9 assets\oritech\blockstates\destroyer_block.json
eafe84c787830ab2a866e0878e9ed718d58659f5 assets\oritech\blockstates\banana_block.json
b5ee97616ae0d2da17dfaecf45aa42f2cf19f691 assets\oritech\blockstates\machine_extender.json
25864df3cd7786f2bf4fe6fa9855b3cf366c28ca assets\oritech\models\item\banana.json
1fdbeb99862a58436d745edb768b503539ecb295 assets\oritech\models\item\placer_block.json
9cd64a2fe3b9a0ee479646d36cc0302bcd7cab4f assets\oritech\models\block\destroyer_block.json
b8bc03092cb1eb686ede01daffc7421253af860c assets\oritech\models\item\machine_extender.json
53f76976c5fe0593fa89a4b835dde07c96b07067 assets\oritech\blockstates\centrifuge_block.json
9cd64a2fe3b9a0ee479646d36cc0302bcd7cab4f assets\oritech\models\block\destroyer_block.json
63f14855c688ce7ec236097ce232dd381cbc1538 assets\oritech\blockstates\addon_indicator_block.json
7ee14de0149c70d1145dbf338518690b536cc02e assets\oritech\models\item\powered_furnace_block.json
746b98d721e5ae0d96dd769e71b786afa8c2d142 assets\oritech\models\item\banana_block.json
Expand All @@ -26,8 +28,8 @@ f29468ff950a191567ab35557334666099ccd7cc assets\oritech\blockstates\assembler_bl
5054284e6d5fe0785ac93bdda5101c47337953cf assets\oritech\models\item\machine_frame_block.json
e4497bad8afbd4f4b4e830d892284a05718b06dd assets\oritech\models\block\machine_core_basic.json
505d30e3b61ee0ba1f2616e1226689e2cdb7ab58 assets\oritech\models\block\addon_indicator_block.json
3810f72943d88c81d3ab6b4329d437911c859621 assets\oritech\blockstates\powered_furnace_block.json
1b9cd3719105dc1e03398de41f2cab37337816fe assets\oritech\blockstates\machine_core_good.json
3810f72943d88c81d3ab6b4329d437911c859621 assets\oritech\blockstates\powered_furnace_block.json
5462a2453fcdd2f8b99129894aec60f282d29ca9 assets\oritech\models\item\pulverizer_block.json
a3f9b72f6f36d42af4e5c3a87d7e180b2e36a2ed assets\oritech\models\item\machine_core_good.json
a5651b8d4a27308b40c404f7cd3abcf9769b64b6 assets\oritech\models\item\machine_core_basic.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "oritech:block/centrifuge_block"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "oritech:block/centrifuge_block"
}
Original file line number Diff line number Diff line change
Expand Up @@ -571,14 +571,12 @@ public int[] getAvailableSlots(Direction side) {
for (int i = 0; i < getSlots().outputCount(); i++) {
res[i] = getSlots().outputStart() + i;
}
System.out.println(Arrays.toString(res));
return res;
} else {
var res = new int[getSlots().inputCount()];
for (int i = 0; i < getSlots().inputCount(); i++) {
res[i] = getSlots().inputStart() + i;
}
System.out.println("input" + Arrays.toString(res));
return res;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package rearth.oritech.block.blocks.machines.processing;

import net.minecraft.block.BlockEntityProvider;
import net.minecraft.block.entity.BlockEntity;
import org.jetbrains.annotations.NotNull;
import rearth.oritech.block.base.block.MultiblockMachine;
import rearth.oritech.block.entity.machines.processing.CentrifugeBlockEntity;
import rearth.oritech.block.entity.machines.processing.FoundryBlockEntity;

public class CentrifugeBlock extends MultiblockMachine implements BlockEntityProvider {

public CentrifugeBlock(Settings settings) {
super(settings);
}

@Override
public @NotNull Class<? extends BlockEntity> getBlockEntityType() {
return CentrifugeBlockEntity.class;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package rearth.oritech.block.entity.machines.processing;

import net.minecraft.block.BlockState;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import rearth.oritech.block.base.entity.MultiblockMachineEntity;
import rearth.oritech.client.init.ModScreens;
import rearth.oritech.init.BlockEntitiesContent;
import rearth.oritech.init.recipes.OritechRecipeType;
import rearth.oritech.init.recipes.RecipeContent;
import rearth.oritech.util.InventorySlotAssignment;

import java.util.List;

public class CentrifugeBlockEntity extends MultiblockMachineEntity {

public CentrifugeBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntitiesContent.CENTRIFUGE_ENTITY, pos, state, 32);
}

@Override
protected OritechRecipeType getOwnRecipeType() {
return RecipeContent.CENTRIFUGE;
}

@Override
public InventorySlotAssignment getSlots() {
return new InventorySlotAssignment(0, 1, 1, 3);
}

@Override
public List<GuiSlot> getGuiSlots() {
return List.of(
new GuiSlot(0, 80, 11),
new GuiSlot(1, 60, 59),
new GuiSlot(2, 80, 59),
new GuiSlot(3, 100, 59));
}

@Override
public ScreenHandlerType<?> getScreenHandlerType() {
return ModScreens.CENTRIFUGE_SCREEN;
}

@Override
public int getInventorySize() {
return 4;
}

@Override
public List<Vec3i> getCorePositions() {
return List.of(
new Vec3i(0, 1,0)
);
}

@Override
public boolean inputOptionsEnabled() {
return false;
}

@Override
public List<Vec3i> getAddonSlots() {

return List.of(
new Vec3i(0, 0,-1),
new Vec3i(0, 0,1)
);
}
}
1 change: 1 addition & 0 deletions src/main/java/rearth/oritech/client/init/ModRenderers.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public static void registerRenderers() {
BlockEntityRendererFactories.register(BlockEntitiesContent.GRINDER_ENTITY, ctx -> new MachineRenderer<>("models/grinder_block"));
BlockEntityRendererFactories.register(BlockEntitiesContent.ASSEMBLER_ENTITY, ctx -> new MachineRenderer<>("models/assembler_block"));
BlockEntityRendererFactories.register(BlockEntitiesContent.FOUNDRY_ENTITY, ctx -> new MachineRenderer<>("models/foundry_block"));
BlockEntityRendererFactories.register(BlockEntitiesContent.CENTRIFUGE_ENTITY, ctx -> new MachineRenderer<>("models/centrifuge_block"));
BlockEntityRendererFactories.register(BlockEntitiesContent.POWERED_FURNACE_ENTITY, ctx -> new MachineRenderer<>("models/powered_furnace_block"));
BlockEntityRendererFactories.register(BlockEntitiesContent.PLACER_BLOCK_ENTITY, ctx -> new MachineGantryRenderer());
BlockEntityRendererFactories.register(BlockEntitiesContent.DESTROYER_BLOCK_ENTITY, ctx -> new MachineGantryRenderer());
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/rearth/oritech/client/init/ModScreens.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class ModScreens implements AutoRegistryContainer<ScreenHandlerType<?>> {
public static final ExtendedScreenHandlerType<UpgradableMachineScreenHandler> GRINDER_SCREEN = new ExtendedScreenHandlerType<>(UpgradableMachineScreenHandler::new);
public static final ExtendedScreenHandlerType<UpgradableMachineScreenHandler> ASSEMBLER_SCREEN = new ExtendedScreenHandlerType<>(UpgradableMachineScreenHandler::new);
public static final ExtendedScreenHandlerType<UpgradableMachineScreenHandler> FOUNDRY_SCREEN = new ExtendedScreenHandlerType<>(UpgradableMachineScreenHandler::new);
public static final ExtendedScreenHandlerType<UpgradableMachineScreenHandler> CENTRIFUGE_SCREEN = new ExtendedScreenHandlerType<>(UpgradableMachineScreenHandler::new);
public static final ExtendedScreenHandlerType<UpgradableMachineScreenHandler> POWERED_FURNACE_SCREEN = new ExtendedScreenHandlerType<>(UpgradableMachineScreenHandler::new);
public static final ExtendedScreenHandlerType<UpgradableMachineScreenHandler> DESTROYER_SCREEN = new ExtendedScreenHandlerType<>(UpgradableMachineScreenHandler::new);
public static final ExtendedScreenHandlerType<UpgradableMachineScreenHandler> PLACER_SCREEN = new ExtendedScreenHandlerType<>(UpgradableMachineScreenHandler::new);
Expand All @@ -25,6 +26,7 @@ public static void assignScreens() {
HandledScreens.register(GRINDER_SCREEN, UpgradableMachineScreen::new);
HandledScreens.register(ASSEMBLER_SCREEN, UpgradableMachineScreen::new);
HandledScreens.register(FOUNDRY_SCREEN, UpgradableMachineScreen::new);
HandledScreens.register(CENTRIFUGE_SCREEN, UpgradableMachineScreen::new);
HandledScreens.register(POWERED_FURNACE_SCREEN, UpgradableMachineScreen::new);
HandledScreens.register(INVENTORY_PROXY_SCREEN, InventoryProxyScreen::new);
HandledScreens.register(DESTROYER_SCREEN, UpgradableMachineScreen::new);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/rearth/oritech/init/BlockContent.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class BlockContent implements BlockRegistryContainer {
@UseGeoBlockItem(scale = 0.7f)
public static final Block FOUNDRY_BLOCK = new FoundryBlock(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).nonOpaque());
@UseGeoBlockItem(scale = 0.7f)
public static final Block CENTRIFUGE_BLOCK = new CentrifugeBlock(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).nonOpaque());
@UseGeoBlockItem(scale = 0.7f)
public static final Block POWERED_FURNACE_BLOCK = new PoweredFurnaceBlock(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).nonOpaque());

public static final Block PLACER_BLOCK = new PlacerBlock(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).nonOpaque());
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/rearth/oritech/init/BlockEntitiesContent.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public class BlockEntitiesContent implements AutoRegistryContainer<BlockEntityTy
@AssignSidedEnergy
public static final BlockEntityType<FoundryBlockEntity> FOUNDRY_ENTITY = FabricBlockEntityTypeBuilder.create(FoundryBlockEntity::new, BlockContent.FOUNDRY_BLOCK).build();

@AssignSidedInventory
@AssignSidedEnergy
public static final BlockEntityType<CentrifugeBlockEntity> CENTRIFUGE_ENTITY = FabricBlockEntityTypeBuilder.create(CentrifugeBlockEntity::new, BlockContent.CENTRIFUGE_BLOCK).build();

@AssignSidedInventory
@AssignSidedEnergy
public static final BlockEntityType<PoweredFurnaceBlockEntity> POWERED_FURNACE_ENTITY = FabricBlockEntityTypeBuilder.create(PoweredFurnaceBlockEntity::new, BlockContent.POWERED_FURNACE_BLOCK).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ public void registerCategories(CategoryRegistry registry) {
registerOritechCategory(registry, RecipeContent.GRINDER, BlockContent.GRINDER_BLOCK, BasicMachineScreen::new);
registerOritechCategory(registry, RecipeContent.ASSEMBLER, BlockContent.ASSEMBLER_BLOCK, BasicMachineScreen::new);
registerOritechCategory(registry, RecipeContent.FOUNDRY, BlockContent.FOUNDRY_BLOCK, BasicMachineScreen::new);
registerOritechCategory(registry, RecipeContent.CENTRIFUGE, BlockContent.CENTRIFUGE_BLOCK, BasicMachineScreen::new);

// workstations
registerOriWorkstation(registry, RecipeContent.PULVERIZER, BlockContent.PULVERIZER_BLOCK);
registerOriWorkstation(registry, RecipeContent.GRINDER, BlockContent.GRINDER_BLOCK);
registerOriWorkstation(registry, RecipeContent.ASSEMBLER, BlockContent.ASSEMBLER_BLOCK);
registerOriWorkstation(registry, RecipeContent.FOUNDRY, BlockContent.FOUNDRY_BLOCK);
registerOriWorkstation(registry, RecipeContent.CENTRIFUGE, BlockContent.CENTRIFUGE_BLOCK);
}

// creates a screen instance that displays all recipes of that recipe type
Expand All @@ -46,6 +48,7 @@ public void registerDisplays(DisplayRegistry registry) {
registerMachineRecipeType(registry, RecipeContent.ASSEMBLER);
registerMachineRecipeType(registry, RecipeContent.GRINDER);
registerMachineRecipeType(registry, RecipeContent.FOUNDRY);
registerMachineRecipeType(registry, RecipeContent.CENTRIFUGE);
}

private void registerOritechCategory(CategoryRegistry registry, OritechRecipeType recipeType, ItemConvertible machineIcon, BiFunction<OritechRecipeType, ItemConvertible, BasicMachineScreen> screenType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGen
blockStateModelGenerator.registerSimpleState(BlockContent.GRINDER_BLOCK);
blockStateModelGenerator.registerSimpleState(BlockContent.ASSEMBLER_BLOCK);
blockStateModelGenerator.registerSimpleState(BlockContent.FOUNDRY_BLOCK);
blockStateModelGenerator.registerSimpleState(BlockContent.CENTRIFUGE_BLOCK);
blockStateModelGenerator.registerSimpleState(BlockContent.POWERED_FURNACE_BLOCK);

blockStateModelGenerator.registerSimpleCubeAll(BlockContent.MACHINE_CORE_BASIC);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class RecipeContent {
public static final OritechRecipeType GRINDER = register(new Identifier(Oritech.MOD_ID, "grinder"));
public static final OritechRecipeType ASSEMBLER = register(new Identifier(Oritech.MOD_ID, "assembler"));
public static final OritechRecipeType FOUNDRY = register(new Identifier(Oritech.MOD_ID, "foundry"));
public static final OritechRecipeType CENTRIFUGE = register(new Identifier(Oritech.MOD_ID, "centrifuge"));

private static OritechRecipeType register(Identifier name) {

Expand Down
Loading

0 comments on commit 010dc37

Please sign in to comment.