Merge branch 'master' into 1.10
This commit is contained in:
commit
fa2e013a4b
|
|
@ -23,7 +23,7 @@ import tschipp.carryon.common.command.CommandCarryOn;
|
|||
import tschipp.carryon.common.command.CommandCarryOnReload;
|
||||
|
||||
@EventBusSubscriber
|
||||
@Mod(modid = CarryOn.MODID, name = CarryOn.NAME, version = CarryOn.VERSION, guiFactory = "tschipp.carryon.client.gui.GuiFactoryCarryOn", updateJSON = CarryOn.UPDATE_JSON)
|
||||
@Mod(modid = CarryOn.MODID, name = CarryOn.NAME, version = CarryOn.VERSION, guiFactory = "tschipp.carryon.client.gui.GuiFactoryCarryOn", updateJSON = CarryOn.UPDATE_JSON, acceptedMinecraftVersions = CarryOn.ACCEPTED_VERSIONS)
|
||||
public class CarryOn {
|
||||
|
||||
@SidedProxy(clientSide = "tschipp.carryon.client.ClientProxy", serverSide = "tschipp.carryon.common.CommonProxy")
|
||||
|
|
@ -34,8 +34,9 @@ public class CarryOn {
|
|||
public static CarryOn instance;
|
||||
|
||||
public static final String MODID = "carryon";
|
||||
public static final String VERSION = "1.6";
|
||||
public static final String VERSION = "1.7";
|
||||
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/";
|
||||
public static final Logger LOGGER = LogManager.getFormatterLogger("CarryOn");
|
||||
public static File CONFIGURATION_FILE;
|
||||
|
|
@ -62,7 +63,6 @@ public class CarryOn {
|
|||
{
|
||||
event.registerServerCommand(new CommandCarryOn());
|
||||
event.registerServerCommand(new CommandCarryOnReload());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
|
@ -138,6 +139,10 @@ public class RenderEntityEvents
|
|||
|
||||
if (stack != null ? (stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack)) : false)
|
||||
{
|
||||
if(Loader.isModLoaded("realrender") || Loader.isModLoaded("rfpr"))
|
||||
return;
|
||||
|
||||
|
||||
Entity entity = ItemEntity.getEntity(stack, world);
|
||||
|
||||
if (entity != null)
|
||||
|
|
@ -328,6 +333,9 @@ public class RenderEntityEvents
|
|||
GlStateManager.rotate(rotation, 0, 1f, 0);
|
||||
GlStateManager.translate(0.0, height / 2 + -(height / 2) + 1, width - 0.1 < 0.7 ? width - 0.1 + (0.7 - (width - 0.1)) : width - 0.1);
|
||||
|
||||
if((Loader.isModLoaded("realrender") || Loader.isModLoaded("rfpr")) && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0)
|
||||
GlStateManager.translate(0, 0, -0.3);
|
||||
|
||||
if (player.isSneaking())
|
||||
{
|
||||
GlStateManager.translate(0, -0.3, 0);
|
||||
|
|
|
|||
|
|
@ -182,6 +182,9 @@ public class RenderEvents
|
|||
|
||||
if (stack != null ? stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack) : false)
|
||||
{
|
||||
if(Loader.isModLoaded("realrender") || Loader.isModLoaded("rfpr"))
|
||||
return;
|
||||
|
||||
Block block = ItemTile.getBlock(stack);
|
||||
NBTTagCompound tag = ItemTile.getTileData(stack);
|
||||
IBlockState state = ItemTile.getBlockState(stack);
|
||||
|
|
@ -353,15 +356,20 @@ public class RenderEvents
|
|||
GlStateManager.translate(xOffset, yOffset, zOffset);
|
||||
GlStateManager.scale(0.6, 0.6, 0.6);
|
||||
|
||||
|
||||
if (CarryOnConfig.settings.facePlayer ? !isChest(block) : isChest(block))
|
||||
{
|
||||
GlStateManager.rotate(rotation, 0, 1.0f, 0);
|
||||
GlStateManager.translate(0, 1.6, 0.65);
|
||||
if((Loader.isModLoaded("realrender") || Loader.isModLoaded("rfpr")) && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0)
|
||||
GlStateManager.translate(0, 0, -0.4);
|
||||
}
|
||||
else
|
||||
{
|
||||
GlStateManager.rotate(rotation + 180, 0, 1.0f, 0);
|
||||
GlStateManager.translate(0, 1.6, -0.65);
|
||||
if((Loader.isModLoaded("realrender") || Loader.isModLoaded("rfpr")) && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0)
|
||||
GlStateManager.translate(0, 0, 0.4);
|
||||
}
|
||||
|
||||
if (player.isSneaking())
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ public class Configs {
|
|||
"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\"}",
|
||||
"animania:nest->(block)animania:nest",
|
||||
"animania:block_nest->(block)animania:block_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",
|
||||
|
|
|
|||
|
|
@ -17,8 +17,10 @@ import net.minecraft.util.text.TextComponentString;
|
|||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.event.ClickEvent;
|
||||
import net.minecraft.util.text.event.ClickEvent.Action;
|
||||
import net.minecraft.world.GameRules;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent.StartTracking;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
|
|
@ -236,5 +238,32 @@ public class ItemEvents
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRespawn(PlayerEvent.Clone event)
|
||||
{
|
||||
EntityPlayer original = event.getOriginal();
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
boolean wasDead = event.isWasDeath();
|
||||
GameRules rules = player.worldObj.getGameRules();
|
||||
boolean keepInv = rules.getBoolean("keepInventory");
|
||||
boolean wasCarrying = player.inventory.hasItemStack(new ItemStack(RegistrationHandler.itemTile)) || player.inventory.hasItemStack(new ItemStack(RegistrationHandler.itemEntity));
|
||||
|
||||
if((wasDead ? keepInv : true) && wasCarrying)
|
||||
{
|
||||
int carrySlot = original.inventory.currentItem;
|
||||
|
||||
ItemStack stack = player.inventory.removeStackFromSlot(carrySlot);
|
||||
World world = player.worldObj;
|
||||
|
||||
EntityItem item = new EntityItem(world);
|
||||
item.setEntityItemStack(stack);
|
||||
BlockPos pos = original.getBedLocation();
|
||||
if(pos == null)
|
||||
pos = player.getPosition();
|
||||
item.setPosition(pos.getX(), pos.getY(), pos.getZ());
|
||||
world.spawnEntityInWorld(item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package tschipp.carryon.common.handler;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.feed_the_beast.ftbl.lib.math.BlockPosContainer;
|
||||
|
|
@ -146,7 +148,9 @@ public class PickupHandler
|
|||
if (toPickUp instanceof EntityTameable)
|
||||
{
|
||||
EntityTameable tame = (EntityTameable) toPickUp;
|
||||
if (tame.getOwnerId() != null && tame.getOwnerId() != player.getUUID(player.getGameProfile()))
|
||||
UUID owner = tame.getOwnerId();
|
||||
UUID playerID = player.getUUID(player.getGameProfile());
|
||||
if (owner != null && !owner.equals(playerID))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package tschipp.carryon.common.helper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
|
@ -7,6 +10,7 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.scoreboard.Score;
|
||||
import net.minecraft.scoreboard.ScoreObjective;
|
||||
import net.minecraft.scoreboard.Scoreboard;
|
||||
|
|
@ -227,6 +231,62 @@ public class ScriptParseHelper
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static boolean hasEffects(EntityPlayer player, String cond)
|
||||
{
|
||||
if(cond == null)
|
||||
return true;
|
||||
|
||||
Collection<PotionEffect> effects = player.getActivePotionEffects();
|
||||
String[] potions = cond.split(",");
|
||||
|
||||
List<String> names = new ArrayList<String>();
|
||||
List<Integer> levels = new ArrayList<Integer>();
|
||||
|
||||
for(int i = 0; i < potions.length; i++)
|
||||
{
|
||||
String pot = potions[i];
|
||||
if(pot.contains("#"))
|
||||
{
|
||||
String level = pot.substring(pot.indexOf("#"));
|
||||
String name = pot.substring(0, pot.indexOf("#"));
|
||||
level = level.replace("#", "");
|
||||
int lev = 0;
|
||||
try
|
||||
{
|
||||
lev = Integer.parseInt(level);
|
||||
}
|
||||
catch(Exception e)
|
||||
{}
|
||||
|
||||
levels.add(lev);
|
||||
names.add(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
levels.add(0);
|
||||
names.add(pot);
|
||||
}
|
||||
}
|
||||
|
||||
int matches = 0;
|
||||
for(PotionEffect effect : effects)
|
||||
{
|
||||
int amp = effect.getAmplifier();
|
||||
String name = effect.getPotion().getRegistryName().toString();
|
||||
|
||||
if(names.contains(name))
|
||||
{
|
||||
int idx = names.indexOf(name);
|
||||
int lev = levels.get(idx);
|
||||
|
||||
if(lev == amp)
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
|
||||
return matches == potions.length;
|
||||
}
|
||||
|
||||
public static boolean matches(Material material, String cond)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ public class CarryOnOverride
|
|||
private String conditionGamemode;
|
||||
private String conditionScoreboard;
|
||||
private String conditionPosition;
|
||||
private String conditionEffects;
|
||||
|
||||
// RENDER
|
||||
private String renderNameBlock;
|
||||
|
|
@ -50,6 +51,16 @@ public class CarryOnOverride
|
|||
this.path = path;
|
||||
}
|
||||
|
||||
public String getConditionEffects()
|
||||
{
|
||||
return conditionEffects;
|
||||
}
|
||||
|
||||
public void setConditionEffects(String conditionEffects)
|
||||
{
|
||||
this.conditionEffects = conditionEffects;
|
||||
}
|
||||
|
||||
public String getRenderRotationLeftArm()
|
||||
{
|
||||
return renderRotationLeftArm;
|
||||
|
|
|
|||
|
|
@ -98,8 +98,9 @@ public class ScriptChecker
|
|||
boolean position = ScriptParseHelper.matches(player.getPosition(), override.getConditionPosition());
|
||||
boolean xp = ScriptParseHelper.matches(player.experienceLevel, override.getConditionXp());
|
||||
boolean scoreboard = ScriptParseHelper.matchesScore(player, override.getConditionScoreboard());
|
||||
|
||||
return (achievement && gamemode && position && xp && scoreboard);
|
||||
boolean effects = ScriptParseHelper.hasEffects(player, override.getConditionEffects());
|
||||
|
||||
return (achievement && gamemode && position && xp && scoreboard && effects);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ public class ScriptReader
|
|||
JsonElement gamemode = conditions.get("gamemode");
|
||||
JsonElement scoreboard = conditions.get("scoreboard");
|
||||
JsonElement position = conditions.get("position");
|
||||
JsonElement effects = conditions.get("effects");
|
||||
|
||||
|
||||
if(achievement != null)
|
||||
|
|
@ -132,6 +133,8 @@ public class ScriptReader
|
|||
override.setConditionScoreboard(scoreboard.getAsString());
|
||||
if(position != null)
|
||||
override.setConditionPosition(position.getAsString());
|
||||
if(effects != null)
|
||||
override.setConditionEffects(effects.getAsString());
|
||||
}
|
||||
|
||||
if (render != null)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
"modid" : "carryon",
|
||||
"name" : "Carry On",
|
||||
"version" : "1.6", "mcversion" : "1.10.2",
|
||||
"version" : "1.7", "mcversion" : "1.10.2",
|
||||
"url" : "",
|
||||
"credits" : "Tschipp, Purplicious_Cow, cy4n",
|
||||
"authorList" : ["Tschipp, Purplicious_Cow, cy4n"],
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user