Skip to content

Commit 0d7a441

Browse files
committed
Merge remote-tracking branches 'pr275/cc-compat' and 'pr280/personal-space-compat'
3 parents 1c035f6 + fdd9fde + f0ab230 commit 0d7a441

File tree

7 files changed

+190
-5
lines changed

7 files changed

+190
-5
lines changed

build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ dependencies {
6565
// region Our deps
6666
implementationSplit("com.falsepattern:falsepatternlib-mc1.7.10:1.9.0")
6767
compileOnly("it.unimi.dsi:fastutil:8.5.16")
68-
implementationSplit("com.falsepattern:chunkapi-mc1.7.10:0.6.4")
68+
implementationSplit("com.falsepattern:chunkapi-mc1.7.10:0.8.0")
6969
// endregion
7070

7171
// region maintained mods
@@ -210,6 +210,9 @@ dependencies {
210210
//Nostalgic World Generation 1.0.0
211211
compileOnly(deobfCurse("nostalgiagenerator-927053:4816167"))
212212

213+
//Personal Space 1.0.33
214+
compileOnly(deobfCurse("PersonalSpace-819596:6536785"))
215+
213216
//RandomThings 2.2.4
214217
compileOnly(deobfCurse("randomthings-59816:2225310"))
215218

@@ -260,4 +263,4 @@ dependencies {
260263
//needed by: Biome Wand
261264
//Source: http://spacechase0.com/files/mcmod/1.7.10-SpaceCore-0.7.14.jar
262265
compileOnly(deobf("mirror:1.7.10-SpaceCore:0.7.14"))
263-
}
266+
}

src/main/java/com/falsepattern/endlessids/EndlessIDs.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
version = Tags.VERSION,
4343
name = Tags.MODNAME,
4444
acceptedMinecraftVersions = "[1.7.10]",
45-
dependencies = "required-after:chunkapi@[0.6.4,);" +
45+
dependencies = "required-after:chunkapi@[0.8.0,);" +
4646
"required-after:falsepatternlib@[1.9.0,);" +
4747
"after:antiidconflict")
4848
public class EndlessIDs {

src/main/java/com/falsepattern/endlessids/managers/BlockIDManager.java

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import static com.falsepattern.endlessids.util.DataUtil.*;
4646

4747
//NOTE: Also change the save logic in MapWriter mod if changing this
48-
public class BlockIDManager implements DataManager.PacketDataManager, DataManager.SubChunkDataManager, DataManager.BlockPacketDataManager {
48+
public class BlockIDManager implements DataManager.PacketDataManager, DataManager.CubicPacketDataManager, DataManager.SubChunkDataManager, DataManager.BlockPacketDataManager {
4949

5050
@Override
5151
public String domain() {
@@ -259,4 +259,77 @@ public void writeBlockPacketToBuffer(S23PacketBlockChange packet, PacketBuffer b
259259
public void readBlockPacketFromBuffer(S23PacketBlockChange packet, PacketBuffer buffer) {
260260
packet.field_148883_d = Block.getBlockById(buffer.readInt());
261261
}
262+
263+
@Override
264+
public int maxPacketSizeCubic() {
265+
return 3 * 16 * 16 * 16 + 4;
266+
}
267+
268+
@Override
269+
public void writeToBuffer(Chunk chunk, ExtendedBlockStorage extendedBlockStorage, ByteBuffer data) {
270+
val subChunk = (SubChunkBlockHook) extendedBlockStorage;
271+
272+
data.put((byte) subChunk.eid$getBlockMask());
273+
274+
val b1 = subChunk.eid$getB1();
275+
data.put(b1);
276+
277+
val b2Low = subChunk.eid$getB2Low();
278+
if (b2Low == null) return;
279+
data.put(b2Low.data);
280+
281+
val b2High = subChunk.eid$getB2High();
282+
if (b2High == null) return;
283+
data.put(b2High.data);
284+
285+
val b3 = subChunk.eid$getB3();
286+
if (b3 != null) {
287+
data.put(b3);
288+
}
289+
}
290+
291+
@Override
292+
public void readFromBuffer(Chunk chunk, ExtendedBlockStorage extendedBlockStorage, ByteBuffer data) {
293+
val subChunk = (SubChunkBlockHook) extendedBlockStorage;
294+
val storageFlag = data.get();
295+
296+
val b1 = subChunk.eid$getB1();
297+
data.get(b1);
298+
299+
if (storageFlag == 0b00) {
300+
subChunk.eid$setB2Low(null);
301+
subChunk.eid$setB2High(null);
302+
subChunk.eid$setB3(null);
303+
return;
304+
}
305+
306+
var b2Low = subChunk.eid$getB2Low();
307+
if (b2Low == null) {
308+
b2Low = subChunk.eid$createB2Low();
309+
}
310+
data.get(b2Low.data);
311+
312+
if (storageFlag == 0b01) {
313+
subChunk.eid$setB2High(null);
314+
subChunk.eid$setB3(null);
315+
return;
316+
}
317+
318+
var b2High = subChunk.eid$getB2High();
319+
if (b2High == null) {
320+
b2High = subChunk.eid$createB2High();
321+
}
322+
data.get(b2High.data);
323+
324+
if (storageFlag == 0b10) {
325+
subChunk.eid$setB3(null);
326+
return;
327+
}
328+
329+
var b3 = subChunk.eid$getB3();
330+
if (b3 == null) {
331+
b3 = subChunk.eid$createB3();
332+
}
333+
data.get(b3);
334+
}
262335
}

src/main/java/com/falsepattern/endlessids/managers/BlockMetaManager.java

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
import static com.falsepattern.endlessids.constants.ExtendedConstants.blocksPerSubChunk;
4545

4646
//NOTE: Also change the save logic in MapWriter mod if changing this
47-
public class BlockMetaManager implements DataManager.PacketDataManager, DataManager.SubChunkDataManager, DataManager.BlockPacketDataManager {
47+
public class BlockMetaManager implements DataManager.PacketDataManager, DataManager.CubicPacketDataManager, DataManager.SubChunkDataManager, DataManager.BlockPacketDataManager {
4848

4949
@Override
5050
public String domain() {
@@ -233,4 +233,60 @@ public void writeBlockPacketToBuffer(S23PacketBlockChange packet, PacketBuffer b
233233
public void readBlockPacketFromBuffer(S23PacketBlockChange packet, PacketBuffer buffer) {
234234
packet.field_148884_e = buffer.readUnsignedShort();
235235
}
236+
237+
@Override
238+
public int maxPacketSizeCubic() {
239+
return 2 * 16 * 16 * 16 + 4;
240+
}
241+
242+
@Override
243+
public void writeToBuffer(Chunk chunk, ExtendedBlockStorage extendedBlockStorage, ByteBuffer data) {
244+
val subChunk = (SubChunkBlockHook) extendedBlockStorage;
245+
246+
data.put((byte) subChunk.eid$getMetadataMask());
247+
248+
val m1Low = subChunk.eid$getM1Low();
249+
data.put(m1Low.data);
250+
251+
val m1High = subChunk.eid$getM1High();
252+
if (m1High == null) return;
253+
data.put(m1High.data);
254+
255+
val m2 = subChunk.eid$getM2();
256+
if (m2 != null) {
257+
data.put(m2);
258+
}
259+
}
260+
261+
@Override
262+
public void readFromBuffer(Chunk chunk, ExtendedBlockStorage extendedBlockStorage, ByteBuffer data) {
263+
val subChunk = (SubChunkBlockHook) extendedBlockStorage;
264+
val storageFlag = data.get();
265+
266+
val m1Low = subChunk.eid$getM1Low();
267+
data.get(m1Low.data);
268+
269+
if (storageFlag == 0b01) {
270+
subChunk.eid$setM1High(null);
271+
subChunk.eid$setM2(null);
272+
return;
273+
}
274+
275+
var m1High = subChunk.eid$getM1High();
276+
if (m1High == null) {
277+
m1High = subChunk.eid$createM1High();
278+
}
279+
data.get(m1High.data);
280+
281+
if (storageFlag == 0b10) {
282+
subChunk.eid$setM2(null);
283+
return;
284+
}
285+
286+
var m2 = subChunk.eid$getM2();
287+
if (m2 == null) {
288+
m2 = subChunk.eid$createM2();
289+
}
290+
data.get(m2);
291+
}
236292
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* EndlessIDs
3+
*
4+
* Copyright (C) 2022-2025 FalsePattern, The MEGA Team
5+
* All Rights Reserved
6+
*
7+
* The above copyright notice, this permission notice and the word "MEGA"
8+
* shall be included in all copies or substantial portions of the Software.
9+
*
10+
* This program is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Lesser General Public License as published by
12+
* the Free Software Foundation, only version 3 of the License.
13+
*
14+
* This program is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
21+
*/
22+
23+
package com.falsepattern.endlessids.mixin.mixins.common.biome.personalspace;
24+
25+
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
26+
import me.eigenraven.personalspace.world.PersonalChunkProvider;
27+
import org.spongepowered.asm.mixin.Mixin;
28+
import org.spongepowered.asm.mixin.Shadow;
29+
import org.spongepowered.asm.mixin.injection.At;
30+
import org.spongepowered.asm.mixin.injection.Redirect;
31+
import net.minecraft.world.biome.BiomeGenBase;
32+
import net.minecraft.world.chunk.Chunk;
33+
34+
@Mixin(PersonalChunkProvider.class)
35+
public class PersonalChunkProviderMixin {
36+
37+
@Shadow private int savedBiomeId = -1;
38+
39+
@Redirect(method = "provideChunk",
40+
at = @At(value = "INVOKE",
41+
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"),
42+
require = 1)
43+
private byte[] setBiomesTweaked(Chunk instance) {
44+
return BiomePatchHelper.getBiomeArrayTweaked(instance, i -> BiomeGenBase.getBiome(savedBiomeId));
45+
}
46+
}

src/main/java/com/falsepattern/endlessids/mixin/plugin/Mixin.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
import static com.falsepattern.endlessids.mixin.plugin.TargetMod.NomadicTents;
7979
import static com.falsepattern.endlessids.mixin.plugin.TargetMod.NuclearTech;
8080
import static com.falsepattern.endlessids.mixin.plugin.TargetMod.OldWorldGen;
81+
import static com.falsepattern.endlessids.mixin.plugin.TargetMod.PersonalSpace;
8182
import static com.falsepattern.endlessids.mixin.plugin.TargetMod.RandomThings;
8283
import static com.falsepattern.endlessids.mixin.plugin.TargetMod.RealisticTerrainGeneration;
8384
import static com.falsepattern.endlessids.mixin.plugin.TargetMod.RealisticWorldGen;
@@ -342,6 +343,11 @@ public enum Mixin implements IMixins {
342343
require(OldWorldGen),
343344
common("biome.owg.ChunkGeneratorBetaMixin")),
344345

346+
Biome_PersonalSpace(Phase.LATE,
347+
Ext.Biome,
348+
require(PersonalSpace),
349+
common("biome.personalspace.PersonalChunkProviderMixin")),
350+
345351
Biome_RandomThings(Phase.EARLY,
346352
Ext.Biome,
347353
require(RandomThings),

src/main/java/com/falsepattern/endlessids/mixin/plugin/TargetMod.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public enum TargetMod implements ITargetMod {
8080
NomadicTents("com.yurtmod.main.NomadicTents"),
8181
NuclearTech("com.hbm.main.MainRegistry"),
8282
OldWorldGen("owg.OWG"),
83+
PersonalSpace("me.eigenraven.personalspace.PersonalSpaceMod"),
8384
Ruins("atomicstryker.ruins.common.RuinsMod"),
8485
RealisticTerrainGeneration("rtg.RTG"),
8586
RealisticWorldGen("rwg.RWG"),

0 commit comments

Comments
 (0)