Unsplit again and fix more compile errors

This commit is contained in:
Sollace 2020-04-15 14:22:03 +02:00
parent fdc7984ab6
commit ea51af542a
302 changed files with 1689 additions and 1832 deletions

View file

@ -1,10 +1,10 @@
package com.minelittlepony.unicopia.redux;
package com.minelittlepony.unicopia;
import java.util.List;
import com.minelittlepony.unicopia.core.magic.spell.SpellRegistry;
import com.minelittlepony.unicopia.redux.block.ITillable;
import com.minelittlepony.unicopia.redux.item.UItems;
import com.minelittlepony.unicopia.block.ITillable;
import com.minelittlepony.unicopia.item.UItems;
import com.minelittlepony.unicopia.magic.spell.SpellRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -15,6 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
// TODO: forge events
public class BlockInteractions {
public boolean onBlockTilled(World world, BlockPos pos, PlayerEntity player, ItemStack hoe) {
BlockState state = world.getBlockState(pos);

View file

@ -1,7 +1,6 @@
package com.minelittlepony.unicopia.redux;
package com.minelittlepony.unicopia;
import com.minelittlepony.unicopia.core.EquinePredicates;
import com.minelittlepony.unicopia.redux.entity.CloudEntity;
import com.minelittlepony.unicopia.entity.CloudEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.ItemEntity;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core;
package com.minelittlepony.unicopia;
import java.io.IOException;
import java.nio.file.Files;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core;
package com.minelittlepony.unicopia;
import com.google.common.base.Predicate;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.redux;
package com.minelittlepony.unicopia;
/*
package com.minelittlepony.unicopia.world;
@ -27,18 +27,6 @@ public class Hooks {
UWorld.instance().getBlocks().addAuxiliaryDrops(event.getWorld(), event.getState(), event.getPos(), event.getDrops(), event.getFortuneLevel());
}
public static void onBlockTilled(UseHoeEvent event) {
if (UWorld.instance().getBlocks().onBlockTilled(event.getWorld(), event.getPos(), event.getPlayerEntity(), event.getCurrent())) {
event.setResult(Result.ALLOW);
}
}
public static void onStructureGen(PopulateChunkEvent.Populate event) {
if (event.getType() == EventType.DUNGEON) {
UWorld.instance().generateStructures(event.getWorld(), event.getChunkX(), event.getChunkZ(), event.getGen());
}
}
public static void onWorldTick(TickEvent.WorldTickEvent event) {
if (event.phase == Phase.START) {
UWorld.instance().onUpdate(event.world);

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core;
package com.minelittlepony.unicopia;
public interface IKeyBindingHandler {

View file

@ -1,10 +1,10 @@
package com.minelittlepony.unicopia.core;
package com.minelittlepony.unicopia;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.core.util.dummy.DummyPlayerEntity;
import com.minelittlepony.unicopia.core.util.dummy.DummyServerPlayerEntity;
import com.minelittlepony.unicopia.util.dummy.DummyPlayerEntity;
import com.minelittlepony.unicopia.util.dummy.DummyServerPlayerEntity;
import com.mojang.authlib.GameProfile;
import net.minecraft.entity.Entity;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core;
package com.minelittlepony.unicopia;
import java.util.HashMap;
import java.util.Map;

View file

@ -1,12 +1,12 @@
package com.minelittlepony.unicopia.core;
package com.minelittlepony.unicopia;
import java.util.Optional;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.core.Config;
import com.minelittlepony.unicopia.core.ducks.IRaceContainerHolder;
import com.minelittlepony.unicopia.core.entity.IEntity;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.Config;
import com.minelittlepony.unicopia.ducks.IRaceContainerHolder;
import com.minelittlepony.unicopia.entity.IEntity;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;

View file

@ -1,29 +1,28 @@
package com.minelittlepony.unicopia.redux;
package com.minelittlepony.unicopia;
import com.minelittlepony.unicopia.core.UnicopiaCore;
import com.minelittlepony.unicopia.redux.block.BlockCloudDoor;
import com.minelittlepony.unicopia.redux.block.BlockGrowingCuccoon;
import com.minelittlepony.unicopia.redux.block.BlockTomatoPlant;
import com.minelittlepony.unicopia.redux.block.ChiselledChitinBlock;
import com.minelittlepony.unicopia.redux.block.ChitinBlock;
import com.minelittlepony.unicopia.redux.block.CloudAnvilBlock;
import com.minelittlepony.unicopia.redux.block.CloudBlock;
import com.minelittlepony.unicopia.redux.block.CloudFarmlandBlock;
import com.minelittlepony.unicopia.redux.block.CloudFenceBlock;
import com.minelittlepony.unicopia.redux.block.CloudSlabBlock;
import com.minelittlepony.unicopia.redux.block.CloudStairsBlock;
import com.minelittlepony.unicopia.redux.block.DiamondDoorBlock;
import com.minelittlepony.unicopia.redux.block.DutchDoorBlock;
import com.minelittlepony.unicopia.redux.block.FruitLeavesBlock;
import com.minelittlepony.unicopia.redux.block.GlowingGemBlock;
import com.minelittlepony.unicopia.redux.block.HiveWallBlock;
import com.minelittlepony.unicopia.redux.block.SlimeLayerBlock;
import com.minelittlepony.unicopia.redux.block.StickBlock;
import com.minelittlepony.unicopia.redux.block.SugarBlock;
import com.minelittlepony.unicopia.redux.block.TallCropBlock;
import com.minelittlepony.unicopia.redux.item.AppleItem;
import com.minelittlepony.unicopia.redux.item.UItems;
import com.minelittlepony.unicopia.redux.structure.CustomSaplingGenerator;
import com.minelittlepony.unicopia.block.CloudDoorBlock;
import com.minelittlepony.unicopia.block.BlockGrowingCuccoon;
import com.minelittlepony.unicopia.block.TomatoPlantBlock;
import com.minelittlepony.unicopia.block.ChiselledChitinBlock;
import com.minelittlepony.unicopia.block.ChitinBlock;
import com.minelittlepony.unicopia.block.CloudAnvilBlock;
import com.minelittlepony.unicopia.block.CloudBlock;
import com.minelittlepony.unicopia.block.CloudFarmlandBlock;
import com.minelittlepony.unicopia.block.CloudFenceBlock;
import com.minelittlepony.unicopia.block.CloudSlabBlock;
import com.minelittlepony.unicopia.block.CloudStairsBlock;
import com.minelittlepony.unicopia.block.DiamondDoorBlock;
import com.minelittlepony.unicopia.block.DutchDoorBlock;
import com.minelittlepony.unicopia.block.FruitLeavesBlock;
import com.minelittlepony.unicopia.block.GlowingGemBlock;
import com.minelittlepony.unicopia.block.HiveWallBlock;
import com.minelittlepony.unicopia.block.SlimeLayerBlock;
import com.minelittlepony.unicopia.block.StickBlock;
import com.minelittlepony.unicopia.block.SugarBlock;
import com.minelittlepony.unicopia.block.TallCropBlock;
import com.minelittlepony.unicopia.item.AppleItem;
import com.minelittlepony.unicopia.item.UItems;
import com.minelittlepony.unicopia.structure.CustomSaplingGenerator;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;
@ -46,7 +45,7 @@ public interface UBlocks {
CloudSlabBlock<CloudBlock> enchanted_cloud_slab = register(new CloudSlabBlock<>(enchanted_cloud, UMaterials.CLOUD), "enchanted_cloud_slab");
CloudSlabBlock<CloudBlock> packed_cloud_slab = register(new CloudSlabBlock<>(enchanted_cloud, UMaterials.CLOUD), "packed_cloud_slab");
BlockCloudDoor mist_door = register(new BlockCloudDoor(), "mist_door");
CloudDoorBlock mist_door = register(new CloudDoorBlock(), "mist_door");
DutchDoorBlock library_door = register(new DutchDoorBlock(FabricBlockSettings.of(Material.WOOD).sounds(BlockSoundGroup.WOOD).hardness(3).build()), "library_door");
DutchDoorBlock bakery_door = register(new DutchDoorBlock(FabricBlockSettings.of(Material.WOOD).sounds(BlockSoundGroup.WOOD).hardness(3).build()), "bakery_door");
DiamondDoorBlock diamond_door = register(new DiamondDoorBlock(), "diamond_door");
@ -60,7 +59,7 @@ public interface UBlocks {
TallCropBlock alfalfa = register(new TallCropBlock(FabricBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP).build()), "alfalfa");
StickBlock stick = register(new StickBlock(), "stick");
BlockTomatoPlant tomato_plant = register(new BlockTomatoPlant(), "tomato_plant");
TomatoPlantBlock tomato_plant = register(new TomatoPlantBlock(), "tomato_plant");
CloudFarmlandBlock cloud_farmland = register(new CloudFarmlandBlock(FabricBlockSettings.of(UMaterials.CLOUD).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.WOOL).build()), "cloud_farmland");

View file

@ -1,8 +1,7 @@
package com.minelittlepony.unicopia.redux;
package com.minelittlepony.unicopia;
import com.minelittlepony.unicopia.core.UnicopiaCore;
import com.minelittlepony.unicopia.redux.container.BagOfHoldingContainer;
import com.minelittlepony.unicopia.redux.container.SpellBookContainer;
import com.minelittlepony.unicopia.container.BagOfHoldingContainer;
import com.minelittlepony.unicopia.container.SpellBookContainer;
import net.fabricmc.fabric.api.container.ContainerProviderRegistry;
import net.minecraft.util.Identifier;

View file

@ -1,7 +1,7 @@
package com.minelittlepony.unicopia.core;
package com.minelittlepony.unicopia;
import com.minelittlepony.unicopia.core.util.CustomStatusEffect;
import com.minelittlepony.unicopia.core.util.MagicalDamageSource;
import com.minelittlepony.unicopia.util.CustomStatusEffect;
import com.minelittlepony.unicopia.util.MagicalDamageSource;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance;

View file

@ -1,17 +1,17 @@
package com.minelittlepony.unicopia.redux;
package com.minelittlepony.unicopia;
import com.minelittlepony.unicopia.core.util.collection.ListHelper;
import com.minelittlepony.unicopia.redux.entity.ButterflyEntity;
import com.minelittlepony.unicopia.redux.entity.CloudEntity;
import com.minelittlepony.unicopia.redux.entity.ConstructionCloudEntity;
import com.minelittlepony.unicopia.redux.entity.CuccoonEntity;
import com.minelittlepony.unicopia.redux.entity.ProjectileEntity;
import com.minelittlepony.unicopia.redux.entity.RacingCloudEntity;
import com.minelittlepony.unicopia.redux.entity.RainbowEntity;
import com.minelittlepony.unicopia.redux.entity.SpearEntity;
import com.minelittlepony.unicopia.redux.entity.SpellbookEntity;
import com.minelittlepony.unicopia.redux.entity.SpellcastEntity;
import com.minelittlepony.unicopia.redux.entity.WildCloudEntity;
import com.minelittlepony.unicopia.entity.ButterflyEntity;
import com.minelittlepony.unicopia.entity.CloudEntity;
import com.minelittlepony.unicopia.entity.ConstructionCloudEntity;
import com.minelittlepony.unicopia.entity.CuccoonEntity;
import com.minelittlepony.unicopia.entity.ProjectileEntity;
import com.minelittlepony.unicopia.entity.RacingCloudEntity;
import com.minelittlepony.unicopia.entity.RainbowEntity;
import com.minelittlepony.unicopia.entity.SpearEntity;
import com.minelittlepony.unicopia.entity.SpellbookEntity;
import com.minelittlepony.unicopia.entity.SpellcastEntity;
import com.minelittlepony.unicopia.entity.WildCloudEntity;
import com.minelittlepony.unicopia.util.collection.ListHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCategory;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.redux;
package com.minelittlepony.unicopia;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;

View file

@ -1,10 +1,10 @@
package com.minelittlepony.unicopia.core;
package com.minelittlepony.unicopia;
import net.minecraft.particle.DefaultParticleType;
import net.minecraft.util.Identifier;
public interface UParticles {
// TODO:
// TODO: ParticleTypeRegistry
interface ParticleTypeRegistry {
static ParticleTypeRegistry getTnstance() {return null;}
DefaultParticleType register(Identifier id);

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core;
package com.minelittlepony.unicopia;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core;
package com.minelittlepony.unicopia;
import net.fabricmc.fabric.api.tag.TagRegistry;
import net.minecraft.item.Item;

View file

@ -1,17 +1,24 @@
package com.minelittlepony.unicopia.core;
package com.minelittlepony.unicopia;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.minecraft.resource.ResourceType;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.minelittlepony.common.util.GamePaths;
import com.minelittlepony.jumpingcastle.api.Channel;
import com.minelittlepony.jumpingcastle.api.JumpingCastle;
import com.minelittlepony.unicopia.core.ability.PowersRegistry;
import com.minelittlepony.unicopia.core.command.Commands;
import com.minelittlepony.unicopia.core.network.MsgPlayerAbility;
import com.minelittlepony.unicopia.core.network.MsgPlayerCapabilities;
import com.minelittlepony.unicopia.core.network.MsgRequestCapabilities;
import com.minelittlepony.unicopia.ability.PowersRegistry;
import com.minelittlepony.unicopia.command.Commands;
import com.minelittlepony.unicopia.enchanting.Pages;
import com.minelittlepony.unicopia.enchanting.recipe.AffineIngredients;
import com.minelittlepony.unicopia.item.UItems;
import com.minelittlepony.unicopia.network.MsgPlayerAbility;
import com.minelittlepony.unicopia.network.MsgPlayerCapabilities;
import com.minelittlepony.unicopia.network.MsgRequestCapabilities;
import com.minelittlepony.unicopia.structure.UStructures;
public class UnicopiaCore implements ModInitializer {
public static final String MODID = "unicopia";
@ -39,6 +46,13 @@ public class UnicopiaCore implements ModInitializer {
UTags.bootstrap();
Commands.bootstrap();
UBlocks.bootstrap();
UItems.bootstrap();
UContainers.bootstrap();
UStructures.bootstrap();
PowersRegistry.instance().init();
ResourceManagerHelper.get(ResourceType.SERVER_DATA).registerReloadListener(Pages.instance());
ResourceManagerHelper.get(ResourceType.SERVER_DATA).registerReloadListener(AffineIngredients.instance());
}
}

View file

@ -0,0 +1,5 @@
package com.minelittlepony.unicopia.ability;
public class Hit implements IPower.IData {
}

View file

@ -1,6 +1,6 @@
package com.minelittlepony.unicopia.core.ability;
package com.minelittlepony.unicopia.ability;
import com.minelittlepony.unicopia.core.ability.IPower;
import com.minelittlepony.unicopia.ability.IPower;
public interface IAbilityReceiver {

View file

@ -1,6 +1,6 @@
package com.minelittlepony.unicopia.core.ability;
package com.minelittlepony.unicopia.ability;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.entity.player.IPlayer;
/**
* Predicate for abilities to control whether a player can fly.

View file

@ -1,6 +1,6 @@
package com.minelittlepony.unicopia.core.ability;
package com.minelittlepony.unicopia.ability;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.entity.player.IPlayer;
/**
* Predicate for abilities to control what the player's physical height is.

View file

@ -1,10 +1,10 @@
package com.minelittlepony.unicopia.core.ability;
package com.minelittlepony.unicopia.ability;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.core.IKeyBindingHandler;
import com.minelittlepony.unicopia.core.Race;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.IKeyBindingHandler;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import net.minecraft.world.World;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core.ability;
package com.minelittlepony.unicopia.ability;
import com.google.gson.annotations.Expose;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core.ability;
package com.minelittlepony.unicopia.ability;
import com.google.gson.annotations.Expose;

View file

@ -1,10 +1,10 @@
package com.minelittlepony.unicopia.core.ability;
package com.minelittlepony.unicopia.ability;
import org.lwjgl.glfw.GLFW;
import com.minelittlepony.unicopia.core.Race;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.core.util.VecHelper;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import com.minelittlepony.unicopia.util.VecHelper;
import net.minecraft.client.network.packet.EntityPassengersSetS2CPacket;
import net.minecraft.entity.Entity;

View file

@ -1,15 +1,13 @@
package com.minelittlepony.unicopia.redux.ability;
package com.minelittlepony.unicopia.ability;
import java.util.Optional;
import org.lwjgl.glfw.GLFW;
import com.minelittlepony.unicopia.core.Race;
import com.minelittlepony.unicopia.core.UParticles;
import com.minelittlepony.unicopia.core.ability.IPower;
import com.minelittlepony.unicopia.core.ability.Numeric;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.core.util.VecHelper;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.UParticles;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import com.minelittlepony.unicopia.util.VecHelper;
import net.minecraft.entity.Entity;

View file

@ -1,19 +1,17 @@
package com.minelittlepony.unicopia.redux.ability;
package com.minelittlepony.unicopia.ability;
import javax.annotation.Nullable;
import org.lwjgl.glfw.GLFW;
import com.minelittlepony.unicopia.core.Race;
import com.minelittlepony.unicopia.core.SpeciesList;
import com.minelittlepony.unicopia.core.UParticles;
import com.minelittlepony.unicopia.core.ability.Hit;
import com.minelittlepony.unicopia.core.ability.PowerFeed;
import com.minelittlepony.unicopia.core.entity.InAnimate;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.core.util.VecHelper;
import com.minelittlepony.unicopia.redux.magic.spells.DisguiseSpell;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.SpeciesList;
import com.minelittlepony.unicopia.UParticles;
import com.minelittlepony.unicopia.entity.InAnimate;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import com.minelittlepony.unicopia.magic.spell.DisguiseSpell;
import com.minelittlepony.unicopia.util.VecHelper;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;

View file

@ -1,14 +1,12 @@
package com.minelittlepony.unicopia.redux.ability;
package com.minelittlepony.unicopia.ability;
import javax.annotation.Nullable;
import org.lwjgl.glfw.GLFW;
import com.minelittlepony.unicopia.core.Race;
import com.minelittlepony.unicopia.core.ability.Hit;
import com.minelittlepony.unicopia.core.ability.IPower;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.redux.magic.spells.ChangelingTrapSpell;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import com.minelittlepony.unicopia.magic.spell.ChangelingTrapSpell;
public class PowerEngulf implements IPower<Hit> {

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core.ability;
package com.minelittlepony.unicopia.ability;
import java.util.List;
import java.util.stream.Collectors;
@ -7,10 +7,10 @@ import javax.annotation.Nullable;
import org.lwjgl.glfw.GLFW;
import com.minelittlepony.unicopia.core.Race;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.core.util.MagicalDamageSource;
import com.minelittlepony.unicopia.core.util.VecHelper;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import com.minelittlepony.unicopia.util.MagicalDamageSource;
import com.minelittlepony.unicopia.util.VecHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
@ -134,7 +134,7 @@ public class PowerFeed implements IPower<Hit> {
living.damage(d, damage);
}
// TODO:
// TODO: ParticleTypeRegistry
//ParticleTypeRegistry.spawnParticles(UParticles.CHANGELING_MAGIC, living, 7);
if (changeling.hasStatusEffect(StatusEffects.NAUSEA)) {

View file

@ -1,11 +1,11 @@
package com.minelittlepony.unicopia.core.ability;
package com.minelittlepony.unicopia.ability;
import org.lwjgl.glfw.GLFW;
import com.minelittlepony.unicopia.core.Race;
import com.minelittlepony.unicopia.core.UParticles;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.core.util.VecHelper;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.UParticles;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import com.minelittlepony.unicopia.util.VecHelper;
import net.minecraft.block.BlockState;
import net.minecraft.item.BoneMealItem;

View file

@ -1,11 +1,11 @@
package com.minelittlepony.unicopia.core.ability;
package com.minelittlepony.unicopia.ability;
import org.lwjgl.glfw.GLFW;
import com.minelittlepony.unicopia.core.Race;
import com.minelittlepony.unicopia.core.UParticles;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.core.magic.spell.ShieldSpell;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.UParticles;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import com.minelittlepony.unicopia.magic.spell.ShieldSpell;
/**
* A magic casting ability for unicorns.

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.redux.ability;
package com.minelittlepony.unicopia.ability;
import java.util.ArrayList;
import java.util.List;
@ -6,19 +6,17 @@ import org.lwjgl.glfw.GLFW;
import com.google.common.collect.Lists;
import com.google.gson.annotations.Expose;
import com.minelittlepony.unicopia.core.Race;
import com.minelittlepony.unicopia.core.SpeciesList;
import com.minelittlepony.unicopia.core.ability.IPower;
import com.minelittlepony.unicopia.core.ability.Location;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.core.util.AwaitTickQueue;
import com.minelittlepony.unicopia.core.util.MagicalDamageSource;
import com.minelittlepony.unicopia.core.util.PosHelper;
import com.minelittlepony.unicopia.core.util.VecHelper;
import com.minelittlepony.unicopia.core.util.WorldEvent;
import com.minelittlepony.unicopia.core.util.shape.IShape;
import com.minelittlepony.unicopia.core.util.shape.Sphere;
import com.minelittlepony.unicopia.redux.item.AppleItem;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.SpeciesList;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import com.minelittlepony.unicopia.item.AppleItem;
import com.minelittlepony.unicopia.util.AwaitTickQueue;
import com.minelittlepony.unicopia.util.MagicalDamageSource;
import com.minelittlepony.unicopia.util.PosHelper;
import com.minelittlepony.unicopia.util.VecHelper;
import com.minelittlepony.unicopia.util.WorldEvent;
import com.minelittlepony.unicopia.util.shape.IShape;
import com.minelittlepony.unicopia.util.shape.Sphere;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -462,7 +460,7 @@ public class PowerStomp implements IPower<PowerStomp.Data> {
}
private Object getVariant(BlockState state) {
// TODO:
// TODO: Variants are gone
/*if (state.getBlock() instanceof LeavesBlock) {
return ((LeavesBlock)state.getBlock()).getWoodType(state);
}

View file

@ -1,11 +1,11 @@
package com.minelittlepony.unicopia.core.ability;
package com.minelittlepony.unicopia.ability;
import org.lwjgl.glfw.GLFW;
import com.minelittlepony.unicopia.core.Race;
import com.minelittlepony.unicopia.core.UParticles;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.core.util.VecHelper;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.UParticles;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import com.minelittlepony.unicopia.util.VecHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core.ability;
package com.minelittlepony.unicopia.ability;
import java.util.ArrayList;
import java.util.Collection;
@ -7,7 +7,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import com.minelittlepony.unicopia.core.Race;
import com.minelittlepony.unicopia.Race;
public class PowersRegistry {
@ -25,11 +25,15 @@ public class PowersRegistry {
}
public void init() {
registerPower(new PowerTeleport());
registerPower(new PowerMagic());
registerPower(new PowerGrow());
registerPower(new PowerFeed());
registerPower(new PowerCarry());
register(new PowerTeleport());
register(new PowerMagic());
register(new PowerGrow());
register(new PowerFeed());
register(new PowerCarry());
register(new PowerCloudBase());
register(new PowerEngulf());
register(new PowerStomp());
register(new PowerDisguise());
}
public boolean hasRegisteredPower(int keyCode) {
@ -50,7 +54,7 @@ public class PowersRegistry {
return keyToPowerMap.computeIfAbsent(keyCode, ArrayList::new);
}
public void registerPower(IPower<? extends IPower.IData> power) {
public void register(IPower<? extends IPower.IData> power) {
getKeyCodePool(power.getKeyCode()).add(power);
powerNamesMap.put(power.getKeyName(), power);
}

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.redux.advancements;
package com.minelittlepony.unicopia.advancements;
import java.util.List;
import java.util.Map;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.redux.advancements;
package com.minelittlepony.unicopia.advancements;
import com.google.gson.JsonElement;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.redux.advancements;
package com.minelittlepony.unicopia.advancements;
import java.util.Optional;

View file

@ -1,8 +1,8 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.core.util.WorldEvent;
import com.minelittlepony.unicopia.util.WorldEvent;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;

View file

@ -1,25 +1,27 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.core.EquinePredicates;
import com.minelittlepony.unicopia.core.USounds;
import com.minelittlepony.unicopia.core.util.MagicalDamageSource;
import com.minelittlepony.unicopia.core.util.PosHelper;
import com.minelittlepony.unicopia.redux.UBlocks;
import com.minelittlepony.unicopia.redux.UMaterials;
import com.minelittlepony.unicopia.EquinePredicates;
import com.minelittlepony.unicopia.UBlocks;
import com.minelittlepony.unicopia.UMaterials;
import com.minelittlepony.unicopia.USounds;
import com.minelittlepony.unicopia.util.MagicalDamageSource;
import com.minelittlepony.unicopia.util.PosHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.LadderBlock;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.sound.SoundCategory;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.state.property.IntProperty;
import net.minecraft.util.StringIdentifiable;
@ -115,7 +117,7 @@ public class BlockGrowingCuccoon extends Block {
BlockPos below = pos.down();
if (world.isBlockLoaded(below)) {
boolean spaceBelow = world.isAirBlock(below);
boolean spaceBelow = world.isAir(below);
Shape shape = state.get(SHAPE);
@ -132,7 +134,7 @@ public class BlockGrowingCuccoon extends Block {
} else {
if (age < getMaximumAge(world, pos, state, spaceBelow)) {
if (rand.nextInt(5 * (age + 1)) == 0) {
world.setBlockState(pos, state.cycleProperty(AGE));
world.setBlockState(pos, state.cycle(AGE));
}
}
}
@ -295,10 +297,11 @@ public class BlockGrowingCuccoon extends Block {
return new BlockStateContainer(this, AGE, SHAPE);
}
@Override
// TODO: isLadder
/*@Override
public boolean isLadder(BlockState state, BlockView world, BlockPos pos, LivingEntity entity) {
return true;
}
}*/
@Override
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {

View file

@ -1,11 +1,11 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.core.Race;
import com.minelittlepony.unicopia.core.SpeciesList;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.redux.UMaterials;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.SpeciesList;
import com.minelittlepony.unicopia.UMaterials;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;

View file

@ -1,9 +1,9 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import com.minelittlepony.unicopia.core.Race;
import com.minelittlepony.unicopia.core.SpeciesList;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.redux.UMaterials;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.SpeciesList;
import com.minelittlepony.unicopia.UMaterials;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;

View file

@ -1,9 +1,9 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import java.util.Random;
import com.minelittlepony.unicopia.core.util.WorldEvent;
import com.minelittlepony.unicopia.redux.CloudType;
import com.minelittlepony.unicopia.CloudType;
import com.minelittlepony.unicopia.util.WorldEvent;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.AnvilBlock;

View file

@ -1,11 +1,11 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import java.util.Random;
import com.minelittlepony.unicopia.core.SpeciesList;
import com.minelittlepony.unicopia.redux.CloudType;
import com.minelittlepony.unicopia.redux.UBlocks;
import com.minelittlepony.unicopia.redux.item.MossItem;
import com.minelittlepony.unicopia.CloudType;
import com.minelittlepony.unicopia.SpeciesList;
import com.minelittlepony.unicopia.UBlocks;
import com.minelittlepony.unicopia.item.MossItem;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;

View file

@ -1,7 +1,7 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import com.minelittlepony.unicopia.redux.CloudType;
import com.minelittlepony.unicopia.redux.UMaterials;
import com.minelittlepony.unicopia.CloudType;
import com.minelittlepony.unicopia.UMaterials;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.BlockRenderLayer;
@ -15,10 +15,10 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
public class BlockCloudDoor extends AbstractDoorBlock implements ICloudBlock {
public class CloudDoorBlock extends AbstractDoorBlock implements ICloudBlock {
@SuppressWarnings("deprecation")
public BlockCloudDoor() {
public CloudDoorBlock() {
super(FabricBlockSettings.of(UMaterials.CLOUD)
.sounds(BlockSoundGroup.WOOL)
.hardness(3)

View file

@ -1,8 +1,8 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import com.minelittlepony.unicopia.core.ducks.IFarmland;
import com.minelittlepony.unicopia.redux.CloudType;
import com.minelittlepony.unicopia.redux.UBlocks;
import com.minelittlepony.unicopia.CloudType;
import com.minelittlepony.unicopia.UBlocks;
import com.minelittlepony.unicopia.ducks.IFarmland;
import net.minecraft.block.BlockRenderLayer;
import net.minecraft.block.BlockState;

View file

@ -1,6 +1,6 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import com.minelittlepony.unicopia.redux.CloudType;
import com.minelittlepony.unicopia.CloudType;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.BlockRenderLayer;

View file

@ -1,6 +1,6 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import com.minelittlepony.unicopia.redux.CloudType;
import com.minelittlepony.unicopia.CloudType;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;

View file

@ -1,6 +1,6 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import com.minelittlepony.unicopia.redux.CloudType;
import com.minelittlepony.unicopia.CloudType;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;

View file

@ -1,8 +1,8 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.core.EquinePredicates;
import com.minelittlepony.unicopia.EquinePredicates;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.BlockState;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import net.minecraft.block.BlockState;
import net.minecraft.block.enums.DoubleBlockHalf;

View file

@ -1,11 +1,11 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import java.util.Random;
import java.util.function.Function;
import javax.annotation.Nonnull;
import com.minelittlepony.unicopia.core.SpeciesList;
import com.minelittlepony.unicopia.SpeciesList;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;

View file

@ -1,8 +1,9 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import java.util.Random;
import com.minelittlepony.unicopia.redux.CloudType;
import com.minelittlepony.unicopia.CloudType;
import com.minelittlepony.unicopia.UParticles;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;
@ -124,10 +125,9 @@ public class GlowingGemBlock extends TorchBlock implements ICloudBlock {
if (state.get(ON)) {
for (int i = 0; i < 3; i++) {
// TODO:
// ParticleTypeRegistry.getTnstance().spawnParticle(UParticles.UNICORN_MAGIC, false,
// x - 0.3, y - 0.3, z - 0.3,
// rand.nextFloat(), rand.nextFloat(), rand.nextFloat());
world.addParticle(UParticles.UNICORN_MAGIC,
x - 0.3, y - 0.3, z - 0.3,
rand.nextFloat(), rand.nextFloat(), rand.nextFloat());
}
} else {
world.addParticle(ParticleTypes.SMOKE, x, y, z, 0, 0, 0);

View file

@ -1,18 +1,18 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import java.util.Map;
import java.util.Random;
import com.google.common.collect.Maps;
import com.minelittlepony.unicopia.core.Race;
import com.minelittlepony.unicopia.core.SpeciesList;
import com.minelittlepony.unicopia.core.USounds;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.core.util.PosHelper;
import com.minelittlepony.unicopia.core.util.shape.IShape;
import com.minelittlepony.unicopia.core.util.shape.Sphere;
import com.minelittlepony.unicopia.redux.UBlocks;
import com.minelittlepony.unicopia.redux.UMaterials;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.SpeciesList;
import com.minelittlepony.unicopia.UBlocks;
import com.minelittlepony.unicopia.UMaterials;
import com.minelittlepony.unicopia.USounds;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import com.minelittlepony.unicopia.util.PosHelper;
import com.minelittlepony.unicopia.util.shape.IShape;
import com.minelittlepony.unicopia.util.shape.Sphere;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;
@ -45,6 +45,7 @@ public class HiveWallBlock extends FallingBlock {
private static final IShape shape = new Sphere(false, 1.5);
@SuppressWarnings("deprecation")
public HiveWallBlock() {
super(FabricBlockSettings.of(UMaterials.HIVE)
.noCollision()
@ -53,14 +54,12 @@ public class HiveWallBlock extends FallingBlock {
.ticksRandomly()
.lightLevel(1)
.sounds(BlockSoundGroup.SAND)
.breakByTool(net.fabricmc.fabric.api.tools.FabricToolTags.PICKAXES, 1)
.build()
);
setDefaultState(stateFactory.getDefaultState()
.with(STATE, State.GROWING).with(AXIS, Axis.Y)
);
// TODO:
// setHarvestLevel("pickaxe", 1);
}
@Override

View file

@ -1,7 +1,7 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import com.minelittlepony.unicopia.core.EquinePredicates;
import com.minelittlepony.unicopia.redux.CloudType;
import com.minelittlepony.unicopia.CloudType;
import com.minelittlepony.unicopia.EquinePredicates;
import net.minecraft.block.BedBlock;
import net.minecraft.block.Block;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import net.minecraft.block.BlockState;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import javax.annotation.Nonnull;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.BlockRenderLayer;
@ -20,8 +20,7 @@ public class SlimeLayerBlock extends SnowBlock {
.build()
);
// TODO:
// drops Items.SLIME_BALL x1
// TODO: drops Items.SLIME_BALL x1
}
@Override

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;
@ -40,8 +40,7 @@ public class StickBlock extends Block {
.build()
);
// TODO:
// drops Items.STICK x1
// TODO: drops Items.STICK x1
}
@Override

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.FallingBlock;
@ -13,8 +13,6 @@ public class SugarBlock extends FallingBlock {
.sounds(BlockSoundGroup.SAND)
.build()
);
//TODO:
// Loot table drops:
// // Items.SUGAR x 9;
//TODO: drops SUGAR x 9;
}
}

View file

@ -1,10 +1,10 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import java.util.Random;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.redux.item.UItems;
import com.minelittlepony.unicopia.item.UItems;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;

View file

@ -1,13 +1,14 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import java.util.Random;
import com.minelittlepony.unicopia.redux.item.UItems;
import java.util.List;
import com.minelittlepony.unicopia.UBlocks;
import com.minelittlepony.unicopia.item.UItems;
import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.CropBlock;
import net.minecraft.block.Fertilizable;
import net.minecraft.block.Material;
import net.minecraft.entity.EntityContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
@ -21,21 +22,30 @@ import net.minecraft.util.Hand;
import net.minecraft.util.StringIdentifiable;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.ViewableWorld;
import net.minecraft.world.World;
import net.minecraft.world.loot.context.LootContext;
public class BlockTomatoPlant extends CropBlock {
public class TomatoPlantBlock extends CropBlock {
public static final EnumProperty<Type> TYPE = EnumProperty.of("type", Type.class);
public BlockTomatoPlant() {
public TomatoPlantBlock() {
super(FabricBlockSettings.of(Material.PLANT)
.noCollision()
.strength(0.2F, 0.2F)
.ticksRandomly()
.lightLevel(1)
.sounds(BlockSoundGroup.WOOD)
.build()
);
setDefaultState(getDefaultState().with(TYPE, Type.NORMAL));
setHardness(0.2F);
setSoundType(SoundType.WOOD);
// TODO: drops UItems.tomato_seeds x1
// if mature: UItems.tomato
}
@Deprecated
@ -61,14 +71,9 @@ public class BlockTomatoPlant extends CropBlock {
return UItems.tomato_seeds;
}
@Override
protected Item getCrop() {
return UItems.tomato;
}
@Override
public boolean canPlaceAt(BlockState state, ViewableWorld world, BlockPos pos) {
if (world.getBlockState(pos.down()).getBlock() instanceof BlockTomatoPlant) {
if (world.getBlockState(pos.down()).getBlock() instanceof TomatoPlantBlock) {
return true;
}
@ -76,55 +81,27 @@ public class BlockTomatoPlant extends CropBlock {
}
@Override
public boolean canSustainPlant(BlockState state, BlockView world, BlockPos pos, Direction direction, Fertilizable plantable) {
if (direction == Direction.UP && state.getBlock() instanceof BlockTomatoPlant) {
return true;
}
return super.canSustainPlant(state, world, pos, direction, plantable);
protected boolean canPlantOnTop(BlockState state, BlockView view, BlockPos pos) {
return super.canPlantOnTop(state, view, pos)
|| state.getBlock() == UBlocks.cloud_farmland
|| state.getBlock() == UBlocks.tomato_plant
|| state.getBlock() == UBlocks.stick;
}
@Override
public void onScheduledTick(BlockState state, World world, BlockPos pos, Random rand) {
checkAndDropBlock(world, pos, state);
@Deprecated
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder context) {
List<ItemStack> drops = super.getDroppedStacks(state, context);
if (world.isBlockLoaded(pos) && world.getLightLevel(pos.up()) >= 9) {
int i = getAge(state);
if (i < getMaxAge()) {
float f = getAvailableMoisture(this, world, pos);
world.setBlockState(pos, state.with(getAgeProperty(), i + 1), 2);
}
}
}
@Override
public int quantityDropped(BlockState state, int fortune, Random random) {
return 1;
}
@Override
public Item getItemDropped(BlockState state, Random rand, int fortune) {
drops.add(new ItemStack(Items.STICK, 1));
if (isMature(state)) {
return state.get(TYPE).getCrop();
drops.add(new ItemStack(state.get(TYPE).getCrop(), 1));
} else {
drops.add(new ItemStack(getSeedsItem()));
}
return getSeed();
}
@Override
public void getDrops(NonNullList<ItemStack> drops, WorldView world, BlockPos pos, BlockState state, int fortune) {
Random rand = world instanceof World ? ((World)world).random : RANDOM;
drops.add(new ItemStack(Items.STICK, 1, 0));
Item item = getItemDropped(state, rand, fortune);
if (item != Items.AIR) {
drops.add(new ItemStack(item, 1, damageDropped(state)));
}
return drops;
}
@Override
@ -163,10 +140,7 @@ public class BlockTomatoPlant extends CropBlock {
}
public boolean plant(World world, BlockPos pos, BlockState state) {
Block block = state.getBlock();
if (block instanceof StickBlock && ((StickBlock)block).canSustainPlant(world, pos, this)) {
if (canPlantOnTop(state, world, pos)) {
world.setBlockState(pos, getPlacedState(world, pos, state).with(getAgeProperty(), 1));
BlockSoundGroup sound = getSoundGroup(state);
@ -189,7 +163,7 @@ public class BlockTomatoPlant extends CropBlock {
return getDefaultState().with(TYPE, Type.CLOUDSDALE);
}
if (state.getBlock() instanceof BlockTomatoPlant) {
if (state.getBlock() instanceof TomatoPlantBlock) {
return getDefaultState().with(TYPE, state.get(TYPE));
}

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import java.util.Random;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.redux.block;
package com.minelittlepony.unicopia.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;

View file

@ -1,7 +1,7 @@
package com.minelittlepony.unicopia.core.client;
package com.minelittlepony.unicopia.client;
import com.minelittlepony.unicopia.core.SpeciesList;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.SpeciesList;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.input.Input;

View file

@ -1,13 +1,13 @@
package com.minelittlepony.unicopia.core.client;
package com.minelittlepony.unicopia.client;
import java.util.ArrayList;
import java.util.List;
import com.minelittlepony.unicopia.core.IKeyBindingHandler;
import com.minelittlepony.unicopia.core.SpeciesList;
import com.minelittlepony.unicopia.core.UnicopiaCore;
import com.minelittlepony.unicopia.core.ability.PowersRegistry;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.IKeyBindingHandler;
import com.minelittlepony.unicopia.SpeciesList;
import com.minelittlepony.unicopia.UnicopiaCore;
import com.minelittlepony.unicopia.ability.PowersRegistry;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding;
import net.fabricmc.fabric.api.client.keybinding.KeyBindingRegistry;

View file

@ -1,6 +1,6 @@
package com.minelittlepony.unicopia.core.client;
package com.minelittlepony.unicopia.client;
import com.minelittlepony.unicopia.core.SpeciesList;
import com.minelittlepony.unicopia.SpeciesList;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.Mouse;

View file

@ -0,0 +1,39 @@
package com.minelittlepony.unicopia.client;
import com.minelittlepony.unicopia.client.render.ButterflyEntityRenderer;
import com.minelittlepony.unicopia.client.render.CloudEntityRenderer;
import com.minelittlepony.unicopia.client.render.CuccoonEntityRenderer;
import com.minelittlepony.unicopia.client.render.RainbowEntityRenderer;
import com.minelittlepony.unicopia.client.render.SpearEntityRenderer;
import com.minelittlepony.unicopia.client.render.RenderSpellbook;
import com.minelittlepony.unicopia.client.render.SpellcastEntityRenderer;
import com.minelittlepony.unicopia.entity.ButterflyEntity;
import com.minelittlepony.unicopia.entity.CloudEntity;
import com.minelittlepony.unicopia.entity.CuccoonEntity;
import com.minelittlepony.unicopia.entity.ProjectileEntity;
import com.minelittlepony.unicopia.entity.RainbowEntity;
import com.minelittlepony.unicopia.entity.SpearEntity;
import com.minelittlepony.unicopia.entity.SpellbookEntity;
import com.minelittlepony.unicopia.entity.SpellcastEntity;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.client.render.entity.FlyingItemEntityRenderer;
public interface URenderers {
static void bootstrap() {
EntityRendererRegistry.INSTANCE.register(CloudEntity.class, CloudEntityRenderer::new);
EntityRendererRegistry.INSTANCE.register(SpellcastEntity.class, SpellcastEntityRenderer::new);
EntityRendererRegistry.INSTANCE.register(ProjectileEntity.class, (manager, context) -> new FlyingItemEntityRenderer<>(manager, context.getItemRenderer()));
EntityRendererRegistry.INSTANCE.register(SpellbookEntity.class, RenderSpellbook::new);
EntityRendererRegistry.INSTANCE.register(RainbowEntity.class, RainbowEntityRenderer::new);
EntityRendererRegistry.INSTANCE.register(ButterflyEntity.class, ButterflyEntityRenderer::new);
EntityRendererRegistry.INSTANCE.register(CuccoonEntity.class, CuccoonEntityRenderer::new);
EntityRendererRegistry.INSTANCE.register(SpearEntity.class, SpearEntityRenderer::new);
// TODO: ParticleFactoryRegistry
//ParticleFactoryRegistry.instance().register(UParticles.UNICORN_MAGIC, MagicParticle::new);
//ParticleFactoryRegistry.instance().register(UParticles.CHANGELING_MAGIC, ChangelingMagicParticle::new);
//ParticleFactoryRegistry.instance().register(UParticles.RAIN_DROPS, RaindropsParticle::new);
//ParticleFactoryRegistry.instance().register(UParticles.SPHERE, SphereParticle::new);
//ParticleFactoryRegistry.instance().register(UParticles.DISK, DiskParticle::new);
}
}

View file

@ -1,22 +1,22 @@
package com.minelittlepony.unicopia.core.client;
package com.minelittlepony.unicopia.client;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.minelittlepony.common.event.ClientReadyCallback;
import com.minelittlepony.jumpingcastle.api.Target;
import com.minelittlepony.unicopia.core.Config;
import com.minelittlepony.unicopia.core.IKeyBindingHandler;
import com.minelittlepony.unicopia.core.InteractionManager;
import com.minelittlepony.unicopia.core.Race;
import com.minelittlepony.unicopia.core.SpeciesList;
import com.minelittlepony.unicopia.core.UnicopiaCore;
import com.minelittlepony.unicopia.core.ability.PowersRegistry;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.core.network.MsgRequestCapabilities;
import com.minelittlepony.unicopia.core.util.MineLPConnector;
import com.minelittlepony.unicopia.core.util.dummy.DummyClientPlayerEntity;
import com.minelittlepony.unicopia.redux.client.render.DisguiseRenderer;
import com.minelittlepony.unicopia.Config;
import com.minelittlepony.unicopia.IKeyBindingHandler;
import com.minelittlepony.unicopia.InteractionManager;
import com.minelittlepony.unicopia.Race;
import com.minelittlepony.unicopia.SpeciesList;
import com.minelittlepony.unicopia.UnicopiaCore;
import com.minelittlepony.unicopia.ability.PowersRegistry;
import com.minelittlepony.unicopia.client.render.DisguiseRenderer;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import com.minelittlepony.unicopia.network.MsgRequestCapabilities;
import com.minelittlepony.unicopia.util.MineLPConnector;
import com.minelittlepony.unicopia.util.dummy.DummyClientPlayerEntity;
import com.mojang.authlib.GameProfile;
import com.mojang.blaze3d.platform.GlStateManager;

View file

@ -1,13 +1,14 @@
package com.minelittlepony.unicopia.redux.client;
package com.minelittlepony.unicopia.client;
import static com.minelittlepony.unicopia.core.EquinePredicates.MAGI;
import static com.minelittlepony.unicopia.EquinePredicates.MAGI;
import javax.annotation.Nullable;
import com.minelittlepony.unicopia.core.magic.spell.SpellRegistry;
import com.minelittlepony.unicopia.redux.UBlocks;
import com.minelittlepony.unicopia.redux.block.IColourful;
import com.minelittlepony.unicopia.redux.item.UItems;
import com.minelittlepony.unicopia.UBlocks;
import com.minelittlepony.unicopia.block.IColourful;
import com.minelittlepony.unicopia.item.UItems;
import com.minelittlepony.unicopia.magic.spell.SpellRegistry;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.render.ColorProviderRegistry;
import net.minecraft.block.Block;

View file

@ -1,7 +1,7 @@
package com.minelittlepony.unicopia.core.client.gui;
package com.minelittlepony.unicopia.client.gui;
import com.minelittlepony.unicopia.core.SpeciesList;
import com.minelittlepony.unicopia.core.client.gui.UHud;
import com.minelittlepony.unicopia.SpeciesList;
import com.minelittlepony.unicopia.client.gui.UHud;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.MinecraftClient;

View file

@ -1,6 +1,6 @@
package com.minelittlepony.unicopia.core.client.gui;
package com.minelittlepony.unicopia.client.gui;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.gui.DrawableHelper;

View file

@ -1,6 +1,6 @@
package com.minelittlepony.unicopia.core.client.gui;
package com.minelittlepony.unicopia.client.gui;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.entity.player.IPlayer;
public interface IHudElement {

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core.client.gui;
package com.minelittlepony.unicopia.client.gui;
import com.minelittlepony.common.client.gui.GameGui;
import com.minelittlepony.common.client.gui.element.Button;

View file

@ -1,11 +1,11 @@
package com.minelittlepony.unicopia.core.client.gui;
package com.minelittlepony.unicopia.client.gui;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.MinecraftClient;

View file

@ -1,12 +1,12 @@
package com.minelittlepony.unicopia.core.mixin.client;
package com.minelittlepony.unicopia.client.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import com.minelittlepony.unicopia.core.SpeciesList;
import com.minelittlepony.unicopia.core.entity.player.PlayerCamera;
import com.minelittlepony.unicopia.SpeciesList;
import com.minelittlepony.unicopia.entity.player.PlayerCamera;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.Camera;

View file

@ -1,11 +1,11 @@
package com.minelittlepony.unicopia.core.mixin.client;
package com.minelittlepony.unicopia.client.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.minelittlepony.unicopia.core.SpeciesList;
import com.minelittlepony.unicopia.SpeciesList;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.Camera;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core.client.particle;
package com.minelittlepony.unicopia.client.particle;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core.client.particle;
package com.minelittlepony.unicopia.client.particle;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.Camera;
@ -7,7 +7,7 @@ import net.minecraft.world.World;
import org.lwjgl.opengl.GL14;
import com.minelittlepony.unicopia.core.client.render.DiskModel;
import com.minelittlepony.unicopia.client.render.DiskModel;
import com.mojang.blaze3d.platform.GlStateManager;
public class DiskParticle extends SphereParticle {

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core.client.particle;
package com.minelittlepony.unicopia.client.particle;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core.client.particle;
package com.minelittlepony.unicopia.client.particle;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleFactory;

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core.client.particle;
package com.minelittlepony.unicopia.client.particle;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.particle.Particle;
@ -15,9 +15,9 @@ import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
import com.minelittlepony.unicopia.core.client.render.SphereModel;
import com.minelittlepony.unicopia.core.magic.ICaster;
import com.minelittlepony.unicopia.core.util.particles.ParticleConnection.IAttachableParticle;
import com.minelittlepony.unicopia.client.render.SphereModel;
import com.minelittlepony.unicopia.magic.ICaster;
import com.minelittlepony.unicopia.util.particles.ParticleConnection.IAttachableParticle;
import com.mojang.blaze3d.platform.GlStateManager;
public class SphereParticle extends Particle implements IAttachableParticle {

View file

@ -1,9 +1,10 @@
package com.minelittlepony.unicopia.redux.client.render;
package com.minelittlepony.unicopia.client.render;
import com.minelittlepony.unicopia.redux.client.render.model.ButterflyEntityModel;
import com.minelittlepony.unicopia.redux.entity.ButterflyEntity;
import com.minelittlepony.unicopia.client.render.model.ButterflyEntityModel;
import com.minelittlepony.unicopia.entity.ButterflyEntity;
import com.mojang.blaze3d.platform.GlStateManager;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.util.Identifier;
@ -11,8 +12,8 @@ import net.minecraft.util.math.MathHelper;
public class ButterflyEntityRenderer extends LivingEntityRenderer<ButterflyEntity, ButterflyEntityModel> {
public ButterflyEntityRenderer(EntityRenderDispatcher rm) {
super(rm, new ButterflyEntityModel(), 0.25F);
public ButterflyEntityRenderer(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager, new ButterflyEntityModel(), 0.25F);
}
@Override

View file

@ -0,0 +1,78 @@
package com.minelittlepony.unicopia.client.render;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.util.Identifier;
import org.lwjgl.opengl.GL11;
import com.minelittlepony.unicopia.client.render.model.CloudEntityModel;
import com.minelittlepony.unicopia.entity.CloudEntity;
import com.minelittlepony.unicopia.util.WorldHelper;
import com.mojang.blaze3d.platform.GlStateManager;
public class CloudEntityRenderer extends LivingEntityRenderer<CloudEntity, CloudEntityModel> {
private static final Identifier cloud = new Identifier("unicopia", "textures/entity/clouds.png");
private static final Identifier rainCloud = new Identifier("unicopia", "textures/entity/clouds_storm.png");
public CloudEntityRenderer(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager, new CloudEntityModel(), 1f);
}
@Override
public void scale(CloudEntity entity, float par2) {
float scale = entity.getCloudSize();
GL11.glScalef(scale, scale, scale);
}
@Override
protected void render(CloudEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor) {
if (!entity.removed) {
GlStateManager.pushMatrix();
GlStateManager.translatef(0, -entity.getHeight()/entity.getCloudSize() + 0.3F, 0);
GlStateManager.disableLighting();
GlStateManager.enableBlend();
float brightness = Math.max(WorldHelper.getDaylightBrightness(entity.getEntityWorld(), 0) * 3, 0.05F);
GlStateManager.color4f(brightness, brightness, brightness, entity.getOpaque() ? 1 : 0.8F);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
super.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor);
GlStateManager.disableBlend();
GlStateManager.enableLighting();
GlStateManager.color4f(1, 1, 1, 1);
GlStateManager.popMatrix();
}
}
@Override
protected Identifier getTexture(CloudEntity entity) {
if (entity.getIsRaining() && entity.getIsThundering()) {
return rainCloud;
}
return cloud;
}
@Override
protected float getLyingAngle(CloudEntity par1LivingEntity) {
return 0;
}
}

View file

@ -0,0 +1,53 @@
package com.minelittlepony.unicopia.client.render;
import com.minelittlepony.unicopia.InteractionManager;
import com.minelittlepony.unicopia.UnicopiaCore;
import com.minelittlepony.unicopia.client.render.model.CuccoonEntityModel;
import com.minelittlepony.unicopia.entity.CuccoonEntity;
import com.mojang.blaze3d.platform.GlStateManager;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.Identifier;
public class CuccoonEntityRenderer extends LivingEntityRenderer<CuccoonEntity, CuccoonEntityModel> {
private static final Identifier TEXTURE = new Identifier(UnicopiaCore.MODID, "textures/entity/cuccoon.png");
public CuccoonEntityRenderer(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager, new CuccoonEntityModel(), 1);
}
@Override
protected Identifier getTexture(CuccoonEntity entity) {
return TEXTURE;
}
@Override
protected float getLyingAngle(CuccoonEntity entity) {
return 0;
}
@Override
public void render(CuccoonEntity entity, double x, double y, double z, float entityYaw, float partialTicks) {
if (entity.hasPassengers()) {
Entity rider = entity.getPrimaryPassenger();
if (!(rider == MinecraftClient.getInstance().player) || InteractionManager.instance().getViewMode() != 0) {
GlStateManager.enableAlphaTest();
GlStateManager.enableBlend();
renderManager.render(rider, x, y + rider.getMountedHeightOffset(), z, entityYaw, partialTicks, true);
GlStateManager.disableBlend();
GlStateManager.disableAlphaTest();
}
}
super.render(entity, x, y, z, entityYaw, partialTicks);
}
}

View file

@ -1,7 +1,7 @@
package com.minelittlepony.unicopia.redux.client.render;
package com.minelittlepony.unicopia.client.render;
import com.minelittlepony.unicopia.core.entity.player.IPlayer;
import com.minelittlepony.unicopia.redux.magic.spells.DisguiseSpell;
import com.minelittlepony.unicopia.entity.player.IPlayer;
import com.minelittlepony.unicopia.magic.spell.DisguiseSpell;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.entity.EntityRenderDispatcher;

View file

@ -1,13 +1,14 @@
package com.minelittlepony.unicopia.core.client.render;
package com.minelittlepony.unicopia.client.render;
public class DiskModel extends SphereModel {
@Override
protected void drawShape() {
Disk sphere = new Disk();
/* Disk sphere = new Disk();
sphere.setDrawStyle(GLU.GLU_FILL);
sphere.setNormals(GL.GLU_SMOOTH);
sphere.draw(0, 1, 32, 32);
sphere.draw(0, 1, 32, 32);*/
// TODO: GLU Disk
}
}

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core.client.render;
package com.minelittlepony.unicopia.client.render;
import java.util.ArrayList;
import java.util.List;

View file

@ -0,0 +1,75 @@
package com.minelittlepony.unicopia.client.render;
import org.lwjgl.opengl.GL11;
import com.minelittlepony.unicopia.entity.RainbowEntity;
import com.minelittlepony.unicopia.util.WorldHelper;
import com.mojang.blaze3d.platform.GlStateManager;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.util.Identifier;
public class RainbowEntityRenderer extends EntityRenderer<RainbowEntity> {
public RainbowEntityRenderer(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager);
}
private static final Identifier TEXTURE = new Identifier("unicopia", "textures/environment/rainbow.png");
public void doRender(RainbowEntity entity, double x, double y, double z, float entityYaw, float partialTicks) {
float distance = MinecraftClient.getInstance().getCameraEntity().distanceTo(entity);
float maxDistance = 16 * MinecraftClient.getInstance().options.viewDistance;
double r = entity.getRadius();
float light = WorldHelper.getDaylightBrightness(entity.getEntityWorld(), partialTicks);
float opacity = ((maxDistance - distance) / maxDistance);
opacity *= light;
if (opacity <= 0) {
return;
}
bindEntityTexture(entity);
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
GlStateManager.disableCull();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
GlStateManager.translated(x, y, z);
GlStateManager.rotatef(entityYaw, 0, 1, 0);
GlStateManager.color4f(1, 1, 1, opacity);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBufferBuilder();
bufferbuilder.begin(GL11.GL_QUADS, VertexFormats.POSITION_UV);
bufferbuilder.vertex(-r, r, 0).texture(1, 0).end();
bufferbuilder.vertex( r, r, 0).texture(0, 0).end();
bufferbuilder.vertex( r, 0, 0).texture(0, 1).end();
bufferbuilder.vertex(-r, 0, 0).texture(1, 1).end();
tessellator.draw();
GlStateManager.disableBlend();
GlStateManager.enableCull();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
}
@Override
protected Identifier getTexture(RainbowEntity entity) {
return TEXTURE;
}
}

View file

@ -1,10 +1,11 @@
package com.minelittlepony.unicopia.redux.client.render;
package com.minelittlepony.unicopia.client.render;
import com.minelittlepony.unicopia.redux.client.render.model.SpellbookModel;
import com.minelittlepony.unicopia.redux.entity.SpellbookEntity;
import com.minelittlepony.unicopia.client.render.model.SpellbookModel;
import com.minelittlepony.unicopia.entity.SpellbookEntity;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.util.math.MathHelper;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.util.Identifier;
@ -14,24 +15,24 @@ public class RenderSpellbook extends LivingEntityRenderer<SpellbookEntity, Spell
private static final Identifier BLUE = new Identifier("unicopia", "textures/entity/enchanting_table_book_blue.png");
private static final Identifier NORMAL = new Identifier("unicopia", "textures/entity/enchanting_table_book.png");
public RenderSpellbook(EntityRenderDispatcher rendermanagerIn) {
super(rendermanagerIn, new SpellbookModel(), 0);
public RenderSpellbook(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager, new SpellbookModel(), 0);
}
@Override
protected Identifier getEntityTexture(SpellbookEntity entity) {
protected Identifier getTexture(SpellbookEntity entity) {
return entity.getIsAltered() ? BLUE : NORMAL;
}
@Override
protected float getDeathMaxRotation(SpellbookEntity entity) {
protected float getLyingAngle(SpellbookEntity entity) {
return 0;
}
@Override
protected void renderModel(SpellbookEntity entity, float time, float walkSpeed, float stutter, float yaw, float pitch, float increment) {
protected void render(SpellbookEntity entity, float time, float walkSpeed, float stutter, float yaw, float pitch, float increment) {
float breath = MathHelper.sin(((float)entity.ticksExisted + stutter) / 20) * 0.01F + 0.1F;
float breath = MathHelper.sin((entity.age + stutter) / 20) * 0.01F + 0.1F;
float first_page_rot = walkSpeed + (breath * 10);
float second_page_rot = 1 - first_page_rot;
@ -57,18 +58,21 @@ public class RenderSpellbook extends LivingEntityRenderer<SpellbookEntity, Spell
}
GlStateManager.enableCull();
super.renderModel(entity, 0, first_page_rot, second_page_rot, open_angle, 0.0F, 0.0625F);
super.render(entity, 0, first_page_rot, second_page_rot, open_angle, 0, 0.0625F);
GlStateManager.popMatrix();
}
@Override
protected void applyRotations(SpellbookEntity entity, float p_77043_2_, float p_77043_3_, float partialTicks) {
GlStateManager.rotate(-interpolateRotation(entity.prevRotationYaw, entity.rotationYaw, partialTicks), 0, 1, 0);
protected void setupTransforms(SpellbookEntity entity, float p_77043_2_, float p_77043_3_, float partialTicks) {
GlStateManager.rotatef(-MathHelper.lerp(entity.prevYaw, entity.yaw, partialTicks), 0, 1, 0);
}
@Override
protected boolean canRenderName(SpellbookEntity targetEntity) {
return super.canRenderName(targetEntity) && (targetEntity.getAlwaysRenderNameTagForRender() || targetEntity.hasCustomName() && targetEntity == renderManager.pointedEntity);
protected boolean hasLabel(SpellbookEntity targetEntity) {
return super.hasLabel(targetEntity)
&& (targetEntity.isCustomNameVisible()
|| targetEntity.hasCustomName()
&& targetEntity == renderManager.targetedEntity);
}
}

View file

@ -0,0 +1,22 @@
package com.minelittlepony.unicopia.client.render;
import com.minelittlepony.unicopia.UnicopiaCore;
import com.minelittlepony.unicopia.entity.SpearEntity;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.ProjectileEntityRenderer;
import net.minecraft.util.Identifier;
public class SpearEntityRenderer extends ProjectileEntityRenderer<SpearEntity> {
public static final Identifier TEXTURE = new Identifier(UnicopiaCore.MODID, "textures/entity/projectiles/spear.png");
public SpearEntityRenderer(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager);
}
@Override
protected Identifier getTexture(SpearEntity entity) {
return TEXTURE;
}
}

View file

@ -1,21 +1,20 @@
package com.minelittlepony.unicopia.redux.client.render;
package com.minelittlepony.unicopia.client.render;
import com.minelittlepony.unicopia.redux.client.render.model.ModelGem;
import com.minelittlepony.unicopia.redux.entity.SpellcastEntity;
import com.minelittlepony.unicopia.client.render.model.GemEntityModel;
import com.minelittlepony.unicopia.entity.SpellcastEntity;
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
import net.minecraft.client.render.Frustum;
import net.minecraft.client.render.VisibleRegion;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.util.Identifier;
public class SpellcastEntityRenderer extends LivingEntityRenderer<SpellcastEntity, ModelGem> {
public class SpellcastEntityRenderer extends LivingEntityRenderer<SpellcastEntity, GemEntityModel> {
private static final Identifier gem = new Identifier("unicopia", "textures/entity/gem.png");
public SpellcastEntityRenderer(EntityRenderDispatcher manager, EntityRendererRegistry.Context context) {
super(manager, new ModelGem(), 0);
super(manager, new GemEntityModel(), 0);
}
@Override
@ -29,13 +28,13 @@ public class SpellcastEntityRenderer extends LivingEntityRenderer<SpellcastEntit
}
@Override
protected float getDeathMaxRotation(SpellcastEntity entity) {
protected float getLyingAngle(SpellcastEntity entity) {
return 0;
}
@Override
protected boolean canRenderName(SpellcastEntity targetEntity) {
return super.canRenderName(targetEntity) && (targetEntity.getAlwaysRenderNameTagForRender()
protected boolean hasLabel(SpellcastEntity targetEntity) {
return super.hasLabel(targetEntity) && (targetEntity.isCustomNameVisible()
|| targetEntity.hasCustomName() && targetEntity == renderManager.targetedEntity);
}
}

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core.client.render;
package com.minelittlepony.unicopia.client.render;
import org.lwjgl.opengl.GL11;
@ -70,11 +70,12 @@ public class SphereModel {
protected void drawShape() {
Sphere sphere = new Sphere();
/*Sphere sphere = new Sphere();
sphere.setDrawStyle(GLU.GLU_FILL);
sphere.setNormals(GLU.GLU_SMOOTH);
sphere.draw(1, 32, 32);
sphere.draw(1, 32, 32);*/
// TODO: GLU Sphere
}
static void glRotate(float angle, float x, float y, float z) {

View file

@ -1,4 +1,4 @@
package com.minelittlepony.unicopia.core.client.render;
package com.minelittlepony.unicopia.client.render;
import net.minecraft.client.model.Quad;
import net.minecraft.client.model.Vertex;

View file

@ -1,6 +1,6 @@
package com.minelittlepony.unicopia.redux.client.render.model;
package com.minelittlepony.unicopia.client.render.model;
import com.minelittlepony.unicopia.redux.entity.ButterflyEntity;
import com.minelittlepony.unicopia.entity.ButterflyEntity;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.model.Cuboid;

View file

@ -0,0 +1,32 @@
package com.minelittlepony.unicopia.client.render.model;
import com.minelittlepony.unicopia.entity.CloudEntity;
import net.minecraft.client.model.Cuboid;
import net.minecraft.client.render.entity.model.EntityModel;
public class CloudEntityModel extends EntityModel<CloudEntity> {
private final Cuboid body;
public CloudEntityModel() {
body = new Cuboid(this, 0, 0);
body.setTextureSize(250, 90);
body.setTextureOffset(0, 0);
body.addBox(-24, 5, -24, 48, 10, 48);
body.setTextureOffset(0, 58);
body.addBox(-10, 14.999F, -10, 30, 2, 30);
body.setTextureOffset(120, 58);
body.addBox(-10, 3.001F, -10, 30, 2, 30);
body.rotationPointY += 4.2;
}
@Override
public void render(CloudEntity cloud, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
body.render(scale);
}
}

View file

@ -1,20 +1,19 @@
package com.minelittlepony.unicopia.redux.client.render.model;
package com.minelittlepony.unicopia.client.render.model;
import com.minelittlepony.unicopia.redux.entity.CuccoonEntity;
import com.minelittlepony.unicopia.entity.CuccoonEntity;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.platform.GlStateManager.DestFactor;
import com.mojang.blaze3d.platform.GlStateManager.SourceFactor;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.GlStateManager.DestFactor;
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
import net.minecraft.entity.Entity;
import net.minecraft.client.model.Cuboid;
import net.minecraft.client.render.entity.model.EntityModel;
public class ModelCuccoon extends ModelBase {
public class CuccoonEntityModel extends EntityModel<CuccoonEntity> {
private final ModelRenderer body;
private final Cuboid body;
public ModelCuccoon() {
body = new ModelRenderer(this, 0, 0);
public CuccoonEntityModel() {
body = new Cuboid(this, 0, 0);
body.setTextureSize(250, 250);
body.setTextureOffset(0, 0);
@ -38,30 +37,30 @@ public class ModelCuccoon extends ModelBase {
}
@Override
public void render(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
public void render(CuccoonEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
float breatheAmount = ((CuccoonEntity)entity).getBreatheAmount(ageInTicks) / 8;
float breatheAmount = entity.getBreatheAmount(ageInTicks) / 8;
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableAlphaTest();
GlStateManager.enableNormalize();
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
GlStateManager.scale(1 - breatheAmount, 1 + breatheAmount, 1 - breatheAmount);
GlStateManager.translate(0, -breatheAmount * 1.3F, 0);
GlStateManager.scalef(1 - breatheAmount, 1 + breatheAmount, 1 - breatheAmount);
GlStateManager.translatef(0, -breatheAmount * 1.3F, 0);
body.render(scale);
GlStateManager.scale(0.9, 0.9, 0.9);
GlStateManager.translate(0, 0.2F, 0);
GlStateManager.scalef(0.9F, 0.9F, 0.9F);
GlStateManager.translatef(0, 0.2F, 0);
body.render(scale);
GlStateManager.disableNormalize();
GlStateManager.disableAlpha();
GlStateManager.disableAlphaTest();
GlStateManager.disableBlend();
GlStateManager.popMatrix();

View file

@ -1,21 +1,22 @@
package com.minelittlepony.unicopia.redux.client.render.model;
package com.minelittlepony.unicopia.client.render.model;
import com.minelittlepony.unicopia.core.client.render.ModelQuads;
import com.minelittlepony.unicopia.redux.entity.SpellcastEntity;
import com.minelittlepony.unicopia.client.render.ModelQuads;
import com.minelittlepony.unicopia.entity.SpellcastEntity;
import com.minelittlepony.util.Color;
import com.mojang.blaze3d.platform.GLX;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.model.Cuboid;
import net.minecraft.client.model.Vertex;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityPose;
import net.minecraft.util.math.MathHelper;
public class ModelGem extends EntityModel<SpellcastEntity> {
public class GemEntityModel extends EntityModel<SpellcastEntity> {
private Cuboid body;
public ModelGem() {
public GemEntityModel() {
textureWidth = 256;
textureHeight = 256;
@ -102,7 +103,8 @@ public class ModelGem extends EntityModel<SpellcastEntity> {
setLightingConditionsBrightness(0xF0F0);
if (entity.hasEffect()) {
Color.glColor(entity.getEffect().getTint(), 1);
int tint = entity.getEffect().getTint();
GlStateManager.color4f(Color.r(tint), Color.g(tint), Color.b(tint), 1);
}
int tiers = Math.min(entity.getCurrentLevel(), 5);
@ -150,6 +152,6 @@ public class ModelGem extends EntityModel<SpellcastEntity> {
int texX = brightness % 0x10000;
int texY = brightness / 0x10000;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, texX, texY);
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, texX, texY);
}
}

View file

@ -0,0 +1,49 @@
package com.minelittlepony.unicopia.client.render.model;
import com.minelittlepony.unicopia.entity.SpellbookEntity;
import net.minecraft.client.model.Cuboid;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.util.math.MathHelper;
public class SpellbookModel extends EntityModel<SpellbookEntity> {
private final Cuboid leftCover = (new Cuboid(this)).setTextureOffset(0, 0).addBox(-6.0F, -5.0F, 0.0F, 6, 10, 0);
private final Cuboid rightCover = (new Cuboid(this)).setTextureOffset(16, 0).addBox(0.0F, -5.0F, 0.0F, 6, 10, 0);
private final Cuboid leftBlock = (new Cuboid(this)).setTextureOffset(0, 10).addBox(0.0F, -4.0F, -0.99F, 5, 8, 1);
private final Cuboid rightBlock = (new Cuboid(this)).setTextureOffset(12, 10).addBox(0.0F, -4.0F, -0.01F, 5, 8, 1);
private final Cuboid leftPage = (new Cuboid(this)).setTextureOffset(24, 10).addBox(0.0F, -4.0F, 0.0F, 5, 8, 0);
private final Cuboid rightPage = (new Cuboid(this)).setTextureOffset(24, 10).addBox(0.0F, -4.0F, 0.0F, 5, 8, 0);
private final Cuboid spine = (new Cuboid(this)).setTextureOffset(12, 0).addBox(-1.0F, -5.0F, 0.0F, 2, 10, 0);
public SpellbookModel() {
this.leftCover.setRotationPoint(0.0F, 0.0F, -1.0F);
this.rightCover.setRotationPoint(0.0F, 0.0F, 1.0F);
this.spine.yaw = 1.5707964F;
}
@Override
public void render(SpellbookEntity entity, float float_1, float float_2, float float_3, float float_4, float float_5, float float_6) {
this.leftCover.render(float_6);
this.rightCover.render(float_6);
this.spine.render(float_6);
this.leftBlock.render(float_6);
this.rightBlock.render(float_6);
this.leftPage.render(float_6);
this.rightPage.render(float_6);
}
@Override
public void setAngles(SpellbookEntity entity, float float_1, float float_2, float float_3, float float_4, float float_5, float float_6) {
float float_7 = (MathHelper.sin(float_1 * 0.02F) * 0.1F + 1.25F) * float_4;
this.leftCover.yaw = 3.1415927F + float_7;
this.rightCover.yaw = -float_7;
this.leftBlock.yaw = float_7;
this.rightBlock.yaw = -float_7;
this.leftPage.yaw = float_7 - float_7 * 2.0F * float_2;
this.rightPage.yaw = float_7 - float_7 * 2.0F * float_3;
this.leftBlock.rotationPointX = MathHelper.sin(float_7);
this.rightBlock.rotationPointX = MathHelper.sin(float_7);
this.leftPage.rotationPointX = MathHelper.sin(float_7);
this.rightPage.rotationPointX = MathHelper.sin(float_7);
}
}

View file

@ -0,0 +1,19 @@
package com.minelittlepony.unicopia.command;
import net.fabricmc.fabric.api.registry.CommandRegistry;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.server.MinecraftServer;
public class Commands {
public static void bootstrap() {
CommandRegistry.INSTANCE.register(false, SpeciesCommand::register);
CommandRegistry.INSTANCE.register(false, RacelistCommand::register);
CommandRegistry.INSTANCE.register(false, GravityCommand::register);
CommandRegistry.INSTANCE.register(false, DisguiseCommand::register);
Object game = FabricLoader.getInstance().getGameInstance();
if (game instanceof MinecraftServer) {
((MinecraftServer)game).setFlightEnabled(true);
}
}
}

Some files were not shown because too many files have changed in this diff Show more