fixed bugs
This commit is contained in:
parent
308fc5c775
commit
058df989fc
|
|
@ -1,16 +1,9 @@
|
|||
package tschipp.carryon;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
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;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
|
|
@ -21,22 +14,22 @@ import net.minecraftforge.fml.network.NetworkDirection;
|
|||
import net.minecraftforge.fml.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.network.simple.SimpleChannel;
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import tschipp.carryon.common.config.Configs;
|
||||
import tschipp.carryon.common.handler.RegistrationHandler;
|
||||
import tschipp.carryon.network.client.CarrySlotPacket;
|
||||
import tschipp.carryon.network.client.ScriptReloadPacket;
|
||||
import tschipp.carryon.network.server.SyncKeybindPacket;
|
||||
import tschipp.carryon.proxy.ClientProxy;
|
||||
import tschipp.carryon.proxy.IProxy;
|
||||
import tschipp.carryon.proxy.ServerProxy;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Optional;
|
||||
|
||||
@Mod(CarryOn.MODID)
|
||||
@EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class CarryOn
|
||||
{
|
||||
|
||||
public static IProxy proxy = DistExecutor.safeRunForDist(() -> ClientProxy::new, () -> ServerProxy::new);
|
||||
|
||||
public static final String MODID = "carryon";
|
||||
public static final Logger LOGGER = LogManager.getFormatterLogger("CarryOn");
|
||||
public static final String DEPENDENCIES = "required-after:forge@[13.20.1.2386,);after:gamestages;";
|
||||
|
|
@ -72,12 +65,8 @@ public class CarryOn
|
|||
CarryOn.network.registerMessage(2, SyncKeybindPacket.class, SyncKeybindPacket::toBytes, SyncKeybindPacket::new, SyncKeybindPacket::handle, Optional.of(NetworkDirection.PLAY_TO_SERVER));
|
||||
|
||||
RegistrationHandler.regCommonEvents();
|
||||
|
||||
// Init
|
||||
RegistrationHandler.regOverrideList();
|
||||
RegistrationHandler.regCaps();
|
||||
|
||||
proxy.setup(event);
|
||||
RegistrationHandler.regOverrideList();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
package tschipp.carryon.client.event;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
|
|
@ -14,6 +11,7 @@ import net.minecraft.client.GameSettings;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer.Impl;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
|
|
@ -49,7 +47,6 @@ import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
|
|||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.client.event.ClientPlayerNetworkEvent.LoggedInEvent;
|
||||
import net.minecraftforge.event.TickEvent.PlayerTickEvent;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
|
|
@ -60,7 +57,6 @@ import tschipp.carryon.CarryOn;
|
|||
import tschipp.carryon.client.helper.CarryRenderHelper;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
import tschipp.carryon.common.config.Configs.Settings;
|
||||
import tschipp.carryon.common.handler.ListHandler;
|
||||
import tschipp.carryon.common.handler.ModelOverridesHandler;
|
||||
import tschipp.carryon.common.handler.RegistrationHandler;
|
||||
import tschipp.carryon.common.helper.KeyboardCallbackWrapper.KeyPressedEvent;
|
||||
|
|
@ -73,6 +69,10 @@ import tschipp.carryon.common.scripting.CarryOnOverride;
|
|||
import tschipp.carryon.common.scripting.ScriptChecker;
|
||||
import tschipp.carryon.network.server.SyncKeybindPacket;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class RenderEvents
|
||||
{
|
||||
/*
|
||||
|
|
@ -242,7 +242,7 @@ public class RenderEvents
|
|||
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack) && perspective == 0 && !f1)
|
||||
{
|
||||
if (ModList.get().isLoaded("realrender") || ModList.get().isLoaded("rfpr"))
|
||||
if (ModList.get().isLoaded("firstperson") || ModList.get().isLoaded("firstpersonmod"))
|
||||
return;
|
||||
|
||||
Block block = ItemCarryonBlock.getBlock(stack);
|
||||
|
|
@ -299,13 +299,13 @@ public class RenderEvents
|
|||
matrix.popPose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @SubscribeEvent
|
||||
// public void onJoinServer(LoggedInEvent event)
|
||||
// {
|
||||
// ListHandler.initConfigLists();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Render blocks and entities in third person
|
||||
|
|
@ -317,118 +317,128 @@ public class RenderEvents
|
|||
{
|
||||
World world = Minecraft.getInstance().level;
|
||||
float partialticks = event.getPartialTicks();
|
||||
Impl buffer = IRenderTypeBuffer.immediate(Tessellator.getInstance().getBuilder());
|
||||
MatrixStack matrix = event.getMatrixStack();
|
||||
int light = 0;
|
||||
int perspective = CarryRenderHelper.getPerspective();
|
||||
EntityRendererManager manager = Minecraft.getInstance().getEntityRenderDispatcher();
|
||||
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.disableCull();
|
||||
RenderSystem.disableDepthTest();
|
||||
Map<RenderType, BufferBuilder> builders = new ImmutableMap.Builder<RenderType, BufferBuilder>()
|
||||
.put(RenderType.glint(), new BufferBuilder(RenderType.glint().bufferSize()))
|
||||
.put(RenderType.glintDirect(), new BufferBuilder(RenderType.glintDirect().bufferSize()))
|
||||
.put(RenderType.glintTranslucent(), new BufferBuilder(RenderType.glintTranslucent().bufferSize()))
|
||||
.put(RenderType.entityGlint(), new BufferBuilder(RenderType.entityGlint().bufferSize()))
|
||||
.put(RenderType.entityGlintDirect(), new BufferBuilder(RenderType.entityGlintDirect().bufferSize()))
|
||||
.build();
|
||||
Impl buffer = IRenderTypeBuffer.immediateWithBuffers(builders, Tessellator.getInstance().getBuilder());
|
||||
|
||||
for (PlayerEntity player : world.players())
|
||||
{
|
||||
if (perspective == 0 && player == Minecraft.getInstance().player)
|
||||
continue;
|
||||
|
||||
light = Minecraft.getInstance().getEntityRenderDispatcher().getPackedLightCoords(player, partialticks);
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
for (PlayerEntity player : world.players()) {
|
||||
try {
|
||||
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack))
|
||||
{
|
||||
Block block = ItemCarryonBlock.getBlock(stack);
|
||||
BlockState state = ItemCarryonBlock.getBlockState(stack);
|
||||
CompoundNBT tag = ItemCarryonBlock.getTileData(stack);
|
||||
ItemStack tileItem = ItemCarryonBlock.getItemStack(stack);
|
||||
if (perspective == 0 && player == Minecraft.getInstance().player && !(ModList.get().isLoaded("firstperson") || ModList.get().isLoaded("firstpersonmod")))
|
||||
continue;
|
||||
|
||||
applyBlockTransformations(player, partialticks, matrix, block);
|
||||
|
||||
IBakedModel model = ModelOverridesHandler.hasCustomOverrideModel(state, tag) ? ModelOverridesHandler.getCustomOverrideModel(state, tag, world, player) : (tileItem.isEmpty() ? Minecraft.getInstance().getBlockRenderer().getBlockModel(state) : Minecraft.getInstance().getItemRenderer().getModel(tileItem, world, player));
|
||||
light = Minecraft.getInstance().getEntityRenderDispatcher().getPackedLightCoords(player, partialticks);
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
|
||||
CarryOnOverride carryOverride = ScriptChecker.getOverride(player);
|
||||
if (carryOverride != null)
|
||||
{
|
||||
CarryRenderHelper.performOverrideTransformation(matrix, carryOverride);
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack)) {
|
||||
Block block = ItemCarryonBlock.getBlock(stack);
|
||||
BlockState state = ItemCarryonBlock.getBlockState(stack);
|
||||
CompoundNBT tag = ItemCarryonBlock.getTileData(stack);
|
||||
ItemStack tileItem = ItemCarryonBlock.getItemStack(stack);
|
||||
|
||||
if (!carryOverride.getRenderNameBlock().isEmpty())
|
||||
{
|
||||
Block b = StringParser.getBlock(carryOverride.getRenderNameBlock());
|
||||
if (b != null)
|
||||
{
|
||||
ItemStack s = new ItemStack(b, 1);
|
||||
s.setTag(carryOverride.getRenderNBT());
|
||||
model = Minecraft.getInstance().getItemRenderer().getModel(s, world, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
applyBlockTransformations(player, partialticks, matrix, block);
|
||||
|
||||
Minecraft.getInstance().getTextureManager().bind(AtlasTexture.LOCATION_BLOCKS);
|
||||
CarryRenderHelper.renderItem(state, tag, stack, tileItem, matrix, buffer, light, model);
|
||||
buffer.endBatch();
|
||||
|
||||
matrix.popPose();
|
||||
|
||||
drawArms(player, partialticks, matrix, buffer, light);
|
||||
|
||||
matrix.popPose();
|
||||
}
|
||||
else if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
Entity entity = RenderEntityEvents.getEntity(stack, world);
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
applyEntityTransformations(player, partialticks, matrix, entity);
|
||||
|
||||
manager.setRenderShadow(false);
|
||||
IBakedModel model = ModelOverridesHandler.hasCustomOverrideModel(state, tag) ? ModelOverridesHandler.getCustomOverrideModel(state, tag, world, player) : (tileItem.isEmpty() ? Minecraft.getInstance().getBlockRenderer().getBlockModel(state) : Minecraft.getInstance().getItemRenderer().getModel(tileItem, world, player));
|
||||
|
||||
CarryOnOverride carryOverride = ScriptChecker.getOverride(player);
|
||||
if (carryOverride != null)
|
||||
{
|
||||
if (carryOverride != null) {
|
||||
CarryRenderHelper.performOverrideTransformation(matrix, carryOverride);
|
||||
|
||||
String entityname = carryOverride.getRenderNameEntity();
|
||||
if (entityname != null)
|
||||
{
|
||||
Entity newEntity = null;
|
||||
|
||||
Optional<EntityType<?>> type = EntityType.byString(entityname);
|
||||
if (type.isPresent())
|
||||
newEntity = type.get().create(world);
|
||||
|
||||
if (newEntity != null)
|
||||
{
|
||||
CompoundNBT nbttag = carryOverride.getRenderNBT();
|
||||
if (nbttag != null)
|
||||
newEntity.deserializeNBT(nbttag);
|
||||
entity = newEntity;
|
||||
entity.yRot = 0.0f;
|
||||
entity.yRotO = 0.0f;
|
||||
entity.setYHeadRot(0.0f);
|
||||
entity.xRot = 0.0f;
|
||||
entity.xRotO = 0.0f;
|
||||
if (!carryOverride.getRenderNameBlock().isEmpty()) {
|
||||
Block b = StringParser.getBlock(carryOverride.getRenderNameBlock());
|
||||
if (b != null) {
|
||||
ItemStack s = new ItemStack(b, 1);
|
||||
s.setTag(carryOverride.getRenderNBT());
|
||||
model = Minecraft.getInstance().getItemRenderer().getModel(s, world, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity instanceof LivingEntity)
|
||||
((LivingEntity) entity).hurtTime = 0;
|
||||
|
||||
manager.render(entity, 0, 0, 0, 0f, 0, matrix, buffer, light);
|
||||
Minecraft.getInstance().getTextureManager().bind(AtlasTexture.LOCATION_BLOCKS);
|
||||
CarryRenderHelper.renderItem(state, tag, stack, tileItem, matrix, buffer, light, model);
|
||||
buffer.endBatch();
|
||||
|
||||
matrix.popPose();
|
||||
|
||||
drawArms(player, partialticks, matrix, buffer, light);
|
||||
|
||||
manager.setRenderShadow(true);
|
||||
|
||||
matrix.popPose();
|
||||
}
|
||||
}
|
||||
} else if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack)) {
|
||||
Entity entity = RenderEntityEvents.getEntity(stack, world);
|
||||
|
||||
if (entity != null) {
|
||||
applyEntityTransformations(player, partialticks, matrix, entity);
|
||||
|
||||
manager.setRenderShadow(false);
|
||||
|
||||
CarryOnOverride carryOverride = ScriptChecker.getOverride(player);
|
||||
if (carryOverride != null) {
|
||||
CarryRenderHelper.performOverrideTransformation(matrix, carryOverride);
|
||||
|
||||
String entityname = carryOverride.getRenderNameEntity();
|
||||
if (entityname != null) {
|
||||
Entity newEntity = null;
|
||||
|
||||
Optional<EntityType<?>> type = EntityType.byString(entityname);
|
||||
if (type.isPresent())
|
||||
newEntity = type.get().create(world);
|
||||
|
||||
if (newEntity != null) {
|
||||
CompoundNBT nbttag = carryOverride.getRenderNBT();
|
||||
if (nbttag != null)
|
||||
newEntity.deserializeNBT(nbttag);
|
||||
entity = newEntity;
|
||||
entity.yRot = 0.0f;
|
||||
entity.yRotO = 0.0f;
|
||||
entity.setYHeadRot(0.0f);
|
||||
entity.xRot = 0.0f;
|
||||
entity.xRotO = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity instanceof LivingEntity)
|
||||
((LivingEntity) entity).hurtTime = 0;
|
||||
|
||||
manager.render(entity, 0, 0, 0, 0f, 0, matrix, buffer, light);
|
||||
buffer.endBatch();
|
||||
|
||||
matrix.popPose();
|
||||
|
||||
drawArms(player, partialticks, matrix, buffer, light);
|
||||
|
||||
manager.setRenderShadow(true);
|
||||
|
||||
matrix.popPose();
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
buffer.endBatch();
|
||||
|
||||
buffer.endBatch(RenderType.entitySolid(AtlasTexture.LOCATION_BLOCKS));
|
||||
buffer.endBatch(RenderType.entityCutout(AtlasTexture.LOCATION_BLOCKS));
|
||||
buffer.endBatch(RenderType.entityCutoutNoCull(AtlasTexture.LOCATION_BLOCKS));
|
||||
buffer.endBatch(RenderType.entitySmoothCutout(AtlasTexture.LOCATION_BLOCKS));
|
||||
|
||||
RenderSystem.enableDepthTest();
|
||||
RenderSystem.enableCull();
|
||||
RenderSystem.disableBlend();
|
||||
|
|
|
|||
|
|
@ -15,14 +15,12 @@ public class PositionProvider implements ICapabilitySerializable<CompoundNBT>
|
|||
|
||||
private IPosition instance = POSITION_CAPABILITY.getDefaultInstance();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side)
|
||||
{
|
||||
if (cap == POSITION_CAPABILITY)
|
||||
return (LazyOptional<T>) LazyOptional.of(() -> {
|
||||
return new TEPosition();
|
||||
});
|
||||
return (LazyOptional<T>) LazyOptional.of(TEPosition::new);
|
||||
|
||||
return LazyOptional.empty();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
package tschipp.carryon.common.config;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.electronwill.nightconfig.core.CommentedConfig;
|
||||
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.minecraftforge.common.ForgeConfigSpec.BooleanValue;
|
||||
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
|
||||
|
|
@ -18,9 +14,13 @@ import net.minecraftforge.fml.config.ModConfig;
|
|||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.common.handler.ListHandler;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = CarryOn.MODID, bus = Bus.MOD)
|
||||
public class Configs {
|
||||
|
||||
|
||||
private static final ForgeConfigSpec.Builder SERVER_BUILDER = new ForgeConfigSpec.Builder();
|
||||
private static final ForgeConfigSpec.Builder CLIENT_BUILDER = new ForgeConfigSpec.Builder();
|
||||
|
||||
|
|
@ -28,92 +28,90 @@ public class Configs {
|
|||
public static final ForgeConfigSpec CLIENT_CONFIG;
|
||||
|
||||
static {
|
||||
|
||||
|
||||
Settings.init(SERVER_BUILDER, CLIENT_BUILDER);
|
||||
Blacklist.init(SERVER_BUILDER, CLIENT_BUILDER);
|
||||
WhiteList.init(SERVER_BUILDER, CLIENT_BUILDER);
|
||||
ModelOverrides.init(SERVER_BUILDER, CLIENT_BUILDER);
|
||||
CustomPickupConditions.init(SERVER_BUILDER, CLIENT_BUILDER);
|
||||
|
||||
|
||||
SERVER_CONFIG = SERVER_BUILDER.build();
|
||||
CLIENT_CONFIG = CLIENT_BUILDER.build();
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onLoad(final ModConfig.Loading event)
|
||||
{
|
||||
if (event.getConfig().getModId().equals(CarryOn.MODID))
|
||||
{
|
||||
if (event.getConfig().getModId().equals(CarryOn.MODID)) {
|
||||
ListHandler.initConfigLists();
|
||||
|
||||
CommentedConfig cfg = event.getConfig().getConfigData();
|
||||
|
||||
|
||||
if(cfg instanceof CommentedFileConfig)
|
||||
((CommentedFileConfig) cfg).load();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onConfigChanged(ModConfig.Reloading event)
|
||||
{
|
||||
if (event.getConfig().getModId().equals(CarryOn.MODID))
|
||||
{
|
||||
if (event.getConfig().getModId().equals(CarryOn.MODID)) {
|
||||
ListHandler.initConfigLists();
|
||||
|
||||
CommentedConfig cfg = event.getConfig().getConfigData();
|
||||
|
||||
|
||||
if(cfg instanceof CommentedFileConfig)
|
||||
((CommentedFileConfig) cfg).load();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class Settings
|
||||
{
|
||||
public static BooleanValue facePlayer;
|
||||
|
||||
|
||||
public static BooleanValue heavyTiles;
|
||||
|
||||
|
||||
public static BooleanValue pickupAllBlocks;
|
||||
|
||||
|
||||
public static BooleanValue slownessInCreative;
|
||||
|
||||
|
||||
public static DoubleValue maxDistance;
|
||||
|
||||
|
||||
public static DoubleValue maxEntityWidth;
|
||||
|
||||
|
||||
public static DoubleValue maxEntityHeight;
|
||||
|
||||
|
||||
public static BooleanValue pickupHostileMobs;
|
||||
|
||||
|
||||
public static BooleanValue heavyEntities;
|
||||
|
||||
|
||||
public static DoubleValue blockSlownessMultiplier;
|
||||
|
||||
|
||||
public static DoubleValue entitySlownessMultiplier;
|
||||
|
||||
|
||||
public static BooleanValue renderArms;
|
||||
|
||||
|
||||
public static BooleanValue allowBabies;
|
||||
|
||||
|
||||
public static BooleanValue useWhitelistBlocks;
|
||||
|
||||
|
||||
public static BooleanValue useWhitelistEntities;
|
||||
|
||||
|
||||
public static BooleanValue useWhitelistStacking;
|
||||
|
||||
|
||||
public static BooleanValue hitWhileCarrying;
|
||||
|
||||
|
||||
public static BooleanValue dropCarriedWhenHit;
|
||||
|
||||
|
||||
public static BooleanValue useScripts;
|
||||
|
||||
|
||||
public static BooleanValue stackableEntities;
|
||||
|
||||
|
||||
public static IntValue maxEntityStackLimit;
|
||||
|
||||
|
||||
public static BooleanValue entitySizeMattersStacking;
|
||||
|
||||
|
||||
public static void init(ForgeConfigSpec.Builder s, ForgeConfigSpec.Builder c)
|
||||
{
|
||||
c.comment("Settings");
|
||||
|
|
@ -121,336 +119,324 @@ public class Configs {
|
|||
|
||||
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);
|
||||
|
||||
|
||||
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", 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);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
s.pop();
|
||||
c.pop();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
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");
|
||||
|
||||
|
||||
allowedEntities = s
|
||||
.comment("Entities that CAN be picked up (useWhitelistEntities must be true)")
|
||||
.defineList("whitelist.allowedEntities", Arrays.asList(new String[]{}), (obj) -> obj instanceof String ? true : false);
|
||||
|
||||
.defineList("whitelist.allowedEntities", Arrays.asList(new String[]{}), (obj) -> obj instanceof String);
|
||||
|
||||
allowedBlocks = s
|
||||
.comment("Blocks that CAN be picked up (useWhitelistBlocks must be true)")
|
||||
.defineList("whitelist.allowedBlocks", Arrays.asList(new String[]{}), (obj) -> obj instanceof String ? true : false);
|
||||
|
||||
.defineList("whitelist.allowedBlocks", Arrays.asList(new String[]{}), (obj) -> obj instanceof String);
|
||||
|
||||
allowedStacking = s
|
||||
.comment("Entities that CAN have other entities stacked on top of them (useWhitelistStacking must be true)")
|
||||
.defineList("whitelist.allowedStacking", Arrays.asList(new String[]{}), (obj) -> obj instanceof String ? true : false);
|
||||
.defineList("whitelist.allowedStacking", Arrays.asList(new String[]{}), (obj) -> obj instanceof String);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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");
|
||||
|
||||
|
||||
forbiddenTiles = s
|
||||
.comment("Blocks that cannot be picked up")
|
||||
.defineList("blacklist.forbiddenTiles", Arrays.asList(new String[]
|
||||
{
|
||||
"#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:*"
|
||||
|
||||
.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:*",
|
||||
"framedblocks:*", "securitycraft:*", "forgemultipartcbe:*", "integrateddynamics:cable", "tanknull:*"), (obj) -> obj instanceof String);
|
||||
|
||||
}), (obj) -> obj instanceof String);
|
||||
|
||||
forbiddenEntities = s
|
||||
.comment("Entities that cannot be picked up")
|
||||
.defineList("blacklist.forbiddenEntities", Arrays.asList(new String[]
|
||||
{
|
||||
"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);
|
||||
|
||||
.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:*",
|
||||
"securitycraft:*", "taterzens:npc", "easy_npc:*", "minecolonies:*"), (obj) -> obj instanceof String);
|
||||
|
||||
forbiddenStacking = s
|
||||
.comment("Entities that cannot have other entities stacked on top of them")
|
||||
.defineList("blacklist.forbiddenStacking", Arrays.asList(new String[]
|
||||
{
|
||||
"minecraft:horse"
|
||||
}), (obj) -> obj instanceof String ? true : false);
|
||||
.defineList("blacklist.forbiddenStacking", Arrays.asList("minecraft:horse"), (obj) -> obj instanceof String);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
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");
|
||||
|
||||
|
||||
|
||||
modelOverrides = c
|
||||
.comment("Model Overrides based on NBT or on Meta. Advanced Users Only!")
|
||||
.defineList("modeloverrides.overrides", Arrays.asList(new String[]
|
||||
{
|
||||
"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);
|
||||
.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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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");
|
||||
|
||||
|
||||
|
||||
customPickupConditionsBlocks = s
|
||||
.comment("Custom Pickup Conditions for Blocks")
|
||||
.defineList("custom_pickup_conditions.customPickupConditionsBlocks", Arrays.asList(new String[]{}), (obj) -> obj instanceof String ? true : false);
|
||||
|
||||
.defineList("custom_pickup_conditions.customPickupConditionsBlocks", Collections.emptyList(), (obj) -> obj instanceof String);
|
||||
|
||||
customPickupConditionsEntities = s
|
||||
.comment("Custom Pickup Conditions for Entities")
|
||||
.defineList("custom_pickup_conditions.customPickupConditionsEntities", Arrays.asList(new String[]{}), (obj) -> obj instanceof String ? true : false);
|
||||
.defineList("custom_pickup_conditions.customPickupConditionsEntities", Collections.emptyList(), (obj) -> obj instanceof String);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class ItemEvents
|
|||
{
|
||||
player.getPersistentData().remove("carrySlot");
|
||||
event.setUseBlock(Result.DENY);
|
||||
|
||||
|
||||
if (!player.level.isClientSide)
|
||||
{
|
||||
CarryOnOverride override = ScriptChecker.getOverride(player);
|
||||
|
|
@ -92,7 +92,7 @@ public class ItemEvents
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onItemDropped(EntityJoinWorldEvent event)
|
||||
{
|
||||
|
|
@ -141,7 +141,7 @@ public class ItemEvents
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerLogin(PlayerLoggedInEvent event)
|
||||
{
|
||||
|
|
@ -184,17 +184,18 @@ public class ItemEvents
|
|||
{
|
||||
CommandCarryOn.register(event.getDispatcher());
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void serverLoad(FMLServerStartingEvent event)
|
||||
{
|
||||
CustomPickupOverrideHandler.initPickupOverrides();
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void reloadTags(TagsUpdatedEvent event)
|
||||
{
|
||||
ListHandler.initConfigLists();
|
||||
CustomPickupOverrideHandler.initPickupOverrides();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
@ -292,7 +293,7 @@ public class ItemEvents
|
|||
public static void onBlockRightClick(PlayerInteractEvent.RightClickBlock event)
|
||||
{
|
||||
PlayerEntity player = event.getPlayer();
|
||||
|
||||
|
||||
if(event.isCanceled())
|
||||
return;
|
||||
|
||||
|
|
@ -484,8 +485,8 @@ public class ItemEvents
|
|||
int slotBlock = getSlot(player, RegistrationHandler.itemTile);
|
||||
int slotEntity = getSlot(player, RegistrationHandler.itemEntity);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ItemEntity item = null;
|
||||
if (slotBlock != -1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
package tschipp.carryon.common.handler;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.AgeableEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
|
@ -18,14 +14,17 @@ import net.minecraft.util.math.vector.Vector3d;
|
|||
import net.minecraft.world.GameType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import tschipp.carryon.common.config.Configs.Settings;
|
||||
import tschipp.carryon.common.helper.CarryonGamestageHelper;
|
||||
import tschipp.carryon.common.item.ItemCarryonBlock;
|
||||
import tschipp.carryon.common.scripting.CarryOnOverride;
|
||||
import tschipp.carryon.common.scripting.ScriptChecker;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PickupHandler
|
||||
{
|
||||
|
||||
|
|
@ -192,11 +191,14 @@ public class PickupHandler
|
|||
}
|
||||
}
|
||||
|
||||
public static class PickUpEntityEvent extends AttackEntityEvent
|
||||
public static class PickUpEntityEvent extends Event
|
||||
{
|
||||
public final PlayerEntity player;
|
||||
public final Entity target;
|
||||
public PickUpEntityEvent(PlayerEntity player, Entity target)
|
||||
{
|
||||
super(player, target);
|
||||
this.player = player;
|
||||
this.target = target;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ public class RegistrationHandler
|
|||
MinecraftForge.EVENT_BUS.register(new ItemEvents());
|
||||
MinecraftForge.EVENT_BUS.register(new ItemEntityEvents());
|
||||
MinecraftForge.EVENT_BUS.register(new PositionCommonEvents());
|
||||
MinecraftForge.EVENT_BUS.register(new IMCEvents());
|
||||
}
|
||||
|
||||
public static void regClientEvents()
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
package tschipp.carryon.common.helper;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.glfw.GLFWKeyCallback;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.glfw.GLFWKeyCallback;
|
||||
|
||||
public class KeyboardCallbackWrapper
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
package tschipp.carryon.common.helper;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.glfw.GLFWScrollCallback;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.glfw.GLFWScrollCallback;
|
||||
|
||||
//Thanks to gigaherz for the help!
|
||||
public class ScrollCallbackWrapper
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
package tschipp.carryon.common.item;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.CharMatcher;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
|
|
@ -42,6 +37,9 @@ import tschipp.carryon.common.event.ItemEvents;
|
|||
import tschipp.carryon.common.handler.CustomPickupOverrideHandler;
|
||||
import tschipp.carryon.common.handler.ModelOverridesHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Set;
|
||||
|
||||
public class ItemCarryonBlock extends Item
|
||||
{
|
||||
|
||||
|
|
@ -187,7 +185,11 @@ public class ItemCarryonBlock extends Item
|
|||
{
|
||||
CompoundNBT data = getTileData(stack);
|
||||
updateTileLocation(data, pos2);
|
||||
tile.load(actualState, data);
|
||||
try {
|
||||
tile.load(actualState, data);
|
||||
}
|
||||
catch (Exception e)
|
||||
{}
|
||||
}
|
||||
clearTileData(stack);
|
||||
player.playSound(actualState.getSoundType(world, pos2, player).getPlaceSound(), 1.0f, 0.5f);
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
package tschipp.carryon.network.client;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.network.NetworkEvent;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.common.scripting.ScriptChecker;
|
||||
import tschipp.carryon.proxy.ClientProxy;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class CarrySlotPacket
|
||||
{
|
||||
|
|
@ -49,7 +49,7 @@ public class CarrySlotPacket
|
|||
{
|
||||
ctx.get().enqueueWork(() -> {
|
||||
|
||||
World world = CarryOn.proxy.getWorld();
|
||||
World world = ClientProxy.getWorld();
|
||||
|
||||
if (world != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,35 +3,38 @@ package tschipp.carryon.proxy;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
import tschipp.carryon.common.handler.RegistrationHandler;
|
||||
import tschipp.carryon.common.helper.KeyboardCallbackWrapper;
|
||||
import tschipp.carryon.common.helper.ScrollCallbackWrapper;
|
||||
|
||||
public class ClientProxy implements IProxy {
|
||||
|
||||
|
||||
@Override
|
||||
public void setup(FMLCommonSetupEvent event)
|
||||
@EventBusSubscriber(modid = CarryOn.MODID, bus = Bus.MOD, value = Dist.CLIENT)
|
||||
public class ClientProxy
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void setup(FMLClientSetupEvent event)
|
||||
{
|
||||
RegistrationHandler.regClientEvents();
|
||||
|
||||
|
||||
CarryOnKeybinds.init();
|
||||
|
||||
new ScrollCallbackWrapper().setup(Minecraft.getInstance());;
|
||||
|
||||
new ScrollCallbackWrapper().setup(Minecraft.getInstance());
|
||||
new KeyboardCallbackWrapper().setup(Minecraft.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerEntity getPlayer()
|
||||
public static PlayerEntity getPlayer()
|
||||
{
|
||||
|
||||
return Minecraft.getInstance().player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
public static World getWorld()
|
||||
{
|
||||
return Minecraft.getInstance().level;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
package tschipp.carryon.proxy;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
|
||||
public interface IProxy
|
||||
{
|
||||
|
||||
public void setup(final FMLCommonSetupEvent event);
|
||||
|
||||
public PlayerEntity getPlayer();
|
||||
|
||||
public World getWorld();
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
package tschipp.carryon.proxy;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
|
||||
public class ServerProxy implements IProxy
|
||||
{
|
||||
|
||||
@Override
|
||||
public void setup(FMLCommonSetupEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerEntity getPlayer()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user