Merge branch 'master' into 1.10
This commit is contained in:
commit
48b0e03340
165
LICENSE
Normal file
165
LICENSE
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
|
|
@ -34,7 +34,7 @@ public class CarryOn {
|
|||
public static CarryOn instance;
|
||||
|
||||
public static final String MODID = "carryon";
|
||||
public static final String VERSION = "1.7.1";
|
||||
public static final String VERSION = "1.8";
|
||||
public static final String NAME = "Carry On";
|
||||
public static final String ACCEPTED_VERSIONS = "[1.10,1.11)";
|
||||
public static final String UPDATE_JSON = "https://gist.githubusercontent.com/Tschipp/dccadee7c90d7a34e6e76a35d9d6fa2e/raw/";
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import net.minecraftforge.client.event.GuiOpenEvent;
|
|||
import net.minecraftforge.client.event.MouseEvent;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
||||
|
|
@ -35,6 +36,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
import tschipp.carryon.common.handler.RegistrationHandler;
|
||||
import tschipp.carryon.common.helper.ScriptParseHelper;
|
||||
import tschipp.carryon.common.item.ItemEntity;
|
||||
import tschipp.carryon.common.item.ItemTile;
|
||||
import tschipp.carryon.common.scripting.CarryOnOverride;
|
||||
import tschipp.carryon.common.scripting.ScriptChecker;
|
||||
|
||||
|
|
@ -65,19 +67,21 @@ public class RenderEntityEvents
|
|||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onGuiOpen(GuiOpenEvent event)
|
||||
public void onGuiInit(InitGuiEvent.Pre event)
|
||||
{
|
||||
if (event.getGui() != null)
|
||||
{
|
||||
boolean inventory = event.getGui() instanceof GuiContainer;
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (player != null)
|
||||
if (player != null && inventory)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(EnumHand.MAIN_HAND);
|
||||
if (inventory && (stack != null ? stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack) : false))
|
||||
{
|
||||
event.setCanceled(true);
|
||||
Minecraft.getMinecraft().thePlayer.closeScreen();
|
||||
Minecraft.getMinecraft().currentScreen = null;
|
||||
Minecraft.getMinecraft().setIngameFocus();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import net.minecraft.client.renderer.OpenGlHelper;
|
|||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.resources.DefaultPlayerSkin;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
|
|
@ -31,13 +30,11 @@ import net.minecraft.util.EnumHand;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.GuiOpenEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
|
||||
import net.minecraftforge.client.event.MouseEvent;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
||||
|
|
@ -114,19 +111,21 @@ public class RenderEvents
|
|||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onGuiOpen(GuiOpenEvent event)
|
||||
public void onGuiInit(InitGuiEvent.Pre event)
|
||||
{
|
||||
if (event.getGui() != null)
|
||||
{
|
||||
boolean inventory = event.getGui() instanceof GuiContainer;
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (player != null)
|
||||
if (player != null && inventory)
|
||||
{
|
||||
ItemStack stack = player.getHeldItem(EnumHand.MAIN_HAND);
|
||||
if (inventory && (stack != null ? stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack) : false))
|
||||
{
|
||||
event.setCanceled(true);
|
||||
Minecraft.getMinecraft().thePlayer.closeScreen();
|
||||
Minecraft.getMinecraft().currentScreen = null;
|
||||
Minecraft.getMinecraft().setIngameFocus();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package tschipp.carryon.client.model;
|
||||
|
||||
import net.minecraft.client.model.ModelPlayer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelPlayerCarrying extends ModelPlayer
|
||||
{
|
||||
|
||||
public ModelPlayerCarrying(float modelSize, boolean smallArmsIn)
|
||||
{
|
||||
super(modelSize, smallArmsIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
|
||||
{
|
||||
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -52,6 +52,7 @@ public class CommonProxy
|
|||
e.printStackTrace();
|
||||
}
|
||||
RegistrationHandler.regOverrideList();
|
||||
RegistrationHandler.regCaps();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package tschipp.carryon.common.capabilities;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface IPosition {
|
||||
|
||||
public BlockPos getPos();
|
||||
|
||||
public void setPos(BlockPos pos);
|
||||
|
||||
public boolean isBlockActivated();
|
||||
|
||||
public void setBlockActivated(boolean b);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package tschipp.carryon.common.capabilities;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
|
||||
|
||||
public class PositionProvider implements ICapabilitySerializable {
|
||||
|
||||
@CapabilityInject(IPosition.class)
|
||||
public static final Capability<IPosition> POSITION_CAPABILITY = null;
|
||||
|
||||
private IPosition instance = POSITION_CAPABILITY.getDefaultInstance();
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
return capability == POSITION_CAPABILITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
return capability == POSITION_CAPABILITY ? POSITION_CAPABILITY.cast(instance) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTBase serializeNBT() {
|
||||
return POSITION_CAPABILITY.getStorage().writeNBT(POSITION_CAPABILITY, instance, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeNBT(NBTBase nbt) {
|
||||
POSITION_CAPABILITY.getStorage().readNBT(POSITION_CAPABILITY, instance, null, nbt);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package tschipp.carryon.common.capabilities;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.Capability.IStorage;
|
||||
|
||||
public class PositionStorage implements IStorage<IPosition> {
|
||||
|
||||
@Override
|
||||
public NBTBase writeNBT(Capability<IPosition> capability, IPosition instance, EnumFacing side) {
|
||||
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
||||
tag.setBoolean("blockActivated", instance.isBlockActivated());
|
||||
tag.setInteger("x", instance.getPos().getX());
|
||||
tag.setInteger("y", instance.getPos().getY());
|
||||
tag.setInteger("z", instance.getPos().getZ());
|
||||
|
||||
return tag;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(Capability<IPosition> capability, IPosition instance, EnumFacing side, NBTBase nbt) {
|
||||
|
||||
NBTTagCompound tag = (NBTTagCompound) nbt;
|
||||
|
||||
int x = tag.getInteger("x");
|
||||
int y = tag.getInteger("y");
|
||||
int z = tag.getInteger("z");
|
||||
|
||||
BlockPos pos = new BlockPos(x,y,z);
|
||||
|
||||
instance.setPos(pos);
|
||||
instance.setBlockActivated(tag.getBoolean("blockActivated"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package tschipp.carryon.common.capabilities;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class TEPosition implements IPosition {
|
||||
|
||||
private BlockPos pos = new BlockPos(0, 0, 0);
|
||||
private boolean blockActivated = false;
|
||||
|
||||
@Override
|
||||
public BlockPos getPos()
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
@Override
|
||||
public void setPos(BlockPos pos)
|
||||
{
|
||||
this.pos = pos;
|
||||
}
|
||||
@Override
|
||||
public boolean isBlockActivated()
|
||||
{
|
||||
return blockActivated;
|
||||
}
|
||||
@Override
|
||||
public void setBlockActivated(boolean b)
|
||||
{
|
||||
this.blockActivated = b;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package tschipp.carryon.common.capabilities.event;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerContainerEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import tschipp.carryon.common.capabilities.IPosition;
|
||||
import tschipp.carryon.common.capabilities.PositionProvider;
|
||||
|
||||
public class PositionClientEvents
|
||||
{
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onGui(GuiScreenEvent.DrawScreenEvent event)
|
||||
{
|
||||
if (event.getGui() != null)
|
||||
{
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
boolean inventory = event.getGui() instanceof GuiContainer;
|
||||
|
||||
if (player != null && inventory)
|
||||
{
|
||||
if(player.hasCapability(PositionProvider.POSITION_CAPABILITY, null))
|
||||
{
|
||||
IPosition cap = player.getCapability(PositionProvider.POSITION_CAPABILITY, null);
|
||||
if(cap.isBlockActivated())
|
||||
{
|
||||
World world = player.worldObj;
|
||||
BlockPos pos = cap.getPos();
|
||||
if(world != null)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
if(te == null)
|
||||
{
|
||||
// player.openContainer = null;
|
||||
Minecraft.getMinecraft().currentScreen = null;
|
||||
Minecraft.getMinecraft().setIngameFocus();
|
||||
cap.setBlockActivated(false);
|
||||
cap.setPos(new BlockPos(0,0,0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onGuiClose(PlayerContainerEvent.Close event)
|
||||
{
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
if(player.hasCapability(PositionProvider.POSITION_CAPABILITY, null))
|
||||
{
|
||||
IPosition cap = player.getCapability(PositionProvider.POSITION_CAPABILITY, null);
|
||||
cap.setBlockActivated(false);
|
||||
cap.setPos(new BlockPos(0,0,0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void onPlayerTick(PlayerTickEvent event)
|
||||
{
|
||||
if (event.side == Side.CLIENT)
|
||||
{
|
||||
EntityPlayer player = event.player;
|
||||
if (player.hasCapability(PositionProvider.POSITION_CAPABILITY, null))
|
||||
{
|
||||
IPosition cap = player.getCapability(PositionProvider.POSITION_CAPABILITY, null);
|
||||
if (cap.isBlockActivated() && Minecraft.getMinecraft().currentScreen == null)
|
||||
{
|
||||
cap.setBlockActivated(false);
|
||||
cap.setPos(new BlockPos(0, 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package tschipp.carryon.common.capabilities.event;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.common.capabilities.IPosition;
|
||||
import tschipp.carryon.common.capabilities.PositionProvider;
|
||||
|
||||
public class PositionCommonEvents
|
||||
{
|
||||
|
||||
@SubscribeEvent
|
||||
public void onAttachCaps(AttachCapabilitiesEvent<Entity> event)
|
||||
{
|
||||
if (event.getObject() instanceof EntityPlayer)
|
||||
{
|
||||
event.addCapability(new ResourceLocation(CarryOn.MODID, "position"), new PositionProvider());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBlockRight(PlayerInteractEvent.RightClickBlock event)
|
||||
{
|
||||
BlockPos pos = event.getPos();
|
||||
World world = event.getWorld();
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
|
||||
if (event.isCanceled())
|
||||
return;
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (player instanceof FakePlayer)
|
||||
return;
|
||||
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
if (te != null)
|
||||
{
|
||||
if (player.hasCapability(PositionProvider.POSITION_CAPABILITY, null))
|
||||
{
|
||||
IPosition cap = player.getCapability(PositionProvider.POSITION_CAPABILITY, null);
|
||||
cap.setBlockActivated(true);
|
||||
cap.setPos(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -119,6 +119,10 @@ public class Configs {
|
|||
"embers:field_chart",
|
||||
"embers:inferno_forge",
|
||||
"storagedrawers:framingtable",
|
||||
"skyresources:*",
|
||||
"lootbags:*",
|
||||
"exsartagine:*",
|
||||
|
||||
};
|
||||
|
||||
@Comment("Entities that cannot be picked up")
|
||||
|
|
@ -128,6 +132,11 @@ public class Configs {
|
|||
"EnderDragon",
|
||||
"Ghast",
|
||||
"Shulker",
|
||||
"LeashKnot",
|
||||
"ArmorStand",
|
||||
"ItemFrame",
|
||||
"Painting",
|
||||
"ShulkerBullet",
|
||||
"animania:textures/entity/pigs/hamster_tarou.png",
|
||||
"animania:hamster",
|
||||
"animania:ferret*",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
|
|
@ -16,9 +17,9 @@ import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
|||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import tschipp.carryon.CarryOn;
|
||||
|
|
@ -88,6 +89,9 @@ public class ItemEntityEvents
|
|||
|
||||
if (entity.hurtResistantTime == 0)
|
||||
{
|
||||
if(entity instanceof EntityAnimal)
|
||||
((EntityAnimal) entity).clearLeashed(true, true);
|
||||
|
||||
if (PickupHandler.canPlayerPickUpEntity(player, entity))
|
||||
{
|
||||
if (ItemEntity.storeEntityData(entity, world, stack))
|
||||
|
|
|
|||
|
|
@ -218,6 +218,7 @@ public class ItemEvents
|
|||
{
|
||||
player.setHeldItem(EnumHand.MAIN_HAND, null);
|
||||
EntityItem item = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, stack);
|
||||
CarryOn.network.sendToAllAround(new CarrySlotPacket(9, player.getEntityId()), new TargetPoint(player.worldObj.provider.getDimension(), player.posX, player.posY, player.posZ, 256));
|
||||
player.worldObj.spawnEntityInWorld(item);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,15 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.client.event.RenderEntityEvents;
|
||||
import tschipp.carryon.client.event.RenderEvents;
|
||||
import tschipp.carryon.common.capabilities.IPosition;
|
||||
import tschipp.carryon.common.capabilities.PositionStorage;
|
||||
import tschipp.carryon.common.capabilities.TEPosition;
|
||||
import tschipp.carryon.common.capabilities.event.PositionClientEvents;
|
||||
import tschipp.carryon.common.capabilities.event.PositionCommonEvents;
|
||||
import tschipp.carryon.common.event.ItemEntityEvents;
|
||||
import tschipp.carryon.common.event.ItemEvents;
|
||||
import tschipp.carryon.common.item.ItemEntity;
|
||||
|
|
@ -33,12 +39,14 @@ public class RegistrationHandler
|
|||
{
|
||||
MinecraftForge.EVENT_BUS.register(new ItemEvents());
|
||||
MinecraftForge.EVENT_BUS.register(new ItemEntityEvents());
|
||||
MinecraftForge.EVENT_BUS.register(new PositionCommonEvents());
|
||||
}
|
||||
|
||||
public static void regClientEvents()
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(new RenderEvents());
|
||||
MinecraftForge.EVENT_BUS.register(new RenderEntityEvents());
|
||||
MinecraftForge.EVENT_BUS.register(new PositionClientEvents());
|
||||
}
|
||||
|
||||
public static void regOverrideList()
|
||||
|
|
@ -47,6 +55,9 @@ public class RegistrationHandler
|
|||
ListHandler.initForbiddenTiles();
|
||||
}
|
||||
|
||||
|
||||
public static void regCaps()
|
||||
{
|
||||
CapabilityManager.INSTANCE.register(IPosition.class, new PositionStorage(), TEPosition::new);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ public class ItemTile extends Item
|
|||
{
|
||||
e.printStackTrace();
|
||||
|
||||
if (world.isRemote)
|
||||
if (world != null && world.isRemote)
|
||||
{
|
||||
CarryOn.LOGGER.info("Block: " + ItemTile.getBlock(stack));
|
||||
CarryOn.LOGGER.info("BlockState: " + ItemTile.getBlockState(stack));
|
||||
|
|
|
|||
14
src/main/resources/assets/carryon/lang/en_UD.lang
Normal file
14
src/main/resources/assets/carryon/lang/en_UD.lang
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
carryon.category.settings=sᵷuᴉʇʇǝS
|
||||
carryon.category.blacklist=ʇsᴉꞁʞɔɐꞁᗺ
|
||||
carryon.category.modeloverrides=(pǝɔuɐʌpⱯ) sǝpᴉɹɹǝʌO ꞁǝpoW
|
||||
carryon.category.custompickupconditions=(pǝɔuɐʌpⱯ) suoᴉʇᴉpuoƆ dnʞɔᴉԀ ɯoʇsnƆ
|
||||
carryon.category.whitelist=ʇsᴉꞁǝʇᴉɥM
|
||||
|
||||
carryon.general.modeloverrides.modeloverrides=sǝpᴉɹɹǝʌO ꞁǝpoW
|
||||
carryon.general.blacklist.forbiddenentities=dn ʞɔᴉd ʇouuɐɔ ɹǝʎɐꞁԀ ǝɥʇ ʇɐɥʇ sǝᴉʇᴉʇuƎ
|
||||
carryon.general.blacklist.forbiddentiles=dn ʞɔᴉd ʇouuɐɔ ɹǝʎɐꞁԀ ǝɥʇ ʇɐɥʇ sʞɔoꞁᗺ
|
||||
carryon.category.custompickupconditions.custompickupconditionsblocks=suoᴉʇᴉpuoƆ dnʞɔᴉԀ ʞɔoꞁᗺ ɯoʇsnƆ
|
||||
carryon.category.custompickupconditions.custompickupconditionsentities=suoᴉʇᴉpuoƆ dnʞɔᴉԀ ʎʇᴉʇuƎ ɯoʇsnƆ
|
||||
|
||||
key.carry.desc=ʎɹɹɐƆ
|
||||
key.carry.category=uO ʎɹɹɐƆ
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
"modid" : "carryon",
|
||||
"name" : "Carry On",
|
||||
"version" : "1.7.1", "mcversion" : "1.10.2",
|
||||
"version" : "1.8", "mcversion" : "1.10.2",
|
||||
"url" : "",
|
||||
"credits" : "Tschipp, Purplicious_Cow, cy4n",
|
||||
"authorList" : ["Tschipp, Purplicious_Cow, cy4n"],
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user