Updated to 1.14.4
This commit is contained in:
parent
b34e09a387
commit
fe6a41e3f3
|
|
@ -89,7 +89,7 @@ dependencies {
|
|||
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
|
||||
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
|
||||
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
||||
minecraft 'net.minecraftforge:forge:1.14.4-28.0.14'
|
||||
minecraft 'net.minecraftforge:forge:1.14.4-28.1.0'
|
||||
|
||||
// You may put jars on which you depend on in ./libs or you may define them like so..
|
||||
// compile "some.group:artifact:version:classifier"
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ public class RenderEntityEvents
|
|||
public void onPlayerRenderPost(RenderPlayerEvent.Post event)
|
||||
{
|
||||
World world = Minecraft.getInstance().world;
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getPlayer();
|
||||
ClientPlayerEntity clientPlayer = Minecraft.getInstance().player;
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
float partialticks = event.getPartialRenderTick();
|
||||
|
|
@ -262,7 +262,7 @@ public class RenderEntityEvents
|
|||
if((ModList.get().isLoaded("realrender") || ModList.get().isLoaded("rfpr")) && Minecraft.getInstance().gameSettings.thirdPersonView == 0)
|
||||
GlStateManager.translated(0, 0, -0.3);
|
||||
|
||||
if (player.isSneaking())
|
||||
if (RenderEvents.doSneakCheck(player))
|
||||
{
|
||||
GlStateManager.translated(0, -0.3, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import net.minecraft.block.Blocks;
|
|||
import net.minecraft.client.GameSettings;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||
import net.minecraft.client.renderer.entity.PlayerRenderer;
|
||||
|
|
@ -40,12 +39,12 @@ import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
|
|||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.client.event.RenderSpecificHandEvent;
|
||||
import net.minecraftforge.event.TickEvent.PlayerTickEvent;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
import tschipp.carryon.common.config.Configs.Settings;
|
||||
|
|
@ -203,9 +202,9 @@ public class RenderEvents
|
|||
|
||||
int current = player.inventory.currentItem;
|
||||
|
||||
if (player.getEntityData().contains("carrySlot") ? player.getEntityData().getInt("carrySlot") != current : false)
|
||||
if (player.getPersistentData().contains("carrySlot") ? player.getPersistentData().getInt("carrySlot") != current : false)
|
||||
{
|
||||
player.inventory.currentItem = player.getEntityData().getInt("carrySlot");
|
||||
player.inventory.currentItem = player.getPersistentData().getInt("carrySlot");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -351,8 +350,8 @@ public class RenderEvents
|
|||
public void onPlayerRenderPost(RenderPlayerEvent.Post event)
|
||||
{
|
||||
World world = Minecraft.getInstance().world;
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
ClientPlayerEntity clientPlayer = Minecraft.getInstance().player;
|
||||
PlayerEntity player = event.getPlayer();
|
||||
// ClientPlayerEntity clientPlayer = Minecraft.getInstance().player;
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
float partialticks = event.getPartialRenderTick();
|
||||
|
||||
|
|
@ -374,13 +373,12 @@ public class RenderEvents
|
|||
double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialticks;
|
||||
double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialticks;
|
||||
|
||||
double c0 = clientPlayer.lastTickPosX + (clientPlayer.posX - clientPlayer.lastTickPosX) * partialticks;
|
||||
double c1 = clientPlayer.lastTickPosY + (clientPlayer.posY - clientPlayer.lastTickPosY) * partialticks;
|
||||
double c2 = clientPlayer.lastTickPosZ + (clientPlayer.posZ - clientPlayer.lastTickPosZ) * partialticks;
|
||||
|
||||
double xOffset = d0 - c0;
|
||||
double yOffset = d1 - c1;
|
||||
double zOffset = d2 - c2;
|
||||
Vec3d cameraPos = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();
|
||||
|
||||
double xOffset = d0 - cameraPos.getX();
|
||||
double yOffset = d1 - cameraPos.getY();
|
||||
double zOffset = d2 - cameraPos.getZ();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated(xOffset, yOffset, zOffset);
|
||||
|
|
@ -401,7 +399,7 @@ public class RenderEvents
|
|||
GlStateManager.translated(0, 0, 0.4);
|
||||
}
|
||||
|
||||
if (player.isSneaking())
|
||||
if (doSneakCheck(player))
|
||||
{
|
||||
GlStateManager.translated(0, -0.3, 0);
|
||||
}
|
||||
|
|
@ -466,8 +464,7 @@ public class RenderEvents
|
|||
|
||||
if (handleMobends() && !ModList.get().isLoaded("obfuscate"))
|
||||
{
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
ClientPlayerEntity clientPlayer = Minecraft.getInstance().player;
|
||||
PlayerEntity player = event.getPlayer();
|
||||
float partialticks = event.getPartialRenderTick();
|
||||
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
|
|
@ -488,10 +485,6 @@ public class RenderEvents
|
|||
double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialticks;
|
||||
double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialticks;
|
||||
|
||||
double c0 = clientPlayer.lastTickPosX + (clientPlayer.posX - clientPlayer.lastTickPosX) * partialticks;
|
||||
double c1 = clientPlayer.lastTickPosY + (clientPlayer.posY - clientPlayer.lastTickPosY) * partialticks;
|
||||
double c2 = clientPlayer.lastTickPosZ + (clientPlayer.posZ - clientPlayer.lastTickPosZ) * partialticks;
|
||||
|
||||
Vec3d cameraPos = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();
|
||||
|
||||
double xOffset = d0 - cameraPos.getX();
|
||||
|
|
@ -518,30 +511,30 @@ public class RenderEvents
|
|||
|
||||
if (renderLeft && rotLeft != null)
|
||||
{
|
||||
renderArmPost(model.bipedLeftArm, (float) rotLeft[0], (float) rotLeft[2], rotation, false, player.isSneaking());
|
||||
renderArmPost(model.bipedLeftArmwear, (float) rotLeft[0], (float) rotLeft[2], rotation, false, player.isSneaking());
|
||||
renderArmPost(model.bipedLeftArm, (float) rotLeft[0], (float) rotLeft[2], rotation, false, doSneakCheck(player));
|
||||
renderArmPost(model.bipedLeftArmwear, (float) rotLeft[0], (float) rotLeft[2], rotation, false, doSneakCheck(player));
|
||||
} else if (renderLeft)
|
||||
{
|
||||
renderArmPost(model.bipedLeftArm, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation, false, player.isSneaking());
|
||||
renderArmPost(model.bipedLeftArmwear, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation, false, player.isSneaking());
|
||||
renderArmPost(model.bipedLeftArm, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation, false, doSneakCheck(player));
|
||||
renderArmPost(model.bipedLeftArmwear, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation, false, doSneakCheck(player));
|
||||
}
|
||||
|
||||
if (renderRight && rotRight != null)
|
||||
{
|
||||
renderArmPost(model.bipedRightArm, (float) rotRight[0], (float) rotRight[2], rotation, true, player.isSneaking());
|
||||
renderArmPost(model.bipedRightArmwear, (float) rotRight[0], (float) rotRight[2], rotation, true, player.isSneaking());
|
||||
renderArmPost(model.bipedRightArm, (float) rotRight[0], (float) rotRight[2], rotation, true, doSneakCheck(player));
|
||||
renderArmPost(model.bipedRightArmwear, (float) rotRight[0], (float) rotRight[2], rotation, true, doSneakCheck(player));
|
||||
} else if (renderRight)
|
||||
{
|
||||
renderArmPost(model.bipedRightArm, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation, true, player.isSneaking());
|
||||
renderArmPost(model.bipedRightArmwear, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation, true, player.isSneaking());
|
||||
renderArmPost(model.bipedRightArm, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation, true, doSneakCheck(player));
|
||||
renderArmPost(model.bipedRightArmwear, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation, true, doSneakCheck(player));
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
renderArmPost(model.bipedRightArm, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation, true, player.isSneaking());
|
||||
renderArmPost(model.bipedLeftArm, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation, false, player.isSneaking());
|
||||
renderArmPost(model.bipedLeftArmwear, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation, false, player.isSneaking());
|
||||
renderArmPost(model.bipedRightArmwear, 2.0F + (player.isSneaking() ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation, true, player.isSneaking());
|
||||
renderArmPost(model.bipedRightArm, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation, true, doSneakCheck(player));
|
||||
renderArmPost(model.bipedLeftArm, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation, false, doSneakCheck(player));
|
||||
renderArmPost(model.bipedLeftArmwear, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation, false, doSneakCheck(player));
|
||||
renderArmPost(model.bipedRightArmwear, 2.0F + (doSneakCheck(player) ? 0f : 0.2f) - (stack.getItem() == RegistrationHandler.itemEntity ? 0.3f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation, true, doSneakCheck(player));
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
|
@ -560,7 +553,7 @@ public class RenderEvents
|
|||
|
||||
if (handleMobends() && !ModList.get().isLoaded("obfuscate"))
|
||||
{
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getPlayer();
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
|
|
@ -643,6 +636,14 @@ public class RenderEvents
|
|||
return true;
|
||||
}
|
||||
|
||||
public static boolean doSneakCheck(PlayerEntity player)
|
||||
{
|
||||
if(player.abilities.isFlying)
|
||||
return false;
|
||||
|
||||
return player.isSneaking();
|
||||
}
|
||||
|
||||
public static boolean isChest(Block block)
|
||||
{
|
||||
return block == Blocks.CHEST || block == Blocks.ENDER_CHEST || block == Blocks.TRAPPED_CHEST;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class CarryOnKeybinds
|
|||
|
||||
public static boolean isKeyPressed(PlayerEntity player)
|
||||
{
|
||||
CompoundNBT tag = player.getEntityData();
|
||||
CompoundNBT tag = player.getPersistentData();
|
||||
if(tag != null && tag.contains(KEYBIND_KEY))
|
||||
{
|
||||
return tag.getBoolean(KEYBIND_KEY);
|
||||
|
|
@ -33,7 +33,7 @@ public class CarryOnKeybinds
|
|||
|
||||
public static void setKeyPressed(PlayerEntity player, boolean pressed)
|
||||
{
|
||||
CompoundNBT tag = player.getEntityData();
|
||||
CompoundNBT tag = player.getPersistentData();
|
||||
tag.putBoolean(KEYBIND_KEY, pressed);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import net.minecraftforge.event.TickEvent.PlayerTickEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerContainerEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||
import tschipp.carryon.common.capabilities.IPosition;
|
||||
import tschipp.carryon.common.capabilities.PositionProvider;
|
||||
import tschipp.carryon.common.capabilities.TEPosition;
|
||||
|
|
@ -60,7 +60,7 @@ public class PositionClientEvents
|
|||
@SubscribeEvent
|
||||
public void onGuiClose(PlayerContainerEvent.Close event)
|
||||
{
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getPlayer();
|
||||
if(player.getCapability(PositionProvider.POSITION_CAPABILITY).isPresent())
|
||||
{
|
||||
IPosition cap = player.getCapability(PositionProvider.POSITION_CAPABILITY).orElse(new TEPosition());
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class PositionCommonEvents
|
|||
{
|
||||
BlockPos pos = event.getPos();
|
||||
World world = event.getWorld();
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getPlayer();
|
||||
|
||||
if (event.isCanceled())
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -3,85 +3,15 @@ package tschipp.carryon.common.config;
|
|||
public class CarryOnConfig
|
||||
{
|
||||
|
||||
// @Config.LangKey(CarryOn.MODID)
|
||||
// @Config.Comment("General Mod Settings")
|
||||
public static Configs.Settings settings = new Configs.Settings();
|
||||
|
||||
// @Config.LangKey(CarryOn.MODID)
|
||||
// @Config.Comment("Blacklist for Blocks and Entities")
|
||||
public static Configs.Blacklist blacklist = new Configs.Blacklist();
|
||||
|
||||
// @Config.LangKey(CarryOn.MODID)
|
||||
// @Config.Comment("Whitelist for Blocks and Entities (useWhitelist must be true!)")
|
||||
public static Configs.WhiteList whitelist = new Configs.WhiteList();
|
||||
|
||||
// @Config.LangKey(CarryOn.MODID)
|
||||
// @Config.Comment("Model Overrides based on NBT or on Meta. Advanced Users Only!")
|
||||
public static Configs.ModelOverrides modelOverrides = new Configs.ModelOverrides();
|
||||
|
||||
// @Config.LangKey(CarryOn.MODID)
|
||||
// @Config.Comment("Custom Pickup Conditions for certain blocks. ONLY WORKS WHEN GAMESTAGES IS INSTALLED! Advanced Users Only!")
|
||||
public static Configs.CustomPickupConditions customPickupConditions = new Configs.CustomPickupConditions();
|
||||
|
||||
// @Mod.EventBusSubscriber
|
||||
// public static class EventHandler
|
||||
// {
|
||||
//
|
||||
// /**
|
||||
// * The {@link ConfigManager#CONFIGS} getter.
|
||||
// */
|
||||
// private static final MethodHandle CONFIGS_GETTER = ReflectionUtil.findFieldGetter(ConfigManager.class, "CONFIGS");
|
||||
//
|
||||
// /**
|
||||
// * The {@link Configuration} instance.
|
||||
// */
|
||||
// private static Configuration configuration;
|
||||
//
|
||||
// /**
|
||||
// * Get the {@link Configuration} instance from {@link ConfigManager}.
|
||||
// * <p>
|
||||
// * TODO: Use a less hackish method of getting the
|
||||
// * {@link Configuration}/{@link IConfigElement}s when possible.
|
||||
// *
|
||||
// * @return The Configuration instance
|
||||
// */
|
||||
// public static Configuration getConfiguration()
|
||||
// {
|
||||
// if (EventHandler.configuration == null)
|
||||
// try
|
||||
// {
|
||||
// final String fileName = CarryOn.MODID + ".cfg";
|
||||
//
|
||||
// @SuppressWarnings("unchecked")
|
||||
// final Map<String, Configuration> configsMap = (Map<String, Configuration>) EventHandler.CONFIGS_GETTER.invokeExact();
|
||||
//
|
||||
// final Optional<Map.Entry<String, Configuration>> entryOptional = configsMap.entrySet().stream().filter(entry -> fileName.equals(new File(entry.getKey()).getName())).findFirst();
|
||||
//
|
||||
// entryOptional.ifPresent(stringConfigurationEntry -> EventHandler.configuration = stringConfigurationEntry.getValue());
|
||||
// }
|
||||
// catch (Throwable throwable)
|
||||
// {
|
||||
// throwable.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// return EventHandler.configuration;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Inject the new values and save to the config file when the config has
|
||||
// * been changed from the GUI.
|
||||
// *
|
||||
// * @param event
|
||||
// * The event
|
||||
// */
|
||||
// @SubscribeEvent
|
||||
// public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event)
|
||||
// {
|
||||
// if (event.getModID().equals(CarryOn.MODID))
|
||||
// ConfigManager.load(CarryOn.MODID, Config.Type.INSTANCE);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,11 +46,13 @@ public class Configs {
|
|||
.autosave()
|
||||
.autoreload()
|
||||
.writingMode(WritingMode.REPLACE)
|
||||
.preserveInsertionOrder()
|
||||
.build();
|
||||
|
||||
CarryOn.LOGGER.debug("Loading CarryOn Config");
|
||||
configData.load();
|
||||
spec.setConfig(configData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -271,7 +273,7 @@ public class Configs {
|
|||
"minecraft:lilac",
|
||||
"minecraft:sunflower",
|
||||
"minecraft:*_bed",
|
||||
"minecraft:wooden_door",
|
||||
"minecraft:oak_door",
|
||||
"minecraft:iron_door",
|
||||
"minecraft:spruce_door",
|
||||
"minecraft:birch_door",
|
||||
|
|
@ -280,7 +282,7 @@ public class Configs {
|
|||
"minecraft:dark_oak_door",
|
||||
"minecraft:waterlily",
|
||||
"minecraft:cake",
|
||||
"minecraft:portal",
|
||||
"minecraft:nether_portal",
|
||||
"minecraft:tall_seagrass",
|
||||
"animania:block_trough",
|
||||
"animania:block_invisiblock",
|
||||
|
|
@ -350,7 +352,7 @@ public class Configs {
|
|||
.comment("Entities that cannot be picked up")
|
||||
.defineList("blacklist.forbiddenEntities", Arrays.asList(new String[]
|
||||
{
|
||||
"minecraft:ender_crystal",
|
||||
"minecraft:end_crystal",
|
||||
"minecraft:ender_dragon",
|
||||
"minecraft:ghast",
|
||||
"minecraft:shulker",
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@ public class ItemEntityEvents
|
|||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onBlockClick(PlayerInteractEvent.RightClickBlock event)
|
||||
{
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getPlayer();
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity && ItemCarryonEntity.hasEntityData(stack))
|
||||
{
|
||||
player.getEntityData().remove("carrySlot");
|
||||
player.getPersistentData().remove("carrySlot");
|
||||
event.setUseBlock(Result.DENY);
|
||||
|
||||
if (!player.world.isRemote)
|
||||
|
|
@ -90,7 +90,7 @@ public class ItemEntityEvents
|
|||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onEntityRightClick(PlayerInteractEvent.EntityInteract event)
|
||||
{
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getPlayer();
|
||||
|
||||
if (player instanceof ServerPlayerEntity)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,12 +29,14 @@ import net.minecraft.world.GameRules.BooleanValue;
|
|||
import net.minecraft.world.GameRules.RuleKey;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
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;
|
||||
|
|
@ -42,8 +44,7 @@ import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;
|
|||
import net.minecraftforge.eventbus.api.Event.Result;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
|
|
@ -67,6 +68,7 @@ import tschipp.carryon.common.scripting.ScriptChecker;
|
|||
import tschipp.carryon.common.scripting.ScriptReader;
|
||||
import tschipp.carryon.network.client.CarrySlotPacket;
|
||||
|
||||
@EventBusSubscriber(modid = CarryOn.MODID)
|
||||
public class ItemEvents
|
||||
{
|
||||
|
||||
|
|
@ -78,11 +80,11 @@ public class ItemEvents
|
|||
if (event.isCanceled())
|
||||
return;
|
||||
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getPlayer();
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemCarryonBlock.hasTileData(stack))
|
||||
{
|
||||
player.getEntityData().remove("carrySlot");
|
||||
player.getPersistentData().remove("carrySlot");
|
||||
event.setUseBlock(Result.DENY);
|
||||
|
||||
if (!player.world.isRemote)
|
||||
|
|
@ -195,7 +197,7 @@ public class ItemEvents
|
|||
public void onEntityStartTracking(StartTracking event)
|
||||
{
|
||||
Entity e = event.getTarget();
|
||||
PlayerEntity tracker = event.getEntityPlayer();
|
||||
PlayerEntity tracker = event.getPlayer();
|
||||
|
||||
if (e instanceof PlayerEntity && tracker instanceof ServerPlayerEntity)
|
||||
{
|
||||
|
|
@ -228,7 +230,7 @@ public class ItemEvents
|
|||
@SubscribeEvent
|
||||
public void harvestSpeed(BreakSpeed event)
|
||||
{
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getPlayer();
|
||||
if (player != null && !Settings.hitWhileCarrying.get())
|
||||
{
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
|
|
@ -240,7 +242,7 @@ public class ItemEvents
|
|||
@SubscribeEvent
|
||||
public void attackEntity(AttackEntityEvent event)
|
||||
{
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getPlayer();
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (!stack.isEmpty() && !Settings.hitWhileCarrying.get() && (stack.getItem() == RegistrationHandler.itemTile || stack.getItem() == RegistrationHandler.itemEntity))
|
||||
{
|
||||
|
|
@ -304,11 +306,11 @@ public class ItemEvents
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBlockRightClick(PlayerInteractEvent.RightClickBlock event)
|
||||
public static void onBlockRightClick(PlayerInteractEvent.RightClickBlock event)
|
||||
{
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getPlayer();
|
||||
|
||||
if (player instanceof ServerPlayerEntity)
|
||||
if (!player.world.isRemote)
|
||||
{
|
||||
|
||||
ItemStack main = player.getHeldItemMainhand();
|
||||
|
|
@ -447,7 +449,7 @@ public class ItemEvents
|
|||
public void onRespawn(PlayerEvent.Clone event)
|
||||
{
|
||||
PlayerEntity original = event.getOriginal();
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getPlayer();
|
||||
boolean wasDead = event.isWasDeath();
|
||||
GameRules rules = player.world.getGameRules();
|
||||
boolean keepInv = rules.getBoolean(new RuleKey<BooleanValue>("keepInventory"));
|
||||
|
|
@ -558,11 +560,11 @@ public class ItemEvents
|
|||
|
||||
if (currentItem >= 9)
|
||||
{
|
||||
player.getEntityData().remove("carrySlot");
|
||||
player.getEntityData().remove("overrideKey");
|
||||
player.getPersistentData().remove("carrySlot");
|
||||
player.getPersistentData().remove("overrideKey");
|
||||
} else
|
||||
{
|
||||
player.getEntityData().putInt("carrySlot", currentItem);
|
||||
player.getPersistentData().putInt("carrySlot", currentItem);
|
||||
if (hash != 0)
|
||||
ScriptChecker.setCarryOnOverride(player, hash);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ public class ItemCarryonBlock extends Item
|
|||
return new StringTextComponent("");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public ActionResultType onItemUse(ItemUseContext context)
|
||||
{
|
||||
|
|
@ -172,7 +171,7 @@ public class ItemCarryonBlock extends Item
|
|||
clearTileData(stack);
|
||||
player.playSound(actualState.getSoundType(world, pos2, player).getPlaceSound(), 1.0f, 0.5f);
|
||||
player.setHeldItem(Hand.MAIN_HAND, ItemStack.EMPTY);
|
||||
player.getEntityData().remove("overrideKey");
|
||||
player.getPersistentData().remove("overrideKey");
|
||||
ItemEvents.sendPacket(player, 9, 0);
|
||||
return ActionResultType.SUCCESS;
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public class ItemCarryonEntity extends Item {
|
|||
ItemEvents.sendPacket(player, 9, 0);
|
||||
|
||||
}
|
||||
player.getEntityData().remove("overrideKey");
|
||||
player.getPersistentData().remove("overrideKey");
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
@ -154,7 +154,7 @@ public class ItemCarryonEntity extends Item {
|
|||
}
|
||||
}
|
||||
|
||||
public static CompoundNBT getEntityData(ItemStack stack) {
|
||||
public static CompoundNBT getPersistentData(ItemStack stack) {
|
||||
if (stack.hasTag()) {
|
||||
CompoundNBT tag = stack.getTag();
|
||||
return tag.getCompound(ENTITY_DATA_KEY);
|
||||
|
|
@ -168,7 +168,7 @@ public class ItemCarryonEntity extends Item {
|
|||
|
||||
String name = getEntityName(stack);
|
||||
|
||||
CompoundNBT e = getEntityData(stack);
|
||||
CompoundNBT e = getPersistentData(stack);
|
||||
Optional<EntityType<?>> type = EntityType.byKey(name);
|
||||
Entity entity = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ public class ScriptChecker
|
|||
@Nullable
|
||||
public static CarryOnOverride getOverride(PlayerEntity player)
|
||||
{
|
||||
CompoundNBT tag = player.getEntityData();
|
||||
CompoundNBT tag = player.getPersistentData();
|
||||
|
||||
if (tag != null && tag.contains("overrideKey"))
|
||||
{
|
||||
|
|
@ -179,7 +179,7 @@ public class ScriptChecker
|
|||
|
||||
public static void setCarryOnOverride(PlayerEntity player, int i)
|
||||
{
|
||||
CompoundNBT tag = player.getEntityData();
|
||||
CompoundNBT tag = player.getPersistentData();
|
||||
|
||||
if (tag != null)
|
||||
tag.putInt("overrideKey", i);
|
||||
|
|
|
|||
|
|
@ -61,12 +61,12 @@ public class CarrySlotPacket
|
|||
|
||||
if (slot >= 9)
|
||||
{
|
||||
player.getEntityData().remove("carrySlot");
|
||||
player.getEntityData().remove("overrideKey");
|
||||
player.getPersistentData().remove("carrySlot");
|
||||
player.getPersistentData().remove("overrideKey");
|
||||
} else
|
||||
{
|
||||
|
||||
player.getEntityData().putInt("carrySlot", slot);
|
||||
player.getPersistentData().putInt("carrySlot", slot);
|
||||
if (carryOverride != 0)
|
||||
ScriptChecker.setCarryOnOverride(player, carryOverride);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user