Obfuscate Support
This commit is contained in:
parent
d3fb8efb45
commit
cb5edc3061
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -21,3 +21,5 @@ build
|
|||
# other
|
||||
eclipse
|
||||
run
|
||||
|
||||
gradle\.properties
|
||||
|
|
|
|||
28
build.gradle
28
build.gradle
|
|
@ -35,6 +35,8 @@ repositories {
|
|||
|
||||
maven { url 'http://maven.epoxide.org' }
|
||||
|
||||
maven { url = "https://mrcrayfish.com/maven" }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -42,7 +44,9 @@ repositories {
|
|||
dependencies {
|
||||
|
||||
// deobfCompile "net.darkhax.gamestages:GameStages-1.12.2:2.0.91"
|
||||
|
||||
|
||||
compile "com.mrcrayfish:obfuscate:0.2.6-1.12.2"
|
||||
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
|
@ -60,3 +64,25 @@ processResources {
|
|||
exclude 'mcmod.info'
|
||||
}
|
||||
}
|
||||
|
||||
task signJar(type: SignJar, dependsOn: reobfJar) {
|
||||
|
||||
// Skips if the keyStore property is missing.
|
||||
onlyIf {
|
||||
project.hasProperty('keyStore')
|
||||
}
|
||||
|
||||
// findProperty allows us to reference the property without it existing.
|
||||
// Using project.propName would cause the script to fail validation if
|
||||
// the property did not exist.
|
||||
keyStore = project.findProperty('keyStore')
|
||||
alias = project.findProperty('keyStoreAlias')
|
||||
storePass = project.findProperty('keyStorePass')
|
||||
keyPass = project.findProperty('keyStoreKeyPass')
|
||||
inputFile = jar.archivePath
|
||||
outputFile = jar.archivePath
|
||||
}
|
||||
|
||||
// Runs this task automatically when build is ran.
|
||||
build.dependsOn signJar
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
package tschipp.carryon;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.Mod.Instance;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLFingerprintViolationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
|
@ -21,7 +21,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 = CarryOn.DEPENDENCIES, updateJSON = CarryOn.UPDATE_JSON, acceptedMinecraftVersions = CarryOn.ACCEPTED_VERSIONS)
|
||||
@Mod(modid = CarryOn.MODID, name = CarryOn.NAME, version = CarryOn.VERSION, guiFactory = "tschipp.carryon.client.gui.GuiFactoryCarryOn", dependencies = CarryOn.DEPENDENCIES, updateJSON = CarryOn.UPDATE_JSON, acceptedMinecraftVersions = CarryOn.ACCEPTED_VERSIONS, certificateFingerprint = CarryOn.CERTIFICATE_FINGERPRINT)
|
||||
public class CarryOn {
|
||||
|
||||
@SidedProxy(clientSide = "tschipp.carryon.client.ClientProxy", serverSide = "tschipp.carryon.common.CommonProxy")
|
||||
|
|
@ -32,12 +32,13 @@ public class CarryOn {
|
|||
public static CarryOn instance;
|
||||
|
||||
public static final String MODID = "carryon";
|
||||
public static final String VERSION = "1.11.1";
|
||||
public static final String VERSION = "1.12";
|
||||
public static final String NAME = "Carry On";
|
||||
public static final String ACCEPTED_VERSIONS = "[1.12.2,1.13)";
|
||||
public static final String UPDATE_JSON = "https://gist.githubusercontent.com/Tschipp/dccadee7c90d7a34e6e76a35d9d6fa2e/raw/";
|
||||
public static final Logger LOGGER = LogManager.getFormatterLogger("CarryOn");
|
||||
public static final String DEPENDENCIES = "required-after:forge@[13.20.1.2386,);after:gamestages;";
|
||||
public static final String CERTIFICATE_FINGERPRINT = "55e88f24d04398481ae6f1ce76f65fd776f14227";
|
||||
public static File CONFIGURATION_FILE;
|
||||
|
||||
public static SimpleNetworkWrapper network;
|
||||
|
|
@ -64,6 +65,10 @@ public class CarryOn {
|
|||
event.registerServerCommand(new CommandCarryOnReload());
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onFingerprintViolation(FMLFingerprintViolationEvent event) {
|
||||
|
||||
LOGGER.error("WARNING! Invalid fingerprint detected! The file " + event.getSource().getName() + " may have been tampered with! If you didn't download the file from https://minecraft.curseforge.com/projects/carry-on or through any kind of mod launcher, immediately delete the file and re-download it from https://minecraft.curseforge.com/projects/carry-on");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -447,12 +447,17 @@ public class RenderEvents
|
|||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onEvent(RenderPlayerEvent.Post event)
|
||||
{
|
||||
if (handleMobends())
|
||||
if(!CarryOnConfig.settings.renderArms)
|
||||
return;
|
||||
|
||||
if (handleMobends() && !Loader.isModLoaded("obfuscate"))
|
||||
{
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
EntityPlayerSP clientPlayer = Minecraft.getMinecraft().player;
|
||||
float partialticks = event.getPartialRenderTick();
|
||||
|
||||
RenderPlayer render = event.getRenderer();
|
||||
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
|
||||
{
|
||||
|
|
@ -539,7 +544,10 @@ public class RenderEvents
|
|||
@SubscribeEvent(priority = EventPriority.NORMAL)
|
||||
public void onEvent(RenderPlayerEvent.Pre event)
|
||||
{
|
||||
if (handleMobends())
|
||||
if(!CarryOnConfig.settings.renderArms)
|
||||
return;
|
||||
|
||||
if (handleMobends() && !Loader.isModLoaded("obfuscate"))
|
||||
{
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -55,6 +55,9 @@ public class Configs {
|
|||
@Comment("Use Whitelist instead of Blacklist for Entities")
|
||||
public boolean useWhitelistEntities=false;
|
||||
|
||||
@Comment("Use Whitelist instead of Blacklist for Stacking")
|
||||
public boolean useWhitelistStacking=false;
|
||||
|
||||
@Comment("Whether the player can hit blocks and entities while carrying or not")
|
||||
public boolean hitWhileCarrying=false;
|
||||
|
||||
|
|
@ -78,22 +81,24 @@ public class Configs {
|
|||
|
||||
public static class WhiteList
|
||||
{
|
||||
@Config.RequiresMcRestart()
|
||||
@Comment("Entities that CAN be picked up")
|
||||
public String[] allowedEntities=new String[]
|
||||
{
|
||||
};
|
||||
|
||||
@Config.RequiresMcRestart()
|
||||
@Comment("Blocks that CAN be picked up")
|
||||
public String[] allowedBlocks=new String[]
|
||||
{
|
||||
};
|
||||
|
||||
@Comment("Entities that CAN have other entities stacked on top of them")
|
||||
public String[] allowedStacking = new String[]
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
public static class Blacklist
|
||||
{
|
||||
@Config.RequiresMcRestart()
|
||||
@Comment("Tile Entities that cannot be picked up")
|
||||
public String[] forbiddenTiles = new String[]
|
||||
{
|
||||
|
|
@ -169,11 +174,11 @@ public class Configs {
|
|||
"practicallogistics2:*",
|
||||
"mcmultipart:*",
|
||||
"enderstorage:*",
|
||||
"betterstorage:*"
|
||||
"betterstorage:*",
|
||||
"practicallogistics2:*"
|
||||
|
||||
};
|
||||
|
||||
@Config.RequiresMcRestart()
|
||||
@Comment("Entities that cannot be picked up")
|
||||
public String[] forbiddenEntities = new String[]
|
||||
{
|
||||
|
|
@ -195,11 +200,17 @@ public class Configs {
|
|||
"mynko:*"
|
||||
};
|
||||
|
||||
|
||||
@Comment("Entities that cannot have other entities stacked on top of them")
|
||||
public String[] forbiddenStacking = new String[]
|
||||
{
|
||||
"minecraft:horse"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public static class ModelOverrides
|
||||
{
|
||||
@Config.RequiresMcRestart()
|
||||
@Comment("Model Overrides based on NBT or on Meta. Advanced Users Only!")
|
||||
public String[] modelOverrides = new String[]
|
||||
{
|
||||
|
|
@ -217,6 +228,9 @@ public class Configs {
|
|||
"minecraft:leaves2->(item)minecraft:leaves2",
|
||||
"minecraft:reeds->(block)minecraft:reeds",
|
||||
"minecraft:daylight_detector_inverted->minecraft:daylight_detector",
|
||||
"minecraft:standing_sign->(item)minecraft:sign",
|
||||
"minecraft:wall_sign->(item)minecraft:sign",
|
||||
"minecraft:redstone_wire->(item)minecraft:redstone",
|
||||
"quark:custom_chest{type:\"spruce\"}->quark:custom_chest;0",
|
||||
"quark:custom_chest{type:\"birch\"}->quark:custom_chest;1",
|
||||
"quark:custom_chest{type:\"jungle\"}->quark:custom_chest;2",
|
||||
|
|
@ -264,7 +278,6 @@ public class Configs {
|
|||
"animania:cheese_mold;8->(block)animania:cheese_mold;8",
|
||||
"animania:cheese_mold;9->(block)animania:cheese_mold;9",
|
||||
"animania:cheese_mold;10->(block)animania:cheese_mold;10",
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import net.minecraftforge.items.CapabilityItemHandler;
|
|||
import net.minecraftforge.items.IItemHandler;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
import tschipp.carryon.common.config.CarryOnConfig;
|
||||
import tschipp.carryon.common.handler.ListHandler;
|
||||
import tschipp.carryon.common.handler.PickupHandler;
|
||||
import tschipp.carryon.common.handler.RegistrationHandler;
|
||||
import tschipp.carryon.common.item.ItemEntity;
|
||||
|
|
@ -158,42 +159,46 @@ public class ItemEntityEvents
|
|||
{
|
||||
Entity topEntity = getTopPassenger(lowestEntity);
|
||||
|
||||
double sizeEntity = topEntity.height * topEntity.width;
|
||||
if ((CarryOnConfig.settings.entitySizeMattersStacking && sizeHeldEntity <= sizeEntity) || !CarryOnConfig.settings.entitySizeMattersStacking)
|
||||
if (CarryOnConfig.settings.useWhitelistStacking ? ListHandler.isStackingAllowed(topEntity) : !ListHandler.isStackingForbidden(topEntity))
|
||||
{
|
||||
if (topEntity instanceof EntityHorse)
|
||||
double sizeEntity = topEntity.height * topEntity.width;
|
||||
if ((CarryOnConfig.settings.entitySizeMattersStacking && sizeHeldEntity <= sizeEntity) || !CarryOnConfig.settings.entitySizeMattersStacking)
|
||||
{
|
||||
EntityHorse horse = (EntityHorse) topEntity;
|
||||
horse.setHorseTamed(true);
|
||||
}
|
||||
if (topEntity instanceof EntityHorse)
|
||||
{
|
||||
EntityHorse horse = (EntityHorse) topEntity;
|
||||
horse.setHorseTamed(true);
|
||||
}
|
||||
|
||||
if (distance < 6)
|
||||
{
|
||||
double tempX = entity.posX;
|
||||
double tempY = entity.posY;
|
||||
double tempZ = entity.posZ;
|
||||
entityHeld.setPosition(tempX, tempY + 2.6, tempZ);
|
||||
world.spawnEntity(entityHeld);
|
||||
entityHeld.startRiding(topEntity, false);
|
||||
entityHeld.setPositionAndUpdate(tempX, tempY, tempZ);
|
||||
if (distance < 6)
|
||||
{
|
||||
double tempX = entity.posX;
|
||||
double tempY = entity.posY;
|
||||
double tempZ = entity.posZ;
|
||||
entityHeld.setPosition(tempX, tempY + 2.6, tempZ);
|
||||
world.spawnEntity(entityHeld);
|
||||
entityHeld.startRiding(topEntity, false);
|
||||
entityHeld.setPositionAndUpdate(tempX, tempY, tempZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
entityHeld.setPosition(entity.posX, entity.posY, entity.posZ);
|
||||
world.spawnEntity(entityHeld);
|
||||
entityHeld.startRiding(topEntity, false);
|
||||
}
|
||||
|
||||
ItemEntity.clearEntityData(main);
|
||||
player.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
|
||||
ItemEvents.sendPacket(player, 9, 0);
|
||||
event.setCanceled(true);
|
||||
event.setCancellationResult(EnumActionResult.FAIL);
|
||||
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_HORSE_SADDLE, SoundCategory.PLAYERS, 0.5F, 1.5F);
|
||||
}
|
||||
else
|
||||
{
|
||||
entityHeld.setPosition(entity.posX, entity.posY, entity.posZ);
|
||||
world.spawnEntity(entityHeld);
|
||||
entityHeld.startRiding(topEntity, false);
|
||||
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.BLOCK_NOTE_BASS, SoundCategory.PLAYERS, 0.5F, 1.5F);
|
||||
return;
|
||||
}
|
||||
|
||||
ItemEntity.clearEntityData(main);
|
||||
player.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
|
||||
ItemEvents.sendPacket(player, 9, 0);
|
||||
event.setCanceled(true);
|
||||
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_HORSE_SADDLE, SoundCategory.PLAYERS, 0.5F, 1.5F);
|
||||
}
|
||||
else
|
||||
{
|
||||
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.BLOCK_NOTE_BASS, SoundCategory.PLAYERS, 0.5F, 1.5F);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ 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.common.config.Config;
|
||||
import net.minecraftforge.common.config.ConfigManager;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
|
|
@ -36,6 +38,7 @@ import net.minecraftforge.event.entity.player.PlayerEvent.StartTracking;
|
|||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;
|
||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
|
@ -47,6 +50,7 @@ import net.minecraftforge.items.IItemHandler;
|
|||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
import tschipp.carryon.common.config.CarryOnConfig;
|
||||
import tschipp.carryon.common.handler.ListHandler;
|
||||
import tschipp.carryon.common.handler.PickupHandler;
|
||||
import tschipp.carryon.common.handler.RegistrationHandler;
|
||||
import tschipp.carryon.common.item.ItemEntity;
|
||||
|
|
@ -59,7 +63,7 @@ public class ItemEvents
|
|||
{
|
||||
|
||||
public static Map<BlockPos, Integer> positions = new HashMap<BlockPos, Integer>();
|
||||
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void onBlockClick(PlayerInteractEvent.RightClickBlock event)
|
||||
{
|
||||
|
|
@ -124,10 +128,9 @@ public class ItemEvents
|
|||
ItemTile.clearTileData(stack);
|
||||
eitem.setItem(ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
BlockPos pos = new BlockPos(Math.floor(eitem.posX), Math.floor(eitem.posY), Math.floor(eitem.posZ));
|
||||
if(positions.containsKey(pos))
|
||||
if (positions.containsKey(pos))
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
|
@ -259,28 +262,27 @@ public class ItemEvents
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldTick(TickEvent.WorldTickEvent event)
|
||||
{
|
||||
for(Entry<BlockPos, Integer> entry : positions.entrySet())
|
||||
for (Entry<BlockPos, Integer> entry : positions.entrySet())
|
||||
{
|
||||
entry.setValue(entry.getValue() + 1);
|
||||
|
||||
if(entry.getValue() > 3)
|
||||
|
||||
if (entry.getValue() > 3)
|
||||
positions.remove(entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDrop(HarvestDropsEvent event)
|
||||
{
|
||||
if(positions.containsKey(event.getPos()))
|
||||
if (positions.containsKey(event.getPos()))
|
||||
{
|
||||
event.getDrops().clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBlockRightClick(PlayerInteractEvent.RightClickBlock event)
|
||||
{
|
||||
|
|
@ -306,7 +308,6 @@ public class ItemEvents
|
|||
{
|
||||
player.closeScreen();
|
||||
|
||||
|
||||
if (ItemTile.storeTileData(te, world, pos, state.getActualState(world, pos), stack))
|
||||
{
|
||||
|
||||
|
|
@ -319,7 +320,7 @@ public class ItemEvents
|
|||
overrideHash = override.hashCode();
|
||||
|
||||
positions.put(pos, 0);
|
||||
|
||||
|
||||
boolean success = false;
|
||||
|
||||
try
|
||||
|
|
@ -368,7 +369,6 @@ public class ItemEvents
|
|||
if (command != null)
|
||||
player.getServer().getCommandManager().executeCommand(player.getServer(), "/execute " + player.getGameProfile().getName() + " ~ ~ ~ " + command);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -500,6 +500,16 @@ public class ItemEvents
|
|||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event)
|
||||
{
|
||||
if (event.getModID().equals(CarryOn.MODID))
|
||||
{
|
||||
ListHandler.initLists();
|
||||
ConfigManager.load(CarryOn.MODID, Config.Type.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
public int getSlot(EntityPlayer player, Item item)
|
||||
{
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ public class ListHandler
|
|||
public static List<String> FORBIDDEN_ENTITIES;
|
||||
public static List<String> ALLOWED_ENTITIES;
|
||||
public static List<String> ALLOWED_TILES;
|
||||
|
||||
public static List<String> FORBIDDEN_STACKING;
|
||||
public static List<String> ALLOWED_STACKING;
|
||||
|
||||
public static boolean isForbidden(Block block)
|
||||
{
|
||||
String name = block.getRegistryName().toString();
|
||||
|
|
@ -45,6 +47,7 @@ public class ListHandler
|
|||
boolean contains = FORBIDDEN_ENTITIES.contains(name);
|
||||
return contains;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -59,6 +62,29 @@ public class ListHandler
|
|||
return true;
|
||||
}
|
||||
|
||||
public static boolean isStackingForbidden(Entity entity)
|
||||
{
|
||||
if (EntityList.getKey(entity) != null)
|
||||
{
|
||||
String name = EntityList.getKey(entity).toString();
|
||||
boolean contains = FORBIDDEN_STACKING.contains(name);
|
||||
return contains;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isStackingAllowed(Entity entity)
|
||||
{
|
||||
if (EntityList.getKey(entity) != null)
|
||||
{
|
||||
String name = EntityList.getKey(entity).toString();
|
||||
boolean contains = ALLOWED_STACKING.contains(name);
|
||||
return contains;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isAllowed(Block block)
|
||||
{
|
||||
String name = block.getRegistryName().toString();
|
||||
|
|
@ -80,7 +106,7 @@ public class ListHandler
|
|||
|
||||
}
|
||||
|
||||
public static void initForbiddenTiles()
|
||||
public static void initLists()
|
||||
{
|
||||
String[] forbidden = CarryOnConfig.blacklist.forbiddenTiles;
|
||||
FORBIDDEN_TILES = new ArrayList<String>();
|
||||
|
|
@ -133,6 +159,43 @@ public class ListHandler
|
|||
{
|
||||
ALLOWED_TILES.add(allowedBlocks[i]);
|
||||
}
|
||||
|
||||
String[] forbiddenStacking = CarryOnConfig.blacklist.forbiddenStacking;
|
||||
FORBIDDEN_STACKING = new ArrayList<String>();
|
||||
|
||||
for (int i = 0; i < forbiddenStacking.length; i++)
|
||||
{
|
||||
if (forbiddenStacking[i].contains("*"))
|
||||
{
|
||||
String modid = forbiddenStacking[i].replace("*", "");
|
||||
for (int k = 0; k < ForgeRegistries.ENTITIES.getKeys().size(); k++)
|
||||
{
|
||||
if (ForgeRegistries.ENTITIES.getKeys().toArray()[k].toString().contains(modid))
|
||||
{
|
||||
FORBIDDEN_STACKING.add(ForgeRegistries.ENTITIES.getKeys().toArray()[k].toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
FORBIDDEN_STACKING.add(forbiddenStacking[i]);
|
||||
}
|
||||
|
||||
String[] allowedStacking = CarryOnConfig.whitelist.allowedStacking;
|
||||
ALLOWED_STACKING = new ArrayList<String>();
|
||||
for (int i = 0; i < allowedStacking.length; i++)
|
||||
{
|
||||
if (allowedStacking[i].contains("*"))
|
||||
{
|
||||
String modid = allowedStacking[i].replace("*", "");
|
||||
for (int k = 0; k < ForgeRegistries.ENTITIES.getKeys().size(); k++)
|
||||
{
|
||||
if (ForgeRegistries.ENTITIES.getKeys().toArray()[k].toString().contains(modid))
|
||||
{
|
||||
ALLOWED_STACKING.add(ForgeRegistries.ENTITIES.getKeys().toArray()[k].toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
ALLOWED_STACKING.add(allowedStacking[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.client.event.RenderEntityEvents;
|
||||
import tschipp.carryon.client.event.RenderEvents;
|
||||
|
|
@ -17,6 +18,7 @@ import tschipp.carryon.common.event.ItemEntityEvents;
|
|||
import tschipp.carryon.common.event.ItemEvents;
|
||||
import tschipp.carryon.common.item.ItemEntity;
|
||||
import tschipp.carryon.common.item.ItemTile;
|
||||
import tschipp.carryon.compat.obfuscate.ObfuscateEvents;
|
||||
|
||||
public class RegistrationHandler
|
||||
{
|
||||
|
|
@ -47,13 +49,17 @@ public class RegistrationHandler
|
|||
MinecraftForge.EVENT_BUS.register(new RenderEvents());
|
||||
MinecraftForge.EVENT_BUS.register(new RenderEntityEvents());
|
||||
MinecraftForge.EVENT_BUS.register(new PositionClientEvents());
|
||||
|
||||
if(Loader.isModLoaded("obfuscate"))
|
||||
MinecraftForge.EVENT_BUS.register(new ObfuscateEvents());
|
||||
|
||||
}
|
||||
|
||||
public static void regOverrideList()
|
||||
{
|
||||
ModelOverridesHandler.initOverrides();
|
||||
CustomPickupOverrideHandler.initPickupOverrides();
|
||||
ListHandler.initForbiddenTiles();
|
||||
ListHandler.initLists();
|
||||
}
|
||||
|
||||
public static void regCaps()
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import net.minecraft.world.WorldServer;
|
|||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import tschipp.carryon.common.config.CarryOnConfig;
|
||||
import tschipp.carryon.common.handler.ListHandler;
|
||||
import tschipp.carryon.common.helper.ScriptParseHelper;
|
||||
|
||||
public class ScriptChecker
|
||||
|
|
@ -39,12 +40,17 @@ public class ScriptChecker
|
|||
float resistance = block.getExplosionResistance(null);
|
||||
NBTTagCompound nbt = tag;
|
||||
|
||||
for (CarryOnOverride override : ScriptReader.OVERRIDES.values())
|
||||
boolean isAllowed = CarryOnConfig.settings.useWhitelistBlocks ? ListHandler.isAllowed(block) : !ListHandler.isForbidden(block);
|
||||
|
||||
if (isAllowed)
|
||||
{
|
||||
if (override.isBlock())
|
||||
for (CarryOnOverride override : ScriptReader.OVERRIDES.values())
|
||||
{
|
||||
if (matchesAll(override, block, meta, material, hardness, resistance, nbt))
|
||||
return override;
|
||||
if (override.isBlock())
|
||||
{
|
||||
if (matchesAll(override, block, meta, material, hardness, resistance, nbt))
|
||||
return override;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -64,12 +70,17 @@ public class ScriptChecker
|
|||
NBTTagCompound tag = new NBTTagCompound();
|
||||
entity.writeToNBT(tag);
|
||||
|
||||
for (CarryOnOverride override : ScriptReader.OVERRIDES.values())
|
||||
boolean isAllowed = CarryOnConfig.settings.useWhitelistEntities ? ListHandler.isAllowed(entity) : !ListHandler.isForbidden(entity);
|
||||
|
||||
if (isAllowed)
|
||||
{
|
||||
if (override.isEntity())
|
||||
for (CarryOnOverride override : ScriptReader.OVERRIDES.values())
|
||||
{
|
||||
if (matchesAll(override, name, height, width, health, tag))
|
||||
return override;
|
||||
if (override.isEntity())
|
||||
{
|
||||
if (matchesAll(override, name, height, width, health, tag))
|
||||
return override;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,104 @@
|
|||
package tschipp.carryon.compat.obfuscate;
|
||||
|
||||
import com.mrcrayfish.obfuscate.client.event.ModelPlayerEvent;
|
||||
|
||||
import net.minecraft.client.model.ModelPlayer;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import tschipp.carryon.common.config.CarryOnConfig;
|
||||
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;
|
||||
|
||||
public class ObfuscateEvents
|
||||
{
|
||||
|
||||
@SubscribeEvent
|
||||
public void preModelPlayerEvent(ModelPlayerEvent.SetupAngles.Post event)
|
||||
{
|
||||
if(!CarryOnConfig.settings.renderArms)
|
||||
return;
|
||||
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
float partialticks = event.getPartialTicks();
|
||||
|
||||
ModelPlayer model = event.getModelPlayer();
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (!stack.isEmpty() && stack.getItem() == RegistrationHandler.itemTile && ItemTile.hasTileData(stack) || stack.getItem() == RegistrationHandler.itemEntity && ItemEntity.hasEntityData(stack))
|
||||
{
|
||||
|
||||
float rotation = 0;
|
||||
|
||||
if (player.isRiding() && player.getRidingEntity() instanceof EntityLivingBase)
|
||||
rotation = 0;
|
||||
else
|
||||
rotation = 0;
|
||||
|
||||
|
||||
CarryOnOverride overrider = ScriptChecker.getOverride(player);
|
||||
if (overrider != null)
|
||||
{
|
||||
double[] rotLeft = null;
|
||||
double[] rotRight = null;
|
||||
if (overrider.getRenderRotationLeftArm() != null)
|
||||
rotLeft = ScriptParseHelper.getXYZArray(overrider.getRenderRotationLeftArm());
|
||||
if (overrider.getRenderRotationRightArm() != null)
|
||||
rotRight = ScriptParseHelper.getXYZArray(overrider.getRenderRotationRightArm());
|
||||
|
||||
boolean renderRight = overrider.isRenderRightArm();
|
||||
boolean renderLeft = overrider.isRenderLeftArm();
|
||||
|
||||
if (renderLeft && rotLeft != null)
|
||||
{
|
||||
renderArmPre(model.bipedLeftArm, (float) rotLeft[0], (float) rotLeft[2], rotation);
|
||||
renderArmPre(model.bipedLeftArmwear, (float) rotLeft[0], (float) rotLeft[2], rotation);
|
||||
}
|
||||
else if (renderLeft)
|
||||
{
|
||||
renderArmPre(model.bipedLeftArm, 0.8F + (player.isSneaking() ? 0.2f : 0f) - (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation);
|
||||
renderArmPre(model.bipedLeftArmwear, 0.8F + (player.isSneaking() ? 0.2f : 0f) - (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation);
|
||||
}
|
||||
|
||||
if (renderRight && rotRight != null)
|
||||
{
|
||||
renderArmPre(model.bipedRightArm, (float) rotRight[0], (float) rotRight[2], rotation);
|
||||
renderArmPre(model.bipedRightArmwear, (float) rotRight[0], (float) rotRight[2], rotation);
|
||||
}
|
||||
else if (renderRight)
|
||||
{
|
||||
renderArmPre(model.bipedRightArm, 0.8F + (player.isSneaking() ? 0.2f : 0f) - (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation);
|
||||
renderArmPre(model.bipedRightArmwear, 0.8F + (player.isSneaking() ? 0.2f : 0f) - (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
renderArmPre(model.bipedRightArm, 0.8F + (player.isSneaking() ? 0.2f : 0f) - (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation);
|
||||
renderArmPre(model.bipedRightArmwear, 0.8F + (player.isSneaking() ? 0.2f : 0f) - (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? -0.15f : 0), rotation);
|
||||
renderArmPre(model.bipedLeftArm, 0.8F + (player.isSneaking() ? 0.2f : 0f) - (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation);
|
||||
renderArmPre(model.bipedLeftArmwear, 0.8F + (player.isSneaking() ? 0.2f : 0f) - (stack.getItem() == RegistrationHandler.itemEntity ? -0.2f : 0), (stack.getItem() == RegistrationHandler.itemEntity ? 0.15f : 0), rotation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void renderArmPre(ModelRenderer arm, float x, float z, float rotation)
|
||||
{
|
||||
arm.rotateAngleX = (float) -x;
|
||||
arm.rotateAngleY = (float) -Math.toRadians(rotation);
|
||||
arm.rotateAngleZ = (float) z;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
"modid" : "carryon",
|
||||
"name" : "Carry On",
|
||||
"version" : "1.11.1", "mcversion" : "1.12.2",
|
||||
"version" : "1.12", "mcversion" : "1.12.2",
|
||||
"url" : "",
|
||||
"credits" : "Tschipp, Purplicious_Cow, cy4n",
|
||||
"authorList" : ["Tschipp, Purplicious_Cow, cy4n"],
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user