Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04483c289f | ||
|
|
e3218f490d | ||
|
|
0162587ff6 | ||
|
|
c6a6799af9 | ||
|
|
2605332502 | ||
|
|
3614ed7c89 | ||
|
|
337ccf5df9 | ||
|
|
a5c47c9152 |
17
build.gradle
17
build.gradle
|
|
@ -1,18 +1,15 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
maven { url = 'https://maven.minecraftforge.net' }
|
||||
maven { url = 'https://maven.parchmentmc.org' }
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
|
||||
classpath 'org.parchmentmc:librarian:1.+'
|
||||
}
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
plugins {
|
||||
id 'eclipse'
|
||||
id 'maven-publish'
|
||||
id 'net.minecraftforge.gradle' version '5.1.+'
|
||||
}
|
||||
|
||||
apply plugin: 'org.parchmentmc.librarian.forgegradle'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
version=1.17.0
|
||||
minecraft_version=1.18.2
|
||||
mappings_version=2022.02.13-1.18.1
|
||||
forge_version=40.0.3
|
||||
version=1.18.2
|
||||
minecraft_version=1.19.2
|
||||
mappings_version=2022.11.20-1.19.2
|
||||
forge_version=43.1.55
|
||||
org.gradle.daemon=false
|
||||
# chorg.gradle.java.home=C:/Program Files/AdoptOpenJDK/jdk-17.0.1/
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,5 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
|||
10
gradlew
vendored
10
gradlew
vendored
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
|
@ -32,10 +32,10 @@
|
|||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
|
|
|
|||
9
settings.gradle
Normal file
9
settings.gradle
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven { url = 'https://maven.minecraftforge.net/' }
|
||||
maven { url = 'https://maven.parchmentmc.org' }
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
|
@ -7,9 +7,6 @@ import org.apache.logging.log4j.LogManager;
|
|||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
|
@ -56,6 +53,7 @@ public class CarryOn
|
|||
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, Configs.SERVER_CONFIG);
|
||||
|
||||
info = ModLoadingContext.get().getActiveContainer().getModInfo();
|
||||
RegistrationHandler.init();
|
||||
}
|
||||
|
||||
private void setup(final FMLCommonSetupEvent event)
|
||||
|
|
@ -78,13 +76,4 @@ public class CarryOn
|
|||
|
||||
proxy.setup(event);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRegistry(RegistryEvent.Register<Item> event)
|
||||
{
|
||||
RegistrationHandler.regItems();
|
||||
|
||||
event.getRegistry().register(RegistrationHandler.itemEntity);
|
||||
event.getRegistry().register(RegistrationHandler.itemTile);
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ import net.minecraft.world.phys.Vec3;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.event.level.LevelEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import tschipp.carryon.client.helper.CarryRenderHelper;
|
||||
|
|
@ -51,7 +51,7 @@ public class RenderEntityEvents
|
|||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onLevelUnload(WorldEvent.Unload event)
|
||||
public void onLevelUnload(LevelEvent.Unload event)
|
||||
{
|
||||
nbtEntityMap.clear();
|
||||
}
|
||||
|
|
@ -68,13 +68,13 @@ public class RenderEntityEvents
|
|||
Player player = Minecraft.getInstance().player;
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
int perspective = CarryRenderHelper.getPerspective();
|
||||
float partialticks = event.getPartialTicks();
|
||||
float partialticks = event.getPartialTick();
|
||||
PoseStack matrix = event.getPoseStack();
|
||||
int light = event.getPackedLight();
|
||||
MultiBufferSource buffer = event.getMultiBufferSource();
|
||||
EntityRenderDispatcher manager = Minecraft.getInstance().getEntityRenderDispatcher();
|
||||
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity.get() && ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
if (ModList.get().isLoaded("realrender") || ModList.get().isLoaded("rfpr"))
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import net.minecraft.client.resources.model.BakedModel;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.ClickEvent.Action;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
|
|
@ -48,9 +48,9 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.RenderLevelLastEvent;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.client.event.ScreenEvent.InitScreenEvent;
|
||||
import net.minecraftforge.client.event.ScreenEvent;
|
||||
import net.minecraftforge.event.TickEvent.PlayerTickEvent;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.EntityJoinLevelEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
|
|
@ -87,7 +87,7 @@ public class RenderEvents
|
|||
{
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile || stack.getItem() == RegistrationHandler.itemEntity))
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile.get() || stack.getItem() == RegistrationHandler.itemEntity.get()))
|
||||
{
|
||||
if (ItemCarryonBlock.hasTileData(stack) || ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
|
|
@ -124,7 +124,7 @@ public class RenderEvents
|
|||
|
||||
@SubscribeEvent
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void onJoinLevel(EntityJoinWorldEvent event)
|
||||
public void onJoinLevel(EntityJoinLevelEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Player)
|
||||
{
|
||||
|
|
@ -136,10 +136,10 @@ public class RenderEvents
|
|||
|
||||
if (CarryOn.FINGERPRINT_VIOLATED)
|
||||
{
|
||||
TextComponent cf = new TextComponent(ChatFormatting.AQUA + "Curseforge" + ChatFormatting.RED);
|
||||
Component cf = Component.literal(ChatFormatting.AQUA + "Curseforge" + ChatFormatting.RED);
|
||||
cf.getStyle().withClickEvent(new ClickEvent(Action.OPEN_URL, "https://minecraft.curseforge.com/projects/carry-on"));
|
||||
|
||||
player.displayClientMessage(new TextComponent(ChatFormatting.RED + "[CarryOn] WARNING! Invalid fingerprint detected! The Carry On mod file may have been tampered with! If you didn't download the file from ").append(cf).append(ChatFormatting.RED + " or through any kind of mod launcher, immediately delete the file and re-download it from ").append(cf), false);
|
||||
player.displayClientMessage(Component.literal(ChatFormatting.RED + "[CarryOn] WARNING! Invalid fingerprint detected! The Carry On mod file may have been tampered with! If you didn't download the file from ").append(cf).append(ChatFormatting.RED + " or through any kind of mod launcher, immediately delete the file and re-download it from ").append(cf), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ public class RenderEvents
|
|||
@SuppressWarnings("resource")
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onGuiInit(InitScreenEvent.Pre event)
|
||||
public void onGuiInit(ScreenEvent.Init.Pre event)
|
||||
{
|
||||
if (event.getScreen() != null)
|
||||
{
|
||||
|
|
@ -163,7 +163,7 @@ public class RenderEvents
|
|||
{
|
||||
ItemStack stack = player.getItemInHand(InteractionHand.MAIN_HAND);
|
||||
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack)))
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile.get() && ItemCarryonBlock.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity.get() && ItemCarryonEntity.hasEntityData(stack)))
|
||||
{
|
||||
Minecraft.getInstance().player.closeContainer();
|
||||
Minecraft.getInstance().screen = null;
|
||||
|
|
@ -192,7 +192,7 @@ public class RenderEvents
|
|||
{
|
||||
ItemStack stack = Minecraft.getInstance().player.getMainHandItem();
|
||||
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack)))
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile.get() && ItemCarryonBlock.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity.get() && ItemCarryonEntity.hasEntityData(stack)))
|
||||
{
|
||||
if (settings.keyDrop.matches(key, scancode))
|
||||
{
|
||||
|
|
@ -241,7 +241,7 @@ public class RenderEvents
|
|||
PoseStack matrix = event.getPoseStack();
|
||||
int light = event.getPackedLight();
|
||||
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack) && perspective == 0 && !f1)
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile.get() && ItemCarryonBlock.hasTileData(stack) && perspective == 0 && !f1)
|
||||
{
|
||||
if (ModList.get().isLoaded("realrender") || ModList.get().isLoaded("rfpr"))
|
||||
return;
|
||||
|
|
@ -336,7 +336,7 @@ public class RenderEvents
|
|||
light = manager.getPackedLightCoords(player, partialticks);
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack))
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile.get() && ItemCarryonBlock.hasTileData(stack))
|
||||
{
|
||||
Block block = ItemCarryonBlock.getBlock(stack);
|
||||
BlockState state = ItemCarryonBlock.getBlockState(stack);
|
||||
|
|
@ -380,7 +380,7 @@ public class RenderEvents
|
|||
|
||||
matrix.popPose();
|
||||
}
|
||||
else if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))
|
||||
else if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity.get() && ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
Entity entity = RenderEntityEvents.getEntity(stack, level);
|
||||
|
||||
|
|
@ -594,7 +594,7 @@ public class RenderEvents
|
|||
if (handleMobends() && !ModList.get().isLoaded("obfuscate"))
|
||||
{
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile.get() && ItemCarryonBlock.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity.get() && ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
PlayerModel<AbstractClientPlayer> model = getPlayerModel((AbstractClientPlayer) player);
|
||||
|
||||
|
|
@ -629,8 +629,8 @@ public class RenderEvents
|
|||
}
|
||||
else if (renderLeft)
|
||||
{
|
||||
renderArmPost(model.leftArm, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0, false, doSneakCheck(player), light, matrix, builder);
|
||||
renderArmPost(model.leftSleeve, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0, false, doSneakCheck(player), light, matrix, builder);
|
||||
renderArmPost(model.leftArm, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.15f : 0, false, doSneakCheck(player), light, matrix, builder);
|
||||
renderArmPost(model.leftSleeve, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.15f : 0, false, doSneakCheck(player), light, matrix, builder);
|
||||
}
|
||||
|
||||
if (renderRight && rotRight != null)
|
||||
|
|
@ -640,16 +640,16 @@ public class RenderEvents
|
|||
}
|
||||
else if (renderRight)
|
||||
{
|
||||
renderArmPost(model.rightArm, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0, true, doSneakCheck(player), light, matrix, builder);
|
||||
renderArmPost(model.rightSleeve, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0, true, doSneakCheck(player), light, matrix, builder);
|
||||
renderArmPost(model.rightArm, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.15f : 0, true, doSneakCheck(player), light, matrix, builder);
|
||||
renderArmPost(model.rightSleeve, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.15f : 0, true, doSneakCheck(player), light, matrix, builder);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
renderArmPost(model.rightArm, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0, true, doSneakCheck(player), light, matrix, builder);
|
||||
renderArmPost(model.leftArm, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0, false, doSneakCheck(player), light, matrix, builder);
|
||||
renderArmPost(model.leftSleeve, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0, false, doSneakCheck(player), light, matrix, builder);
|
||||
renderArmPost(model.rightSleeve, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0, true, doSneakCheck(player), light, matrix, builder);
|
||||
renderArmPost(model.rightArm, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.15f : 0, true, doSneakCheck(player), light, matrix, builder);
|
||||
renderArmPost(model.leftArm, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.15f : 0, false, doSneakCheck(player), light, matrix, builder);
|
||||
renderArmPost(model.leftSleeve, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.15f : 0, false, doSneakCheck(player), light, matrix, builder);
|
||||
renderArmPost(model.rightSleeve, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.3f : 0), stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.15f : 0, true, doSneakCheck(player), light, matrix, builder);
|
||||
}
|
||||
|
||||
if (buffer instanceof BufferSource)
|
||||
|
|
@ -672,10 +672,10 @@ public class RenderEvents
|
|||
|
||||
if (handleMobends() && !ModList.get().isLoaded("obfuscate"))
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Player player = event.getEntity();
|
||||
Pose pose = player.getPose();
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (pose != Pose.SWIMMING && pose != Pose.FALL_FLYING && !stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack)))
|
||||
if (pose != Pose.SWIMMING && pose != Pose.FALL_FLYING && !stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile.get() && ItemCarryonBlock.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity.get() && ItemCarryonEntity.hasEntityData(stack)))
|
||||
{
|
||||
PlayerModel<AbstractClientPlayer> model = event.getRenderer().getModel();
|
||||
|
||||
|
|
@ -787,8 +787,8 @@ public class RenderEvents
|
|||
// {
|
||||
// ItemStack stack = event.getItemStack();
|
||||
//
|
||||
// if (stack != null && (stack.getItem() == RegistrationHandler.itemTile ||
|
||||
// stack.getItem() == RegistrationHandler.itemEntity))
|
||||
// if (stack != null && (stack.getItem() == RegistrationHandler.itemTile.get() ||
|
||||
// stack.getItem() == RegistrationHandler.itemEntity.get()))
|
||||
// {
|
||||
// event.setCanceled(true);
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -4,21 +4,26 @@ import net.minecraft.client.KeyMapping;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.ClientRegistry;
|
||||
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||
import tschipp.carryon.CarryOn;
|
||||
|
||||
@EventBusSubscriber(modid = CarryOn.MODID, bus = Bus.MOD, value = Dist.CLIENT)
|
||||
public class CarryOnKeybinds
|
||||
{
|
||||
|
||||
public static final String KEYBIND_KEY = "carryOnKeyPressed";
|
||||
public static KeyMapping carryKey;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void init()
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerKeybinds(RegisterKeyMappingsEvent event)
|
||||
{
|
||||
carryKey = new KeyMapping("key.carry.desc", 340, "key.carry.category");
|
||||
|
||||
ClientRegistry.registerKeyBinding(carryKey);
|
||||
event.register(carryKey);
|
||||
}
|
||||
|
||||
public static boolean isKeyPressed(Player player)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class PositionClientEvents
|
|||
@SuppressWarnings("resource")
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onGui(ScreenEvent.DrawScreenEvent event)
|
||||
public void onGui(ScreenEvent.BackgroundRendered event)
|
||||
{
|
||||
if (event.getScreen() != null)
|
||||
{
|
||||
|
|
@ -58,7 +58,7 @@ public class PositionClientEvents
|
|||
@SubscribeEvent
|
||||
public void onGuiClose(PlayerContainerEvent.Close event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Player player = event.getEntity();
|
||||
if (player.getCapability(PositionProvider.POSITION_CAPABILITY).isPresent())
|
||||
{
|
||||
IPosition cap = player.getCapability(PositionProvider.POSITION_CAPABILITY).orElse(new TEPosition());
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ public class PositionCommonEvents
|
|||
public void onBlockRight(PlayerInteractEvent.RightClickBlock event)
|
||||
{
|
||||
BlockPos pos = event.getPos();
|
||||
Level level = event.getWorld();
|
||||
Player player = event.getPlayer();
|
||||
Level level = event.getLevel();
|
||||
Player player = event.getEntity();
|
||||
|
||||
if (event.isCanceled() || player == null || player instanceof FakePlayer)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
|||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
|
|
@ -49,17 +49,17 @@ public class CommandCarryOn
|
|||
ServerPlayer player = source.getPlayerOrException();
|
||||
|
||||
ItemStack main = player.getMainHandItem();
|
||||
if (!main.isEmpty() && main.getItem() == RegistrationHandler.itemTile)
|
||||
if (!main.isEmpty() && main.getItem() == RegistrationHandler.itemTile.get())
|
||||
{
|
||||
source.sendSuccess(new TextComponent("Block: " + ItemCarryonBlock.getBlock(main)), true);
|
||||
source.sendSuccess(new TextComponent("BlockState: " + ItemCarryonBlock.getBlockState(main)), true);
|
||||
source.sendSuccess(new TextComponent("ItemStack: " + ItemCarryonBlock.getItemStack(main)), true);
|
||||
source.sendSuccess(Component.literal("Block: " + ItemCarryonBlock.getBlock(main)), true);
|
||||
source.sendSuccess(Component.literal("BlockState: " + ItemCarryonBlock.getBlockState(main)), true);
|
||||
source.sendSuccess(Component.literal("ItemStack: " + ItemCarryonBlock.getItemStack(main)), true);
|
||||
|
||||
if (ModelOverridesHandler.hasCustomOverrideModel(ItemCarryonBlock.getBlockState(main), ItemCarryonBlock.getTileData(main)))
|
||||
source.sendSuccess(new TextComponent("Override Model: " + ModelOverridesHandler.getOverrideObject(ItemCarryonBlock.getBlockState(main), ItemCarryonBlock.getTileData(main))), true);
|
||||
source.sendSuccess(Component.literal("Override Model: " + ModelOverridesHandler.getOverrideObject(ItemCarryonBlock.getBlockState(main), ItemCarryonBlock.getTileData(main))), true);
|
||||
|
||||
if (CustomPickupOverrideHandler.hasSpecialPickupConditions(ItemCarryonBlock.getBlockState(main)))
|
||||
source.sendSuccess(new TextComponent("Custom Pickup Condition: " + CustomPickupOverrideHandler.getPickupCondition(ItemCarryonBlock.getBlockState(main))), true);
|
||||
source.sendSuccess(Component.literal("Custom Pickup Condition: " + CustomPickupOverrideHandler.getPickupCondition(ItemCarryonBlock.getBlockState(main))), true);
|
||||
|
||||
CarryOn.LOGGER.info("Block: " + ItemCarryonBlock.getBlock(main));
|
||||
CarryOn.LOGGER.info("BlockState: " + ItemCarryonBlock.getBlockState(main));
|
||||
|
|
@ -73,13 +73,13 @@ public class CommandCarryOn
|
|||
|
||||
return 1;
|
||||
}
|
||||
else if (!main.isEmpty() && main.getItem() == RegistrationHandler.itemEntity)
|
||||
else if (!main.isEmpty() && main.getItem() == RegistrationHandler.itemEntity.get())
|
||||
{
|
||||
source.sendSuccess(new TextComponent("Entity: " + ItemCarryonEntity.getEntity(main, player.level)), true);
|
||||
source.sendSuccess(new TextComponent("Entity Name: " + ItemCarryonEntity.getEntityName(main)), true);
|
||||
source.sendSuccess(Component.literal("Entity: " + ItemCarryonEntity.getEntity(main, player.level)), true);
|
||||
source.sendSuccess(Component.literal("Entity Name: " + ItemCarryonEntity.getEntityName(main)), true);
|
||||
|
||||
if (CustomPickupOverrideHandler.hasSpecialPickupConditions(ItemCarryonEntity.getEntity(main, player.level)))
|
||||
source.sendSuccess(new TextComponent("Custom Pickup Condition: " + CustomPickupOverrideHandler.getPickupCondition(ItemCarryonEntity.getEntity(main, player.level))), true);
|
||||
source.sendSuccess(Component.literal("Custom Pickup Condition: " + CustomPickupOverrideHandler.getPickupCondition(ItemCarryonEntity.getEntity(main, player.level))), true);
|
||||
|
||||
CarryOn.LOGGER.info("Entity: " + ItemCarryonEntity.getEntity(main, player.level));
|
||||
CarryOn.LOGGER.info("Entity Name: " + ItemCarryonEntity.getEntityName(main));
|
||||
|
|
@ -104,15 +104,15 @@ public class CommandCarryOn
|
|||
for (ServerPlayer player : players)
|
||||
{
|
||||
int cleared = 0;
|
||||
cleared += player.getInventory().clearOrCountMatchingItems(stack -> !stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile, 64, player.inventoryMenu.getCraftSlots()); // TODO
|
||||
cleared += player.getInventory().clearOrCountMatchingItems(stack -> !stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity, 64, player.inventoryMenu.getCraftSlots());
|
||||
cleared += player.getInventory().clearOrCountMatchingItems(stack -> !stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile.get(), 64, player.inventoryMenu.getCraftSlots()); // TODO
|
||||
cleared += player.getInventory().clearOrCountMatchingItems(stack -> !stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity.get(), 64, player.inventoryMenu.getCraftSlots());
|
||||
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> player), new CarrySlotPacket(9, player.getId()));
|
||||
|
||||
if (cleared != 1)
|
||||
source.sendSuccess(new TextComponent("Cleared " + cleared + " Items!"), true);
|
||||
source.sendSuccess(Component.literal("Cleared " + cleared + " Items!"), true);
|
||||
else
|
||||
source.sendSuccess(new TextComponent("Cleared " + cleared + " Item!"), true);
|
||||
source.sendSuccess(Component.literal("Cleared " + cleared + " Item!"), true);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@ import tschipp.carryon.CarryOn;
|
|||
import tschipp.carryon.common.handler.ListHandler;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = CarryOn.MODID, bus = Bus.MOD)
|
||||
public class Configs
|
||||
{
|
||||
public class Configs {
|
||||
|
||||
private static final ForgeConfigSpec.Builder SERVER_BUILDER = new ForgeConfigSpec.Builder();
|
||||
private static final ForgeConfigSpec.Builder CLIENT_BUILDER = new ForgeConfigSpec.Builder();
|
||||
|
|
@ -28,8 +27,9 @@ public class Configs
|
|||
public static final ForgeConfigSpec SERVER_CONFIG;
|
||||
public static final ForgeConfigSpec CLIENT_CONFIG;
|
||||
|
||||
static
|
||||
{
|
||||
public static boolean SERVER_LOADED = false;
|
||||
|
||||
static {
|
||||
|
||||
Settings.init(SERVER_BUILDER, CLIENT_BUILDER);
|
||||
Blacklist.init(SERVER_BUILDER, CLIENT_BUILDER);
|
||||
|
|
@ -42,35 +42,34 @@ public class Configs
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onLoad(final ModConfigEvent.Loading event)
|
||||
{
|
||||
if (event.getConfig().getModId().equals(CarryOn.MODID))
|
||||
{
|
||||
ListHandler.initConfigLists();
|
||||
public static void onLoad(final ModConfigEvent event) {
|
||||
if (event.getConfig().getModId().equals(CarryOn.MODID) && event.getConfig().getSpec() == SERVER_CONFIG) {
|
||||
SERVER_LOADED = true;
|
||||
|
||||
CommentedConfig cfg = event.getConfig().getConfigData();
|
||||
|
||||
if (cfg instanceof CommentedFileConfig)
|
||||
((CommentedFileConfig) cfg).load();
|
||||
if (cfg instanceof CommentedFileConfig cfig) {
|
||||
cfig.load();
|
||||
ListHandler.initConfigLists();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onConfigChanged(ModConfigEvent.Reloading event)
|
||||
{
|
||||
if (event.getConfig().getModId().equals(CarryOn.MODID))
|
||||
{
|
||||
ListHandler.initConfigLists();
|
||||
// @SubscribeEvent
|
||||
// public static void onConfigChanged(ModConfigEvent.Reloading event) {
|
||||
// if (event.getConfig().getModId().equals(CarryOn.MODID) && event.getConfig().getSpec() == SERVER_CONFIG) {
|
||||
//
|
||||
// CommentedConfig cfg = event.getConfig().getConfigData();
|
||||
//
|
||||
// if (cfg instanceof CommentedFileConfig)
|
||||
// {
|
||||
// ((CommentedFileConfig) cfg).load();
|
||||
// ListHandler.initConfigLists();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
CommentedConfig cfg = event.getConfig().getConfigData();
|
||||
|
||||
if (cfg instanceof CommentedFileConfig)
|
||||
((CommentedFileConfig) cfg).load();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Settings
|
||||
{
|
||||
public static class Settings {
|
||||
public static BooleanValue facePlayer;
|
||||
|
||||
public static BooleanValue heavyTiles;
|
||||
|
|
@ -115,57 +114,77 @@ public class Configs
|
|||
|
||||
public static BooleanValue entitySizeMattersStacking;
|
||||
|
||||
public static void init(ForgeConfigSpec.Builder s, ForgeConfigSpec.Builder c)
|
||||
{
|
||||
public static void init(ForgeConfigSpec.Builder s, ForgeConfigSpec.Builder c) {
|
||||
c.comment("Settings");
|
||||
s.comment("Settings");
|
||||
|
||||
s.push("settings");
|
||||
c.push("settings");
|
||||
|
||||
maxDistance = s.comment("Maximum distance from where Blocks and Entities can be picked up").defineInRange("maxDistance", 2.5, 0, Double.MAX_VALUE);
|
||||
maxDistance = s.comment("Maximum distance from where Blocks and Entities can be picked up")
|
||||
.defineInRange("maxDistance", 2.5, 0, Double.MAX_VALUE);
|
||||
|
||||
maxEntityWidth = s.comment("Max width of entities that can be picked up in survival mode").defineInRange("maxEntityWidth", 1.5, 0, 10);
|
||||
maxEntityWidth = s.comment("Max width of entities that can be picked up in survival mode")
|
||||
.defineInRange("maxEntityWidth", 1.5, 0, 10);
|
||||
|
||||
maxEntityHeight = s.comment("Max height of entities that can be picked up in survival mode").defineInRange("maxEntityHeight", 2.0, 0, 10);
|
||||
maxEntityHeight = s.comment("Max height of entities that can be picked up in survival mode")
|
||||
.defineInRange("maxEntityHeight", 2.0, 0, 10);
|
||||
|
||||
blockSlownessMultiplier = s.comment("Slowness multiplier for blocks").defineInRange("blockSlownessMultiplier", 1, 0, Double.MAX_VALUE);
|
||||
blockSlownessMultiplier = s.comment("Slowness multiplier for blocks")
|
||||
.defineInRange("blockSlownessMultiplier", 1, 0, Double.MAX_VALUE);
|
||||
|
||||
entitySlownessMultiplier = s.comment("Slowness multiplier for entities").defineInRange("entitySlownessMultiplier", 1, 0, Double.MAX_VALUE);
|
||||
entitySlownessMultiplier = s.comment("Slowness multiplier for entities")
|
||||
.defineInRange("entitySlownessMultiplier", 1, 0, Double.MAX_VALUE);
|
||||
|
||||
maxEntityStackLimit = s.comment("Maximum stack limit for entities").defineInRange("maxEntityStackLimit", 10, 1, Integer.MAX_VALUE);
|
||||
maxEntityStackLimit = s.comment("Maximum stack limit for entities").defineInRange("maxEntityStackLimit", 10,
|
||||
1, Integer.MAX_VALUE);
|
||||
|
||||
facePlayer = c.comment("If the front of the Tile Entities should face the player or should face outward").define("facePlayer", false);
|
||||
facePlayer = c.comment("If the front of the Tile Entities should face the player or should face outward")
|
||||
.define("facePlayer", false);
|
||||
|
||||
heavyTiles = s.comment("More complex Tile Entities slow down the player more").define("heavyTiles", true);
|
||||
|
||||
pickupAllBlocks = s.comment("Allow all blocks to be picked up, not just Tile Entites").define("pickupAllBlocks", false);
|
||||
pickupAllBlocks = s.comment("Allow all blocks to be picked up, not just Tile Entites")
|
||||
.define("pickupAllBlocks", false);
|
||||
|
||||
slownessInCreative = s.comment("Whether Blocks and Entities slow the creative player down when carried").define("slownessInCreative", true);
|
||||
slownessInCreative = s.comment("Whether Blocks and Entities slow the creative player down when carried")
|
||||
.define("slownessInCreative", true);
|
||||
|
||||
pickupHostileMobs = s.comment("Whether hostile mobs should be able to picked up in survival mode").define("pickupHostileMobs", false);
|
||||
pickupHostileMobs = s.comment("Whether hostile mobs should be able to picked up in survival mode")
|
||||
.define("pickupHostileMobs", false);
|
||||
|
||||
heavyEntities = s.comment("Larger Entities slow down the player more").define("heavyEntities", true);
|
||||
|
||||
renderArms = c.comment("Arms should render on sides when carrying").define("renderArms", true);
|
||||
|
||||
allowBabies = s.comment("Allow babies to be carried even when adult mob is blacklisted (or not whitelisted)").define("allowBabies", false);
|
||||
allowBabies = s
|
||||
.comment("Allow babies to be carried even when adult mob is blacklisted (or not whitelisted)")
|
||||
.define("allowBabies", false);
|
||||
|
||||
useWhitelistBlocks = s.comment("Use Whitelist instead of Blacklist for Blocks").define("useWhitelistBlocks", false);
|
||||
useWhitelistBlocks = s.comment("Use Whitelist instead of Blacklist for Blocks").define("useWhitelistBlocks",
|
||||
false);
|
||||
|
||||
useWhitelistEntities = s.comment("Use Whitelist instead of Blacklist for Entities").define("useWhitelistEntities", false);
|
||||
useWhitelistEntities = s.comment("Use Whitelist instead of Blacklist for Entities")
|
||||
.define("useWhitelistEntities", false);
|
||||
|
||||
useWhitelistStacking = s.comment("Use Whitelist instead of Blacklist for Stacking").define("useWhitelistStacking", false);
|
||||
useWhitelistStacking = s.comment("Use Whitelist instead of Blacklist for Stacking")
|
||||
.define("useWhitelistStacking", false);
|
||||
|
||||
hitWhileCarrying = s.comment("Whether the player can hit blocks and entities while carrying or not").define("hitWhileCarrying", false);
|
||||
hitWhileCarrying = s.comment("Whether the player can hit blocks and entities while carrying or not")
|
||||
.define("hitWhileCarrying", false);
|
||||
|
||||
dropCarriedWhenHit = s.comment("Whether the player drops the carried object when hit or not").define("dropCarriedWhenHit", false);
|
||||
dropCarriedWhenHit = s.comment("Whether the player drops the carried object when hit or not")
|
||||
.define("dropCarriedWhenHit", false);
|
||||
|
||||
useScripts = s.comment("Use custom Pickup Scripts. Having this set to false, will not allow you to run scripts, but will increase your performance").worldRestart().define("useScripts", false);
|
||||
useScripts = s.comment(
|
||||
"Use custom Pickup Scripts. Having this set to false, will not allow you to run scripts, but will increase your performance")
|
||||
.worldRestart().define("useScripts", false);
|
||||
|
||||
stackableEntities = s.comment("Allows entities to be stacked using Carry On").define("stackableEntities", true);
|
||||
stackableEntities = s.comment("Allows entities to be stacked using Carry On").define("stackableEntities",
|
||||
true);
|
||||
|
||||
entitySizeMattersStacking = s.comment("Whether entities' size matters when stacking or not").define("stackableEntities", true);
|
||||
entitySizeMattersStacking = s.comment("Whether entities' size matters when stacking or not")
|
||||
.define("stackableEntities", true);
|
||||
|
||||
s.pop();
|
||||
c.pop();
|
||||
|
|
@ -174,73 +193,136 @@ public class Configs
|
|||
|
||||
}
|
||||
|
||||
public static class WhiteList
|
||||
{
|
||||
public static class WhiteList {
|
||||
public static ConfigValue<List<? extends String>> allowedEntities;
|
||||
|
||||
public static ConfigValue<List<? extends String>> allowedBlocks;
|
||||
|
||||
public static ConfigValue<List<? extends String>> allowedStacking;
|
||||
|
||||
public static void init(ForgeConfigSpec.Builder s, ForgeConfigSpec.Builder c)
|
||||
{
|
||||
s.comment("Whitelist. Read about the format here: https://github.com/Tschipp/CarryOn/wiki/Black---and-Whitelist-Config");
|
||||
public static void init(ForgeConfigSpec.Builder s, ForgeConfigSpec.Builder c) {
|
||||
s.comment(
|
||||
"Whitelist. Read about the format here: https://github.com/Tschipp/CarryOn/wiki/Black---and-Whitelist-Config");
|
||||
|
||||
allowedEntities = s.comment("Entities that CAN be picked up (useWhitelistEntities must be true)").defineList("whitelist.allowedEntities", Arrays.asList(), obj -> obj instanceof String ? true : false);
|
||||
allowedEntities = s.comment("Entities that CAN be picked up (useWhitelistEntities must be true)")
|
||||
.defineList("whitelist.allowedEntities", Arrays.asList(),
|
||||
obj -> obj instanceof String ? true : false);
|
||||
|
||||
allowedBlocks = s.comment("Blocks that CAN be picked up (useWhitelistBlocks must be true)").defineList("whitelist.allowedBlocks", Arrays.asList(), obj -> obj instanceof String ? true : false);
|
||||
allowedBlocks = s.comment("Blocks that CAN be picked up (useWhitelistBlocks must be true)").defineList(
|
||||
"whitelist.allowedBlocks", Arrays.asList(), obj -> obj instanceof String ? true : false);
|
||||
|
||||
allowedStacking = s.comment("Entities that CAN have other entities stacked on top of them (useWhitelistStacking must be true)").defineList("whitelist.allowedStacking", Arrays.asList(), obj -> obj instanceof String ? true : false);
|
||||
allowedStacking = s.comment(
|
||||
"Entities that CAN have other entities stacked on top of them (useWhitelistStacking must be true)")
|
||||
.defineList("whitelist.allowedStacking", Arrays.asList(),
|
||||
obj -> obj instanceof String ? true : false);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Blacklist
|
||||
{
|
||||
public static class Blacklist {
|
||||
public static ConfigValue<List<? extends String>> forbiddenTiles;
|
||||
|
||||
public static ConfigValue<List<? extends String>> forbiddenEntities;
|
||||
|
||||
public static ConfigValue<List<? extends String>> forbiddenStacking;
|
||||
|
||||
public static void init(ForgeConfigSpec.Builder s, ForgeConfigSpec.Builder c)
|
||||
{
|
||||
s.comment("Blacklist. Read about the format here: https://github.com/Tschipp/CarryOn/wiki/Black---and-Whitelist-Config");
|
||||
public static void init(ForgeConfigSpec.Builder s, ForgeConfigSpec.Builder c) {
|
||||
s.comment(
|
||||
"Blacklist. Read about the format here: https://github.com/Tschipp/CarryOn/wiki/Black---and-Whitelist-Config");
|
||||
|
||||
forbiddenTiles = s.comment("Blocks that cannot be picked up").defineList("blacklist.forbiddenTiles", Arrays.asList("#forge:immovable", "#forge:relocation_not_supported", "minecraft:end_portal", "minecraft:end_gateway", "minecraft:tall_grass", "minecraft:large_fern", "minecraft:peony", "minecraft:rose_bush", "minecraft:lilac", "minecraft:sunflower", "minecraft:*_bed", "minecraft:oak_door", "minecraft:iron_door", "minecraft:spruce_door", "minecraft:birch_door", "minecraft:jungle_door", "minecraft:acacia_door", "minecraft:dark_oak_door", "minecraft:waterlily", "minecraft:cake", "minecraft:nether_portal", "minecraft:tall_seagrass", "animania:block_trough", "animania:block_invisiblock", "colossalchests:*", "ic2:*", "bigreactors:*", "forestry:*", "tconstruct:*", "rustic:*", "botania:*", "astralsorcery:*", "quark:colored_bed_*", "immersiveengineering:*", "embers:block_furnace", "embers:ember_bore", "embers:ember_activator", "embers:mixer", "embers:heat_coil", "embers:large_tank", "embers:crystal_cell", "embers:alchemy_pedestal", "embers:boiler", "embers:combustor", "embers:catalzyer", "embers:field_chart", "embers:inferno_forge", "storagedrawers:framingtable", "skyresources:*", "lootbags:*", "exsartagine:*", "aquamunda:tank", "opencomputers:*", "malisisdoors:*", "industrialforegoing:*", "minecolonies:*", "thaumcraft:pillar*", "thaumcraft:infernal_furnace", "thaumcraft:placeholder*", "thaumcraft:infusion_matrix", "thaumcraft:golem_builder", "thaumcraft:thaumatorium*", "magneticraft:oil_heater", "magneticraft:solar_panel", "magneticraft:steam_engine", "magneticraft:shelving_unit", "magneticraft:grinder", "magneticraft:sieve", "magneticraft:solar_tower", "magneticraft:solar_mirror", "magneticraft:container", "magneticraft:pumpjack", "magneticraft:solar_panel", "magneticraft:refinery", "magneticraft:oil_heater", "magneticraft:hydraulic_press", "magneticraft:multiblock_gap", "refinedstorage:*", "mcmultipart:*", "enderstorage:*", "betterstorage:*", "practicallogistics2:*", "wearablebackpacks:*", "rftools:screen", "rftools:creative_screen", "create:*", "magic_doorknob:*", "iceandfire:*", "ftbquests:*", "waystones:*"), obj -> obj instanceof String);
|
||||
forbiddenTiles = s.comment("Blocks that cannot be picked up").defineList("blacklist.forbiddenTiles",
|
||||
Arrays.asList("#forge:immovable", "#forge:relocation_not_supported", "minecraft:end_portal",
|
||||
"minecraft:end_gateway", "minecraft:tall_grass", "minecraft:large_fern", "minecraft:peony",
|
||||
"minecraft:rose_bush", "minecraft:lilac", "minecraft:sunflower", "minecraft:*_bed",
|
||||
"minecraft:oak_door", "minecraft:iron_door", "minecraft:spruce_door",
|
||||
"minecraft:birch_door", "minecraft:jungle_door", "minecraft:acacia_door",
|
||||
"minecraft:dark_oak_door", "minecraft:waterlily", "minecraft:cake",
|
||||
"minecraft:nether_portal", "minecraft:tall_seagrass", "animania:block_trough",
|
||||
"animania:block_invisiblock", "colossalchests:*", "ic2:*", "bigreactors:*", "forestry:*",
|
||||
"tconstruct:*", "rustic:*", "botania:*", "astralsorcery:*", "quark:colored_bed_*",
|
||||
"immersiveengineering:*", "embers:block_furnace", "embers:ember_bore",
|
||||
"embers:ember_activator", "embers:mixer", "embers:heat_coil", "embers:large_tank",
|
||||
"embers:crystal_cell", "embers:alchemy_pedestal", "embers:boiler", "embers:combustor",
|
||||
"embers:catalzyer", "embers:field_chart", "embers:inferno_forge",
|
||||
"storagedrawers:framingtable", "skyresources:*", "lootbags:*", "exsartagine:*",
|
||||
"aquamunda:tank", "opencomputers:*", "malisisdoors:*", "industrialforegoing:*",
|
||||
"minecolonies:*", "thaumcraft:pillar*", "thaumcraft:infernal_furnace",
|
||||
"thaumcraft:placeholder*", "thaumcraft:infusion_matrix", "thaumcraft:golem_builder",
|
||||
"thaumcraft:thaumatorium*", "magneticraft:oil_heater", "magneticraft:solar_panel",
|
||||
"magneticraft:steam_engine", "magneticraft:shelving_unit", "magneticraft:grinder",
|
||||
"magneticraft:sieve", "magneticraft:solar_tower", "magneticraft:solar_mirror",
|
||||
"magneticraft:container", "magneticraft:pumpjack", "magneticraft:solar_panel",
|
||||
"magneticraft:refinery", "magneticraft:oil_heater", "magneticraft:hydraulic_press",
|
||||
"magneticraft:multiblock_gap", "refinedstorage:*", "mcmultipart:*", "enderstorage:*",
|
||||
"betterstorage:*", "practicallogistics2:*", "wearablebackpacks:*", "rftools:screen",
|
||||
"rftools:creative_screen", "create:*", "magic_doorknob:*", "iceandfire:*", "ftbquests:*",
|
||||
"waystones:*"),
|
||||
obj -> obj instanceof String);
|
||||
|
||||
forbiddenEntities = s.comment("Entities that cannot be picked up").defineList("blacklist.forbiddenEntities", Arrays.asList("minecraft:end_crystal", "minecraft:ender_dragon", "minecraft:ghast", "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:*"), obj -> obj instanceof String ? true : false);
|
||||
forbiddenEntities = s.comment("Entities that cannot be picked up").defineList("blacklist.forbiddenEntities",
|
||||
Arrays.asList("minecraft:end_crystal", "minecraft:ender_dragon", "minecraft:ghast",
|
||||
"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:*"),
|
||||
obj -> obj instanceof String ? true : false);
|
||||
|
||||
forbiddenStacking = s.comment("Entities that cannot have other entities stacked on top of them").defineList("blacklist.forbiddenStacking", Arrays.asList("minecraft:horse"), obj -> obj instanceof String ? true : false);
|
||||
forbiddenStacking = s.comment("Entities that cannot have other entities stacked on top of them").defineList(
|
||||
"blacklist.forbiddenStacking", Arrays.asList("minecraft:horse"),
|
||||
obj -> obj instanceof String ? true : false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class ModelOverrides
|
||||
{
|
||||
public static class ModelOverrides {
|
||||
public static ConfigValue<List<? extends String>> modelOverrides;
|
||||
|
||||
public static void init(ForgeConfigSpec.Builder s, ForgeConfigSpec.Builder c)
|
||||
{
|
||||
c.comment("Model Overrides. Read about the format here: https://github.com/Tschipp/CarryOn/wiki/Model-Override-Config");
|
||||
public static void init(ForgeConfigSpec.Builder s, ForgeConfigSpec.Builder c) {
|
||||
c.comment(
|
||||
"Model Overrides. Read about the format here: https://github.com/Tschipp/CarryOn/wiki/Model-Override-Config");
|
||||
|
||||
modelOverrides = c.comment("Model Overrides based on NBT or on Meta. Advanced Users Only!").defineList("modeloverrides.overrides", Arrays.asList("minecraft:hopper->(block)minecraft:hopper", "minecraft:comparator->(block)minecraft:comparator", "minecraft:repeater->(block)minecraft:repeater", "minecraft:cauldron->(block)minecraft:cauldron", "minecraft:brewing_stand->(item)minecraft:brewing_stand", "minecraft:flower_pot->(block)minecraft:flower_pot", "minecraft:sugar_cane->(block)minecraft:sugar_cane", "minecraft:redstone_wire->(item)minecraft:redstone", "animania:block_nest->(block)animania:block_nest", "animania:cheese_mold;0->(block)animania:cheese_mold;0", "animania:cheese_mold;1->(block)animania:cheese_mold;1", "animania:cheese_mold;2->(block)animania:cheese_mold;2", "animania:cheese_mold;3->(block)animania:cheese_mold;3", "animania:cheese_mold;4->(block)animania:cheese_mold;4", "animania:cheese_mold;5->(block)animania:cheese_mold;5", "animania:cheese_mold;6->(block)animania:cheese_mold;6", "animania:cheese_mold;7->(block)animania:cheese_mold;7", "animania:cheese_mold;8->(block)animania:cheese_mold;8", "animania:cheese_mold;9->(block)animania:cheese_mold;9", "animania:cheese_mold;10->(block)animania:cheese_mold;10"), obj -> obj instanceof String ? true : false);
|
||||
modelOverrides = c.comment("Model Overrides based on NBT or on Meta. Advanced Users Only!").defineList(
|
||||
"modeloverrides.overrides",
|
||||
Arrays.asList("minecraft:hopper->(block)minecraft:hopper",
|
||||
"minecraft:comparator->(block)minecraft:comparator",
|
||||
"minecraft:repeater->(block)minecraft:repeater",
|
||||
"minecraft:cauldron->(block)minecraft:cauldron",
|
||||
"minecraft:brewing_stand->(item)minecraft:brewing_stand",
|
||||
"minecraft:flower_pot->(block)minecraft:flower_pot",
|
||||
"minecraft:sugar_cane->(block)minecraft:sugar_cane",
|
||||
"minecraft:redstone_wire->(item)minecraft:redstone",
|
||||
"animania:block_nest->(block)animania:block_nest",
|
||||
"animania:cheese_mold;0->(block)animania:cheese_mold;0",
|
||||
"animania:cheese_mold;1->(block)animania:cheese_mold;1",
|
||||
"animania:cheese_mold;2->(block)animania:cheese_mold;2",
|
||||
"animania:cheese_mold;3->(block)animania:cheese_mold;3",
|
||||
"animania:cheese_mold;4->(block)animania:cheese_mold;4",
|
||||
"animania:cheese_mold;5->(block)animania:cheese_mold;5",
|
||||
"animania:cheese_mold;6->(block)animania:cheese_mold;6",
|
||||
"animania:cheese_mold;7->(block)animania:cheese_mold;7",
|
||||
"animania:cheese_mold;8->(block)animania:cheese_mold;8",
|
||||
"animania:cheese_mold;9->(block)animania:cheese_mold;9",
|
||||
"animania:cheese_mold;10->(block)animania:cheese_mold;10"),
|
||||
obj -> obj instanceof String ? true : false);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CustomPickupConditions
|
||||
{
|
||||
public static class CustomPickupConditions {
|
||||
|
||||
public static ConfigValue<List<? extends String>> customPickupConditionsBlocks;
|
||||
|
||||
public static ConfigValue<List<? extends String>> customPickupConditionsEntities;
|
||||
|
||||
public static void init(ForgeConfigSpec.Builder s, ForgeConfigSpec.Builder c)
|
||||
{
|
||||
s.comment("Custom Pickup Conditions. Read about the format here: https://github.com/Tschipp/CarryOn/wiki/Custom-Pickup-Condition-Config");
|
||||
public static void init(ForgeConfigSpec.Builder s, ForgeConfigSpec.Builder c) {
|
||||
s.comment(
|
||||
"Custom Pickup Conditions. Read about the format here: https://github.com/Tschipp/CarryOn/wiki/Custom-Pickup-Condition-Config");
|
||||
|
||||
customPickupConditionsBlocks = s.comment("Custom Pickup Conditions for Blocks").defineList("custom_pickup_conditions.customPickupConditionsBlocks", Arrays.asList(), obj -> obj instanceof String ? true : false);
|
||||
customPickupConditionsBlocks = s.comment("Custom Pickup Conditions for Blocks").defineList(
|
||||
"custom_pickup_conditions.customPickupConditionsBlocks", Arrays.asList(),
|
||||
obj -> obj instanceof String ? true : false);
|
||||
|
||||
customPickupConditionsEntities = s.comment("Custom Pickup Conditions for Entities").defineList("custom_pickup_conditions.customPickupConditionsEntities", Arrays.asList(), obj -> obj instanceof String ? true : false);
|
||||
customPickupConditionsEntities = s.comment("Custom Pickup Conditions for Entities").defineList(
|
||||
"custom_pickup_conditions.customPickupConditionsEntities", Arrays.asList(),
|
||||
obj -> obj instanceof String ? true : false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.EntityJoinLevelEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingTickEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.eventbus.api.Event.Result;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
|
|
@ -42,9 +42,9 @@ public class ItemEntityEvents
|
|||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onBlockClick(PlayerInteractEvent.RightClickBlock event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Player player = event.getEntity();
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity.get() && ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
player.getPersistentData().remove("carrySlot");
|
||||
event.setUseBlock(Result.DENY);
|
||||
|
|
@ -57,7 +57,7 @@ public class ItemEntityEvents
|
|||
String command = override.getCommandPlace();
|
||||
|
||||
if (command != null)
|
||||
player.getServer().getCommands().performCommand(player.getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().getName() + " run " + command);
|
||||
player.getServer().getCommands().performPrefixedCommand(player.getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().getName() + " run " + command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -65,15 +65,15 @@ public class ItemEntityEvents
|
|||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onItemDropped(EntityJoinWorldEvent event)
|
||||
public void onItemDropped(EntityJoinLevelEvent event)
|
||||
{
|
||||
Entity e = event.getEntity();
|
||||
Level level = event.getWorld();
|
||||
Level level = event.getLevel();
|
||||
if (e instanceof net.minecraft.world.entity.item.ItemEntity eitem)
|
||||
{
|
||||
ItemStack stack = eitem.getItem();
|
||||
Item item = stack.getItem();
|
||||
if (item == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))
|
||||
if (item == RegistrationHandler.itemEntity.get() && ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
BlockPos pos = eitem.blockPosition();
|
||||
Entity entity = ItemCarryonEntity.getEntity(stack, level);
|
||||
|
|
@ -89,19 +89,19 @@ public class ItemEntityEvents
|
|||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onEntityRightClick(PlayerInteractEvent.EntityInteract event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Player player = event.getEntity();
|
||||
|
||||
if (player instanceof ServerPlayer)
|
||||
{
|
||||
ItemStack main = player.getMainHandItem();
|
||||
ItemStack off = player.getOffhandItem();
|
||||
Level level = event.getWorld();
|
||||
Level level = event.getLevel();
|
||||
Entity entity = event.getTarget();
|
||||
BlockPos pos = entity.blockPosition();
|
||||
|
||||
if (main.isEmpty() && off.isEmpty() && CarryOnKeybinds.isKeyPressed(player))
|
||||
{
|
||||
ItemStack stack = new ItemStack(RegistrationHandler.itemEntity);
|
||||
ItemStack stack = new ItemStack(RegistrationHandler.itemEntity.get());
|
||||
|
||||
if (entity.invulnerableTime == 0)
|
||||
{
|
||||
|
|
@ -139,7 +139,7 @@ public class ItemEntityEvents
|
|||
}
|
||||
|
||||
}
|
||||
else if (!main.isEmpty() && main.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(main) && !CarryOnKeybinds.isKeyPressed(player) && Settings.stackableEntities.get())
|
||||
else if (!main.isEmpty() && main.getItem() == RegistrationHandler.itemEntity.get() && ItemCarryonEntity.hasEntityData(main) && !CarryOnKeybinds.isKeyPressed(player) && Settings.stackableEntities.get())
|
||||
{
|
||||
Entity entityHeld = ItemCarryonEntity.getEntity(main, level);
|
||||
|
||||
|
|
@ -243,12 +243,12 @@ public class ItemEntityEvents
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingUpdate(LivingUpdateEvent event)
|
||||
public void onLivingUpdate(LivingTickEvent event)
|
||||
{
|
||||
LivingEntity entity = event.getEntityLiving();
|
||||
LivingEntity entity = event.getEntity();
|
||||
Level level = entity.level;
|
||||
ItemStack main = entity.getMainHandItem();
|
||||
if (!main.isEmpty() && main.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(main))
|
||||
if (!main.isEmpty() && main.getItem() == RegistrationHandler.itemEntity.get() && ItemCarryonEntity.hasEntityData(main))
|
||||
{
|
||||
BlockPos pos = entity.blockPosition();
|
||||
BlockPos below = pos.relative(Direction.DOWN);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.ClickEvent.Action;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
|
|
@ -27,16 +27,17 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
import net.minecraftforge.event.TagsUpdatedEvent;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.EntityJoinLevelEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingTickEvent;
|
||||
import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent.StartTracking;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
|
||||
import net.minecraftforge.event.level.BlockEvent.BreakEvent;
|
||||
import net.minecraftforge.event.level.LevelEvent;
|
||||
import net.minecraftforge.eventbus.api.Event.Result;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
|
@ -49,6 +50,7 @@ import net.minecraftforge.network.PacketDistributor.TargetPoint;
|
|||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
import tschipp.carryon.common.command.CommandCarryOn;
|
||||
import tschipp.carryon.common.config.Configs;
|
||||
import tschipp.carryon.common.config.Configs.Settings;
|
||||
import tschipp.carryon.common.handler.CustomPickupOverrideHandler;
|
||||
import tschipp.carryon.common.handler.ListHandler;
|
||||
|
|
@ -71,9 +73,9 @@ public class ItemEvents
|
|||
if (event.isCanceled())
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Player player = event.getEntity();
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack))
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile.get() && ItemCarryonBlock.hasTileData(stack))
|
||||
{
|
||||
player.getPersistentData().remove("carrySlot");
|
||||
event.setUseBlock(Result.DENY);
|
||||
|
|
@ -86,7 +88,7 @@ public class ItemEvents
|
|||
String command = override.getCommandPlace();
|
||||
|
||||
if (command != null && !command.isEmpty())
|
||||
player.getServer().getCommands().performCommand(player.getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().getName() + " run " + command);
|
||||
player.getServer().getCommands().performPrefixedCommand(player.getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().getName() + " run " + command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -94,15 +96,15 @@ public class ItemEvents
|
|||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onItemDropped(EntityJoinWorldEvent event)
|
||||
public void onItemDropped(EntityJoinLevelEvent event)
|
||||
{
|
||||
Entity e = event.getEntity();
|
||||
Level level = event.getWorld();
|
||||
Level level = event.getLevel();
|
||||
if (e instanceof net.minecraft.world.entity.item.ItemEntity eitem)
|
||||
{
|
||||
ItemStack stack = eitem.getItem();
|
||||
Item item = stack.getItem();
|
||||
if (item == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack))
|
||||
if (item == RegistrationHandler.itemTile.get() && ItemCarryonBlock.hasTileData(stack))
|
||||
{
|
||||
BlockPos pos = eitem.blockPosition();
|
||||
BlockPos finalPos = pos;
|
||||
|
|
@ -146,15 +148,15 @@ public class ItemEvents
|
|||
@SubscribeEvent
|
||||
public void onPlayerLogin(PlayerLoggedInEvent event)
|
||||
{
|
||||
if (event.getPlayer() instanceof Player)
|
||||
if (event.getEntity() instanceof Player)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Player player = event.getEntity();
|
||||
Level level = player.getCommandSenderWorld();
|
||||
|
||||
ItemStack carried = player.getMainHandItem();
|
||||
if (!carried.isEmpty() && carried.getItem() == RegistrationHandler.itemTile || carried.getItem() == RegistrationHandler.itemEntity)
|
||||
if (!carried.isEmpty() && carried.getItem() == RegistrationHandler.itemTile.get() || carried.getItem() == RegistrationHandler.itemEntity.get())
|
||||
{
|
||||
if (carried.getItem() == RegistrationHandler.itemTile)
|
||||
if (carried.getItem() == RegistrationHandler.itemTile.get())
|
||||
{
|
||||
CarryOnOverride override = ScriptChecker.inspectBlock(ItemCarryonBlock.getBlockState(carried), level, player.blockPosition(), ItemCarryonBlock.getTileData(carried));
|
||||
if (override != null)
|
||||
|
|
@ -174,9 +176,9 @@ public class ItemEvents
|
|||
}
|
||||
|
||||
}
|
||||
if (event.getPlayer() instanceof ServerPlayer)
|
||||
if (event.getEntity() instanceof ServerPlayer)
|
||||
{
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) event.getPlayer()), new ScriptReloadPacket(ScriptReader.OVERRIDES.values()));
|
||||
CarryOn.network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) event.getEntity()), new ScriptReloadPacket(ScriptReader.OVERRIDES.values()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -198,20 +200,26 @@ public class ItemEvents
|
|||
ListHandler.initConfigLists();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void unloadWorld(LevelEvent.Unload event)
|
||||
{
|
||||
Configs.SERVER_LOADED = false;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityStartTracking(StartTracking event)
|
||||
{
|
||||
Entity e = event.getTarget();
|
||||
Player tracker = event.getPlayer();
|
||||
Player tracker = event.getEntity();
|
||||
|
||||
if (e instanceof Player player && tracker instanceof ServerPlayer)
|
||||
{
|
||||
Level level = player.getCommandSenderWorld();
|
||||
|
||||
ItemStack carried = player.getMainHandItem();
|
||||
if (!carried.isEmpty() && carried.getItem() == RegistrationHandler.itemTile || carried.getItem() == RegistrationHandler.itemEntity)
|
||||
if (!carried.isEmpty() && carried.getItem() == RegistrationHandler.itemTile.get() || carried.getItem() == RegistrationHandler.itemEntity.get())
|
||||
{
|
||||
if (carried.getItem() == RegistrationHandler.itemTile)
|
||||
if (carried.getItem() == RegistrationHandler.itemTile.get())
|
||||
{
|
||||
CarryOnOverride override = ScriptChecker.inspectBlock(ItemCarryonBlock.getBlockState(carried), level, player.blockPosition(), ItemCarryonBlock.getTileData(carried));
|
||||
if (override != null)
|
||||
|
|
@ -235,11 +243,11 @@ public class ItemEvents
|
|||
@SubscribeEvent
|
||||
public void harvestSpeed(BreakSpeed event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Player player = event.getEntity();
|
||||
if (player != null && !Settings.hitWhileCarrying.get())
|
||||
{
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile || stack.getItem() == RegistrationHandler.itemEntity))
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile.get() || stack.getItem() == RegistrationHandler.itemEntity.get()))
|
||||
event.setNewSpeed(0);
|
||||
}
|
||||
}
|
||||
|
|
@ -247,9 +255,9 @@ public class ItemEvents
|
|||
@SubscribeEvent
|
||||
public void attackEntity(AttackEntityEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Player player = event.getEntity();
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.isEmpty() && !Settings.hitWhileCarrying.get() && (stack.getItem() == RegistrationHandler.itemTile || stack.getItem() == RegistrationHandler.itemEntity))
|
||||
if (!stack.isEmpty() && !Settings.hitWhileCarrying.get() && (stack.getItem() == RegistrationHandler.itemTile.get() || stack.getItem() == RegistrationHandler.itemEntity.get()))
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
|
@ -262,7 +270,7 @@ public class ItemEvents
|
|||
if (player != null && !Settings.hitWhileCarrying.get())
|
||||
{
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile || stack.getItem() == RegistrationHandler.itemEntity))
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile.get() || stack.getItem() == RegistrationHandler.itemEntity.get()))
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -270,11 +278,11 @@ public class ItemEvents
|
|||
@SubscribeEvent
|
||||
public void playerAttack(LivingAttackEvent event)
|
||||
{
|
||||
LivingEntity eliving = event.getEntityLiving();
|
||||
LivingEntity eliving = event.getEntity();
|
||||
if (eliving instanceof Player player && Settings.dropCarriedWhenHit.get())
|
||||
{
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile || stack.getItem() == RegistrationHandler.itemEntity) && !player.level.isClientSide)
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile.get() || stack.getItem() == RegistrationHandler.itemEntity.get()) && !player.level.isClientSide)
|
||||
{
|
||||
player.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY);
|
||||
ItemEntity item = new ItemEntity(player.level, player.getX(), player.getY(), player.getZ(), stack);
|
||||
|
|
@ -288,7 +296,7 @@ public class ItemEvents
|
|||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void onBlockRightClick(PlayerInteractEvent.RightClickBlock event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Player player = event.getEntity();
|
||||
|
||||
if (event.isCanceled())
|
||||
return;
|
||||
|
|
@ -298,14 +306,14 @@ public class ItemEvents
|
|||
|
||||
ItemStack main = player.getMainHandItem();
|
||||
ItemStack off = player.getOffhandItem();
|
||||
Level level = event.getWorld();
|
||||
Level level = event.getLevel();
|
||||
BlockPos pos = event.getPos();
|
||||
BlockState state = level.getBlockState(pos);
|
||||
|
||||
if (main.isEmpty() && off.isEmpty() && CarryOnKeybinds.isKeyPressed(player))
|
||||
{
|
||||
|
||||
ItemStack stack = new ItemStack(RegistrationHandler.itemTile);
|
||||
ItemStack stack = new ItemStack(RegistrationHandler.itemTile.get());
|
||||
|
||||
BlockEntity te = level.getBlockEntity(pos);
|
||||
if (PickupHandler.canPlayerPickUpBlock((ServerPlayer) player, te, level, pos))
|
||||
|
|
@ -360,10 +368,10 @@ public class ItemEvents
|
|||
BlockEntity.loadStatic(pos, statee, tag);
|
||||
}
|
||||
|
||||
player.displayClientMessage(new TextComponent(ChatFormatting.RED + "Error detected. Cannot pick up block."), false);
|
||||
TextComponent s = new TextComponent(ChatFormatting.GOLD + "here");
|
||||
player.displayClientMessage(Component.literal(ChatFormatting.RED + "Error detected. Cannot pick up block."), false);
|
||||
Component s = Component.literal(ChatFormatting.GOLD + "here");
|
||||
s.getStyle().withClickEvent(new ClickEvent(Action.OPEN_URL, "https://github.com/Tschipp/CarryOn/issues"));
|
||||
player.displayClientMessage(new TextComponent(ChatFormatting.RED + "Please report this error ").append(s), false);
|
||||
player.displayClientMessage(Component.literal(ChatFormatting.RED + "Please report this error ").append(s), false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -373,7 +381,7 @@ public class ItemEvents
|
|||
String command = override.getCommandInit();
|
||||
|
||||
if (command != null)
|
||||
player.getServer().getCommands().performCommand(player.getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().getName() + " run " + command);
|
||||
player.getServer().getCommands().performPrefixedCommand(player.getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().getName() + " run " + command);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -433,11 +441,11 @@ public class ItemEvents
|
|||
public void onRespawn(PlayerEvent.Clone event)
|
||||
{
|
||||
Player original = event.getOriginal();
|
||||
Player player = event.getPlayer();
|
||||
Player player = event.getEntity();
|
||||
boolean wasDead = event.isWasDeath();
|
||||
GameRules rules = player.level.getGameRules();
|
||||
boolean keepInv = rules.getBoolean(GameRules.RULE_KEEPINVENTORY);
|
||||
boolean wasCarrying = player.getInventory().contains(new ItemStack(RegistrationHandler.itemTile)) || player.getInventory().contains(new ItemStack(RegistrationHandler.itemEntity));
|
||||
boolean wasCarrying = player.getInventory().contains(new ItemStack(RegistrationHandler.itemTile.get())) || player.getInventory().contains(new ItemStack(RegistrationHandler.itemEntity.get()));
|
||||
|
||||
if ((wasDead ? keepInv : true) && wasCarrying)
|
||||
{
|
||||
|
|
@ -460,18 +468,18 @@ public class ItemEvents
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void dropNonHotbarItems(LivingUpdateEvent event)
|
||||
public void dropNonHotbarItems(LivingTickEvent event)
|
||||
{
|
||||
LivingEntity entity = event.getEntityLiving();
|
||||
LivingEntity entity = event.getEntity();
|
||||
if (entity instanceof Player player && !entity.level.isClientSide)
|
||||
{
|
||||
boolean hasCarried = player.getInventory().contains(new ItemStack(RegistrationHandler.itemTile)) || player.getInventory().contains(new ItemStack(RegistrationHandler.itemEntity));
|
||||
boolean hasCarried = player.getInventory().contains(new ItemStack(RegistrationHandler.itemTile.get())) || player.getInventory().contains(new ItemStack(RegistrationHandler.itemEntity.get()));
|
||||
ItemStack inHand = player.getMainHandItem();
|
||||
|
||||
if (hasCarried && inHand.getItem() != RegistrationHandler.itemTile && inHand.getItem() != RegistrationHandler.itemEntity && player.getDimensionChangingDelay() == 0)
|
||||
if (hasCarried && inHand.getItem() != RegistrationHandler.itemTile.get() && inHand.getItem() != RegistrationHandler.itemEntity.get() && player.getDimensionChangingDelay() == 0)
|
||||
{
|
||||
int slotBlock = this.getSlot(player, RegistrationHandler.itemTile);
|
||||
int slotEntity = this.getSlot(player, RegistrationHandler.itemEntity);
|
||||
int slotBlock = this.getSlot(player, RegistrationHandler.itemTile.get());
|
||||
int slotEntity = this.getSlot(player, RegistrationHandler.itemEntity.get());
|
||||
|
||||
ItemEntity item = null;
|
||||
if (slotBlock != -1)
|
||||
|
|
@ -498,7 +506,7 @@ public class ItemEvents
|
|||
String command = override.getCommandLoop();
|
||||
|
||||
if (command != null)
|
||||
player.getServer().getCommands().performCommand(player.getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().getName() + " run " + command);
|
||||
player.getServer().getCommands().performPrefixedCommand(player.getServer().createCommandSourceStack(), "/execute as " + player.getGameProfile().getName() + " run " + command);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,16 +3,13 @@ package tschipp.carryon.common.handler;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
|
||||
import net.minecraft.commands.arguments.blocks.BlockStateParser;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import tschipp.carryon.common.config.Configs.CustomPickupConditions;
|
||||
import tschipp.carryon.common.helper.InvalidConfigException;
|
||||
import tschipp.carryon.common.helper.StringParser;
|
||||
|
||||
public class CustomPickupOverrideHandler
|
||||
{
|
||||
|
|
@ -85,15 +82,7 @@ public class CustomPickupOverrideHandler
|
|||
|
||||
for (String cond : PICKUP_CONDITIONS.keySet())
|
||||
{
|
||||
BlockStateParser parser = new BlockStateParser(new StringReader(cond), false);
|
||||
try
|
||||
{
|
||||
parser.parse(false);
|
||||
}
|
||||
catch (CommandSyntaxException e)
|
||||
{
|
||||
}
|
||||
if (parser.getState() == state)
|
||||
if(state == StringParser.getBlockState(cond));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -104,15 +93,7 @@ public class CustomPickupOverrideHandler
|
|||
{
|
||||
for (String cond : PICKUP_CONDITIONS.keySet())
|
||||
{
|
||||
BlockStateParser parser = new BlockStateParser(new StringReader(cond), false);
|
||||
try
|
||||
{
|
||||
parser.parse(false);
|
||||
}
|
||||
catch (CommandSyntaxException e)
|
||||
{
|
||||
}
|
||||
if (parser.getState() == state)
|
||||
if(state == StringParser.getBlockState(cond));
|
||||
return PICKUP_CONDITIONS.get(cond);
|
||||
}
|
||||
return null;
|
||||
|
|
@ -123,13 +104,13 @@ public class CustomPickupOverrideHandler
|
|||
if (!ModList.get().isLoaded("gamestages"))
|
||||
return false;
|
||||
|
||||
String name = entity.getType().getRegistryName().toString();
|
||||
String name = ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()).toString();
|
||||
return PICKUP_CONDITIONS_ENTITIES.containsKey(name);
|
||||
}
|
||||
|
||||
public static String getPickupCondition(Entity entity)
|
||||
{
|
||||
String name = entity.getType().getRegistryName().toString();
|
||||
String name = ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()).toString();
|
||||
return PICKUP_CONDITIONS_ENTITIES.get(name);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import net.minecraft.world.entity.Entity;
|
|||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import tschipp.carryon.common.config.Configs;
|
||||
import tschipp.carryon.common.config.Configs.Blacklist;
|
||||
import tschipp.carryon.common.config.Configs.WhiteList;
|
||||
|
||||
|
|
@ -33,7 +34,7 @@ public class ListHandler
|
|||
|
||||
public static boolean isForbidden(Block block)
|
||||
{
|
||||
String name = block.getRegistryName().toString();
|
||||
String name = ForgeRegistries.BLOCKS.getKey(block).toString();
|
||||
if (FORBIDDEN_TILES.contains(name))
|
||||
return true;
|
||||
else
|
||||
|
|
@ -51,7 +52,7 @@ public class ListHandler
|
|||
|
||||
for (TagKey<Block> tag : FORBIDDEN_TILES_TAGS)
|
||||
{
|
||||
if (block.defaultBlockState().m_204336_(tag))
|
||||
if (block.defaultBlockState().is(tag))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -61,12 +62,12 @@ public class ListHandler
|
|||
|
||||
public static boolean isForbidden(Entity entity)
|
||||
{
|
||||
String name = entity.getType().getRegistryName().toString();
|
||||
String name = ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()).toString();
|
||||
boolean contains = FORBIDDEN_ENTITIES.contains(name);
|
||||
|
||||
for (TagKey<EntityType<?>> tag : FORBIDDEN_ENTITIES_TAGS)
|
||||
{
|
||||
if (entity.getType().m_204039_(tag))
|
||||
if (entity.getType().is(tag))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -75,12 +76,12 @@ public class ListHandler
|
|||
|
||||
public static boolean isAllowed(Entity entity)
|
||||
{
|
||||
String name = entity.getType().getRegistryName().toString();
|
||||
String name = ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()).toString();
|
||||
boolean contains = ALLOWED_ENTITIES.contains(name);
|
||||
|
||||
for (TagKey<EntityType<?>> tag : ALLOWED_ENTITIES_TAGS)
|
||||
{
|
||||
if (entity.getType().m_204039_(tag))
|
||||
if (entity.getType().is(tag))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -89,12 +90,12 @@ public class ListHandler
|
|||
|
||||
public static boolean isStackingForbidden(Entity entity)
|
||||
{
|
||||
String name = entity.getType().getRegistryName().toString();
|
||||
String name = ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()).toString();
|
||||
boolean contains = FORBIDDEN_STACKING.contains(name);
|
||||
|
||||
for (TagKey<EntityType<?>> tag : FORBIDDEN_STACKING_TAGS)
|
||||
{
|
||||
if (entity.getType().m_204039_(tag))
|
||||
if (entity.getType().is(tag))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -103,12 +104,12 @@ public class ListHandler
|
|||
|
||||
public static boolean isStackingAllowed(Entity entity)
|
||||
{
|
||||
String name = entity.getType().getRegistryName().toString();
|
||||
String name = ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()).toString();
|
||||
boolean contains = ALLOWED_STACKING.contains(name);
|
||||
|
||||
for (TagKey<EntityType<?>> tag : ALLOWED_STACKING_TAGS)
|
||||
{
|
||||
if (entity.getType().m_204039_(tag))
|
||||
if (entity.getType().is(tag))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +118,7 @@ public class ListHandler
|
|||
|
||||
public static boolean isAllowed(Block block)
|
||||
{
|
||||
String name = block.getRegistryName().toString();
|
||||
String name = ForgeRegistries.BLOCKS.getKey(block).toString();
|
||||
if (ALLOWED_TILES.contains(name))
|
||||
return true;
|
||||
else
|
||||
|
|
@ -135,7 +136,7 @@ public class ListHandler
|
|||
|
||||
for (TagKey<Block> tag : ALLOWED_TILES_TAGS)
|
||||
{
|
||||
if (block.defaultBlockState().m_204336_(tag))
|
||||
if (block.defaultBlockState().is(tag))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -147,6 +148,9 @@ public class ListHandler
|
|||
@SuppressWarnings("deprecation")
|
||||
public static void initConfigLists()
|
||||
{
|
||||
if(!Configs.SERVER_LOADED)
|
||||
return;
|
||||
|
||||
FORBIDDEN_ENTITIES.clear();
|
||||
FORBIDDEN_ENTITIES_TAGS.clear();
|
||||
FORBIDDEN_STACKING.clear();
|
||||
|
|
@ -182,7 +186,7 @@ public class ListHandler
|
|||
{
|
||||
String[] filter = forbiddenEntity.get(i).replace("*", ",").split(",");
|
||||
|
||||
ResourceLocation[] keys = ForgeRegistries.ENTITIES.getKeys().toArray(new ResourceLocation[0]);
|
||||
ResourceLocation[] keys = ForgeRegistries.ENTITY_TYPES.getKeys().toArray(new ResourceLocation[0]);
|
||||
for (ResourceLocation key : keys)
|
||||
{
|
||||
if (containsAll(key.toString(), filter))
|
||||
|
|
@ -206,7 +210,7 @@ public class ListHandler
|
|||
{
|
||||
String[] filter = allowedEntities.get(i).replace("*", ",").split(",");
|
||||
|
||||
ResourceLocation[] keys = ForgeRegistries.ENTITIES.getKeys().toArray(new ResourceLocation[0]);
|
||||
ResourceLocation[] keys = ForgeRegistries.ENTITY_TYPES.getKeys().toArray(new ResourceLocation[0]);
|
||||
for (ResourceLocation key : keys)
|
||||
{
|
||||
if (containsAll(key.toString(), filter))
|
||||
|
|
@ -240,7 +244,7 @@ public class ListHandler
|
|||
{
|
||||
String[] filter = forbiddenStacking.get(i).replace("*", ",").split(",");
|
||||
|
||||
ResourceLocation[] keys = ForgeRegistries.ENTITIES.getKeys().toArray(new ResourceLocation[0]);
|
||||
ResourceLocation[] keys = ForgeRegistries.ENTITY_TYPES.getKeys().toArray(new ResourceLocation[0]);
|
||||
for (ResourceLocation key : keys)
|
||||
{
|
||||
if (containsAll(key.toString(), filter))
|
||||
|
|
@ -264,7 +268,7 @@ public class ListHandler
|
|||
{
|
||||
String[] filter = allowedStacking.get(i).replace("*", ",").split(",");
|
||||
|
||||
ResourceLocation[] keys = ForgeRegistries.ENTITIES.getKeys().toArray(new ResourceLocation[0]);
|
||||
ResourceLocation[] keys = ForgeRegistries.ENTITY_TYPES.getKeys().toArray(new ResourceLocation[0]);
|
||||
for (ResourceLocation key : keys)
|
||||
{
|
||||
if (containsAll(key.toString(), filter))
|
||||
|
|
@ -277,8 +281,9 @@ public class ListHandler
|
|||
}
|
||||
}
|
||||
|
||||
Map<ResourceLocation, TagKey<Block>> blocktags = Registry.BLOCK.m_203613_().collect(Collectors.toMap(t -> t.f_203868_(), t -> t));
|
||||
Map<ResourceLocation, TagKey<EntityType<?>>> entitytags = Registry.ENTITY_TYPE.m_203613_().collect(Collectors.toMap(t -> t.f_203868_(), t -> t));
|
||||
|
||||
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));
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import tschipp.carryon.common.config.Configs.ModelOverrides;
|
||||
import tschipp.carryon.common.helper.InvalidConfigException;
|
||||
import tschipp.carryon.common.helper.StringParser;
|
||||
|
|
@ -131,12 +132,12 @@ public class ModelOverridesHandler
|
|||
keyComp.put("nbttag", tag);
|
||||
if (toOverrideObject instanceof Block)
|
||||
{
|
||||
keyComp.putString("block", ((Block) toOverrideObject).getRegistryName().toString());
|
||||
keyComp.putString("block", ForgeRegistries.BLOCKS.getKey(((Block) toOverrideObject)).toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
keyComp.putInt("stateid", Block.getId((BlockState) toOverrideObject));
|
||||
keyComp.putString("block", ((BlockState) toOverrideObject).getBlock().getRegistryName().toString());
|
||||
keyComp.putString("block", ForgeRegistries.BLOCKS.getKey(((BlockState) toOverrideObject).getBlock()).toString());
|
||||
}
|
||||
OVERRIDE_OBJECTS.put(keyComp, overrideObject);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.event.level.BlockEvent;
|
||||
import tschipp.carryon.common.config.Configs.Settings;
|
||||
import tschipp.carryon.common.helper.CarryonGamestageHelper;
|
||||
import tschipp.carryon.common.item.ItemCarryonBlock;
|
||||
|
|
@ -103,7 +103,7 @@ public class PickupHandler
|
|||
{
|
||||
|
||||
double distance = pos.distanceToSqr(player.position());
|
||||
if (distance <= Math.pow(Settings.maxDistance.get(), 2) && toPickUp instanceof TamableAnimal tame && tame.getOwnerUUID() != null && tame.getOwnerUUID() != Player.createPlayerUUID(player.getGameProfile()))
|
||||
if (distance <= Math.pow(Settings.maxDistance.get(), 2) && toPickUp instanceof TamableAnimal tame && tame.getOwnerUUID() != null && tame.getOwnerUUID() != player.getGameProfile().getId())
|
||||
return false;
|
||||
|
||||
if (CustomPickupOverrideHandler.hasSpecialPickupConditions(toPickUp))
|
||||
|
|
@ -136,7 +136,7 @@ public class PickupHandler
|
|||
if (toPickUp instanceof TamableAnimal tame)
|
||||
{
|
||||
UUID owner = tame.getOwnerUUID();
|
||||
UUID playerID = Player.createPlayerUUID(player.getGameProfile());
|
||||
UUID playerID = player.getGameProfile().getId();
|
||||
if (owner != null && !owner.equals(playerID))
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@ import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent;
|
|||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.client.event.RenderEntityEvents;
|
||||
import tschipp.carryon.client.event.RenderEvents;
|
||||
|
|
@ -22,16 +25,15 @@ import tschipp.carryon.common.item.ItemCarryonEntity;
|
|||
@EventBusSubscriber(modid = CarryOn.MODID, bus = Bus.MOD)
|
||||
public class RegistrationHandler
|
||||
{
|
||||
@ObjectHolder("carryon:tile_item")
|
||||
public static Item itemTile;
|
||||
|
||||
@ObjectHolder("carryon:entity_item")
|
||||
public static Item itemEntity;
|
||||
private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, CarryOn.MODID);
|
||||
|
||||
public static void regItems()
|
||||
{
|
||||
itemTile = new ItemCarryonBlock();
|
||||
itemEntity = new ItemCarryonEntity();
|
||||
public static final RegistryObject<Item> itemTile = ITEMS.register("tile_item", () -> new ItemCarryonBlock());
|
||||
public static final RegistryObject<Item> itemEntity = ITEMS.register("entity_item", () -> new ItemCarryonEntity());
|
||||
|
||||
|
||||
public static void init() {
|
||||
ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||
}
|
||||
|
||||
public static void regCommonEvents()
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import net.minecraft.world.level.material.Material;
|
|||
import net.minecraft.world.scores.Objective;
|
||||
import net.minecraft.world.scores.Score;
|
||||
import net.minecraft.world.scores.Scoreboard;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class ScriptParseHelper
|
||||
{
|
||||
|
|
@ -256,7 +257,7 @@ public class ScriptParseHelper
|
|||
for (MobEffectInstance effect : effects)
|
||||
{
|
||||
int amp = effect.getAmplifier();
|
||||
String name = effect.getEffect().getRegistryName().toString();
|
||||
String name = ForgeRegistries.MOB_EFFECTS.getKey(effect.getEffect()).toString();
|
||||
|
||||
if (names.contains(name))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,11 @@ import javax.annotation.Nullable;
|
|||
import com.mojang.brigadier.StringReader;
|
||||
|
||||
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.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.TagParser;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
|
@ -32,12 +36,11 @@ public class StringParser
|
|||
if (string == null)
|
||||
return null;
|
||||
|
||||
BlockStateParser parser = new BlockStateParser(new StringReader(string), false);
|
||||
|
||||
try
|
||||
{
|
||||
parser.parse(false);
|
||||
return parser.getState();
|
||||
BlockResult result = BlockStateParser.parseForBlock(HolderLookup.forRegistry(Registry.BLOCK), new StringReader(string), false);
|
||||
return result.blockState();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
@ -52,12 +55,11 @@ public class StringParser
|
|||
if (string == null)
|
||||
return null;
|
||||
|
||||
ItemParser parser = new ItemParser(new StringReader(string), false);
|
||||
|
||||
try
|
||||
{
|
||||
parser.parse();
|
||||
return parser.getItem();
|
||||
ItemResult res = ItemParser.parseForItem(HolderLookup.forRegistry(Registry.ITEM), new StringReader(string));
|
||||
return res.item().get();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
@ -71,13 +73,13 @@ public class StringParser
|
|||
if (string == null)
|
||||
return null;
|
||||
|
||||
ItemParser parser = new ItemParser(new StringReader(string), false);
|
||||
|
||||
try
|
||||
{
|
||||
parser.parse();
|
||||
Item item = parser.getItem();
|
||||
CompoundTag nbt = parser.getNbt();
|
||||
ItemResult res = ItemParser.parseForItem(HolderLookup.forRegistry(Registry.ITEM), new StringReader(string));
|
||||
|
||||
Item item = res.item().get();
|
||||
CompoundTag nbt = res.nbt();
|
||||
|
||||
ItemStack stack = new ItemStack(item, 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.ClickEvent.Action;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
|
|
@ -33,8 +32,9 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.BlockSnapshot;
|
||||
import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent;
|
||||
import net.minecraftforge.event.level.BlockEvent.EntityPlaceEvent;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
import tschipp.carryon.common.config.Configs.Settings;
|
||||
|
|
@ -51,7 +51,6 @@ public class ItemCarryonBlock extends Item
|
|||
public ItemCarryonBlock()
|
||||
{
|
||||
super(new Item.Properties().stacksTo(1));
|
||||
this.setRegistryName(CarryOn.MODID, "tile_item");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -77,7 +76,7 @@ public class ItemCarryonBlock extends Item
|
|||
return getItemStack(stack).getHoverName();
|
||||
}
|
||||
|
||||
return new TextComponent("");
|
||||
return Component.literal("");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -207,7 +206,7 @@ public class ItemCarryonBlock extends Item
|
|||
{
|
||||
CarryOn.LOGGER.info("Block: " + ItemCarryonBlock.getBlock(stack));
|
||||
CarryOn.LOGGER.info("BlockState: " + ItemCarryonBlock.getBlockState(stack));
|
||||
// CarryOn.LOGGER.info("Meta: " + ItemTile.getMeta(stack));
|
||||
// CarryOn.LOGGER.info("Meta: " + itemTile.get().getMeta(stack));
|
||||
CarryOn.LOGGER.info("ItemStack: " + ItemCarryonBlock.getItemStack(stack));
|
||||
|
||||
if (ModelOverridesHandler.hasCustomOverrideModel(ItemCarryonBlock.getBlockState(stack), ItemCarryonBlock.getTileData(stack)))
|
||||
|
|
@ -216,10 +215,10 @@ public class ItemCarryonBlock extends Item
|
|||
if (CustomPickupOverrideHandler.hasSpecialPickupConditions(ItemCarryonBlock.getBlockState(stack)))
|
||||
CarryOn.LOGGER.info("Custom Pickup Condition: " + CustomPickupOverrideHandler.getPickupCondition(ItemCarryonBlock.getBlockState(stack)));
|
||||
|
||||
player.displayClientMessage(new TextComponent(ChatFormatting.RED + "Error detected. Cannot place block. Execute \"/carryon clear\" to remove the item"), false);
|
||||
TextComponent s = new TextComponent(ChatFormatting.GOLD + "here");
|
||||
player.displayClientMessage(Component.literal(ChatFormatting.RED + "Error detected. Cannot place block. Execute \"/carryon clear\" to remove the item"), false);
|
||||
Component s = Component.literal(ChatFormatting.GOLD + "here");
|
||||
s.getStyle().withClickEvent(new ClickEvent(Action.OPEN_URL, "https://github.com/Tschipp/CarryOn/issues"));
|
||||
player.displayClientMessage(new TextComponent(ChatFormatting.RED + "Please report this error ").append(s), false);
|
||||
player.displayClientMessage(Component.literal(ChatFormatting.RED + "Please report this error ").append(s), false);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -276,7 +275,7 @@ public class ItemCarryonBlock extends Item
|
|||
// ItemStack drop = new ItemStack(state.getBlock().getItemDropped(state,
|
||||
// itemRand, 0), 1, state.getBlock().damageDropped(state));
|
||||
|
||||
tag.putString("block", state.getBlock().getRegistryName().toString());
|
||||
tag.putString("block", ForgeRegistries.BLOCKS.getKey(state.getBlock()).toString());
|
||||
// Item item = Item.getItemFromBlock(state.getBlock());
|
||||
// tag.setInt("meta", drop.getItemDamage());
|
||||
tag.putInt("stateid", Block.getId(state));
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
|
|
@ -28,7 +26,6 @@ import net.minecraft.world.level.Level;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
import tschipp.carryon.common.config.Configs.Settings;
|
||||
import tschipp.carryon.common.event.ItemEvents;
|
||||
|
|
@ -49,7 +46,6 @@ public class ItemCarryonEntity extends Item
|
|||
public ItemCarryonEntity()
|
||||
{
|
||||
super(new Item.Properties().stacksTo(1));
|
||||
this.setRegistryName(CarryOn.MODID, "entity_item");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -58,10 +54,10 @@ public class ItemCarryonEntity extends Item
|
|||
if (hasEntityData(stack))
|
||||
{
|
||||
|
||||
return new TranslatableComponent(getEntityType(stack).getDescriptionId());
|
||||
return Component.translatable(getEntityType(stack).getDescriptionId());
|
||||
}
|
||||
|
||||
return new TextComponent("");
|
||||
return Component.literal("");
|
||||
}
|
||||
|
||||
public static boolean hasEntityData(ItemStack stack)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import tschipp.carryon.common.config.Configs.Settings;
|
||||
import tschipp.carryon.common.handler.ListHandler;
|
||||
import tschipp.carryon.common.helper.ScriptParseHelper;
|
||||
|
|
@ -58,7 +59,7 @@ public class ScriptChecker
|
|||
if (!Settings.useScripts.get())
|
||||
return null;
|
||||
|
||||
String name = entity.getType().getRegistryName().toString();
|
||||
String name = ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()).toString();
|
||||
float height = entity.getBbHeight();
|
||||
float width = entity.getBbWidth();
|
||||
float health = entity instanceof LivingEntity ? ((LivingEntity) entity).getHealth() : 0.0f;
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@
|
|||
//
|
||||
// PlayerModel<?> model = event.getModelPlayer();
|
||||
// ItemStack stack = player.getMainHandItem();
|
||||
// if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile &&
|
||||
// if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile.get() &&
|
||||
// ItemCarryonBlock.hasTileData(stack) || stack.getItem() ==
|
||||
// RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))
|
||||
// RegistrationHandler.itemEntity.get() && ItemCarryonEntity.hasEntityData(stack))
|
||||
// {
|
||||
//
|
||||
// float rotation = 0;
|
||||
|
|
@ -66,11 +66,11 @@
|
|||
// else if (renderLeft)
|
||||
// {
|
||||
// renderArmPre(model.leftArm, 0.8F + (player.isShiftKeyDown() ? 0.2f : 0f) -
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation);
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.15f : 0), rotation);
|
||||
// renderArmPre(model.leftSleeve, 0.8F + (player.isShiftKeyDown() ? 0.2f : 0f) -
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation);
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.15f : 0), rotation);
|
||||
// }
|
||||
//
|
||||
// if (renderRight && rotRight != null)
|
||||
|
|
@ -83,28 +83,28 @@
|
|||
// else if (renderRight)
|
||||
// {
|
||||
// renderArmPre(model.rightArm, 0.8F + (player.isShiftKeyDown() ? 0.2f : 0f) -
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation);
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.15f : 0), rotation);
|
||||
// renderArmPre(model.rightSleeve, 0.8F + (player.isShiftKeyDown() ? 0.2f : 0f)
|
||||
// - (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation);
|
||||
// - (stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.15f : 0), rotation);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// renderArmPre(model.rightArm, 0.8F + (player.isShiftKeyDown() ? 0.2f : 0f) -
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation);
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.15f : 0), rotation);
|
||||
// renderArmPre(model.rightSleeve, 0.8F + (player.isShiftKeyDown() ? 0.2f : 0f)
|
||||
// - (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation);
|
||||
// - (stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.15f : 0), rotation);
|
||||
// renderArmPre(model.leftArm, 0.8F + (player.isShiftKeyDown() ? 0.2f : 0f) -
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation);
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.15f : 0), rotation);
|
||||
// renderArmPre(model.leftSleeve, 0.8F + (player.isShiftKeyDown() ? 0.2f : 0f) -
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation);
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity.get() ? -0.2f : 0),
|
||||
// (stack.getItem() == RegistrationHandler.itemEntity.get() ? 0.15f : 0), rotation);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -43,13 +43,16 @@ public class CarrySlotPacket
|
|||
buf.writeInt(this.entityid);
|
||||
}
|
||||
|
||||
public void handle(Supplier<NetworkEvent.Context> ctx)
|
||||
public boolean handle(Supplier<NetworkEvent.Context> ctx)
|
||||
{
|
||||
if (ctx.get().getDirection().getReceptionSide().isClient())
|
||||
{
|
||||
ctx.get().setPacketHandled(true);
|
||||
|
||||
ctx.get().enqueueWork(() -> {
|
||||
|
||||
Level level = CarryOn.proxy.getLevel();
|
||||
ctx.get().setPacketHandled(true);
|
||||
|
||||
if (level != null)
|
||||
{
|
||||
|
|
@ -57,7 +60,7 @@ public class CarrySlotPacket
|
|||
|
||||
if (e instanceof Player player)
|
||||
{
|
||||
ctx.get().setPacketHandled(true);
|
||||
|
||||
|
||||
if (this.slot >= 9)
|
||||
{
|
||||
|
|
@ -76,6 +79,8 @@ public class CarrySlotPacket
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ public class ScriptReloadPacket
|
|||
{
|
||||
private List<CarryOnOverride> overrides = new ArrayList<>();
|
||||
|
||||
public ScriptReloadPacket()
|
||||
{
|
||||
}
|
||||
// public ScriptReloadPacket()
|
||||
// {
|
||||
// }
|
||||
|
||||
public ScriptReloadPacket(Collection<CarryOnOverride> collection)
|
||||
{
|
||||
|
|
@ -38,10 +38,11 @@ public class ScriptReloadPacket
|
|||
this.overrides.forEach(override -> override.serialize(buf));
|
||||
}
|
||||
|
||||
public void handle(Supplier<NetworkEvent.Context> ctx)
|
||||
public boolean handle(Supplier<NetworkEvent.Context> ctx)
|
||||
{
|
||||
if (ctx.get().getDirection().getReceptionSide().isClient())
|
||||
{
|
||||
ctx.get().setPacketHandled(true);
|
||||
ctx.get().enqueueWork(() -> {
|
||||
|
||||
ScriptReader.OVERRIDES.clear();
|
||||
|
|
@ -50,9 +51,10 @@ public class ScriptReloadPacket
|
|||
ScriptReader.OVERRIDES.put(override.hashCode(), override);
|
||||
});
|
||||
|
||||
ctx.get().setPacketHandled(true);
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,19 +26,21 @@ public class SyncKeybindPacket
|
|||
buf.writeBoolean(this.pressed);
|
||||
}
|
||||
|
||||
public void handle(Supplier<NetworkEvent.Context> ctx)
|
||||
public boolean handle(Supplier<NetworkEvent.Context> ctx)
|
||||
{
|
||||
if (ctx.get().getDirection().getReceptionSide().isServer())
|
||||
{
|
||||
ctx.get().setPacketHandled(true);
|
||||
ctx.get().enqueueWork(() -> {
|
||||
|
||||
ServerPlayer player = ctx.get().getSender();
|
||||
|
||||
CarryOnKeybinds.setKeyPressed(player, this.pressed);
|
||||
|
||||
ctx.get().setPacketHandled(true);
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ public class ClientProxy implements IProxy
|
|||
{
|
||||
RegistrationHandler.regClientEvents();
|
||||
|
||||
CarryOnKeybinds.init();
|
||||
|
||||
new ScrollCallbackWrapper().setup(Minecraft.getInstance());
|
||||
new KeyboardCallbackWrapper().setup(Minecraft.getInstance());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
modLoader="javafml"
|
||||
loaderVersion="[40,)"
|
||||
loaderVersion="[41,)"
|
||||
issueTrackerURL="https://github.com/Tschipp/CarryOn/issues"
|
||||
logoFile="logo.png"
|
||||
license="GNU LGPLv3"
|
||||
|
|
@ -18,7 +18,7 @@ license="GNU LGPLv3"
|
|||
# Does this dependency have to exist - if not, ordering below must be specified
|
||||
mandatory=true #mandatory
|
||||
# The version range of the dependency
|
||||
versionRange="[40.0.3,)" #mandatory
|
||||
versionRange="[41,)" #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
|
||||
|
|
@ -27,6 +27,6 @@ license="GNU LGPLv3"
|
|||
[[dependencies.carryon]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.18.2,1.19)"
|
||||
versionRange="[1.19,1.20)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
|
|
|||
16
src/main/resources/assets/carryon/lang/pt_br.json
Normal file
16
src/main/resources/assets/carryon/lang/pt_br.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"carryon.category.settings": "Configurações",
|
||||
"carryon.category.blacklist": "Lista negra",
|
||||
"carryon.category.modeloverrides": "Substituições de modelo (avançado)",
|
||||
"carryon.category.custompickupconditions": "Condições de coleta personalizadas (avançado)",
|
||||
"carryon.category.whitelist": "Lista branca",
|
||||
|
||||
"carryon.general.modeloverrides.modeloverrides": "Substituições de modelo",
|
||||
"carryon.general.blacklist.forbiddenentities": "Entidades que o Jogador não pode pegar",
|
||||
"carryon.general.blacklist.forbiddentiles": "Blocos que o jogador não pode pegar",
|
||||
"carryon.category.custompickupconditions.custompickupconditionsblocks": "Condições personalizadas de coleta de blocos",
|
||||
"carryon.category.custompickupconditions.custompickupconditionsentities": "Condições de coleta de entidade personalizada",
|
||||
|
||||
"key.carry.desc": "Carry",
|
||||
"key.carry.category": "Carry On"
|
||||
}
|
||||
16
src/main/resources/assets/carryon/lang/sv_se.json
Normal file
16
src/main/resources/assets/carryon/lang/sv_se.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"carryon.category.settings": "Inställningar",
|
||||
"carryon.category.blacklist": "Svartlista",
|
||||
"carryon.category.modeloverrides": "Åsidosättningar för modeller (avancerat)",
|
||||
"carryon.category.custompickupconditions": "Anpassade villkor för att kunna plocka upp (avancerat)",
|
||||
"carryon.category.whitelist": "Vitlista",
|
||||
|
||||
"carryon.general.modeloverrides.modeloverrides": "Åsidosättningar för modeller",
|
||||
"carryon.general.blacklist.forbiddenentities": "Entiteter som spelare inte kan plocka upp",
|
||||
"carryon.general.blacklist.forbiddentiles": "Block som spelare inte kan plocka upp",
|
||||
"carryon.category.custompickupconditions.custompickupconditionsblocks": "Anpassade villkor för att kunna plocka upp block",
|
||||
"carryon.category.custompickupconditions.custompickupconditionsentities": "Anpassade villkor för att kunna plocka upp entiteter",
|
||||
|
||||
"key.carry.desc": "Plocka upp",
|
||||
"key.carry.category": "Carry On"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user