God damn it Forge. Whoever invented these @SideOnly annotations deserved to die and burn for eternity in the ninth circle of hell for their crimes

This commit is contained in:
Sollace 2019-01-30 12:26:00 +02:00
parent 17db70456a
commit b75ea7dfcf
26 changed files with 399 additions and 212 deletions

View file

@ -23,6 +23,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.biome.BiomeColorHelper; import net.minecraft.world.biome.BiomeColorHelper;
import net.minecraft.world.gen.feature.WorldGenTrees; import net.minecraft.world.gen.feature.WorldGenTrees;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.IForgeRegistry;
public class UBlocks { public class UBlocks {
@ -61,6 +63,7 @@ public class UBlocks {
apple_tree, apple_leaves); apple_tree, apple_leaves);
} }
@SideOnly(Side.CLIENT)
static void registerColors(ItemColors items, BlockColors blocks) { static void registerColors(ItemColors items, BlockColors blocks) {
items.registerItemColorHandler((stack, tint) -> { items.registerItemColorHandler((stack, tint) -> {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")

View file

@ -1,9 +1,51 @@
package com.minelittlepony.unicopia; package com.minelittlepony.unicopia;
import net.minecraftforge.fml.common.FMLCommonHandler; import javax.annotation.Nullable;
public interface UClient { import com.minelittlepony.unicopia.forgebullshit.FUF;
static boolean isClientSide() {
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.IInteractionObject;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
public class UClient {
private static UClient instance;
public static boolean isClientSide() {
return FMLCommonHandler.instance().getSide().isClient(); return FMLCommonHandler.instance().getSide().isClient();
} }
@FUF(reason = "Forced client Separation")
public static UClient instance() {
if (instance == null) {
if (isClientSide()) {
instance = new UnicopiaClient();
} else {
instance = new UClient();
}
}
return instance;
}
@FUF(reason = "Forced client Separation")
public void displayGuiToPlayer(EntityPlayer player, IInteractionObject inventory) {
player.displayGui(inventory);
}
@FUF(reason = "Forced client Separation")
@Nullable
public EntityPlayer getPlayer() {
return null;
}
public void preInit(FMLPreInitializationEvent event) {}
public void init(FMLInitializationEvent event) {}
public void posInit(FMLPostInitializationEvent event) {}
} }

View file

@ -9,15 +9,13 @@ import com.minelittlepony.unicopia.entity.EntitySpell;
import com.minelittlepony.unicopia.entity.EntitySpellbook; import com.minelittlepony.unicopia.entity.EntitySpellbook;
import com.minelittlepony.unicopia.entity.EntityProjectile; import com.minelittlepony.unicopia.entity.EntityProjectile;
import com.minelittlepony.unicopia.entity.EntityWildCloud; import com.minelittlepony.unicopia.entity.EntityWildCloud;
import com.minelittlepony.unicopia.forgebullshit.EntityType;
import com.minelittlepony.unicopia.render.RenderCloud; import com.minelittlepony.unicopia.render.RenderCloud;
import com.minelittlepony.unicopia.render.RenderGem; import com.minelittlepony.unicopia.render.RenderGem;
import com.minelittlepony.unicopia.render.RenderProjectile; import com.minelittlepony.unicopia.render.RenderProjectile;
import com.minelittlepony.unicopia.render.RenderSpellbook; import com.minelittlepony.unicopia.render.RenderSpellbook;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList.EntityEggInfo;
import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.EnumCreatureType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biome.SpawnListEntry; import net.minecraft.world.biome.Biome.SpawnListEntry;
import net.minecraft.world.biome.BiomeEnd; import net.minecraft.world.biome.BiomeEnd;
@ -25,7 +23,6 @@ import net.minecraft.world.biome.BiomeHell;
import net.minecraftforge.common.BiomeManager; import net.minecraftforge.common.BiomeManager;
import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.registry.EntityEntry; import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.EntityEntryBuilder;
import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.IForgeRegistry;
public class UEntities { public class UEntities {
@ -33,14 +30,15 @@ public class UEntities {
private static final int BRUSHES_CHARTREUSE = 0x7FFF00; private static final int BRUSHES_CHARTREUSE = 0x7FFF00;
static void init(IForgeRegistry<EntityEntry> registry) { static void init(IForgeRegistry<EntityEntry> registry) {
EntityType builder = EntityType.builder(Unicopia.MODID);
registry.registerAll( registry.registerAll(
new Entry(EntityCloud.class, "cloud").withEgg(BRUSHES_ROYALBLUE, BRUSHES_CHARTREUSE), builder.creature(EntityCloud.class, "cloud").withEgg(BRUSHES_ROYALBLUE, BRUSHES_CHARTREUSE),
new Entry(EntityWildCloud.class, "wild_cloud"), builder.creature(EntityWildCloud.class, "wild_cloud"),
new Entry(EntityRacingCloud.class, "racing_cloud"), builder.creature(EntityRacingCloud.class, "racing_cloud"),
new Entry(EntityConstructionCloud.class, "construction_cloud"), builder.creature(EntityConstructionCloud.class, "construction_cloud"),
new Entry(EntitySpell.class, "magic_spell"), builder.creature(EntitySpell.class, "magic_spell"),
new Entry(EntitySpellbook.class, "spellbook"), builder.creature(EntitySpellbook.class, "spellbook"),
EntityEntryBuilder.<EntityProjectile>create().entity(EntityProjectile.class).name("thrown_item").id(new ResourceLocation(Unicopia.MODID, "thrown_item"), 0).tracker(10, 5, true).build() builder.projectile(EntityProjectile.class, "thrown_item", 10, 5)
); );
} }
@ -64,18 +62,4 @@ public class UEntities {
}); });
} }
} }
static class Entry extends EntityEntry {
public Entry(Class<? extends Entity> cls, String name) {
super(cls, name);
setRegistryName(Unicopia.MODID, name);
}
Entry withEgg(int a, int b) {
setEgg(new EntityEggInfo(getRegistryName(), a, b));
return this;
}
}
} }

View file

@ -40,6 +40,8 @@ import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.IForgeRegistry;
import static com.minelittlepony.unicopia.Predicates.*; import static com.minelittlepony.unicopia.Predicates.*;
@ -228,6 +230,7 @@ public class UItems {
), new ItemStack(cloud_block, 1, 2)).setRegistryName(Unicopia.MODID, "id_dont_care_just_use_it")); ), new ItemStack(cloud_block, 1, 2)).setRegistryName(Unicopia.MODID, "id_dont_care_just_use_it"));
} }
@SideOnly(Side.CLIENT)
static void registerColors(ItemColors registry) { static void registerColors(ItemColors registry) {
registry.registerItemColorHandler((stack, tint) -> { registry.registerItemColorHandler((stack, tint) -> {
if (Predicates.MAGI.test(Minecraft.getMinecraft().player)) { if (Predicates.MAGI.test(Minecraft.getMinecraft().player)) {

View file

@ -4,5 +4,5 @@ import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
public class UMaterials { public class UMaterials {
public static final Material cloud = (new Material(MapColor.SNOW)); public static final Material cloud = new Material(MapColor.SNOW);
} }

View file

@ -4,11 +4,15 @@ import com.minelittlepony.unicopia.particle.Particles;
import com.minelittlepony.unicopia.particle.client.EntityMagicFX; import com.minelittlepony.unicopia.particle.client.EntityMagicFX;
import com.minelittlepony.unicopia.particle.client.EntityRaindropFX; import com.minelittlepony.unicopia.particle.client.EntityRaindropFX;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class UParticles { public class UParticles {
public static int MAGIC_PARTICLE; public static int MAGIC_PARTICLE;
public static int RAIN_PARTICLE; public static int RAIN_PARTICLE;
@SideOnly(Side.CLIENT)
static void init() { static void init() {
MAGIC_PARTICLE = Particles.instance().registerParticle(EntityMagicFX::new); MAGIC_PARTICLE = Particles.instance().registerParticle(EntityMagicFX::new);
RAIN_PARTICLE = Particles.instance().registerParticle(EntityRaindropFX::new); RAIN_PARTICLE = Particles.instance().registerParticle(EntityRaindropFX::new);

View file

@ -3,7 +3,6 @@ package com.minelittlepony.unicopia;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockTallGrass; import net.minecraft.block.BlockTallGrass;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
@ -15,11 +14,6 @@ import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import net.minecraftforge.client.event.ColorHandlerEvent;
import net.minecraftforge.client.event.EntityViewRenderEvent;
import net.minecraftforge.client.event.FOVUpdateEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.event.entity.item.ItemTossEvent; import net.minecraftforge.event.entity.item.ItemTossEvent;
import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent; import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent;
@ -41,34 +35,28 @@ import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
import net.minecraftforge.fml.common.network.IGuiHandler; import net.minecraftforge.fml.common.network.IGuiHandler;
import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.registry.EntityEntry; import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.minelittlepony.jumpingcastle.api.IChannel; import com.minelittlepony.jumpingcastle.api.IChannel;
import com.minelittlepony.jumpingcastle.api.JumpingCastle; import com.minelittlepony.jumpingcastle.api.JumpingCastle;
import com.minelittlepony.jumpingcastle.api.Target;
import com.minelittlepony.unicopia.advancements.UAdvancements; import com.minelittlepony.unicopia.advancements.UAdvancements;
import com.minelittlepony.unicopia.block.ITillable; import com.minelittlepony.unicopia.block.ITillable;
import com.minelittlepony.unicopia.command.Commands; import com.minelittlepony.unicopia.command.Commands;
import com.minelittlepony.unicopia.enchanting.SpellRecipe; import com.minelittlepony.unicopia.enchanting.SpellRecipe;
import com.minelittlepony.unicopia.forgebullshit.FBS; import com.minelittlepony.unicopia.forgebullshit.FBS;
import com.minelittlepony.unicopia.hud.UHud;
import com.minelittlepony.unicopia.input.Keyboard;
import com.minelittlepony.unicopia.inventory.gui.ContainerSpellBook; import com.minelittlepony.unicopia.inventory.gui.ContainerSpellBook;
import com.minelittlepony.unicopia.inventory.gui.GuiSpellBook; import com.minelittlepony.unicopia.inventory.gui.GuiSpellBook;
import com.minelittlepony.unicopia.network.MsgPlayerAbility; import com.minelittlepony.unicopia.network.MsgPlayerAbility;
import com.minelittlepony.unicopia.network.MsgPlayerCapabilities; import com.minelittlepony.unicopia.network.MsgPlayerCapabilities;
import com.minelittlepony.unicopia.network.MsgRequestCapabilities; import com.minelittlepony.unicopia.network.MsgRequestCapabilities;
import com.minelittlepony.unicopia.player.IPlayer;
import com.minelittlepony.unicopia.player.IView;
import com.minelittlepony.unicopia.player.PlayerSpeciesList; import com.minelittlepony.unicopia.player.PlayerSpeciesList;
import com.minelittlepony.unicopia.power.PowersRegistry; import com.minelittlepony.unicopia.power.PowersRegistry;
import com.minelittlepony.unicopia.util.crafting.CraftingManager; import com.minelittlepony.unicopia.util.crafting.CraftingManager;
import com.minelittlepony.pony.data.IPony;
@Mod( @Mod(
modid = Unicopia.MODID, modid = Unicopia.MODID,
@ -82,43 +70,16 @@ public class Unicopia implements IGuiHandler {
public static final String NAME = "@NAME@"; public static final String NAME = "@NAME@";
public static final String VERSION = "@VERSION@"; public static final String VERSION = "@VERSION@";
public static IChannel channel; public static final Logger log = LogManager.getLogger();
/** public static IChannel channel;
* The race preferred by the client - as determined by mine little pony.
* Human if minelp was not installed.
*
* This is not neccessarily the _actual_ race used for the player,
* as the server may not allow certain race types, or the player may override
* this option in-game themselves.
*/
private static Race clientPlayerRace = getclientPlayerRace();
private static CraftingManager craftingManager; private static CraftingManager craftingManager;
@EventHandler @EventHandler
public void preInit(FMLPreInitializationEvent event) { public void preInit(FMLPreInitializationEvent event) {
UConfig.init(event.getModConfigurationDirectory()); UConfig.init(event.getModConfigurationDirectory());
UClient.instance().preInit(event);
if (UClient.isClientSide()) {
UEntities.preInit();
UParticles.init();
}
}
@SideOnly(Side.CLIENT)
private static Race getclientPlayerRace() {
if (!UConfig.getInstance().ignoresMineLittlePony()
&& Minecraft.getMinecraft().player != null
&& MineLP.modIsActive()) {
Race race = Race.fromPonyRace(IPony.forPlayer(Minecraft.getMinecraft().player).getRace(false));
if (!race.isDefault()) {
return race;
}
}
return UConfig.getInstance().getPrefferedRace();
} }
@EventHandler @EventHandler
@ -135,7 +96,8 @@ public class Unicopia implements IGuiHandler {
FBS.init(); FBS.init();
NetworkRegistry.INSTANCE.registerGuiHandler(this, this); NetworkRegistry.INSTANCE.registerGuiHandler(this, this);
clientPlayerRace = getclientPlayerRace();
UClient.instance().init(event);
} }
@EventHandler @EventHandler
@ -150,6 +112,7 @@ public class Unicopia implements IGuiHandler {
}; };
Biome.REGISTRY.forEach(UEntities::registerSpawnEntries); Biome.REGISTRY.forEach(UEntities::registerSpawnEntries);
UClient.instance().posInit(event);
} }
public static CraftingManager getCraftingManager() { public static CraftingManager getCraftingManager() {
@ -161,12 +124,6 @@ public class Unicopia implements IGuiHandler {
UItems.registerItems(event.getRegistry()); UItems.registerItems(event.getRegistry());
} }
@SubscribeEvent
public static void registerItemColours(ColorHandlerEvent.Item event) {
UItems.registerColors(event.getItemColors());
UBlocks.registerColors(event.getItemColors(), event.getBlockColors());
}
@SubscribeEvent @SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) { public static void registerBlocks(RegistryEvent.Register<Block> event) {
UBlocks.registerBlocks(event.getRegistry()); UBlocks.registerBlocks(event.getRegistry());
@ -187,39 +144,6 @@ public class Unicopia implements IGuiHandler {
UEntities.init(event.getRegistry()); UEntities.init(event.getRegistry());
} }
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void onGameTick(TickEvent.ClientTickEvent event) {
if (event.phase == Phase.END) {
if (Minecraft.getMinecraft().player != null) {
Race newRace = getclientPlayerRace();
if (newRace != clientPlayerRace) {
clientPlayerRace = newRace;
channel.send(new MsgRequestCapabilities(Minecraft.getMinecraft().player, clientPlayerRace), Target.SERVER);
}
}
Keyboard.getKeyHandler().onKeyInput();
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void setupPlayerCamera(EntityViewRenderEvent.CameraSetup event) {
EntityPlayer player = Minecraft.getMinecraft().player;
if (player != null) {
IView view = PlayerSpeciesList.instance().getPlayer(player).getCamera();
event.setRoll(view.calculateRoll());
event.setPitch(view.calculatePitch(event.getPitch()));
event.setYaw(view.calculateYaw(event.getYaw()));
}
}
@SubscribeEvent @SubscribeEvent
public static void onBlockHarvested(BlockEvent.HarvestDropsEvent event) { public static void onBlockHarvested(BlockEvent.HarvestDropsEvent event) {
Block block = event.getState().getBlock(); Block block = event.getState().getBlock();
@ -305,27 +229,10 @@ public class Unicopia implements IGuiHandler {
} }
@EventHandler @EventHandler
public void onServerStarted(FMLServerStartingEvent event) { public void onServerStart(FMLServerStartingEvent event) {
Commands.init(event); Commands.init(event);
} }
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void onRenderHud(RenderGameOverlayEvent.Post event) {
if (event.getType() != ElementType.ALL) {
return;
}
if (UClient.isClientSide()) {
Minecraft mc = Minecraft.getMinecraft();
if (mc.player != null && mc.world != null) {
IPlayer player = PlayerSpeciesList.instance().getPlayer(mc.player);
UHud.instance.renderHud(player, event.getResolution());
}
}
}
@SubscribeEvent @SubscribeEvent
public static void onItemUseFinish(LivingEntityUseItemEvent.Finish event) { public static void onItemUseFinish(LivingEntityUseItemEvent.Finish event) {
Entity e = event.getEntity(); Entity e = event.getEntity();
@ -335,11 +242,6 @@ public class Unicopia implements IGuiHandler {
} }
} }
@SubscribeEvent
public static void modifyFOV(FOVUpdateEvent event) {
event.setNewfov(PlayerSpeciesList.instance().getPlayer(event.getEntity()).getCamera().calculateFieldOfView(event.getFov()));
}
@Override @Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
switch (ID) { switch (ID) {

View file

@ -0,0 +1,152 @@
package com.minelittlepony.unicopia;
import javax.annotation.Nullable;
import com.minelittlepony.jumpingcastle.api.Target;
import com.minelittlepony.pony.data.IPony;
import com.minelittlepony.unicopia.hud.UHud;
import com.minelittlepony.unicopia.input.Keyboard;
import com.minelittlepony.unicopia.inventory.gui.GuiOfHolding;
import com.minelittlepony.unicopia.network.MsgRequestCapabilities;
import com.minelittlepony.unicopia.player.IPlayer;
import com.minelittlepony.unicopia.player.IView;
import com.minelittlepony.unicopia.player.PlayerSpeciesList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.IInteractionObject;
import net.minecraftforge.client.event.ColorHandlerEvent;
import net.minecraftforge.client.event.EntityViewRenderEvent;
import net.minecraftforge.client.event.FOVUpdateEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@EventBusSubscriber(Side.CLIENT)
public class UnicopiaClient extends UClient {
/**
* The race preferred by the client - as determined by mine little pony.
* Human if minelp was not installed.
*
* This is not neccessarily the _actual_ race used for the player,
* as the server may not allow certain race types, or the player may override
* this option in-game themselves.
*/
private static Race clientPlayerRace = getclientPlayerRace();
private static Race getclientPlayerRace() {
if (!UConfig.getInstance().ignoresMineLittlePony()
&& Minecraft.getMinecraft().player != null
&& MineLP.modIsActive()) {
Race race = Race.fromPonyRace(IPony.forPlayer(Minecraft.getMinecraft().player).getRace(false));
if (!race.isDefault()) {
return race;
}
}
return UConfig.getInstance().getPrefferedRace();
}
@Override
public void displayGuiToPlayer(EntityPlayer player, IInteractionObject inventory) {
if (player instanceof EntityPlayerSP) {
if ("unicopia:itemofholding".equals(inventory.getGuiID())) {
Minecraft.getMinecraft().displayGuiScreen(new GuiOfHolding(inventory));
}
} else {
super.displayGuiToPlayer(player, inventory);
}
}
@Nullable
public EntityPlayer getPlayer() {
return Minecraft.getMinecraft().player;
}
@SideOnly(Side.CLIENT)
@Override
public void preInit(FMLPreInitializationEvent event) {
UEntities.preInit();
UParticles.init();
}
@SideOnly(Side.CLIENT)
@Override
public void init(FMLInitializationEvent event) {
clientPlayerRace = getclientPlayerRace();
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void registerItemColours(ColorHandlerEvent.Item event) {
UItems.registerColors(event.getItemColors());
UBlocks.registerColors(event.getItemColors(), event.getBlockColors());
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void onRenderHud(RenderGameOverlayEvent.Post event) {
if (event.getType() != ElementType.ALL) {
return;
}
if (UClient.isClientSide()) {
Minecraft mc = Minecraft.getMinecraft();
if (mc.player != null && mc.world != null) {
IPlayer player = PlayerSpeciesList.instance().getPlayer(mc.player);
UHud.instance.renderHud(player, event.getResolution());
}
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void modifyFOV(FOVUpdateEvent event) {
event.setNewfov(PlayerSpeciesList.instance().getPlayer(event.getEntity()).getCamera().calculateFieldOfView(event.getFov()));
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void onGameTick(TickEvent.ClientTickEvent event) {
if (event.phase == Phase.END) {
if (Minecraft.getMinecraft().player != null) {
Race newRace = getclientPlayerRace();
if (newRace != clientPlayerRace) {
clientPlayerRace = newRace;
Unicopia.channel.send(new MsgRequestCapabilities(Minecraft.getMinecraft().player, clientPlayerRace), Target.SERVER);
}
}
Keyboard.getKeyHandler().onKeyInput();
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void setupPlayerCamera(EntityViewRenderEvent.CameraSetup event) {
EntityPlayer player = Minecraft.getMinecraft().player;
if (player != null) {
IView view = PlayerSpeciesList.instance().getPlayer(player).getCamera();
event.setRoll(view.calculateRoll());
event.setPitch(view.calculatePitch(event.getPitch()));
event.setYaw(view.calculateYaw(event.getYaw()));
}
}
}

View file

@ -11,7 +11,6 @@ import com.minelittlepony.unicopia.player.PlayerSpeciesList;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -182,7 +181,7 @@ public class BlockCloud extends Block implements ICloudBlock, ITillable {
@Override @Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {VARIANT}); return new BlockStateContainer(this, VARIANT);
} }
@Override @Override

View file

@ -1,12 +1,13 @@
package com.minelittlepony.unicopia.block; package com.minelittlepony.unicopia.block;
import com.minelittlepony.unicopia.CloudType; import com.minelittlepony.unicopia.CloudType;
import com.minelittlepony.unicopia.UClient;
import com.minelittlepony.unicopia.forgebullshit.FUF;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockFalling; import net.minecraft.block.BlockFalling;
import net.minecraft.block.BlockTorch; import net.minecraft.block.BlockTorch;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -23,7 +24,7 @@ public interface ICloudBlock {
default boolean handleRayTraceSpecialCases(World world, BlockPos pos, IBlockState state) { default boolean handleRayTraceSpecialCases(World world, BlockPos pos, IBlockState state) {
if (world.isRemote) { if (world.isRemote) {
EntityPlayer player = Minecraft.getMinecraft().player; EntityPlayer player = UClient.instance().getPlayer();
if (!getCanInteract(state, player)) { if (!getCanInteract(state, player)) {
return true; return true;
@ -57,6 +58,7 @@ public interface ICloudBlock {
default boolean getCanInteract(IBlockState state, Entity e) { default boolean getCanInteract(IBlockState state, Entity e) {
if (getCloudMaterialType(state).canInteract(e)) { if (getCloudMaterialType(state).canInteract(e)) {
if (e instanceof EntityItem) { if (e instanceof EntityItem) {
// @FUF(reason = "There is no TickEvents.EntityTickEvent. Waiting on mixins...")
e.setNoGravity(true); e.setNoGravity(true);
} }
return true; return true;
@ -69,6 +71,15 @@ public interface ICloudBlock {
return getCloudMaterialType(blockState) != CloudType.NORMAL; return getCloudMaterialType(blockState) != CloudType.NORMAL;
} }
/**
* Determines whether falling sand entities should fall through this block.
* @param state Our block state
* @param world The current world
* @param pos The current position
*
* @return True to allow blocks to pass.
*/
@FUF(reason = "Hacked until we can get mixins to implement a proper hook")
default boolean allowsFallingBlockToPass(IBlockState state, IBlockAccess world, BlockPos pos) { default boolean allowsFallingBlockToPass(IBlockState state, IBlockAccess world, BlockPos pos) {
if (isDense(state)) { if (isDense(state)) {
return false; return false;

View file

@ -7,6 +7,7 @@ import com.minelittlepony.unicopia.Predicates;
import com.minelittlepony.unicopia.UBlocks; import com.minelittlepony.unicopia.UBlocks;
import com.minelittlepony.unicopia.UItems; import com.minelittlepony.unicopia.UItems;
import com.minelittlepony.unicopia.UParticles; import com.minelittlepony.unicopia.UParticles;
import com.minelittlepony.unicopia.forgebullshit.FUF;
import com.minelittlepony.unicopia.particle.Particles; import com.minelittlepony.unicopia.particle.Particles;
import com.minelittlepony.unicopia.player.PlayerSpeciesList; import com.minelittlepony.unicopia.player.PlayerSpeciesList;
@ -517,6 +518,7 @@ public class EntityCloud extends EntityFlying implements IAnimals {
clearItemFloatingState(); clearItemFloatingState();
} }
@FUF(reason = "There is no TickEvent.EntityTickEvent. Waiting on mixins...")
protected void clearItemFloatingState() { protected void clearItemFloatingState() {
AxisAlignedBB bounds = getEntityBoundingBox().grow(1 / (1 + getCloudSize())).grow(5); AxisAlignedBB bounds = getEntityBoundingBox().grow(1 / (1 + getCloudSize())).grow(5);
@ -579,6 +581,7 @@ public class EntityCloud extends EntityFlying implements IAnimals {
spawnThunderbolt(getPosition()); spawnThunderbolt(getPosition());
} }
// @FUF(reason = "There is no TickEvents.EntityTickEvent. Waiting on mixins...")
if (getStationary() && entity instanceof EntityItem) { if (getStationary() && entity instanceof EntityItem) {
entity.motionX /= 8; entity.motionX /= 8;
entity.motionZ /= 8; entity.motionZ /= 8;

View file

@ -0,0 +1,27 @@
package com.minelittlepony.unicopia.forgebullshit;
import java.util.Optional;
import com.google.common.collect.Lists;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.BiomeManager;
import net.minecraftforge.common.BiomeManager.BiomeType;
/**
* Provides methods and apis that forge seems to be sorely lacking.
*/
public class BiomeBS {
/**
* Gets the biome type associated with a given biome.
*/
public static Optional<BiomeType> getBiomeType(Biome biome) {
return Lists.newArrayList(BiomeManager.BiomeType.values()).stream().filter(type ->
BiomeManager.getBiomes(type).stream().filter(entry ->
entry.biome.equals(biome)
).findFirst()
.isPresent()
).findFirst();
}
}

View file

@ -5,7 +5,13 @@ import java.util.Set;
import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
/**
* Provides access the the built in texture locations.
* This is needed to add things like custom backgrounds for slots.
* @author Chris Albers
*
*/
@FUF(reason = "Forge doesn't provide this, for some unknown reason...")
public final class BuildInTexturesBakery extends ModelBakery { public final class BuildInTexturesBakery extends ModelBakery {
private BuildInTexturesBakery() { private BuildInTexturesBakery() {
super(null, null, null); super(null, null, null);

View file

@ -18,6 +18,7 @@ class DefaultEntityCapabilitiesProxyContainer<T extends Entity> implements ICapa
@CapabilityInject(ICapabilitiesProxyContainer.class) @CapabilityInject(ICapabilitiesProxyContainer.class)
public static Capability<ICapabilitiesProxyContainer<?>> CAPABILITY = null; public static Capability<ICapabilitiesProxyContainer<?>> CAPABILITY = null;
@FUF(reason = "We can't guarantee {CABILITY} won't be null. Whoever thought @CapabilityInject annotations were ever a good idea?")
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
static boolean updateAndCompare(Capability<?> capability) { static boolean updateAndCompare(Capability<?> capability) {
if (CAPABILITY == null && capability != null) { if (CAPABILITY == null && capability != null) {

View file

@ -0,0 +1,52 @@
package com.minelittlepony.unicopia.forgebullshit;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList.EntityEggInfo;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.EntityEntryBuilder;
public class EntityType {
private final String modid;
public EntityType(String modid) {
this.modid = modid;
}
public static EntityType builder(String modid) {
return new EntityType(modid);
}
public Entry creature(Class<? extends Entity> cls, String name) {
return new Entry(cls, name);
}
public EntityEntry projectile(Class<? extends Entity> cls, String name, int min, int max) {
return projectile(cls, name, min, max, true);
}
@FUF(reason = "...and it's much shorter than typing out this factory mess every time.")
public EntityEntry projectile(Class<? extends Entity> cls, String name, int min, int max, boolean includeVelocity) {
return EntityEntryBuilder.create().entity(cls)
.name(name)
.id(new ResourceLocation(modid, name), 0).tracker(min, max, includeVelocity)
.build();
}
@FUF(reason = "This makes it easier to register an egg...")
public class Entry extends EntityEntry {
public Entry(Class<? extends Entity> cls, String name) {
super(cls, name);
setRegistryName(modid, name);
}
public Entry withEgg(int a, int b) {
setEgg(new EntityEggInfo(getRegistryName(), a, b));
return this;
}
}
}

View file

@ -13,6 +13,10 @@ import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
/**
* Wraps the forge Capabilities API into an easier to manage, simple interface.
*/
@FUF(reason = "Capabilities API is such a mess. I'm not going to rewrite it all just to add capabilities to more stuff.")
@EventBusSubscriber(modid = Unicopia.MODID) @EventBusSubscriber(modid = Unicopia.MODID)
public class FBS { public class FBS {
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })

View file

@ -0,0 +1,22 @@
package com.minelittlepony.unicopia.forgebullshit;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.SOURCE;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* Workaround because forge freaks out at the nearest mention
* of the possibility of a client class in a server environment
* even when the logic in the code means it would never be executed.
*
* #FuckUForge
*/
@Documented
@Retention(SOURCE)
@Target({METHOD, FIELD, TYPE, CONSTRUCTOR, PACKAGE})
public @interface FUF {
String reason() default "";
}

View file

@ -1,35 +0,0 @@
package com.minelittlepony.unicopia.forgebullshit;
import net.minecraft.util.ResourceLocation;
public class NoNameSpacedResource extends ResourceLocation {
public static ResourceLocation[] ofAll(String...strings) {
ResourceLocation[] resources = new ResourceLocation[strings.length];
for (int i = 0; i < strings.length; i++) {
resources[i] = new NoNameSpacedResource(strings[i]);
}
return resources;
}
public static ResourceLocation[] ofAllDomained(String domain, String...strings) {
ResourceLocation[] resources = new ResourceLocation[strings.length];
for (int i = 0; i < strings.length; i++) {
resources[i] = new ResourceLocation(domain, strings[i]);
}
return resources;
}
public NoNameSpacedResource(String path) {
super(path);
}
@Override
public String toString() {
return getPath();
}
}

View file

@ -8,6 +8,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilitySerializable; import net.minecraftforge.common.capabilities.ICapabilitySerializable;
@FUF(reason = "Required to provide capability containers. Why can't forge implement this themselves!?")
class Provider implements ICapabilitySerializable<NBTTagCompound> { class Provider implements ICapabilitySerializable<NBTTagCompound> {
private final Entity entity; private final Entity entity;

View file

@ -6,6 +6,7 @@ import java.lang.reflect.Modifier;
import net.minecraft.util.registry.RegistryNamespaced; import net.minecraft.util.registry.RegistryNamespaced;
import net.minecraftforge.registries.ILockableRegistry; import net.minecraftforge.registries.ILockableRegistry;
@FUF(reason = "Forge locks the registries. We need a way to unlock them.")
public final class RegistryLockSpinner { public final class RegistryLockSpinner {
public static void unlock(RegistryNamespaced<?, ?> registry) { public static void unlock(RegistryNamespaced<?, ?> registry) {
@ -24,28 +25,13 @@ public final class RegistryLockSpinner {
public static <K, V> void commit(RegistryNamespaced<K, V> registry, V from, V to, Class<?> inClass) { public static <K, V> void commit(RegistryNamespaced<K, V> registry, V from, V to, Class<?> inClass) {
registry.register(registry.getIDForObject(from), registry.getNameForObject(from), to); registry.register(registry.getIDForObject(from), registry.getNameForObject(from), to);
Field modifieres = null;
try {
modifieres = Field.class.getDeclaredField("modifiers");
modifieres.setAccessible(true);
} catch (NoSuchFieldException | SecurityException e1) {
e1.printStackTrace();
}
for (Field i : inClass.getDeclaredFields()) { for (Field i : inClass.getDeclaredFields()) {
try { try {
if (i.get(null) == from) { if (i.get(null) == from) {
i.setAccessible(true); i.setAccessible(true);
makeNonFinal(i).set(null, to);
if (Modifier.isFinal(i.getModifiers())) {
if (modifieres == null) {
continue;
}
modifieres.setInt(i, i.getModifiers() & ~Modifier.FINAL);
}
i.set(null, to);
} }
} catch (IllegalArgumentException | IllegalAccessException | SecurityException e) { } catch (IllegalArgumentException | IllegalAccessException | SecurityException e) {
e.printStackTrace(); e.printStackTrace();
@ -53,6 +39,31 @@ public final class RegistryLockSpinner {
} }
} }
private static boolean init = false;
private static Field modifieres = null;
protected static void initModifiersField(Field f) {
if (!init) {
init = true;
try {
modifieres = Field.class.getDeclaredField("modifiers");
modifieres.setAccessible(true);
} catch (NoSuchFieldException | SecurityException e1) {
e1.printStackTrace();
}
}
}
@FUF(reason = "Not exactly forge's fault, but it was would be nice of them to not leave these as final")
protected static Field makeNonFinal(Field f) throws IllegalArgumentException, IllegalAccessException {
initModifiersField(f);
if (Modifier.isFinal(f.getModifiers()) && modifieres != null) {
modifieres.setInt(f, f.getModifiers() & ~Modifier.FINAL);
}
return f;
}
public static void lock(RegistryNamespaced<?, ?> registry) { public static void lock(RegistryNamespaced<?, ?> registry) {
if (registry instanceof ILockableRegistry) { if (registry instanceof ILockableRegistry) {
((ILockableRegistry) registry).lock(); ((ILockableRegistry) registry).lock();

View file

@ -7,6 +7,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.Capability.IStorage; import net.minecraftforge.common.capabilities.Capability.IStorage;
@FUF(reason = "Required to persist capabilities. Why can't forge implement this themselves!?")
class Storage<T extends Entity> implements IStorage<ICapabilitiesProxyContainer<T>> { class Storage<T extends Entity> implements IStorage<ICapabilitiesProxyContainer<T>> {
@Override @Override

View file

@ -9,10 +9,10 @@ public final class Keyboard {
if (keyHandler == null) { if (keyHandler == null) {
if (UClient.isClientSide()) { if (UClient.isClientSide()) {
keyHandler = new UKeyHandler();
} else {
keyHandler = bind -> {}; keyHandler = bind -> {};
} }
keyHandler = new UKeyHandler();
} }
return keyHandler; return keyHandler;

View file

@ -10,12 +10,10 @@ import com.minelittlepony.unicopia.Predicates;
import com.minelittlepony.unicopia.UClient; import com.minelittlepony.unicopia.UClient;
import com.minelittlepony.unicopia.inventory.ContainerOfHolding; import com.minelittlepony.unicopia.inventory.ContainerOfHolding;
import com.minelittlepony.unicopia.inventory.InventoryOfHolding; import com.minelittlepony.unicopia.inventory.InventoryOfHolding;
import com.minelittlepony.unicopia.inventory.gui.GuiOfHolding;
import com.minelittlepony.util.vector.VecHelper; import com.minelittlepony.util.vector.VecHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
@ -38,6 +36,8 @@ import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.IInteractionObject; import net.minecraft.world.IInteractionObject;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemOfHolding extends Item implements IMagicalItem { public class ItemOfHolding extends Item implements IMagicalItem {
@ -48,6 +48,7 @@ public class ItemOfHolding extends Item implements IMagicalItem {
setMaxStackSize(1); setMaxStackSize(1);
} }
@SideOnly(Side.CLIENT)
@Override @Override
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
super.addInformation(stack, worldIn, tooltip, flagIn); super.addInformation(stack, worldIn, tooltip, flagIn);
@ -113,14 +114,9 @@ public class ItemOfHolding extends Item implements IMagicalItem {
return new ActionResult<>(EnumActionResult.FAIL, stack); return new ActionResult<>(EnumActionResult.FAIL, stack);
} }
IInteractionObject inventory = new Inventory(stack); UClient.instance().displayGuiToPlayer(player, new Inventory(stack));
if (UClient.isClientSide() && player instanceof EntityPlayerSP) { player.playSound(SoundEvents.BLOCK_ENDERCHEST_OPEN, 0.5F, 1);
Minecraft.getMinecraft().displayGuiScreen(new GuiOfHolding(inventory));
player.playSound(SoundEvents.BLOCK_ENDERCHEST_OPEN, 0.5F, 1);
} else {
player.displayGui(inventory);
}
return new ActionResult<>(EnumActionResult.SUCCESS, stack); return new ActionResult<>(EnumActionResult.SUCCESS, stack);
} }

View file

@ -12,6 +12,7 @@ import com.minelittlepony.jumpingcastle.api.IChannel;
import com.minelittlepony.jumpingcastle.api.IMessage; import com.minelittlepony.jumpingcastle.api.IMessage;
import com.minelittlepony.jumpingcastle.api.IMessageHandler; import com.minelittlepony.jumpingcastle.api.IMessageHandler;
import com.minelittlepony.unicopia.Race; import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.Unicopia;
import com.minelittlepony.unicopia.player.IPlayer; import com.minelittlepony.unicopia.player.IPlayer;
import com.minelittlepony.unicopia.player.PlayerSpeciesList; import com.minelittlepony.unicopia.player.PlayerSpeciesList;
@ -55,9 +56,8 @@ public class MsgPlayerCapabilities implements IMessage, IMessageHandler<MsgPlaye
EntityPlayer self = IPlayer.getPlayerFromClient(senderId); EntityPlayer self = IPlayer.getPlayerFromClient(senderId);
if (self == null) { if (self == null) {
System.out.println("[CLIENT] Player with id " + senderId + " was not found!"); Unicopia.log.warn("[Unicopia] [CLIENT] [MsgPlayerCapabilities] Player with id %s was not found!\n", senderId.toString());
} else { } else {
System.out.println("[CLIENT] Got capabilities for " + senderId);
IPlayer player = PlayerSpeciesList.instance().getPlayer(self); IPlayer player = PlayerSpeciesList.instance().getPlayer(self);
if (compoundTag.length > 0) { if (compoundTag.length > 0) {

View file

@ -7,6 +7,7 @@ import com.minelittlepony.jumpingcastle.api.IChannel;
import com.minelittlepony.jumpingcastle.api.IMessage; import com.minelittlepony.jumpingcastle.api.IMessage;
import com.minelittlepony.jumpingcastle.api.IMessageHandler; import com.minelittlepony.jumpingcastle.api.IMessageHandler;
import com.minelittlepony.unicopia.Race; import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.Unicopia;
import com.minelittlepony.unicopia.player.IPlayer; import com.minelittlepony.unicopia.player.IPlayer;
import com.minelittlepony.unicopia.player.PlayerSpeciesList; import com.minelittlepony.unicopia.player.PlayerSpeciesList;
@ -27,7 +28,7 @@ public class MsgRequestCapabilities implements IMessage, IMessageHandler<MsgRequ
@Override @Override
public void onPayload(MsgRequestCapabilities message, IChannel channel) { public void onPayload(MsgRequestCapabilities message, IChannel channel) {
System.out.println("[SERVER] Sending capabilities to player id " + senderId); Unicopia.log.warn("[Unicopia] [SERVER] [MsgRequestCapabilities] Sending capabilities to player %s\n", senderId.toString());
IPlayer player = PlayerSpeciesList.instance().getPlayer(senderId); IPlayer player = PlayerSpeciesList.instance().getPlayer(senderId);
if (player.getPlayerSpecies().isDefault()) { if (player.getPlayerSpecies().isDefault()) {

View file

@ -7,10 +7,7 @@ import com.minelittlepony.unicopia.particle.Particles;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.Particle;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticlesClient extends Particles<Particle> { public class ParticlesClient extends Particles<Particle> {
static final int PARTICLES_ALL = 0; static final int PARTICLES_ALL = 0;