fixed a bug

This commit is contained in:
Tschipp 2017-08-27 22:23:02 +02:00
parent 07b882da12
commit a1c4313e50
5 changed files with 16 additions and 15 deletions

View File

@ -26,9 +26,9 @@ public class CarryOn {
public static CarryOn instance;
public static final String MODID = "carryon";
public static final String VERSION = "1.2";
public static final String VERSION = "1.2.1";
public static final String NAME = "Carry On";
public static final String UPDATE_JSON = "https://gist.githubusercontent.com/Tschipp/dccadee7c90d7a34e6e76a35d9d6fa2e/raw/bf7fb60d5e59f73eee65b271d5c01585e26a0352/update.json";
public static final String UPDATE_JSON = "https://gist.githubusercontent.com/Tschipp/dccadee7c90d7a34e6e76a35d9d6fa2e/raw/";
public static final Logger LOGGER = LogManager.getFormatterLogger("CarryOn");
//public static SimpleNetworkWrapper network;

View File

@ -72,7 +72,7 @@ public class RenderEntityEvents
if (player != null)
{
ItemStack stack = player.getHeldItem(EnumHand.MAIN_HAND);
if (inventory && stack != null && stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
if (inventory && (stack != null ? stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack) : false))
{
event.setCanceled(true);
Minecraft.getMinecraft().currentScreen = null;
@ -92,7 +92,7 @@ public class RenderEntityEvents
Field field = KeyBinding.class.getDeclaredFields()[7];
field.setAccessible(true);
ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItemMainhand();
if (stack != null && stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
if (stack != null ? stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack) : false)
{
if (settings.keyBindDrop.isPressed())
{
@ -129,7 +129,7 @@ public class RenderEntityEvents
float partialticks = event.getPartialTicks();
if (stack != null && stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
if (stack != null ? stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack) : false)
{
BlockPos pos = player.getPosition();
Entity entity = ItemEntity.getEntity(stack, world);
@ -189,7 +189,7 @@ public class RenderEntityEvents
EntityPlayerSP clientPlayer = Minecraft.getMinecraft().thePlayer;
ItemStack stack = player.getHeldItemMainhand();
float partialticks = event.getPartialRenderTick();
if (stack != null && stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
if (stack != null ? stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack) : false)
{
Entity entity = ItemEntity.getEntity(stack, world);

View File

@ -79,7 +79,7 @@ public class RenderEvents
if (player != null)
{
ItemStack stack = player.getHeldItem(EnumHand.MAIN_HAND);
if (inventory && stack != null && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack))
if (inventory && (stack != null ? stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack) : false))
{
event.setCanceled(true);
Minecraft.getMinecraft().currentScreen = null;
@ -99,7 +99,7 @@ public class RenderEvents
Field field = KeyBinding.class.getDeclaredFields()[7];
field.setAccessible(true);
ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItemMainhand();
if (stack != null && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack))
if (stack != null ? stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack) : false)
{
if (settings.keyBindDrop.isPressed())
{
@ -132,7 +132,7 @@ public class RenderEvents
ItemStack stack = player.getHeldItemMainhand();
int perspective = Minecraft.getMinecraft().gameSettings.thirdPersonView;
if (stack != null && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack))
if (stack != null ? stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack) : false)
{
Block block = ItemTile.getBlock(stack);
BlockPos pos = player.getPosition();
@ -202,6 +202,7 @@ public class RenderEvents
EntityPlayerSP clientPlayer = Minecraft.getMinecraft().thePlayer;
ItemStack stack = player.getHeldItemMainhand();
float partialticks = event.getPartialRenderTick();
if (stack != null ? stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack) : false)
{
Block block = ItemTile.getBlock(stack);
IBlockState state = ItemTile.getBlockState(stack);
@ -290,7 +291,7 @@ public class RenderEvents
player.setArrowCountInEntity(0); //TODO Temporary Fix
if (stack != null && (stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack)) || (stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack)))
if (stack != null ? ((stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack)) || (stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))) : false)
{
if (model.bipedBody.childModels != null && !model.bipedBody.childModels.isEmpty()) {

View File

@ -95,7 +95,7 @@ public class ItemTile extends Item
pos2 = pos.offset(facing);
}
if (world.getBlockState(pos2).getBlock().isReplaceable(world, pos2))
if (world.getBlockState(pos2).getBlock().isReplaceable(world, pos2) && containedblock != null)
{
boolean canPlace = containedblock.canPlaceBlockAt(world, pos2);
@ -234,8 +234,8 @@ public class ItemTile extends Item
if (stack.hasTagCompound())
{
NBTTagCompound tag = stack.getTagCompound();
String name = tag.getString("block");
return Block.getBlockFromName(name);
int id = tag.getInteger("stateid");
return Block.getStateById(id).getBlock();
}
return null;
}

View File

@ -2,13 +2,13 @@
{
"modid" : "carryon",
"name" : "Carry On",
"version" : "1.2", "mcversion" : "1.10.2",
"version" : "1.2.2", "mcversion" : "1.10.2",
"url" : "",
"credits" : "Tschipp, Purplicious_Cow, cy4n",
"authorList" : ["Tschipp, Purplicious_Cow, cy4n"],
"description": "Carry On is a simple mod that improves game interaction by allowing players to pick up, carry, and place single block Tile Entities using only their empty hands.",
"logoFile" : "assets/carryon/logo.png",
"updateUrl" : "https://gist.githubusercontent.com/Tschipp/dccadee7c90d7a34e6e76a35d9d6fa2e/raw/5115328bf7c35d5c5cea64bdb58becd2ca17fcac/update.json",
"updateUrl" : "",
"parent" : "",
"dependencies": [],
"screenshots": []