Update to 1.5

This commit is contained in:
Tschipp 2017-09-17 19:14:23 +02:00
parent 109dbb92c6
commit 1fe9f3920e
11 changed files with 104 additions and 37 deletions

View File

@ -28,7 +28,7 @@ public class CarryOn {
public static CarryOn instance;
public static final String MODID = "carryon";
public static final String VERSION = "1.4.1";
public static final String VERSION = "1.5";
public static final String NAME = "Carry On";
public static final String UPDATE_JSON = "https://gist.githubusercontent.com/Tschipp/dccadee7c90d7a34e6e76a35d9d6fa2e/raw/";
public static final Logger LOGGER = LogManager.getFormatterLogger("CarryOn");

View File

@ -200,7 +200,8 @@ public class RenderEntityEvents
{
Entity entity = ItemEntity.getEntity(stack, world);
float rotation = -player.renderYawOffset;
float rotation = -(player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialticks);
int perspective = Minecraft.getMinecraft().gameSettings.thirdPersonView;
if (entity != null)

View File

@ -251,7 +251,7 @@ public class RenderEvents
ItemStack tileItem = ItemTile.getItemStack(stack);
float rotation = -player.renderYawOffset;
float rotation = -(player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialticks);
int perspective = Minecraft.getMinecraft().gameSettings.thirdPersonView;
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialticks;

View File

@ -28,7 +28,7 @@ public class CarryOnConfig {
public static Configs.Blacklist blacklist = new Configs.Blacklist();
@Config.LangKey(CarryOn.MODID)
@Config.Comment("Whitelist for Entities")
@Config.Comment("Whitelist for Blocks and Entities (useWhitelist must be true!)")
public static Configs.WhiteList whitelist = new Configs.WhiteList();
@Config.LangKey(CarryOn.MODID)

View File

@ -46,11 +46,14 @@ public class Configs {
@Comment("Arms should render on sides when carrying")
public boolean renderArms = true;
@Comment("Allow babies to be carried when parents are not")
public boolean allowBabies=false;
@Comment("Allow babies to be carried even when adult mob is blacklisted (or not whitelisted)")
public boolean allowBabies = false;
@Comment("Use Whitelist instead of Blacklist")
public boolean useWhiteList=false;
@Comment("Use Whitelist instead of Blacklist for Blocks")
public boolean useWhiteistBlocks=false;
@Comment("Use Whitelist instead of Blacklist for Entities")
public boolean useWhiteistEntities=false;
}
public static class WhiteList
@ -59,8 +62,12 @@ public class Configs {
@Comment("Entities that CAN be picked up")
public String[] allowedEntities=new String[]
{
"minecraft:chicken",
"minecraft:rabbit"
};
@Config.RequiresMcRestart()
@Comment("Blocks that CAN be picked up")
public String[] allowedBlocks=new String[]
{
};
}
@ -116,6 +123,9 @@ public class Configs {
"minecraft:ghast",
"minecraft:shulker",
"animania:textures/entity/pigs/hamster_tarou.png",
"animania:hamster",
"animania:ferret*",
"animania:hedgehog*",
"mynko:*"
};
@ -174,7 +184,20 @@ public class Configs {
"storagedrawers:basicdrawers;4{Mat:\"birch\"}->storagedrawers:basicdrawers;4{material:\"birch\"}",
"storagedrawers:basicdrawers;4{Mat:\"jungle\"}->storagedrawers:basicdrawers;4{material:\"jungle\"}",
"storagedrawers:basicdrawers;4{Mat:\"acacia\"}->storagedrawers:basicdrawers;4{material:\"acacia\"}",
"storagedrawers:basicdrawers;4{Mat:\"dark_oak\"}->storagedrawers:basicdrawers;4{material:\"dark_oak\"}"
"storagedrawers:basicdrawers;4{Mat:\"dark_oak\"}->storagedrawers:basicdrawers;4{material:\"dark_oak\"}",
"animania:nest->(block)animania:nest",
"animania:cheese_mold;0->(block)cheese_mold;0",
"animania:cheese_mold;1->(block)cheese_mold;1",
"animania:cheese_mold;2->(block)cheese_mold;2",
"animania:cheese_mold;3->(block)cheese_mold;3",
"animania:cheese_mold;4->(block)cheese_mold;4",
"animania:cheese_mold;5->(block)cheese_mold;5",
"animania:cheese_mold;6->(block)cheese_mold;6",
"animania:cheese_mold;7->(block)cheese_mold;7",
"animania:cheese_mold;8->(block)cheese_mold;8",
"animania:cheese_mold;9->(block)cheese_mold;9",
"animania:cheese_mold;10->(block)cheese_mold;10",
};
}

View File

@ -25,7 +25,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import tschipp.carryon.CarryOn;
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
import tschipp.carryon.common.handler.ForbiddenTileHandler;
import tschipp.carryon.common.handler.ListHandler;
import tschipp.carryon.common.handler.PickupHandler;
import tschipp.carryon.common.handler.RegistrationHandler;
import tschipp.carryon.common.item.ItemTile;
@ -102,7 +102,7 @@ public class ItemEvents
Block block = world.getBlockState(pos).getBlock();
IBlockState state = world.getBlockState(pos);
if (main.isEmpty() && off.isEmpty() && CarryOnKeybinds.isKeyPressed(player) && !ForbiddenTileHandler.isForbidden(block))
if (main.isEmpty() && off.isEmpty() && CarryOnKeybinds.isKeyPressed(player))
{
ItemStack stack = new ItemStack(RegistrationHandler.itemTile);

View File

@ -9,11 +9,12 @@ import net.minecraft.entity.EntityList;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import tschipp.carryon.common.config.CarryOnConfig;
public class ForbiddenTileHandler
public class ListHandler
{
public static List<String> FORBIDDEN_TILES;
public static List<String> FORBIDDEN_ENTITIES;
public static List<String> ALLOWED_ENTITIES;
public static List<String> ALLOWED_TILES;
public static boolean isForbidden(Block block)
{
@ -41,6 +42,11 @@ public class ForbiddenTileHandler
return true;
}
public static boolean isAllowed(Block block)
{
return ALLOWED_TILES.contains(block.getRegistryName().toString());
}
public static void initForbiddenTiles()
{
String[] forbidden = CarryOnConfig.blacklist.forbiddenTiles;
@ -96,6 +102,25 @@ public class ForbiddenTileHandler
}
ALLOWED_ENTITIES.add(allowedEntities[i]);
}
String[] allowedBlocks = CarryOnConfig.whitelist.allowedBlocks;
ALLOWED_TILES = new ArrayList<String>();
for (int i = 0; i < allowedBlocks.length; i++)
{
if (allowedBlocks[i].contains("*"))
{
String modid = allowedBlocks[i].replace("*", "");
for (int k = 0; k < Block.REGISTRY.getKeys().size(); k++)
{
if (Block.REGISTRY.getKeys().toArray()[k].toString().contains(modid))
{
ALLOWED_TILES.add(Block.REGISTRY.getKeys().toArray()[k].toString());
}
}
}
ALLOWED_TILES.add(allowedBlocks[i]);
}
}
}

View File

@ -37,7 +37,21 @@ public class PickupHandler
Block block = state.getBlock();
player.closeScreen();
if (CarryOnConfig.settings.useWhiteistBlocks)
{
if (!ListHandler.isAllowed(world.getBlockState(pos).getBlock()))
{
return false;
}
}
else
{
if (ListHandler.isForbidden(world.getBlockState(pos).getBlock()))
{
return false;
}
}
if ((block.getBlockHardness(state, world, pos) != -1 || player.isCreative()))
{
@ -71,13 +85,16 @@ public class PickupHandler
{
BlockPos pos = toPickUp.getPosition();
if (toPickUp instanceof EntityPlayer)
return false;
//check for allow babies to be picked up
if(toPickUp instanceof EntityAgeable && CarryOnConfig.settings.allowBabies){
EntityAgeable entity_living=(EntityAgeable) toPickUp;
if(entity_living.getGrowingAge()<0){
// check for allow babies to be picked up
if (toPickUp instanceof EntityAgeable && CarryOnConfig.settings.allowBabies)
{
EntityAgeable living = (EntityAgeable) toPickUp;
if (living.getGrowingAge() < 0 || living.isChild())
{
double distance = pos.distanceSqToCenter(player.posX, player.posY + 0.5, player.posZ);
if (distance < Math.pow(CarryOnConfig.settings.maxDistance, 2))
{
@ -100,21 +117,22 @@ public class PickupHandler
}
}
}
if(toPickUp instanceof EntityPlayer)
return false;
if(CarryOnConfig.settings.useWhiteList){
if(!ForbiddenTileHandler.isAllowed(toPickUp)){
return false;
}
}
else{
if (ForbiddenTileHandler.isForbidden(toPickUp))
if (CarryOnConfig.settings.useWhiteistEntities)
{
if (!ListHandler.isAllowed(toPickUp))
{
return false;
}
}
else
{
if (ListHandler.isForbidden(toPickUp))
{
return false;
}
}
if ((CarryOnConfig.settings.pickupHostileMobs ? true : !toPickUp.isCreatureType(EnumCreatureType.MONSTER, false) || player.isCreative()))
{
if ((toPickUp.height <= CarryOnConfig.settings.maxEntityHeight && toPickUp.width <= CarryOnConfig.settings.maxEntityWidth || player.isCreative()))
@ -141,11 +159,10 @@ public class PickupHandler
}
}
}
return false;
}
private static boolean handleFTBUtils(EntityPlayerMP player, World world, BlockPos pos, IBlockState state)
{
if (Loader.isModLoaded("ftbu"))

View File

@ -45,7 +45,7 @@ public class RegistrationHandler
{
ModelOverridesHandler.initOverrides();
CustomPickupOverrideHandler.initPickupOverrides();
ForbiddenTileHandler.initForbiddenTiles();
ListHandler.initForbiddenTiles();
}

View File

@ -2,6 +2,7 @@ carryon.category.settings=Settings
carryon.category.blacklist=Blacklist
carryon.category.modeloverrides=Model Overrides (Advanced)
carryon.category.custompickupconditions=Custom Pickup Conditions (Advanced)
carryon.category.whitelist=Whitelist
carryon.general.modeloverrides.modeloverrides=Model Overrides
carryon.general.blacklist.forbiddenentities=Entities that the Player cannot pick up

View File

@ -2,7 +2,7 @@
{
"modid" : "carryon",
"name" : "Carry On",
"version" : "1.4.1", "mcversion" : "1.12",
"version" : "1.5", "mcversion" : "1.12",
"url" : "",
"credits" : "Tschipp, Purplicious_Cow, cy4n",
"authorList" : ["Tschipp, Purplicious_Cow, cy4n"],