Merge branch '1.19-multiloader' into 1.19.2
This commit is contained in:
commit
edd98a10f7
|
|
@ -9,8 +9,7 @@ import net.minecraft.commands.arguments.blocks.BlockStateParser;
|
|||
import net.minecraft.commands.arguments.blocks.BlockStateParser.BlockResult;
|
||||
import net.minecraft.commands.arguments.item.ItemParser;
|
||||
import net.minecraft.commands.arguments.item.ItemParser.ItemResult;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
|
@ -61,8 +60,8 @@ public class ModelOverride
|
|||
BlockResult res;
|
||||
|
||||
try {
|
||||
res = BlockStateParser.parseForBlock(Registry.BLOCK, from, true);
|
||||
} catch (CommandSyntaxException e) {
|
||||
res = BlockStateParser.parseForBlock(BuiltInRegistries.BLOCK.asLookup(), from, true);
|
||||
} catch (Exception e) {
|
||||
return DataResult.error("Error while parsing " + from + ":" + e.getMessage());
|
||||
}
|
||||
|
||||
|
|
@ -79,9 +78,9 @@ public class ModelOverride
|
|||
Either<ItemResult, BlockResult> either;
|
||||
try {
|
||||
if(type == Type.ITEM)
|
||||
either = Either.left(ItemParser.parseForItem(HolderLookup.forRegistry(Registry.ITEM), new StringReader(to)));
|
||||
either = Either.left(ItemParser.parseForItem(BuiltInRegistries.ITEM.asLookup(), new StringReader(to)));
|
||||
else
|
||||
either = Either.right(BlockStateParser.parseForBlock(Registry.BLOCK, to, true));
|
||||
either = Either.right(BlockStateParser.parseForBlock(BuiltInRegistries.BLOCK.asLookup(), to, true));
|
||||
}catch (CommandSyntaxException e) {
|
||||
return DataResult.error("Error while parsing " + to + ":" + e.getMessage());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package tschipp.carryon.client.render;
|
|||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.Tesselator;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.MultiBufferSource.BufferSource;
|
||||
|
|
@ -72,10 +72,10 @@ public class CarriedObjectRender
|
|||
CarryOnData carry = CarryOnDataManager.getCarryData(player);
|
||||
|
||||
if (Constants.CLIENT_CONFIG.facePlayer != CarryRenderHelper.isChest(state.getBlock())) {
|
||||
matrix.mulPose(Vector3f.YP.rotationDegrees(180));
|
||||
matrix.mulPose(Vector3f.XN.rotationDegrees(8));
|
||||
matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||
matrix.mulPose(Axis.XN.rotationDegrees(8));
|
||||
} else {
|
||||
matrix.mulPose(Vector3f.XP.rotationDegrees(8));
|
||||
matrix.mulPose(Axis.XP.rotationDegrees(8));
|
||||
}
|
||||
|
||||
if(carry.getActiveScript().isPresent())
|
||||
|
|
@ -111,7 +111,7 @@ public class CarriedObjectRender
|
|||
|
||||
matrix.pushPose();
|
||||
matrix.scale(0.8f, 0.8f, 0.8f);
|
||||
matrix.mulPose(Vector3f.YP.rotationDegrees(180));
|
||||
matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||
matrix.translate(0.0, -height - .1, width + 0.1);
|
||||
|
||||
manager.setRenderShadow(false);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ package tschipp.carryon.client.render;
|
|||
|
||||
import com.mojang.authlib.minecraft.client.MinecraftClient;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Quaternion;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
|
|
@ -11,7 +10,7 @@ import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
|
|||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
|
@ -25,6 +24,7 @@ import net.minecraft.world.level.block.RenderShape;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import org.joml.Quaternionf;
|
||||
import tschipp.carryon.Constants;
|
||||
import tschipp.carryon.client.modeloverride.ModelOverride;
|
||||
import tschipp.carryon.client.modeloverride.ModelOverrideHandler;
|
||||
|
|
@ -54,15 +54,15 @@ public class CarryRenderHelper
|
|||
return -(entity.yBodyRotO + (entity.yBodyRot - entity.yBodyRotO) * partialticks);
|
||||
}
|
||||
|
||||
public static Quaternion getExactBodyRotation(LivingEntity entity, float partialticks)
|
||||
public static Quaternionf getExactBodyRotation(LivingEntity entity, float partialticks)
|
||||
{
|
||||
return Vector3f.YP.rotationDegrees(getExactBodyRotationDegrees(entity, partialticks));
|
||||
return Axis.YP.rotationDegrees(getExactBodyRotationDegrees(entity, partialticks));
|
||||
}
|
||||
|
||||
public static void applyGeneralTransformations(Player player, float partialticks, PoseStack matrix)
|
||||
{
|
||||
int perspective = CarryRenderHelper.getPerspective();
|
||||
Quaternion playerrot = CarryRenderHelper.getExactBodyRotation(player, partialticks);
|
||||
Quaternionf playerrot = CarryRenderHelper.getExactBodyRotation(player, partialticks);
|
||||
Vec3 playerpos = CarryRenderHelper.getExactPos(player, partialticks);
|
||||
Vec3 cameraPos = Minecraft.getInstance().gameRenderer.getMainCamera().getPosition();
|
||||
Vec3 offset = playerpos.subtract(cameraPos);
|
||||
|
|
@ -72,7 +72,7 @@ public class CarryRenderHelper
|
|||
matrix.translate(offset.x, offset.y, offset.z);
|
||||
|
||||
if (perspective == 2)
|
||||
playerrot.mul(Vector3f.YP.rotationDegrees(180));
|
||||
playerrot.mul(Axis.YP.rotationDegrees(180));
|
||||
matrix.mulPose(playerrot);
|
||||
|
||||
matrix.pushPose();
|
||||
|
|
@ -94,10 +94,10 @@ public class CarryRenderHelper
|
|||
if (perspective == 2)
|
||||
{
|
||||
matrix.translate(0, 0, 1.35);
|
||||
matrix.mulPose(Vector3f.XP.rotationDegrees(f4));
|
||||
matrix.mulPose(Axis.XP.rotationDegrees(f4));
|
||||
}
|
||||
else
|
||||
matrix.mulPose(Vector3f.XN.rotationDegrees(f4));
|
||||
matrix.mulPose(Axis.XN.rotationDegrees(f4));
|
||||
|
||||
matrix.translate(0, -1.5, -1.848);
|
||||
if (perspective == 2)
|
||||
|
|
@ -114,9 +114,9 @@ public class CarryRenderHelper
|
|||
matrix.translate(0, 0, 1.35);
|
||||
|
||||
if (perspective == 2)
|
||||
matrix.mulPose(Vector3f.XP.rotationDegrees(f2 * (-90.0F - player.xRotO)));
|
||||
matrix.mulPose(Axis.XP.rotationDegrees(f2 * (-90.0F - player.xRotO)));
|
||||
else
|
||||
matrix.mulPose(Vector3f.XN.rotationDegrees(f2 * (-90.0F - player.xRotO)));
|
||||
matrix.mulPose(Axis.XN.rotationDegrees(f2 * (-90.0F - player.xRotO)));
|
||||
}
|
||||
|
||||
Vec3 viewVector = player.getViewVector(partialticks);
|
||||
|
|
@ -128,7 +128,7 @@ public class CarryRenderHelper
|
|||
double d2 = (deltaMovement.x * viewVector.x + deltaMovement.z * viewVector.z) / (Math.sqrt(d0) * Math.sqrt(d1));
|
||||
double d3 = deltaMovement.x * viewVector.z - deltaMovement.z * viewVector.x;
|
||||
|
||||
matrix.mulPose(Vector3f.YP.rotation((float) (Math.signum(d3) * Math.acos(d2))));
|
||||
matrix.mulPose(Axis.YP.rotation((float) (Math.signum(d3) * Math.acos(d2))));
|
||||
}
|
||||
|
||||
if (perspective != 2)
|
||||
|
|
@ -150,18 +150,18 @@ public class CarryRenderHelper
|
|||
//TODO: RealFirstPersonRender
|
||||
//if ((ModList.get().isLoaded("realrender") || ModList.get().isLoaded("rfpr")) && perspective == 0)
|
||||
// matrix.translate(0, 0, -0.4);
|
||||
matrix.mulPose(Vector3f.YP.rotationDegrees(180));
|
||||
matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||
}
|
||||
// if(perspective == 1)
|
||||
// {
|
||||
// matrix.pushPose();
|
||||
// //matrix.mulPose(Vector3f.YP.rotationDegrees(180));
|
||||
// //matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||
// matrix.popPose();
|
||||
// }
|
||||
|
||||
//else if ((ModList.get().isLoaded("realrender") || ModList.get().isLoaded("rfpr")) && perspective == 0)
|
||||
// matrix.translate(0, 0, 0.4);
|
||||
//matrix.mulPose(Vector3f.YP.rotationDegrees(180));
|
||||
//matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||
|
||||
|
||||
|
||||
|
|
@ -193,14 +193,14 @@ public class CarryRenderHelper
|
|||
entity.xRotO = 0.0f;
|
||||
|
||||
if (perspective == 2)
|
||||
matrix.mulPose(Vector3f.YP.rotationDegrees(180));
|
||||
matrix.mulPose(Axis.YP.rotationDegrees(180));
|
||||
|
||||
matrix.scale((10 - multiplier) * 0.08f, (10 - multiplier) * 0.08f, (10 - multiplier) * 0.08f);
|
||||
matrix.translate(0.0, height / 2 + -(height / 2) + 1, width - 0.1 < 0.7 ? width - 0.1 + (0.7 - (width - 0.1)) : width - 0.1);
|
||||
|
||||
if (pose == Pose.SWIMMING || pose == Pose.FALL_FLYING)
|
||||
{
|
||||
matrix.mulPose(Vector3f.XN.rotationDegrees(90));
|
||||
matrix.mulPose(Axis.XN.rotationDegrees(90));
|
||||
matrix.translate(0, -0.2 * height, 0);
|
||||
|
||||
if (pose == Pose.FALL_FLYING)
|
||||
|
|
@ -220,9 +220,9 @@ public class CarryRenderHelper
|
|||
Vec3 rotation = render.renderRotation().getVec();
|
||||
Vec3 scale = render.renderscale().getVec(1, 1, 1);
|
||||
|
||||
Quaternion rot = Vector3f.XP.rotationDegrees((float) rotation.x);
|
||||
rot.mul(Vector3f.YP.rotationDegrees((float) rotation.y));
|
||||
rot.mul(Vector3f.ZP.rotationDegrees((float) rotation.z));
|
||||
Quaternionf rot = Axis.XP.rotationDegrees((float) rotation.x);
|
||||
rot.mul(Axis.YP.rotationDegrees((float) rotation.y));
|
||||
rot.mul(Axis.ZP.rotationDegrees((float) rotation.z));
|
||||
matrix.mulPose(rot);
|
||||
|
||||
matrix.translate(translation.x, translation.y, perspective == 1 && script.isBlock() ? -translation.z : translation.z);
|
||||
|
|
@ -251,7 +251,9 @@ public class CarryRenderHelper
|
|||
{
|
||||
ScriptRender render = carry.getActiveScript().get().scriptRender();
|
||||
if(render.renderNameBlock().isPresent())
|
||||
state = Registry.BLOCK.get(render.renderNameBlock().get()).defaultBlockState();
|
||||
{
|
||||
state = BuiltInRegistries.BLOCK.get(render.renderNameBlock().get()).defaultBlockState();
|
||||
}
|
||||
}
|
||||
|
||||
Optional<ModelOverride> ov = ModelOverrideHandler.getModelOverride(state, carry.getContentNbt());
|
||||
|
|
@ -298,7 +300,7 @@ public class CarryRenderHelper
|
|||
CarryOnScript script = carry.getActiveScript().get();
|
||||
ScriptRender render = script.scriptRender();
|
||||
if(render.renderNameEntity().isPresent())
|
||||
entity = Registry.ENTITY_TYPE.get(render.renderNameEntity().get()).create(player.level);
|
||||
entity = BuiltInRegistries.ENTITY_TYPE.get(render.renderNameEntity().get()).create(player.level);
|
||||
|
||||
if(render.renderNBT().isPresent())
|
||||
entity.load(render.renderNBT().get());
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package tschipp.carryon.common.carry;
|
|||
|
||||
import com.mojang.serialization.DataResult;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
|
|
@ -93,7 +94,7 @@ public class CarryOnData {
|
|||
if(this.type != CarryType.BLOCK)
|
||||
throw new IllegalStateException("Called getBlock on data that contained " + this.type);
|
||||
|
||||
return NbtUtils.readBlockState(nbt.getCompound("block"));
|
||||
return NbtUtils.readBlockState(BuiltInRegistries.BLOCK.asLookup(), nbt.getCompound("block"));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ public class CarryConfig {
|
|||
"magneticraft:multiblock_gap", "refinedstorage:*", "mcmultipart:*", "enderstorage:*",
|
||||
"betterstorage:*", "practicallogistics2:*", "wearablebackpacks:*", "rftools:screen",
|
||||
"rftools:creative_screen", "create:*", "magic_doorknob:*", "iceandfire:*", "ftbquests:*",
|
||||
"waystones:*", "contact:*", "framedblocks:*"
|
||||
"waystones:*", "contact:*", "framedblocks:*", "securitycraft:*"
|
||||
};
|
||||
|
||||
@Property(
|
||||
|
|
@ -243,7 +243,8 @@ public class CarryConfig {
|
|||
"minecraft:shulker", "minecraft:leash_knot", "minecraft:armor_stand",
|
||||
"minecraft:item_frame", "minecraft:painting", "minecraft:shulker_bullet",
|
||||
"animania:hamster", "animania:ferret*", "animania:hedgehog*", "animania:cart",
|
||||
"animania:wagon", "mynko:*", "pixelmon:*", "mocreatures:*", "quark:totem", "vehicle:*"
|
||||
"animania:wagon", "mynko:*", "pixelmon:*", "mocreatures:*", "quark:totem", "vehicle:*",
|
||||
"securitycraft:*"
|
||||
};
|
||||
|
||||
@Property(
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package tschipp.carryon.common.config;
|
|||
|
||||
import com.mojang.datafixers.kinds.Const;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
|
@ -65,7 +66,7 @@ public class ListHandler {
|
|||
|
||||
private static boolean doCheck(Block block, Set<String> regular, List<TagKey<Block>> tags)
|
||||
{
|
||||
String name = Registry.BLOCK.getKey(block).toString();
|
||||
String name = BuiltInRegistries.BLOCK.getKey(block).toString();
|
||||
if(regular.contains(name))
|
||||
return true;
|
||||
for(TagKey<Block> tag : tags)
|
||||
|
|
@ -76,7 +77,7 @@ public class ListHandler {
|
|||
|
||||
private static boolean doCheck(Entity entity, Set<String> regular, List<TagKey<EntityType<?>>> tags)
|
||||
{
|
||||
String name = Registry.ENTITY_TYPE.getKey(entity.getType()).toString();
|
||||
String name = BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
|
||||
if(regular.contains(name))
|
||||
return true;
|
||||
for(TagKey<EntityType<?>> tag : tags)
|
||||
|
|
@ -101,32 +102,32 @@ public class ListHandler {
|
|||
ALLOWED_TILES_TAGS.clear();
|
||||
PROPERTY_EXCEPTION_CLASSES.clear();
|
||||
|
||||
Map<ResourceLocation, TagKey<Block>> blocktags = Registry.BLOCK.getTagNames().collect(Collectors.toMap(t -> t.location(), t -> t));
|
||||
Map<ResourceLocation, TagKey<EntityType<?>>> entitytags = Registry.ENTITY_TYPE.getTagNames().collect(Collectors.toMap(t -> t.location(), t -> t));
|
||||
Map<ResourceLocation, TagKey<Block>> blocktags = BuiltInRegistries.BLOCK.getTagNames().collect(Collectors.toMap(t -> t.location(), t -> t));
|
||||
Map<ResourceLocation, TagKey<EntityType<?>>> entitytags = BuiltInRegistries.ENTITY_TYPE.getTagNames().collect(Collectors.toMap(t -> t.location(), t -> t));
|
||||
|
||||
List<String> forbidden = new ArrayList<>(List.of(Constants.COMMON_CONFIG.blacklist.forbiddenTiles));
|
||||
forbidden.add("#carryon:block_blacklist");
|
||||
addWithWildcards(forbidden, FORBIDDEN_TILES, Registry.BLOCK, blocktags, FORBIDDEN_TILES_TAGS);
|
||||
addWithWildcards(forbidden, FORBIDDEN_TILES, BuiltInRegistries.BLOCK, blocktags, FORBIDDEN_TILES_TAGS);
|
||||
|
||||
List<String> forbiddenEntity = new ArrayList<>(List.of(Constants.COMMON_CONFIG.blacklist.forbiddenEntities));
|
||||
forbiddenEntity.add("#carryon:entity_blacklist");
|
||||
addWithWildcards(forbiddenEntity, FORBIDDEN_ENTITIES, Registry.ENTITY_TYPE, entitytags, FORBIDDEN_ENTITIES_TAGS);
|
||||
addWithWildcards(forbiddenEntity, FORBIDDEN_ENTITIES, BuiltInRegistries.ENTITY_TYPE, entitytags, FORBIDDEN_ENTITIES_TAGS);
|
||||
|
||||
List<String> allowedEntities = new ArrayList<>(List.of(Constants.COMMON_CONFIG.whitelist.allowedEntities));
|
||||
allowedEntities.add("#carryon:entity_whitelist");
|
||||
addWithWildcards(allowedEntities, ALLOWED_ENTITIES, Registry.ENTITY_TYPE, entitytags, ALLOWED_ENTITIES_TAGS);
|
||||
addWithWildcards(allowedEntities, ALLOWED_ENTITIES, BuiltInRegistries.ENTITY_TYPE, entitytags, ALLOWED_ENTITIES_TAGS);
|
||||
|
||||
List<String> allowedBlocks = new ArrayList<>(List.of(Constants.COMMON_CONFIG.whitelist.allowedBlocks));
|
||||
allowedBlocks.add("#carryon:block_whitelist");
|
||||
addWithWildcards(allowedBlocks, ALLOWED_TILES, Registry.BLOCK, blocktags, ALLOWED_TILES_TAGS);
|
||||
addWithWildcards(allowedBlocks, ALLOWED_TILES, BuiltInRegistries.BLOCK, blocktags, ALLOWED_TILES_TAGS);
|
||||
|
||||
List<String> forbiddenStacking = new ArrayList<>(List.of(Constants.COMMON_CONFIG.blacklist.forbiddenStacking));
|
||||
forbiddenStacking.add("#carryon:stacking_blacklist");
|
||||
addWithWildcards(forbiddenStacking, FORBIDDEN_STACKING, Registry.ENTITY_TYPE, entitytags, FORBIDDEN_STACKING_TAGS);
|
||||
addWithWildcards(forbiddenStacking, FORBIDDEN_STACKING, BuiltInRegistries.ENTITY_TYPE, entitytags, FORBIDDEN_STACKING_TAGS);
|
||||
|
||||
List<String> allowedStacking = new ArrayList<>(List.of(Constants.COMMON_CONFIG.whitelist.allowedStacking));
|
||||
allowedStacking.add("#carryon:stacking_whitelist");
|
||||
addWithWildcards(allowedStacking, ALLOWED_STACKING, Registry.ENTITY_TYPE, entitytags, ALLOWED_STACKING_TAGS);
|
||||
addWithWildcards(allowedStacking, ALLOWED_STACKING, BuiltInRegistries.ENTITY_TYPE, entitytags, ALLOWED_STACKING_TAGS);
|
||||
|
||||
for(String propString : Constants.COMMON_CONFIG.settings.placementStateExceptions)
|
||||
{
|
||||
|
|
@ -134,7 +135,7 @@ public class ListHandler {
|
|||
continue;
|
||||
String name = propString.substring(0, propString.indexOf("["));
|
||||
String props = propString.substring(propString.indexOf("[") + 1, propString.indexOf("]"));
|
||||
Block blk = Registry.BLOCK.get(new ResourceLocation(name));
|
||||
Block blk = BuiltInRegistries.BLOCK.get(new ResourceLocation(name));
|
||||
for(String propName : props.split(",")) {
|
||||
for (Property<?> prop : blk.defaultBlockState().getProperties()) {
|
||||
if (prop.getName().equals(propName))
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import com.mojang.serialization.Codec;
|
|||
import com.mojang.serialization.DataResult;
|
||||
import net.minecraft.commands.arguments.blocks.BlockStateParser;
|
||||
import net.minecraft.commands.arguments.blocks.BlockStateParser.BlockResult;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
|
@ -51,7 +51,7 @@ public class PickupCondition
|
|||
{
|
||||
String name = match.contains("[") ? match.substring(0, match.indexOf("[")) : match;
|
||||
String[] split = name.replace("*", ",").split(",");
|
||||
String stateName = Registry.BLOCK.getKey(state.getBlock()).toString();
|
||||
String stateName = BuiltInRegistries.BLOCK.getKey(state.getBlock()).toString();
|
||||
|
||||
if(StringHelper.matchesWildcards(stateName, split))
|
||||
{
|
||||
|
|
@ -76,7 +76,7 @@ public class PickupCondition
|
|||
|
||||
public boolean matches(Entity entity)
|
||||
{
|
||||
String entityName = Registry.ENTITY_TYPE.getKey(entity.getType()).toString();
|
||||
String entityName = BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
|
||||
if(wildcards)
|
||||
{
|
||||
String[] split = match.replace("*", ",").split(",");
|
||||
|
|
@ -99,7 +99,7 @@ public class PickupCondition
|
|||
private BlockResult parseState(String state)
|
||||
{
|
||||
try {
|
||||
BlockResult result = BlockStateParser.parseForBlock(Registry.BLOCK, state, false);
|
||||
BlockResult result = BlockStateParser.parseForBlock(BuiltInRegistries.BLOCK.asLookup(), state, false);
|
||||
return result;
|
||||
} catch (CommandSyntaxException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package tschipp.carryon.common.scripting;
|
|||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
|
@ -83,7 +83,7 @@ public record CarryOnScript(
|
|||
|
||||
public static final Codec<ScriptObjectBlock> CODEC = RecordCodecBuilder.create(instance ->
|
||||
instance.group(
|
||||
ResourceKey.codec(Registry.BLOCK_REGISTRY).optionalFieldOf("name").forGetter(ScriptObjectBlock::typeNameBlock),
|
||||
ResourceKey.codec(Registries.BLOCK).optionalFieldOf("name").forGetter(ScriptObjectBlock::typeNameBlock),
|
||||
MaterialCondition.CODEC.optionalFieldOf("material", MaterialCondition.NONE).forGetter(ScriptObjectBlock::typeMaterial),
|
||||
NumberBoundCondition.CODEC.optionalFieldOf("hardness", NumberBoundCondition.NONE).forGetter(ScriptObjectBlock::typeHardness),
|
||||
NumberBoundCondition.CODEC.optionalFieldOf("resistance", NumberBoundCondition.NONE).forGetter(ScriptObjectBlock::typeResistance),
|
||||
|
|
@ -103,7 +103,7 @@ public record CarryOnScript(
|
|||
|
||||
public static final Codec<ScriptObjectEntity> CODEC = RecordCodecBuilder.create(instance ->
|
||||
instance.group(
|
||||
ResourceKey.codec(Registry.ENTITY_TYPE_REGISTRY).optionalFieldOf("name").forGetter(ScriptObjectEntity::typeNameEntity),
|
||||
ResourceKey.codec(Registries.ENTITY_TYPE).optionalFieldOf("name").forGetter(ScriptObjectEntity::typeNameEntity),
|
||||
NumberBoundCondition.CODEC.optionalFieldOf("health", NumberBoundCondition.NONE).forGetter(ScriptObjectEntity::typeHealth),
|
||||
NumberBoundCondition.CODEC.optionalFieldOf("height", NumberBoundCondition.NONE).forGetter(ScriptObjectEntity::typeHeight),
|
||||
NumberBoundCondition.CODEC.optionalFieldOf("width", NumberBoundCondition.NONE).forGetter(ScriptObjectEntity::typeWidth),
|
||||
|
|
@ -153,8 +153,8 @@ public record CarryOnScript(
|
|||
|
||||
public static final Codec<ScriptRender> CODEC = RecordCodecBuilder.create(instance ->
|
||||
instance.group(
|
||||
ResourceKey.codec(Registry.BLOCK_REGISTRY).optionalFieldOf("name_block").forGetter(ScriptRender::renderNameBlock),
|
||||
ResourceKey.codec(Registry.ENTITY_TYPE_REGISTRY).optionalFieldOf("name_entity").forGetter(ScriptRender::renderNameEntity),
|
||||
ResourceKey.codec(Registries.BLOCK).optionalFieldOf("name_block").forGetter(ScriptRender::renderNameBlock),
|
||||
ResourceKey.codec(Registries.ENTITY_TYPE).optionalFieldOf("name_entity").forGetter(ScriptRender::renderNameEntity),
|
||||
CompoundTag.CODEC.optionalFieldOf("nbt").forGetter(ScriptRender::renderNBT),
|
||||
OptionalVec3.CODEC.optionalFieldOf("translation", OptionalVec3.NONE).forGetter(ScriptRender::renderTranslation),
|
||||
OptionalVec3.CODEC.optionalFieldOf("rotation", OptionalVec3.NONE).forGetter(ScriptRender::renderRotation),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package tschipp.carryon.common.scripting;
|
|||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
|
@ -338,7 +338,7 @@ public final class Matchables
|
|||
for (MobEffectInstance effect : fx)
|
||||
{
|
||||
int amp = effect.getAmplifier();
|
||||
String name = Registry.MOB_EFFECT.getKey(effect.getEffect()).toString();
|
||||
String name = BuiltInRegistries.MOB_EFFECT.getKey(effect.getEffect()).toString();
|
||||
|
||||
if (names.contains(name))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package tschipp.carryon.common.scripting;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
|
@ -67,7 +67,7 @@ public class ScriptManager
|
|||
|
||||
boolean matchname = true;
|
||||
if(scEntity.typeNameEntity().isPresent())
|
||||
matchname = entity.getType().equals(Registry.ENTITY_TYPE.get(scEntity.typeNameEntity().get()));
|
||||
matchname = entity.getType().equals(BuiltInRegistries.ENTITY_TYPE.get(scEntity.typeNameEntity().get()));
|
||||
boolean matchheight = scEntity.typeHeight().matches(height);
|
||||
boolean matchwidth = scEntity.typeWidth().matches(width);
|
||||
boolean matchhealth = scEntity.typeHealth().matches(health);
|
||||
|
|
@ -82,7 +82,7 @@ public class ScriptManager
|
|||
|
||||
boolean matchblock = true;
|
||||
if(scBlock.typeNameBlock().isPresent())
|
||||
matchblock = block == Registry.BLOCK.get(scBlock.typeNameBlock().get());
|
||||
matchblock = block == BuiltInRegistries.BLOCK.get(scBlock.typeNameBlock().get());
|
||||
boolean matchnbt = scBlock.typeBlockTag().matches(nbt);
|
||||
boolean matchmaterial = scBlock.typeMaterial().matches(material);
|
||||
boolean matchhardness = scBlock.typeHardness().matches(hardness);
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
{
|
||||
"carryon.category.settings": "Paramètres",
|
||||
"carryon.category.blacklist": "Liste noire",
|
||||
"carryon.category.modeloverrides": "Modèle de Remplacement (Avancé)",
|
||||
"carryon.category.custompickupconditions": "Conditions de ramassage personalisés (Avancé)",
|
||||
"carryon.category.whitelist": "Liste blanche",
|
||||
"carryon.category.settings": "Paramètres",
|
||||
"carryon.category.blacklist": "Liste noire",
|
||||
"carryon.category.modeloverrides": "Modèle de Remplacement (Avancé)",
|
||||
"carryon.category.custompickupconditions": "Conditions de ramassage personalisés (Avancé)",
|
||||
"carryon.category.whitelist": "Liste blanche",
|
||||
|
||||
"carryon.general.modeloverrides.modeloverrides": "Modèle de Remplacement",
|
||||
"carryon.general.blacklist.forbiddenentities": "Entités que le joueur ne peut pas saisir",
|
||||
"carryon.general.blacklist.forbiddentiles": "Blocs que le joueur ne peut pas saisir",
|
||||
"carryon.category.custompickupconditions.custompickupconditionsblocks": "Conditions de ramassage de blocs personalisés",
|
||||
"carryon.category.custompickupconditions.custompickupconditionsentities": "Conditions de ramassage d'entités personalisés",
|
||||
"carryon.general.modeloverrides.modeloverrides": "Modèle de Remplacement",
|
||||
"carryon.general.blacklist.forbiddenentities": "Entités que le joueur ne peut pas saisir",
|
||||
"carryon.general.blacklist.forbiddentiles": "Blocs que le joueur ne peut pas saisir",
|
||||
"carryon.category.custompickupconditions.custompickupconditionsblocks": "Conditions de ramassage de blocs personalisés",
|
||||
"carryon.category.custompickupconditions.custompickupconditionsentities": "Conditions de ramassage d'entités personalisés",
|
||||
|
||||
"key.carry.desc": "Saisir",
|
||||
"key.carry.category": "Carry On"
|
||||
"key.carry.desc": "Saisir",
|
||||
"key.carry.category": "Carry On"
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
plugins {
|
||||
id 'fabric-loom' version '0.12-SNAPSHOT'
|
||||
id 'fabric-loom' version '1.0-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
id 'idea'
|
||||
}
|
||||
|
|
@ -21,7 +21,10 @@ repositories {
|
|||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${minecraft_version}"
|
||||
mappings loom.officialMojangMappings()
|
||||
mappings loom.layered() {
|
||||
officialMojangMappings()
|
||||
parchment("org.parchmentmc.data:parchment-${parchment_mappings_fabric}@zip")
|
||||
}
|
||||
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
|
||||
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package tschipp.carryon.mixin;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import org.joml.Matrix4f;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
@ -15,7 +15,7 @@ import tschipp.carryon.client.render.CarriedObjectRender;
|
|||
@Mixin(LevelRenderer.class)
|
||||
public class LevelRendererMixin
|
||||
{
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/ParticleEngine;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/client/Camera;F)V"), method = "renderLevel(Lcom/mojang/blaze3d/vertex/PoseStack;FJZLnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/GameRenderer;Lnet/minecraft/client/renderer/LightTexture;Lcom/mojang/math/Matrix4f;)V")
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/ParticleEngine;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/client/Camera;F)V"), method = "Lnet/minecraft/client/renderer/LevelRenderer;renderLevel(Lcom/mojang/blaze3d/vertex/PoseStack;FJZLnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/GameRenderer;Lnet/minecraft/client/renderer/LightTexture;Lorg/joml/Matrix4f;)V")
|
||||
private void onRenderLevel(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f matrix4f, CallbackInfo ci)
|
||||
{
|
||||
CarriedObjectRender.drawThirdPerson(gameRenderer.getMinecraft().getFrameTime(), poseStack);
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14",
|
||||
"fabric": "*",
|
||||
"minecraft": "1.19.x",
|
||||
"fabric-api": "*",
|
||||
"minecraft": ">=1.19.3",
|
||||
"java": ">=17"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,9 +119,9 @@ repositories {
|
|||
dependencies {
|
||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
compileOnly project(":Common")
|
||||
implementation fg.deobf("net.darkhax.gamestages:GameStages-Forge-1.19.2:11.0.2")
|
||||
implementation fg.deobf("net.darkhax.bookshelf:Bookshelf-Forge-1.19.2:16.1.9")
|
||||
minecraftLibrary(annotationProcessor(shade(("com.github.LlamaLad7:MixinExtras:${mixinextras_version}"))))
|
||||
//implementation fg.deobf("net.darkhax.gamestages:GameStages-Forge-1.19.2:11.0.2")
|
||||
//implementation fg.deobf("net.darkhax.bookshelf:Bookshelf-Forge-1.19.3:17.0.2")
|
||||
annotationProcessor 'org.spongepowered:mixin:0.8.4-SNAPSHOT:processor'
|
||||
|
||||
fileTree("libs").matching {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,34 @@
|
|||
package tschipp.carryon.compat;
|
||||
|
||||
import net.darkhax.gamestages.GameStageHelper;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import tschipp.carryon.Constants;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
|
||||
public class GamestageCompat
|
||||
{
|
||||
private static Method hasStage;
|
||||
|
||||
static {
|
||||
try {
|
||||
Class<?> gamestageHelper = Class.forName("net.darkhax.gamestages.GameStageHelper");
|
||||
hasStage = gamestageHelper.getMethod("hasStage", Player.class, String.class);
|
||||
|
||||
} catch (Exception e) {
|
||||
Constants.LOG.info("Gamestages not found. Disabling.");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasStage(Player player, String stage)
|
||||
{
|
||||
return GameStageHelper.hasStage(player, stage);
|
||||
if(hasStage == null)
|
||||
return true;
|
||||
try {
|
||||
return (boolean) hasStage.invoke(null, player, stage);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
modLoader="javafml" #mandatory
|
||||
loaderVersion="[43,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
loaderVersion="[44,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
license="GNU LGPLv3"
|
||||
issueTrackerURL="https://github.com/Tschipp/CarryOn/issues"
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ issueTrackerURL="https://github.com/Tschipp/CarryOn/issues"
|
|||
# Does this dependency have to exist - if not, ordering below must be specified
|
||||
mandatory=true #mandatory
|
||||
# The version range of the dependency
|
||||
versionRange="[43,)" #mandatory
|
||||
versionRange="[44,)" #mandatory
|
||||
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
|
||||
ordering="NONE"
|
||||
# Side this dependency is applied on - BOTH, CLIENT or SERVER
|
||||
|
|
@ -28,6 +28,6 @@ issueTrackerURL="https://github.com/Tschipp/CarryOn/issues"
|
|||
[[dependencies.carryon]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.19.2,1.20)"
|
||||
versionRange="[1.19.3,1.20)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
|
|
|||
|
|
@ -3,19 +3,20 @@ version=2.0.4
|
|||
group=tschipp.carryon
|
||||
|
||||
# Common
|
||||
minecraft_version=1.19.2
|
||||
minecraft_version=1.19.3
|
||||
common_runs_enabled=false
|
||||
common_client_run_name=Common Client
|
||||
common_server_run_name=Common Server
|
||||
|
||||
# Forge
|
||||
forge_version=43.1.30
|
||||
parchment_mappings=2022.11.20-1.19.2
|
||||
forge_version=44.0.11
|
||||
parchment_mappings=1.19.2-2022.11.27-1.19.3
|
||||
//forge_ats_enabled=true
|
||||
|
||||
# Fabric
|
||||
fabric_version=0.62.0+1.19.2
|
||||
fabric_loader_version=0.14.9
|
||||
fabric_version=0.69.0+1.19.3
|
||||
fabric_loader_version=0.14.11
|
||||
parchment_mappings_fabric=1.19.2:2022.11.27
|
||||
|
||||
# Quilt
|
||||
quilt_loader_version=0.16.0-beta.7
|
||||
|
|
@ -30,4 +31,4 @@ mod_id=carryon
|
|||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
|
||||
mixinextras_version=0.2.0-beta.1
|
||||
mixinextras_version=0.2.0-beta.1
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ pluginManagement {
|
|||
|
||||
maven { url 'https://jitpack.io' }
|
||||
|
||||
maven {
|
||||
name = 'ParchmentMC'
|
||||
url = 'https://maven.parchmentmc.org'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user