This commit is contained in:
gnembon committed 2019-09-05 09:09:46 -03:00
1 parent 2fcef289f0
commit addb836b21
12 files changed
+67 -14

No files matched your search

+3 -3
View File
@@ -4,9 +4,9 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
# or better: https://modmuss50.me/fabric.html # or better: https://modmuss50.me/fabric.html
minecraft_version=19w35a minecraft_version=19w36a
yarn_mappings=19w35a+build.1 yarn_mappings=19w36a+build.1
loader_version=0.6.1+build.164 loader_version=0.6.1+build.165
# Mod Properties # Mod Properties
mod_version = 1.0.5+v190828 mod_version = 1.0.5+v190828
@@ -0,0 +1,10 @@
package carpet.fakes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
public interface class_4548Interface
{
void setBiomeAtIndex(BlockPos pos, World world, Biome what);
}
@@ -76,7 +76,7 @@ public class FeatureGenerator
return new VanillaLayeredBiomeSource(new VanillaLayeredBiomeSourceConfig(w.getLevelProperties())) return new VanillaLayeredBiomeSource(new VanillaLayeredBiomeSourceConfig(w.getLevelProperties()))
{ {
@Override @Override
public Biome getBiome(int i, int j) public Biome getBiome(int i, int j, int k)
{ {
return biome; return biome;
} }
@@ -16,6 +16,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(PortalBlock.class) @Mixin(PortalBlock.class)
public class PortalBlock_portalCachingMixin public class PortalBlock_portalCachingMixin
{ {
/*
@Inject(method = "createPortalAt", at = @At( @Inject(method = "createPortalAt", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/block/PortalBlock$AreaHelper;createPortal()V" target = "Lnet/minecraft/block/PortalBlock$AreaHelper;createPortal()V"
@@ -39,5 +40,6 @@ public class PortalBlock_portalCachingMixin
((PortalForcerInterface)((ServerWorld)iWorld_1).getPortalForcer()).invalidateCache(); ((PortalForcerInterface)((ServerWorld)iWorld_1).getPortalForcer()).invalidateCache();
} }
} }
*/
} }
@@ -21,8 +21,9 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Mixin(PortalForcer.class) @Mixin(PortalForcer.class)
public class PortalForcer_portalCachingMixin implements PortalForcerInterface public abstract class PortalForcer_portalCachingMixin implements PortalForcerInterface
{ {
/*
@Shadow @Final private ServerWorld world; @Shadow @Final private ServerWorld world;
private Map<ColumnPos, Object> storedTicketInfos = new HashMap<>(); private Map<ColumnPos, Object> storedTicketInfos = new HashMap<>();
@@ -42,7 +43,7 @@ public class PortalForcer_portalCachingMixin implements PortalForcerInterface
value = "INVOKE", value = "INVOKE",
target = "Ljava/util/Map;get(Ljava/lang/Object;)Ljava/lang/Object;" target = "Ljava/util/Map;get(Ljava/lang/Object;)Ljava/lang/Object;"
)) ))
private Object /* private TicketInfo */ getTicketInfo(Map map, Object /* ColumnPos */ key) private Object / private TicketInfo / getTicketInfo(Map map, Object / ColumnPos / key)
{ {
//Do the dance with ticketinfos. If vanilla has one, we gonna borrow, if vanilla is missing, we supply //Do the dance with ticketinfos. If vanilla has one, we gonna borrow, if vanilla is missing, we supply
if (!CarpetSettings.portalCaching) if (!CarpetSettings.portalCaching)
@@ -69,10 +70,11 @@ public class PortalForcer_portalCachingMixin implements PortalForcerInterface
value = "INVOKE", value = "INVOKE",
target = "Ljava/util/Map;put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;" target = "Ljava/util/Map;put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"
)) ))
private Object /* TicketInfo */ putNewTicket(Map map, Object /*ColumnPos */ key, Object /*TicketInfo */ value) private Object / TicketInfo / putNewTicket(Map map, Object /ColumnPos / key, Object /TicketInfo / value)
{ {
if (CarpetSettings.portalCaching) if (CarpetSettings.portalCaching)
storedTicketInfos.put((ColumnPos) key, value); storedTicketInfos.put((ColumnPos) key, value);
return map.put(key, value); return map.put(key, value);
} }
*/
} }
@@ -65,7 +65,7 @@ public class PortalForcer_portalSuffocationMixin
} }
@Redirect(method = "getPortal",at = @At( @Redirect(method = "method_22391",at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/block/pattern/BlockPattern$Result;method_18478(Lnet/minecraft/util/math/Direction;Lnet/minecraft/util/math/BlockPos;DLnet/minecraft/util/math/Vec3d;D)Lnet/minecraft/block/pattern/BlockPattern$TeleportTarget;" target = "Lnet/minecraft/block/pattern/BlockPattern$Result;method_18478(Lnet/minecraft/util/math/Direction;Lnet/minecraft/util/math/BlockPos;DLnet/minecraft/util/math/Vec3d;D)Lnet/minecraft/block/pattern/BlockPattern$TeleportTarget;"
)) ))
@@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(StructureBlockBlockEntity.class) @Mixin(StructureBlockBlockEntity.class)
public abstract class StructureBlockBlockEntity_fillUpdatesMixin public abstract class StructureBlockBlockEntity_fillUpdatesMixin
{ {
@Redirect(method = "method_21864", at = @At( @Redirect(method = "place", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/structure/Structure;place(Lnet/minecraft/world/IWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;)V" target = "Lnet/minecraft/structure/Structure;place(Lnet/minecraft/world/IWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;)V"
)) ))
@@ -115,8 +115,8 @@ public abstract class StructureFeatureMixin implements StructureFeatureInterface
return structurestart; return structurestart;
} }
} }
Biome biome_1 = generator.getBiomeSource().getBiome(new BlockPos(chunkpos.getStartX() + 9, 0, chunkpos.getStartZ() + 9)); Biome biome_1 = generator.getBiomeSource().getBiome(chunkpos.getStartX() + 9, 0, chunkpos.getStartZ() + 9);
StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos.x, chunkpos.z, biome_1, MutableIntBoundingBox.empty(),0,generator.getSeed()); StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos.x, chunkpos.z, MutableIntBoundingBox.empty(),0,generator.getSeed());
structurestart1.initialize(generator, ((ServerWorld)worldIn).getStructureManager() , chunkpos.x, chunkpos.z, biome_1); structurestart1.initialize(generator, ((ServerWorld)worldIn).getStructureManager() , chunkpos.x, chunkpos.z, biome_1);
structurestart = structurestart1.hasChildren() ? structurestart1 : StructureStart.DEFAULT; structurestart = structurestart1.hasChildren() ? structurestart1 : StructureStart.DEFAULT;
@@ -0,0 +1,35 @@
package carpet.mixins;
import carpet.fakes.class_4548Interface;
import net.minecraft.class_4548;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import static net.minecraft.class_4548.field_20650;
import static net.minecraft.class_4548.field_20651;
@Mixin(class_4548.class)
public class class_4548_getBiomeArrayMixin implements class_4548Interface
{
@Shadow @Final private Biome[] field_20654;
@Shadow @Final private static int field_20652;
@Override
public void setBiomeAtIndex(BlockPos pos, World world, Biome what)
{
ChunkPos chunkPos = new ChunkPos(pos);
int seaLevel = world.getSeaLevel();
int int_4 = chunkPos.x & field_20650;
int int_5 = MathHelper.clamp(seaLevel, 0, field_20651);
int int_6 = chunkPos.z & field_20650;
field_20654[int_5 << field_20652 + field_20652 | int_6 << field_20652 | int_4] = what;
}
}
@@ -998,6 +998,7 @@ public class CarpetExpression
}); });
this.expr.addLazyFunction("set_biome", -1, (c, t, lv) -> { this.expr.addLazyFunction("set_biome", -1, (c, t, lv) -> {
throw new InternalExpressionException("set_biome is WIP on 19w36a");/*
CarpetContext cc = (CarpetContext)c; CarpetContext cc = (CarpetContext)c;
BlockValue.LocatorResult locator = BlockValue.fromParams(cc, lv, 0); BlockValue.LocatorResult locator = BlockValue.fromParams(cc, lv, 0);
if (lv.size() == locator.offset) if (lv.size() == locator.offset)
@@ -1009,9 +1010,10 @@ public class CarpetExpression
ServerWorld world = cc.s.getWorld(); ServerWorld world = cc.s.getWorld();
BlockPos pos = locator.block.getPos(); BlockPos pos = locator.block.getPos();
Chunk chunk = world.method_22350(pos); Chunk chunk = world.method_22350(pos);
chunk.getBiomeArray()[(pos.getX() & 15) | (pos.getZ() & 15) << 4] = biome; // todo these indices are wrong in 1.15 - needs fixing.
((class_4548Interface)chunk.getBiomeArray()).setBiomeAtIndex(pos, world, biome);
this.forceChunkUpdate(pos, world); this.forceChunkUpdate(pos, world);
return LazyValue.NULL; return LazyValue.NULL; */
}); });
// need get_biome // need get_biome
@@ -221,7 +221,7 @@ public class CarpetSettings
@Rule(desc = "Pistons, Glass and Sponge can be broken faster with their appropriate tools", category = SURVIVAL) @Rule(desc = "Pistons, Glass and Sponge can be broken faster with their appropriate tools", category = SURVIVAL)
public static boolean missingTools = false; public static boolean missingTools = false;
@Rule(desc = "Alternative, persistent caching strategy for nether portals", category = {SURVIVAL, CREATIVE}) //@Rule(desc = "Alternative, persistent caching strategy for nether portals", category = {SURVIVAL, CREATIVE})
public static boolean portalCaching = false; public static boolean portalCaching = false;
@Rule(desc = "fill/clone/setblock and structure blocks cause block updates", category = CREATIVE) @Rule(desc = "fill/clone/setblock and structure blocks cause block updates", category = CREATIVE)
+2
View File
@@ -65,6 +65,8 @@
"SaplingBlockMixin", "SaplingBlockMixin",
"EntityMixin", "EntityMixin",
"class_4548_getBiomeArrayMixin",
"GuardianEntityMixin", "GuardianEntityMixin",
"DesertPyramidFeatureMixin", "DesertPyramidFeatureMixin",
"HuskEntityMixin", "HuskEntityMixin",