Skip to content

Commit a579eaf

Browse files
committed
nouvelle version
1 parent fcd6390 commit a579eaf

16 files changed

Lines changed: 141 additions & 42 deletions

src/client/java/fr/geomtech/universegate/PortalKeyboardScreen.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class PortalKeyboardScreen extends AbstractContainerScreen<PortalKeyboard
3838
public PortalKeyboardScreen(PortalKeyboardMenu menu, Inventory inv, Component title) {
3939
super(menu, inv, title);
4040
this.imageWidth = 256;
41-
this.imageHeight = 200;
41+
this.imageHeight = 120;
4242
this.inventoryLabelY = this.imageHeight - 94;
4343
}
4444

@@ -145,7 +145,10 @@ private String shortDim(ResourceLocation dim) {
145145

146146
@Override
147147
protected void renderBg(GuiGraphics g, float partialTicks, int mouseX, int mouseY) {
148-
g.blit(TEXTURE, leftPos, topPos, 0, 0, imageWidth, imageHeight, 256, 200);
148+
// Draw top part
149+
g.blit(TEXTURE, leftPos, topPos, 0, 0, imageWidth, 113, 256, 200);
150+
// Draw bottom part
151+
g.blit(TEXTURE, leftPos, topPos + 113, 0, 193, imageWidth, 7, 256, 200);
149152

150153
if (filteredPortals.size() > VISIBLE_PORTALS) {
151154
int trackX = leftPos + imageWidth - 28;
@@ -161,7 +164,6 @@ protected void renderBg(GuiGraphics g, float partialTicks, int mouseX, int mouse
161164

162165
@Override
163166
protected void renderLabels(GuiGraphics g, int mouseX, int mouseY) {
164-
g.drawString(this.font, this.playerInventoryTitle, inventoryLabelX, inventoryLabelY, 0xA0A0A0, false);
165167
}
166168

167169
@Override

src/client/java/fr/geomtech/universegate/UniverseGateClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public void onInitializeClient() {
1515
MenuScreens.register(ModMenuTypes.PORTAL_CORE, PortalCoreScreen::new);
1616
MenuScreens.register(ModMenuTypes.METEOROLOGICAL_CONTROLLER, MeteorologicalControllerScreen::new);
1717
MenuScreens.register(ModMenuTypes.ENERGY_MONITOR, EnergyMonitorScreen::new);
18+
MenuScreens.register(ModMenuTypes.RIFT_REFINER, RiftRefinerScreen::new);
1819
BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.PORTAL_FIELD, RenderType.translucent());
1920
EntityModelLayerRegistry.registerModelLayer(RiftShadeModel.LAYER_LOCATION, RiftShadeModel::createBodyLayer);
2021
EntityRendererRegistry.register(ModEntityTypes.RIFT_BEAST, RiftBeastRenderer::new);

src/main/java/fr/geomtech/universegate/ModBlockEntities.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,20 @@ public final class ModBlockEntities {
8484
BlockEntityType.Builder.of(ParabolaBlockEntity::new, ModBlocks.PARABOLA_BLOCK).build(null)
8585
);
8686

87+
public static final BlockEntityType<RiftRefinerBlockEntity> RIFT_REFINER =
88+
Registry.register(
89+
BuiltInRegistries.BLOCK_ENTITY_TYPE,
90+
ResourceLocation.fromNamespaceAndPath(UniverseGate.MOD_ID, "rift_refiner"),
91+
BlockEntityType.Builder.of(RiftRefinerBlockEntity::new, ModBlocks.RIFT_REFINER).build(null)
92+
);
93+
94+
public static final BlockEntityType<DarkEnergyGeneratorBlockEntity> DARK_ENERGY_GENERATOR =
95+
Registry.register(
96+
BuiltInRegistries.BLOCK_ENTITY_TYPE,
97+
ResourceLocation.fromNamespaceAndPath(UniverseGate.MOD_ID, "dark_energy_generator"),
98+
BlockEntityType.Builder.of(DarkEnergyGeneratorBlockEntity::new, ModBlocks.DARK_ENERGY_GENERATOR).build(null)
99+
);
100+
87101
public static void register() {}
88102

89103
private ModBlockEntities() {}

src/main/java/fr/geomtech/universegate/ModBlocks.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import net.minecraft.world.level.block.Block;
55
import net.minecraft.world.level.block.Blocks;
66
import net.minecraft.world.level.block.RotatedPillarBlock;
7+
import net.minecraft.world.level.block.LiquidBlock;
8+
import net.minecraft.world.level.block.Rotation;
79
import net.minecraft.world.level.block.state.BlockBehaviour;
810
import net.minecraft.resources.ResourceLocation;
911
import net.minecraft.core.Registry;
@@ -164,6 +166,31 @@ public final class ModBlocks {
164166
new ChargedLightningRodBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.LIGHTNING_ROD))
165167
);
166168

169+
public static final Block DARK_MATTER_BLOCK = register(
170+
"dark_matter_block",
171+
new LiquidBlock(ModFluids.STILL_DARK_MATTER, BlockBehaviour.Properties.ofFullCopy(Blocks.WATER).noLootTable())
172+
);
173+
174+
public static final Block RIFT_REFINER = register(
175+
"rift_refiner",
176+
new RiftRefinerBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).strength(3.5f).requiresCorrectToolForDrops())
177+
);
178+
179+
public static final Block FLUID_PIPE = register(
180+
"fluid_pipe",
181+
new FluidPipeBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS).noOcclusion())
182+
);
183+
184+
public static final Block DARK_ENERGY_CONDUIT = register(
185+
"dark_energy_conduit",
186+
new DarkEnergyConduitBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.OBSIDIAN).strength(2.0f).noOcclusion())
187+
);
188+
189+
public static final Block DARK_ENERGY_GENERATOR = register(
190+
"dark_energy_generator",
191+
new DarkEnergyGeneratorBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK))
192+
);
193+
167194
private static Block register(String id, Block block) {
168195
return Registry.register(
169196
BuiltInRegistries.BLOCK,

src/main/java/fr/geomtech/universegate/ModItemGroups.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ public final class ModItemGroups {
4747
output.accept(ModItems.RIFT_CRYSTAL);
4848
output.accept(ModItems.RIFT_SHADE_SPAWN_EGG);
4949
output.accept(ModItems.RIFT_BEAST_SPAWN_EGG);
50-
output.accept(ModItems.RIFT_CORE_FRAGMENT);
50+
output.accept(ModItems.DARK_MATTER_BUCKET);
51+
output.accept(ModItems.RIFT_REFINER_ITEM);
52+
output.accept(ModItems.FLUID_PIPE_ITEM);
53+
output.accept(ModItems.DARK_ENERGY_CONDUIT_ITEM);
54+
output.accept(ModItems.DARK_ENERGY_GENERATOR_ITEM);
5155
})
5256
.build();
5357

src/main/java/fr/geomtech/universegate/ModItems.java

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import net.minecraft.core.registries.BuiltInRegistries;
44
import net.minecraft.world.item.BlockItem;
55
import net.minecraft.world.food.FoodProperties;
6+
import net.minecraft.world.item.BucketItem;
67
import net.minecraft.world.item.Item;
78
import net.minecraft.world.item.SpawnEggItem;
89
import net.minecraft.resources.ResourceLocation;
@@ -135,9 +136,29 @@ public final class ModItems {
135136
new Item(new Item.Properties().stacksTo(64))
136137
);
137138

138-
public static final Item RIFT_CORE_FRAGMENT = register(
139-
"rift_core_fragment",
140-
new Item(new Item.Properties())
139+
public static final Item RIFT_REFINER_ITEM = register(
140+
"rift_refiner",
141+
new BlockItem(ModBlocks.RIFT_REFINER, new Item.Properties())
142+
);
143+
144+
public static final Item DARK_MATTER_BUCKET = register(
145+
"dark_matter_bucket",
146+
new BucketItem(ModFluids.STILL_DARK_MATTER, new Item.Properties().stacksTo(1).craftRemainder(net.minecraft.world.item.Items.BUCKET))
147+
);
148+
149+
public static final Item FLUID_PIPE_ITEM = register(
150+
"fluid_pipe",
151+
new BlockItem(ModBlocks.FLUID_PIPE, new Item.Properties())
152+
);
153+
154+
public static final Item DARK_ENERGY_CONDUIT_ITEM = register(
155+
"dark_energy_conduit",
156+
new BlockItem(ModBlocks.DARK_ENERGY_CONDUIT, new Item.Properties())
157+
);
158+
159+
public static final Item DARK_ENERGY_GENERATOR_ITEM = register(
160+
"dark_energy_generator",
161+
new BlockItem(ModBlocks.DARK_ENERGY_GENERATOR, new Item.Properties())
141162
);
142163

143164
private static Item register(String id, Item item) {

src/main/java/fr/geomtech/universegate/ModMenuTypes.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ public final class ModMenuTypes {
4848
)
4949
);
5050

51+
public static final ExtendedScreenHandlerType<RiftRefinerMenu, BlockPos> RIFT_REFINER =
52+
Registry.register(
53+
BuiltInRegistries.MENU,
54+
ResourceLocation.fromNamespaceAndPath(UniverseGate.MOD_ID, "rift_refiner"),
55+
new ExtendedScreenHandlerType<>(
56+
RiftRefinerMenu::new,
57+
BlockPos.STREAM_CODEC
58+
)
59+
);
60+
5161
public static void register() {}
5262

5363
private ModMenuTypes() {}

src/main/java/fr/geomtech/universegate/PortalFrameHelper.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,19 @@ private PortalFrameHelper() {}
1111

1212
public static List<BlockPos> collectFrame(PortalFrameDetector.FrameMatch match, BlockPos corePos) {
1313
List<BlockPos> result = new ArrayList<>();
14-
int halfWidth = PortalFrameDetector.INNER_WIDTH / 2 + 1; // outer half width
15-
int topY = PortalFrameDetector.INNER_HEIGHT + 1; // outer height
14+
int halfWidth = PortalFrameDetector.INNER_WIDTH / 2 + 1; // 2
15+
int topY = PortalFrameDetector.INNER_HEIGHT + 1; // 5
1616

1717
for (int dy = 0; dy <= topY; dy++) {
1818
for (int dx = -halfWidth; dx <= halfWidth; dx++) {
19-
boolean isBorder = dy == 0 || dy == topY || dx == -halfWidth || dx == halfWidth;
19+
boolean isBorder = (dy == 0 || dy == topY || dx == -halfWidth || dx == halfWidth);
2020
if (!isBorder) continue;
21-
if (dx == 0 && dy == 0) continue; // core position
21+
if (dx == 0 && dy == 0) continue;
2222

2323
BlockPos p = corePos.offset(match.right().getStepX() * dx, dy, match.right().getStepZ() * dx);
2424
result.add(p);
2525
}
2626
}
27-
2827
return result;
2928
}
3029

src/main/java/fr/geomtech/universegate/PortalRegistrySavedData.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import net.minecraft.world.level.saveddata.SavedData;
1414

1515

16+
import fr.geomtech.universegate.net.UniverseGateNetwork;
17+
1618
import java.util.*;
1719

1820
public class PortalRegistrySavedData extends SavedData {
@@ -49,6 +51,16 @@ public Collection<PortalEntry> listVisible() {
4951
}
5052

5153
public PortalEntry get(UUID id) {
54+
if (UniverseGateNetwork.DARK_DIMENSION_ID.equals(id)) {
55+
// Return a dummy entry for the Dark Dimension
56+
// We use BlockPos.ZERO or a specific coordinate if needed.
57+
// But connecting to BlockPos.ZERO might cause issues if there is no portal there.
58+
// However, for the purpose of "unlocking", this satisfies the lookup.
59+
// The PortalConnectionManager might fail later if it checks for a PortalCoreBlockEntity at destination.
60+
// But we satisfied the first step.
61+
ResourceKey<Level> dim = ResourceKey.create(net.minecraft.core.registries.Registries.DIMENSION, ResourceLocation.parse("universegate:rift"));
62+
return new PortalEntry(id, "Dark Dimension", dim, BlockPos.ZERO, false);
63+
}
5264
return portals.get(id);
5365
}
5466

src/main/java/fr/geomtech/universegate/RiftScenarioGenerator.java

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ public static void ensureGenerated(ServerLevel riftLevel, BlockPos brokenPortalP
6565
}
6666

6767
addCompassToOutpostContainers(riftLevel, outpost.get(), workingPortalCore);
68-
addRiftCoreFragmentToOutpostContainers(riftLevel, outpost.get(), workingPortalCore);
6968
data.setGenerated(outpost.get().center(), workingPortalCore, outpostBedPos);
7069

7170
UniverseGate.LOGGER.info("Rift scenario generated: outpost at {}, outpost bed at {}, working portal at {}", outpost.get().center(), outpostBedPos, workingPortalCore);
@@ -322,29 +321,4 @@ BlockPos center() {
322321
return start.offset(size.getX() / 2, 0, size.getZ() / 2);
323322
}
324323
}
325-
326-
private static void addRiftCoreFragmentToOutpostContainers(ServerLevel level, PlacedTemplate outpost, BlockPos targetCorePos) {
327-
ItemStack fragment = new ItemStack(ModItems.RIFT_CORE_FRAGMENT);
328-
BlockPos start = outpost.start();
329-
Vec3i size = outpost.size();
330-
BlockPos end = start.offset(size.getX() - 1, size.getY() - 1, size.getZ() - 1);
331-
332-
boolean inserted = false;
333-
for (BlockPos pos : BlockPos.betweenClosed(start, end)) {
334-
var be = level.getBlockEntity(pos);
335-
if (!(be instanceof Container container)) continue;
336-
for (int i = 0; i < container.getContainerSize(); i++) {
337-
if (!container.getItem(i).isEmpty()) continue;
338-
container.setItem(i, fragment);
339-
inserted = true;
340-
UniverseGate.LOGGER.info("Inserted Rift Core Fragment in outpost container at {} targeting core {} (tracked=false)", pos, targetCorePos);
341-
break;
342-
}
343-
if (inserted) break;
344-
}
345-
346-
if (!inserted) {
347-
UniverseGate.LOGGER.warn("No container found in rift outpost for Rift Core Fragment at {}", outpost.start());
348-
}
349-
}
350324
}

0 commit comments

Comments
 (0)