This commit is contained in:
gnembon committed 2023-04-05 20:12:21 +02:00
1 parent 9a5c2d5fc3
commit 1751f103f9
8 files changed
+27 -61

No files matched your search

+3 -3
View File
@@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check https://fabricmc.net/develop/ # check https://fabricmc.net/develop/
minecraft_version=23w13a minecraft_version=23w14a
loader_version=0.14.18 loader_version=0.14.19
jsr305_version=3.0.2 jsr305_version=3.0.2
fabric_version=0.76.0+1.19.4 fabric_version=0.77.0+1.19.4
# Mod Properties # Mod Properties
mod_version = 1.4.103 mod_version = 1.4.103
@@ -241,7 +241,7 @@ public class OptimizedExplosion
BlockState state = world.getBlockState(blockpos); BlockState state = world.getBlockState(blockpos);
Block block = state.getBlock(); Block block = state.getBlock();
if (state.getMaterial() != Material.AIR) if (!state.isAir())
{ {
if (block.dropFromExplosion(e) && world instanceof ServerLevel serverLevel) if (block.dropFromExplosion(e) && world instanceof ServerLevel serverLevel)
{ {
@@ -281,7 +281,7 @@ public class OptimizedExplosion
BlockPos down = blockpos1.below(1); BlockPos down = blockpos1.below(1);
if (eAccess.getRandom().nextInt(3) == 0 && if (eAccess.getRandom().nextInt(3) == 0 &&
chunk.getBlockState(blockpos1).getMaterial() == Material.AIR && chunk.getBlockState(blockpos1).isAir() &&
chunk.getBlockState(down).isSolidRender(world, down) chunk.getBlockState(down).isSolidRender(world, down)
) )
{ {
@@ -346,7 +346,7 @@ public class OptimizedExplosion
BlockState state = eAccess.getLevel().getBlockState(blockpos); BlockState state = eAccess.getLevel().getBlockState(blockpos);
FluidState fluidState = eAccess.getLevel().getFluidState(blockpos); FluidState fluidState = eAccess.getLevel().getFluidState(blockpos);
if (state.getMaterial() != Material.AIR) { if (!state.isAir()) {
float f2 = Math.max(state.getBlock().getExplosionResistance(), fluidState.getExplosionResistance()); float f2 = Math.max(state.getBlock().getExplosionResistance(), fluidState.getExplosionResistance());
if (eAccess.getSource() != null) if (eAccess.getSource() != null)
f2 = eAccess.getSource().getBlockExplosionResistance(e, eAccess.getLevel(), blockpos, state, fluidState, f2); f2 = eAccess.getSource().getBlockExplosionResistance(e, eAccess.getLevel(), blockpos, state, fluidState, f2);
@@ -475,7 +475,7 @@ public class OptimizedExplosion
fluidCache.put(posImmutable, fluid); fluidCache.put(posImmutable, fluid);
} }
if (state.getMaterial() != Material.AIR) if (!state.isAir())
{ {
float resistance = Math.max(state.getBlock().getExplosionResistance(), fluid.getExplosionResistance()); float resistance = Math.max(state.getBlock().getExplosionResistance(), fluid.getExplosionResistance());
@@ -538,7 +538,7 @@ public class OptimizedExplosion
BlockState state = eAccess.getLevel().getBlockState(blockpos); BlockState state = eAccess.getLevel().getBlockState(blockpos);
FluidState fluidState = eAccess.getLevel().getFluidState(blockpos); FluidState fluidState = eAccess.getLevel().getFluidState(blockpos);
if (state.getMaterial() != Material.AIR) { if (!state.isAir()) {
float f2 = Math.max(state.getBlock().getExplosionResistance(), fluidState.getExplosionResistance()); float f2 = Math.max(state.getBlock().getExplosionResistance(), fluidState.getExplosionResistance());
if (eAccess.getSource() != null) if (eAccess.getSource() != null)
f2 = eAccess.getSource().getBlockExplosionResistance(e, eAccess.getLevel(), blockpos, state, fluidState, f2); f2 = eAccess.getSource().getBlockExplosionResistance(e, eAccess.getLevel(), blockpos, state, fluidState, f2);
@@ -3,10 +3,10 @@ package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.FlowingFluid; import net.minecraft.world.level.material.FlowingFluid;
import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.Material;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
@@ -27,8 +27,7 @@ public class FlowingFluid_liquidDamageDisabledMixin
{ {
if (CarpetSettings.liquidDamageDisabled) if (CarpetSettings.liquidDamageDisabled)
{ {
Material material = state.getMaterial(); cir.setReturnValue(state.isAir() || state.is(Blocks.WATER) || state.is(Blocks.LAVA));
cir.setReturnValue(material == Material.AIR || material.isLiquid());
} }
} }
} }
@@ -104,6 +104,7 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.commands.BossBarCommands; import net.minecraft.server.commands.BossBarCommands;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.storage.loot.LootDataType;
import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec2;
import net.minecraft.world.scores.Scoreboard; import net.minecraft.world.scores.Scoreboard;
@@ -210,10 +211,10 @@ public abstract class CommandArgument
(c, p) -> ValueConversions.of(ResourceLocationArgument.getAdvancement(c, p).getId()), (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().getAdvancements().getAllAdvancements().stream().map(Advancement::getId), builder) (c, p) -> ValueConversions.of(ResourceLocationArgument.getAdvancement(c, p).getId()), (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().getAdvancements().getAllAdvancements().stream().map(Advancement::getId), builder)
), ),
new VanillaUnconfigurableArgument("lootcondition", ResourceLocationArgument::id, new VanillaUnconfigurableArgument("lootcondition", ResourceLocationArgument::id,
(c, p) -> ValueConversions.of(c.getSource().registryAccess().registryOrThrow(Registries.LOOT_CONDITION_TYPE).getKey(ResourceLocationArgument.getPredicate(c, p).getType())), (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().getPredicateManager().getKeys(), builder) (c, p) -> ValueConversions.of(c.getSource().registryAccess().registryOrThrow(Registries.LOOT_CONDITION_TYPE).getKey(ResourceLocationArgument.getPredicate(c, p).getType())), (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().getLootData().getKeys(LootDataType.PREDICATE), builder)
), ),
new VanillaUnconfigurableArgument("loottable", ResourceLocationArgument::id, new VanillaUnconfigurableArgument("loottable", ResourceLocationArgument::id,
(c, p) -> ValueConversions.of(ResourceLocationArgument.getId(c, p)), (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().getLootTables().getIds(), builder) (c, p) -> ValueConversions.of(ResourceLocationArgument.getId(c, p)), (ctx, builder) -> SharedSuggestionProvider.suggestResource(ctx.getSource().getServer().getLootData().getKeys(LootDataType.TABLE), builder)
), ),
new VanillaUnconfigurableArgument("attribute", Registries.ATTRIBUTE), new VanillaUnconfigurableArgument("attribute", Registries.ATTRIBUTE),
+2 -42
View File
@@ -156,51 +156,11 @@ public class Colors
); );
public static final Map<Material, String> materialName = Map.ofEntries( public static final Map<Material, String> materialName = Map.ofEntries(
entry(Material.AIR , "air" ),
entry(Material.STRUCTURAL_AIR , "void" ),
entry(Material.PORTAL , "portal" ),
entry(Material.CLOTH_DECORATION , "carpet" ),
entry(Material.PLANT , "plant" ), entry(Material.PLANT , "plant" ),
entry(Material.WATER_PLANT, "water_plant" ), entry(Material.DEPRECATED_REPLACEABLE, "vegetation" ),
entry(Material.REPLACEABLE_PLANT, "vegetation" ),
entry(Material.REPLACEABLE_FIREPROOF_PLANT, "nether_shoots" ),
entry(Material.REPLACEABLE_WATER_PLANT, "sea_grass" ),
entry(Material.WATER , "water" ),
entry(Material.BUBBLE_COLUMN , "bubble_column"),
entry(Material.LAVA , "lava" ),
entry(Material.TOP_SNOW , "snow_layer" ),
entry(Material.FIRE , "fire" ),
entry(Material.DECORATION , "decoration" ),
entry(Material.WEB , "cobweb" ),
entry(Material.SCULK , "sculk" ),
entry(Material.BUILDABLE_GLASS , "redstone_lamp"),
entry(Material.CLAY, "clay" ),
entry(Material.DIRT , "dirt" ),
entry(Material.GRASS , "grass" ),
entry(Material.ICE_SOLID , "packed_ice" ),
entry(Material.SAND , "sand" ), entry(Material.SAND , "sand" ),
entry(Material.SPONGE , "sponge" ),
entry(Material.SHULKER_SHELL , "shulker" ),
entry(Material.WOOD , "wood" ), entry(Material.WOOD , "wood" ),
entry(Material.BAMBOO_SAPLING , "shoots" ),
entry(Material.BAMBOO , "bamboo" ),
entry(Material.WOOL , "wool" ),
entry(Material.EXPLOSIVE , "tnt" ),
entry(Material.LEAVES , "leaves" ),
entry(Material.GLASS , "glass" ), entry(Material.GLASS , "glass" ),
entry(Material.ICE , "ice" ), entry(Material.STONE , "stone" )
entry(Material.CACTUS , "cactus" ),
entry(Material.STONE , "stone" ),
entry(Material.METAL , "metal" ),
entry(Material.SNOW , "snow" ),
entry(Material.HEAVY_METAL , "anvil" ),
entry(Material.BARRIER , "barrier" ),
entry(Material.PISTON , "piston" ),
entry(Material.MOSS , "moss" ),
entry(Material.VEGETABLE , "gourd" ),
entry(Material.EGG , "dragon_egg" ),
entry(Material.CAKE , "cake" ),
entry(Material.AMETHYST , "amethyst" ),
entry(Material.POWDER_SNOW , "powder_snow")
); );
} }
+2 -2
View File
@@ -17,6 +17,7 @@ import net.minecraft.world.entity.ai.util.DefaultRandomPos;
import net.minecraft.world.entity.monster.ZombifiedPiglin; import net.minecraft.world.entity.monster.ZombifiedPiglin;
import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.level.pathfinder.PathComputationType;
@@ -39,13 +40,12 @@ public class BlockInfo
lst.add(Messenger.s("")); lst.add(Messenger.s(""));
lst.add(Messenger.s("=====================================")); lst.add(Messenger.s("====================================="));
lst.add(Messenger.s(String.format("Block info for %s%s (id %d%s):", blocks.getKey(block),metastring, blocks.getId(block), metastring ))); lst.add(Messenger.s(String.format("Block info for %s%s (id %d%s):", blocks.getKey(block),metastring, blocks.getId(block), metastring )));
lst.add(Messenger.s(String.format(" - Material: %s", Colors.materialName.get(material))));
lst.add(Messenger.s(String.format(" - Map colour: %s", Colors.mapColourName.get(state.getMapColor(world, pos))))); lst.add(Messenger.s(String.format(" - Map colour: %s", Colors.mapColourName.get(state.getMapColor(world, pos)))));
lst.add(Messenger.s(String.format(" - Sound type: %s", Colors.soundName.get(block.getSoundType(state))))); lst.add(Messenger.s(String.format(" - Sound type: %s", Colors.soundName.get(block.getSoundType(state)))));
lst.add(Messenger.s("")); lst.add(Messenger.s(""));
lst.add(Messenger.s(String.format(" - Full block: %s", state.isCollisionShapeFullBlock(world, pos)))); // isFullCube() ))); lst.add(Messenger.s(String.format(" - Full block: %s", state.isCollisionShapeFullBlock(world, pos)))); // isFullCube() )));
lst.add(Messenger.s(String.format(" - Normal cube: %s", state.isRedstoneConductor(world, pos)))); //isNormalCube()))); isSimpleFullBlock lst.add(Messenger.s(String.format(" - Normal cube: %s", state.isRedstoneConductor(world, pos)))); //isNormalCube()))); isSimpleFullBlock
lst.add(Messenger.s(String.format(" - Is liquid: %s", material.isLiquid()))); lst.add(Messenger.s(String.format(" - Is liquid: %s", state.is(Blocks.WATER) || state.is(Blocks.LAVA))));
lst.add(Messenger.s("")); lst.add(Messenger.s(""));
lst.add(Messenger.s(String.format(" - Light in: %d, above: %d", lst.add(Messenger.s(String.format(" - Light in: %d, above: %d",
Math.max(world.getBrightness(LightLayer.BLOCK, pos),world.getBrightness(LightLayer.SKY, pos)) , Math.max(world.getBrightness(LightLayer.BLOCK, pos),world.getBrightness(LightLayer.SKY, pos)) ,
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.tags.FluidTags;
import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.AgeableMob;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.Mob;
@@ -18,7 +19,6 @@ import net.minecraft.world.level.biome.MobSpawnSettings;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
public class PerimeterDiagnostics public class PerimeterDiagnostics
{ {
@@ -114,7 +114,7 @@ public class PerimeterDiagnostics
BlockState iblockstate_down = worldserver.getBlockState(pos.below()); BlockState iblockstate_down = worldserver.getBlockState(pos.below());
BlockState iblockstate_up = worldserver.getBlockState(pos.above()); BlockState iblockstate_up = worldserver.getBlockState(pos.above());
if ( iblockstate.getMaterial() == Material.WATER && iblockstate_down.getMaterial() == Material.WATER && !iblockstate_up.isRedstoneConductor(worldserver, pos)) // isSimpleFUllBLock if ( iblockstate.getFluidState().is(FluidTags.WATER) && !iblockstate_up.isRedstoneConductor(worldserver, pos)) // isSimpleFUllBLock
{ {
result.liquid++; result.liquid++;
if (add_water && diagnostic.check_entity_spawn(pos)) if (add_water && diagnostic.check_entity_spawn(pos))
+8 -2
View File
@@ -13,14 +13,16 @@ import net.minecraft.commands.CommandSourceStack;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.DyeColor;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import javax.annotation.Nullable;
import static java.util.Map.entry; import static java.util.Map.entry;
/** /**
@@ -129,11 +131,15 @@ public class WoolTool
/** /**
* Gets the colour of wool at the position, for hoppers to be able to decide whether to add their items to the global counter. * Gets the colour of wool at the position, for hoppers to be able to decide whether to add their items to the global counter.
*/ */
@Nullable
public static DyeColor getWoolColorAtPosition(Level worldIn, BlockPos pos) public static DyeColor getWoolColorAtPosition(Level worldIn, BlockPos pos)
{ {
BlockState state = worldIn.getBlockState(pos); BlockState state = worldIn.getBlockState(pos);
if (state.getMaterial() != Material.WOOL || !state.isRedstoneConductor(worldIn, pos)) //isSimpleFullBlock // wool and wool carpets
if (!state.is(BlockTags.WOOL))
{
return null; return null;
}
return Material2Dye.get(state.getMapColor(worldIn, pos)); return Material2Dye.get(state.getMapColor(worldIn, pos));
} }
} }