fixed 1.19
This commit is contained in:
parent
a5c47c9152
commit
337ccf5df9
|
|
@ -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.18.0
|
||||
version=1.18.1
|
||||
minecraft_version=1.19
|
||||
mappings_version=1.18.2-2022.06.05-1.19
|
||||
forge_version=41.0.17
|
||||
mappings_version=1.18.2-2022.07.17-1.19
|
||||
forge_version=41.0.100
|
||||
org.gradle.daemon=false
|
||||
# chorg.gradle.java.home=C:/Program Files/AdoptOpenJDK/jdk-17.0.1/
|
||||
|
|
@ -61,7 +61,7 @@ public class CarryOn
|
|||
String version = info.getVersion().toString();
|
||||
// PreInitevent.
|
||||
CarryOn.network = NetworkRegistry.newSimpleChannel(new ResourceLocation(CarryOn.MODID, "carryonpackets"), () -> version, version::equals, version::equals);
|
||||
|
||||
|
||||
// CLIENT PACKETS
|
||||
CarryOn.network.registerMessage(0, CarrySlotPacket.class, CarrySlotPacket::toBytes, CarrySlotPacket::new, CarrySlotPacket::handle, Optional.of(NetworkDirection.PLAY_TO_CLIENT));
|
||||
CarryOn.network.registerMessage(1, ScriptReloadPacket.class, ScriptReloadPacket::toBytes, ScriptReloadPacket::new, ScriptReloadPacket::handle, Optional.of(NetworkDirection.PLAY_TO_CLIENT));
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
@ -672,7 +672,7 @@ 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.get() && ItemCarryonBlock.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity.get() && ItemCarryonEntity.hasEntityData(stack)))
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,7 +42,7 @@ 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.get() && ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
|
|
@ -65,10 +65,10 @@ 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();
|
||||
|
|
@ -89,13 +89,13 @@ 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();
|
||||
|
||||
|
|
@ -243,9 +243,9 @@ 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.get() && ItemCarryonEntity.hasEntityData(main))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package tschipp.carryon.common.event;
|
||||
|
||||
import java.awt.TextComponent;
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.ChatFormatting;
|
||||
|
|
@ -28,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;
|
||||
|
|
@ -50,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;
|
||||
|
|
@ -72,7 +73,7 @@ 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.get() && ItemCarryonBlock.hasTileData(stack))
|
||||
{
|
||||
|
|
@ -95,10 +96,10 @@ 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();
|
||||
|
|
@ -147,9 +148,9 @@ 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();
|
||||
|
|
@ -175,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,12 +199,18 @@ 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)
|
||||
{
|
||||
|
|
@ -236,7 +243,7 @@ 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();
|
||||
|
|
@ -248,7 +255,7 @@ 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.get() || stack.getItem() == RegistrationHandler.itemEntity.get()))
|
||||
{
|
||||
|
|
@ -271,7 +278,7 @@ 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();
|
||||
|
|
@ -289,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;
|
||||
|
|
@ -299,7 +306,7 @@ 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);
|
||||
|
||||
|
|
@ -434,7 +441,7 @@ 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);
|
||||
|
|
@ -461,9 +468,9 @@ 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.get())) || player.getInventory().contains(new ItemStack(RegistrationHandler.itemEntity.get()));
|
||||
|
|
|
|||
|
|
@ -3,10 +3,6 @@ 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;
|
||||
|
|
@ -108,13 +104,13 @@ public class CustomPickupOverrideHandler
|
|||
if (!ModList.get().isLoaded("gamestages"))
|
||||
return false;
|
||||
|
||||
String name = ForgeRegistries.ENTITIES.getKey(entity.getType()).toString();
|
||||
String name = ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()).toString();
|
||||
return PICKUP_CONDITIONS_ENTITIES.containsKey(name);
|
||||
}
|
||||
|
||||
public static String getPickupCondition(Entity entity)
|
||||
{
|
||||
String name = ForgeRegistries.ENTITIES.getKey(entity.getType()).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;
|
||||
|
||||
|
|
@ -61,7 +62,7 @@ public class ListHandler
|
|||
|
||||
public static boolean isForbidden(Entity entity)
|
||||
{
|
||||
String name = ForgeRegistries.ENTITIES.getKey(entity.getType()).toString();
|
||||
String name = ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()).toString();
|
||||
boolean contains = FORBIDDEN_ENTITIES.contains(name);
|
||||
|
||||
for (TagKey<EntityType<?>> tag : FORBIDDEN_ENTITIES_TAGS)
|
||||
|
|
@ -75,7 +76,7 @@ public class ListHandler
|
|||
|
||||
public static boolean isAllowed(Entity entity)
|
||||
{
|
||||
String name = ForgeRegistries.ENTITIES.getKey(entity.getType()).toString();
|
||||
String name = ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()).toString();
|
||||
boolean contains = ALLOWED_ENTITIES.contains(name);
|
||||
|
||||
for (TagKey<EntityType<?>> tag : ALLOWED_ENTITIES_TAGS)
|
||||
|
|
@ -89,7 +90,7 @@ public class ListHandler
|
|||
|
||||
public static boolean isStackingForbidden(Entity entity)
|
||||
{
|
||||
String name = ForgeRegistries.ENTITIES.getKey(entity.getType()).toString();
|
||||
String name = ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()).toString();
|
||||
boolean contains = FORBIDDEN_STACKING.contains(name);
|
||||
|
||||
for (TagKey<EntityType<?>> tag : FORBIDDEN_STACKING_TAGS)
|
||||
|
|
@ -103,7 +104,7 @@ public class ListHandler
|
|||
|
||||
public static boolean isStackingAllowed(Entity entity)
|
||||
{
|
||||
String name = ForgeRegistries.ENTITIES.getKey(entity.getType()).toString();
|
||||
String name = ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()).toString();
|
||||
boolean contains = ALLOWED_STACKING.contains(name);
|
||||
|
||||
for (TagKey<EntityType<?>> tag : ALLOWED_STACKING_TAGS)
|
||||
|
|
@ -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,6 +281,7 @@ public class ListHandler
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
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,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;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
|||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.client.event.RenderEntityEvents;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ 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;
|
||||
|
|
|
|||
|
|
@ -26,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;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class ScriptChecker
|
|||
if (!Settings.useScripts.get())
|
||||
return null;
|
||||
|
||||
String name = ForgeRegistries.ENTITIES.getKey(entity.getType()).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;
|
||||
|
|
|
|||
|
|
@ -43,21 +43,24 @@ 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)
|
||||
{
|
||||
Entity e = level.getEntity(this.entityid);
|
||||
|
||||
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());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user