Update to 1.7

This commit is contained in:
Tschipp 2017-11-04 11:24:27 +01:00
parent 92ed9ca6af
commit 3795eabb4a
11 changed files with 135 additions and 8 deletions

View File

@ -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", dependencies = "required-after:forge@[13.20.1.2386,)", updateJSON = CarryOn.UPDATE_JSON)
@Mod(modid = CarryOn.MODID, name = CarryOn.NAME, version = CarryOn.VERSION, guiFactory = "tschipp.carryon.client.gui.GuiFactoryCarryOn", dependencies = "required-after:forge@[13.20.1.2386,)", 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.11,1.12)";
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());
}

View File

@ -25,6 +25,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.isEmpty() && stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
{
if(Loader.isModLoaded("realrender") || Loader.isModLoaded("rfpr"))
return;
Entity entity = ItemEntity.getEntity(stack, world);
if (entity != null)
@ -329,6 +334,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);

View File

@ -186,6 +186,14 @@ public class RenderEvents
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack))
{
if(Loader.isModLoaded("realrender") || Loader.isModLoaded("rfpr"))
{
GlStateManager.pushMatrix();
GlStateManager.translate(1, 0, 0);
GlStateManager.popMatrix();
return;
}
Block block = ItemTile.getBlock(stack);
NBTTagCompound tag = ItemTile.getTileData(stack);
IBlockState state = ItemTile.getBlockState(stack);
@ -358,15 +366,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())

View File

@ -189,7 +189,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",

View File

@ -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,30 @@ 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.world.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.world;
EntityItem item = new EntityItem(world);
item.setEntityItemStack(stack);
BlockPos pos = player.getPosition();
item.setPosition(pos.getX(), pos.getY(), pos.getZ());
world.spawnEntity(item);
}
}
}

View File

@ -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;
@ -164,7 +166,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;
}

View File

@ -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)
{

View File

@ -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;

View File

@ -101,8 +101,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 && gamestage && position && xp && scoreboard);
boolean effects = ScriptParseHelper.hasEffects(player, override.getConditionEffects());
return (achievement && gamemode && gamestage && position && xp && scoreboard && effects);
}
@Nullable

View File

@ -121,6 +121,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(gamestage != null)
override.setConditionGamestage(gamestage.getAsString());
@ -134,6 +135,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)

View File

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