mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
It compiles, now for the todos
This commit is contained in:
parent
b7c3a37bee
commit
764e2b1efd
32 changed files with 269 additions and 180 deletions
|
@ -16,7 +16,7 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public class CustomDrops {
|
public class CustomDrops {
|
||||||
// TODO: replace with a loot table
|
// TODO: loot table
|
||||||
public void addAuxiliaryDrops(World world, BlockState state, BlockPos pos, List<ItemStack> drops, int fortune) {
|
public void addAuxiliaryDrops(World world, BlockState state, BlockPos pos, List<ItemStack> drops, int fortune) {
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
|
|
||||||
|
|
84
src/main/java/com/minelittlepony/unicopia/TreeType.java
Normal file
84
src/main/java/com/minelittlepony/unicopia/TreeType.java
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
package com.minelittlepony.unicopia;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
|
import com.minelittlepony.unicopia.util.collection.Weighted;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
|
public final class TreeType {
|
||||||
|
// TODO: Move this to a datapack
|
||||||
|
private static final Set<TreeType> REGISTRY = new HashSet<>();
|
||||||
|
|
||||||
|
public static final TreeType NONE = new TreeType("none", new Weighted<Supplier<ItemStack>>());
|
||||||
|
public static final TreeType OAK = new TreeType("oak", new Weighted<Supplier<ItemStack>>()
|
||||||
|
.put(1, () -> new ItemStack(UItems.rotten_apple))
|
||||||
|
.put(2, () -> new ItemStack(UItems.green_apple))
|
||||||
|
.put(3, () -> new ItemStack(UItems.VanillaOverrides.red_apple)), Blocks.OAK_LOG, Blocks.OAK_LEAVES);
|
||||||
|
public static final TreeType BIRCH = new TreeType("birch", new Weighted<Supplier<ItemStack>>()
|
||||||
|
.put(1, () -> new ItemStack(UItems.rotten_apple))
|
||||||
|
.put(2, () -> new ItemStack(UItems.sweet_apple))
|
||||||
|
.put(5, () -> new ItemStack(UItems.green_apple)), Blocks.BIRCH_LOG, Blocks.BIRCH_LEAVES);
|
||||||
|
public static final TreeType SPRUCE = new TreeType("spruce", new Weighted<Supplier<ItemStack>>()
|
||||||
|
.put(1, () -> new ItemStack(UItems.sour_apple))
|
||||||
|
.put(2, () -> new ItemStack(UItems.green_apple))
|
||||||
|
.put(3, () -> new ItemStack(UItems.sweet_apple))
|
||||||
|
.put(4, () -> new ItemStack(UItems.rotten_apple)), Blocks.SPRUCE_LOG, Blocks.SPRUCE_LEAVES);
|
||||||
|
public static final TreeType ACACIA = new TreeType("acacia", new Weighted<Supplier<ItemStack>>()
|
||||||
|
.put(1, () -> new ItemStack(UItems.rotten_apple))
|
||||||
|
.put(2, () -> new ItemStack(UItems.sweet_apple))
|
||||||
|
.put(5, () -> new ItemStack(UItems.green_apple)), Blocks.ACACIA_LOG, Blocks.ACACIA_LEAVES);
|
||||||
|
public static final TreeType JUNGLE = new TreeType("jungle", new Weighted<Supplier<ItemStack>>()
|
||||||
|
.put(5, () -> new ItemStack(UItems.green_apple))
|
||||||
|
.put(2, () -> new ItemStack(UItems.sweet_apple))
|
||||||
|
.put(1, () -> new ItemStack(UItems.sour_apple)), Blocks.JUNGLE_LOG, Blocks.JUNGLE_LEAVES);
|
||||||
|
public static final TreeType DARK_OAK = new TreeType("dark_oak", new Weighted<Supplier<ItemStack>>()
|
||||||
|
.put(1, () -> new ItemStack(UItems.rotten_apple))
|
||||||
|
.put(2, () -> new ItemStack(UItems.sweet_apple))
|
||||||
|
.put(5, () -> new ItemStack(UItems.zap_apple)), Blocks.DARK_OAK_LOG, Blocks.DARK_OAK_LEAVES);
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
private final Set<Identifier> blocks;
|
||||||
|
private final Weighted<Supplier<ItemStack>> pool;
|
||||||
|
|
||||||
|
private TreeType(String name, Weighted<Supplier<ItemStack>> pool, Block...blocks) {
|
||||||
|
this.name = name;
|
||||||
|
this.pool = pool;
|
||||||
|
this.blocks = Arrays.stream(blocks).map(Registry.BLOCK::getId)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
REGISTRY.add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean matches(BlockState state) {
|
||||||
|
return blocks.contains(Registry.BLOCK.getId(state.getBlock()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack pickRandomStack() {
|
||||||
|
return pool.get().map(Supplier::get).orElse(ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TreeType get(BlockState state) {
|
||||||
|
return REGISTRY.stream().filter(type -> type.matches(state)).findFirst().orElse(TreeType.NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
return o instanceof TreeType && name.compareTo(((TreeType)o).name) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return name.hashCode();
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,12 +11,14 @@ import com.minelittlepony.common.util.GamePaths;
|
||||||
import com.minelittlepony.jumpingcastle.api.Channel;
|
import com.minelittlepony.jumpingcastle.api.Channel;
|
||||||
import com.minelittlepony.jumpingcastle.api.JumpingCastle;
|
import com.minelittlepony.jumpingcastle.api.JumpingCastle;
|
||||||
import com.minelittlepony.unicopia.ability.Abilities;
|
import com.minelittlepony.unicopia.ability.Abilities;
|
||||||
|
import com.minelittlepony.unicopia.advancement.BOHDeathCriterion;
|
||||||
import com.minelittlepony.unicopia.block.UBlocks;
|
import com.minelittlepony.unicopia.block.UBlocks;
|
||||||
import com.minelittlepony.unicopia.command.Commands;
|
import com.minelittlepony.unicopia.command.Commands;
|
||||||
import com.minelittlepony.unicopia.container.UContainers;
|
import com.minelittlepony.unicopia.container.UContainers;
|
||||||
import com.minelittlepony.unicopia.enchanting.Pages;
|
import com.minelittlepony.unicopia.enchanting.Pages;
|
||||||
import com.minelittlepony.unicopia.enchanting.recipe.AffineIngredients;
|
import com.minelittlepony.unicopia.enchanting.recipe.AffineIngredients;
|
||||||
import com.minelittlepony.unicopia.item.UItems;
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
|
import com.minelittlepony.unicopia.mixin.CriterionsRegistry;
|
||||||
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;
|
||||||
|
@ -50,6 +52,7 @@ public class Unicopia implements ModInitializer {
|
||||||
UStructures.bootstrap();
|
UStructures.bootstrap();
|
||||||
Abilities.getInstance().init();
|
Abilities.getInstance().init();
|
||||||
|
|
||||||
|
CriterionsRegistry.register(BOHDeathCriterion.INSTANCE);
|
||||||
ResourceManagerHelper.get(ResourceType.SERVER_DATA).registerReloadListener(Pages.instance());
|
ResourceManagerHelper.get(ResourceType.SERVER_DATA).registerReloadListener(Pages.instance());
|
||||||
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(AffineIngredients.instance());
|
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(AffineIngredients.instance());
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@ import com.google.common.collect.Lists;
|
||||||
import com.google.gson.annotations.Expose;
|
import com.google.gson.annotations.Expose;
|
||||||
import com.minelittlepony.unicopia.AwaitTickQueue;
|
import com.minelittlepony.unicopia.AwaitTickQueue;
|
||||||
import com.minelittlepony.unicopia.Race;
|
import com.minelittlepony.unicopia.Race;
|
||||||
|
import com.minelittlepony.unicopia.TreeType;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.item.AppleItem;
|
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
||||||
import com.minelittlepony.unicopia.util.PosHelper;
|
import com.minelittlepony.unicopia.util.PosHelper;
|
||||||
import com.minelittlepony.unicopia.util.VecHelper;
|
import com.minelittlepony.unicopia.util.VecHelper;
|
||||||
|
@ -28,7 +28,6 @@ import net.minecraft.entity.ItemEntity;
|
||||||
import net.minecraft.entity.attribute.EntityAttributes;
|
import net.minecraft.entity.attribute.EntityAttributes;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.particle.BlockStateParticleEffect;
|
import net.minecraft.particle.BlockStateParticleEffect;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
|
@ -351,7 +350,7 @@ public class EarthPonyStompAbility implements Ability<EarthPonyStompAbility.Data
|
||||||
|
|
||||||
ItemEntity item = new ItemEntity(EntityType.ITEM, w);
|
ItemEntity item = new ItemEntity(EntityType.ITEM, w);
|
||||||
item.setPos(pos.getX() + w.random.nextFloat(), pos.getY() - 0.5, pos.getZ() + w.random.nextFloat());
|
item.setPos(pos.getX() + w.random.nextFloat(), pos.getY() - 0.5, pos.getZ() + w.random.nextFloat());
|
||||||
item.setStack(getApple(w, log));
|
item.setStack(TreeType.get(log).pickRandomStack());
|
||||||
|
|
||||||
drops.add(item);
|
drops.add(item);
|
||||||
}
|
}
|
||||||
|
@ -363,10 +362,6 @@ public class EarthPonyStompAbility implements Ability<EarthPonyStompAbility.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack getApple(World w, BlockState log) {
|
|
||||||
return AppleItem.getRandomItemStack(getVariant(log));
|
|
||||||
}
|
|
||||||
|
|
||||||
private int measureTree(World w, BlockState log, BlockPos pos) {
|
private int measureTree(World w, BlockState log, BlockPos pos) {
|
||||||
List<BlockPos> logs = new ArrayList<>();
|
List<BlockPos> logs = new ArrayList<>();
|
||||||
List<BlockPos> leaves = new ArrayList<>();
|
List<BlockPos> leaves = new ArrayList<>();
|
||||||
|
@ -455,20 +450,7 @@ public class EarthPonyStompAbility implements Ability<EarthPonyStompAbility.Data
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean variantEquals(BlockState one, BlockState two) {
|
private boolean variantEquals(BlockState one, BlockState two) {
|
||||||
return getVariant(one) == getVariant(two);
|
return TreeType.get(one).equals(TreeType.get(two));
|
||||||
}
|
|
||||||
|
|
||||||
private Object getVariant(BlockState state) {
|
|
||||||
// TODO: Variants are gone
|
|
||||||
/*if (state.getBlock() instanceof LeavesBlock) {
|
|
||||||
return ((LeavesBlock)state.getBlock()).getWoodType(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
return state.getEntries().entrySet().stream()
|
|
||||||
.filter(i -> i.getKey().getName().contentEquals("variant"))
|
|
||||||
.map(i -> i.getValue())
|
|
||||||
.findFirst().orElse(null);*/
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static class Data extends Ability.Pos {
|
protected static class Data extends Ability.Pos {
|
||||||
|
|
|
@ -15,7 +15,6 @@ import net.minecraft.util.Identifier;
|
||||||
* Advantement trigger for the book of holding. It's an achievement to die so spectacularly! :D
|
* Advantement trigger for the book of holding. It's an achievement to die so spectacularly! :D
|
||||||
*/
|
*/
|
||||||
public class BOHDeathCriterion extends AbstractCriterion<BOHDeathCriterion.Entry, BOHDeathCriterion.Conditions> {
|
public class BOHDeathCriterion extends AbstractCriterion<BOHDeathCriterion.Entry, BOHDeathCriterion.Conditions> {
|
||||||
// TODO: Need to register this
|
|
||||||
public static final BOHDeathCriterion INSTANCE = new BOHDeathCriterion();
|
public static final BOHDeathCriterion INSTANCE = new BOHDeathCriterion();
|
||||||
|
|
||||||
private static final Identifier ID = new Identifier("unicopia", "death_by_bag_of_holding");
|
private static final Identifier ID = new Identifier("unicopia", "death_by_bag_of_holding");
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Random;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.EquinePredicates;
|
import com.minelittlepony.unicopia.EquinePredicates;
|
||||||
import com.minelittlepony.unicopia.USounds;
|
import com.minelittlepony.unicopia.USounds;
|
||||||
|
import com.minelittlepony.unicopia.ducks.Climbable;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
||||||
import com.minelittlepony.unicopia.util.PosHelper;
|
import com.minelittlepony.unicopia.util.PosHelper;
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ import net.minecraft.world.BlockView;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldView;
|
import net.minecraft.world.WorldView;
|
||||||
|
|
||||||
public class BlockGrowingCuccoon extends Block {
|
public class BlockGrowingCuccoon extends Block implements Climbable {
|
||||||
|
|
||||||
public static final IntProperty AGE = IntProperty.of("age", 0, 7);
|
public static final IntProperty AGE = IntProperty.of("age", 0, 7);
|
||||||
public static final EnumProperty<Shape> SHAPE = EnumProperty.of("shape", Shape.class);
|
public static final EnumProperty<Shape> SHAPE = EnumProperty.of("shape", Shape.class);
|
||||||
|
@ -229,7 +230,6 @@ public class BlockGrowingCuccoon extends Block {
|
||||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, EntityContext ePos) {
|
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, EntityContext ePos) {
|
||||||
Vec3d offset = getOffsetPos(state, view, pos);
|
Vec3d offset = getOffsetPos(state, view, pos);
|
||||||
|
|
||||||
|
|
||||||
if (state.get(SHAPE) == Shape.BULB) {
|
if (state.get(SHAPE) == Shape.BULB) {
|
||||||
return BULBS[state.get(AGE) / 2].offset(offset.x, offset.y, offset.z);
|
return BULBS[state.get(AGE) / 2].offset(offset.x, offset.y, offset.z);
|
||||||
}
|
}
|
||||||
|
@ -243,12 +243,6 @@ public class BlockGrowingCuccoon extends Block {
|
||||||
builder.add(AGE, SHAPE);
|
builder.add(AGE, SHAPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: isLadder
|
|
||||||
/*@Override
|
|
||||||
public boolean isLadder(BlockState state, BlockView world, BlockPos pos, LivingEntity entity) {
|
|
||||||
return true;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random rand) {
|
||||||
if (state.get(SHAPE) == Shape.BULB) {
|
if (state.get(SHAPE) == Shape.BULB) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class ChitinBlock extends Block {
|
||||||
);
|
);
|
||||||
setDefaultState(stateManager.getDefaultState().with(COVERING, Covering.UNCOVERED));
|
setDefaultState(stateManager.getDefaultState().with(COVERING, Covering.UNCOVERED));
|
||||||
|
|
||||||
// TODO: drops:
|
// TODO: loot table:
|
||||||
// UItems.chitin_shell x 3
|
// UItems.chitin_shell x 3
|
||||||
// setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
|
// setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class GlowingGemBlock extends TorchBlock implements Gas {
|
||||||
return CloudType.ENCHANTED;
|
return CloudType.ENCHANTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this is a loot table now
|
// TODO: loot table
|
||||||
/*@Override
|
/*@Override
|
||||||
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder context) {
|
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder context) {
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class StickBlock extends Block {
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: drops Items.STICK x1
|
// TODO: loot table Items.STICK x1
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
|
|
@ -13,6 +13,6 @@ public class SugarBlock extends FallingBlock {
|
||||||
.sounds(BlockSoundGroup.SAND)
|
.sounds(BlockSoundGroup.SAND)
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
//TODO: drops SUGAR x 9;
|
//TODO: loot table SUGAR x 9;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class TomatoPlantBlock extends CropBlock {
|
||||||
);
|
);
|
||||||
setDefaultState(getDefaultState().with(TYPE, Type.NORMAL));
|
setDefaultState(getDefaultState().with(TYPE, Type.NORMAL));
|
||||||
|
|
||||||
// TODO: drops UItems.tomato_seeds x1
|
// TODO: loot table UItems.tomato_seeds x1
|
||||||
// if mature: UItems.tomato
|
// if mature: UItems.tomato
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.minelittlepony.unicopia.block;
|
package com.minelittlepony.unicopia.block;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.TreeType;
|
||||||
import com.minelittlepony.unicopia.Unicopia;
|
import com.minelittlepony.unicopia.Unicopia;
|
||||||
import com.minelittlepony.unicopia.gas.CloudAnvilBlock;
|
import com.minelittlepony.unicopia.gas.CloudAnvilBlock;
|
||||||
import com.minelittlepony.unicopia.gas.CloudBlock;
|
import com.minelittlepony.unicopia.gas.CloudBlock;
|
||||||
|
@ -9,7 +10,6 @@ import com.minelittlepony.unicopia.gas.CloudFenceBlock;
|
||||||
import com.minelittlepony.unicopia.gas.CloudSlabBlock;
|
import com.minelittlepony.unicopia.gas.CloudSlabBlock;
|
||||||
import com.minelittlepony.unicopia.gas.CloudStairsBlock;
|
import com.minelittlepony.unicopia.gas.CloudStairsBlock;
|
||||||
import com.minelittlepony.unicopia.gas.CloudType;
|
import com.minelittlepony.unicopia.gas.CloudType;
|
||||||
import com.minelittlepony.unicopia.item.AppleItem;
|
|
||||||
import com.minelittlepony.unicopia.item.UItems;
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
import com.minelittlepony.unicopia.structure.CustomSaplingGenerator;
|
import com.minelittlepony.unicopia.structure.CustomSaplingGenerator;
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public interface UBlocks {
|
||||||
Block apple_leaves = register(new FruitLeavesBlock()
|
Block apple_leaves = register(new FruitLeavesBlock()
|
||||||
.growthChance(1200)
|
.growthChance(1200)
|
||||||
.tint(0xFFEE81)
|
.tint(0xFFEE81)
|
||||||
.fruit(AppleItem::getRandomItemStack)
|
.fruit(W -> TreeType.OAK.pickRandomStack())
|
||||||
.compost(w -> new ItemStack(UItems.rotten_apple)), "apple_leaves");
|
.compost(w -> new ItemStack(UItems.rotten_apple)), "apple_leaves");
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,12 @@ import com.minelittlepony.unicopia.Race;
|
||||||
import com.minelittlepony.unicopia.Unicopia;
|
import com.minelittlepony.unicopia.Unicopia;
|
||||||
import com.minelittlepony.unicopia.ability.Abilities;
|
import com.minelittlepony.unicopia.ability.Abilities;
|
||||||
import com.minelittlepony.unicopia.block.UBlocks;
|
import com.minelittlepony.unicopia.block.UBlocks;
|
||||||
|
import com.minelittlepony.unicopia.container.SpellbookResultSlot;
|
||||||
import com.minelittlepony.unicopia.ducks.Colourful;
|
import com.minelittlepony.unicopia.ducks.Colourful;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.item.UItems;
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
import com.minelittlepony.unicopia.magic.spell.SpellRegistry;
|
import com.minelittlepony.unicopia.magic.spell.SpellRegistry;
|
||||||
|
import com.minelittlepony.unicopia.mixin.client.DefaultTexturesRegistry;
|
||||||
import com.minelittlepony.unicopia.network.MsgRequestCapabilities;
|
import com.minelittlepony.unicopia.network.MsgRequestCapabilities;
|
||||||
import com.minelittlepony.unicopia.util.dummy.DummyClientPlayerEntity;
|
import com.minelittlepony.unicopia.util.dummy.DummyClientPlayerEntity;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
@ -28,6 +30,8 @@ import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.color.world.BiomeColors;
|
import net.minecraft.client.color.world.BiomeColors;
|
||||||
import net.minecraft.client.color.world.GrassColors;
|
import net.minecraft.client.color.world.GrassColors;
|
||||||
|
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||||
|
import net.minecraft.client.util.SpriteIdentifier;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
@ -55,11 +59,9 @@ public class UnicopiaClient extends InteractionManager implements ClientModIniti
|
||||||
InteractionManager.instance = this;
|
InteractionManager.instance = this;
|
||||||
|
|
||||||
ClientTickCallback.EVENT.register(this::tick);
|
ClientTickCallback.EVENT.register(this::tick);
|
||||||
ClientReadyCallback.EVENT.register(client -> {
|
ClientReadyCallback.EVENT.register(client -> Abilities.getInstance().getValues().forEach(keyboard::addKeybind));
|
||||||
Abilities.getInstance().getValues().forEach(keyboard::addKeybind);
|
|
||||||
});
|
|
||||||
|
|
||||||
//BuildInTexturesBakery.getBuiltInTextures().add(new Identifier(Unicopia.MODID, "items/empty_slot_gem"));
|
DefaultTexturesRegistry.getDefaultTextures().add(new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX, SpellbookResultSlot.EMPTY_GEM_SLOT));
|
||||||
|
|
||||||
ColorProviderRegistry.ITEM.register((stack, tint) -> {
|
ColorProviderRegistry.ITEM.register((stack, tint) -> {
|
||||||
return getLeavesColor(((BlockItem)stack.getItem()).getBlock().getDefaultState(), null, null, tint);
|
return getLeavesColor(((BlockItem)stack.getItem()).getBlock().getDefaultState(), null, null, tint);
|
||||||
|
@ -88,19 +90,6 @@ public class UnicopiaClient extends InteractionManager implements ClientModIniti
|
||||||
|
|
||||||
keyboard.onKeyInput();
|
keyboard.onKeyInput();
|
||||||
}
|
}
|
||||||
private static Race getclientPlayerRace() {
|
|
||||||
if (!Config.getInstance().ignoresMineLittlePony()
|
|
||||||
&& MinecraftClient.getInstance().player != null) {
|
|
||||||
Race race = MineLPConnector.getPlayerPonyRace();
|
|
||||||
|
|
||||||
if (!race.isDefault()) {
|
|
||||||
return race;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return Config.getInstance().getPrefferedRace();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@ -129,6 +118,20 @@ public class UnicopiaClient extends InteractionManager implements ClientModIniti
|
||||||
return MinecraftClient.getInstance().options.perspective;
|
return MinecraftClient.getInstance().options.perspective;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Race getclientPlayerRace() {
|
||||||
|
if (!Config.getInstance().ignoresMineLittlePony()
|
||||||
|
&& MinecraftClient.getInstance().player != null) {
|
||||||
|
Race race = MineLPConnector.getPlayerPonyRace();
|
||||||
|
|
||||||
|
if (!race.isDefault()) {
|
||||||
|
return race;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return Config.getInstance().getPrefferedRace();
|
||||||
|
}
|
||||||
|
|
||||||
private static int getLeavesColor(BlockState state, @Nullable BlockRenderView world, @Nullable BlockPos pos, int tint) {
|
private static int getLeavesColor(BlockState state, @Nullable BlockRenderView world, @Nullable BlockPos pos, int tint) {
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import net.minecraft.client.MinecraftClient;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
// TODO: forge events
|
// TODO: forge events
|
||||||
class ClientHooks {
|
class HudHooks {
|
||||||
public static void beforePreRenderHud() {
|
public static void beforePreRenderHud() {
|
||||||
MinecraftClient client = MinecraftClient.getInstance();
|
MinecraftClient client = MinecraftClient.getInstance();
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ class ClientHooks {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void postRenderHud() {
|
public static void postRenderHud() {
|
||||||
|
|
||||||
MinecraftClient client = MinecraftClient.getInstance();
|
MinecraftClient client = MinecraftClient.getInstance();
|
||||||
|
|
||||||
if (client.player != null && client.world != null) {
|
if (client.player != null && client.world != null) {
|
|
@ -73,7 +73,7 @@ public class SpellBookContainer extends Container {
|
||||||
ItemStack current = craftResult.getInvStack(0);
|
ItemStack current = craftResult.getInvStack(0);
|
||||||
|
|
||||||
if (!current.isEmpty()) {
|
if (!current.isEmpty()) {
|
||||||
// TODO: RecipeType.SPELL_BOOK
|
// TODO: URecipeType.SPELL_BOOK
|
||||||
ItemStack crafted = player.world.getRecipeManager().getFirstMatch(RecipeType.CRAFTING, craftMatrix, worldObj)
|
ItemStack crafted = player.world.getRecipeManager().getFirstMatch(RecipeType.CRAFTING, craftMatrix, worldObj)
|
||||||
.map(Recipe::getOutput)
|
.map(Recipe::getOutput)
|
||||||
.orElse(ItemStack.EMPTY);
|
.orElse(ItemStack.EMPTY);
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.minelittlepony.unicopia.ducks;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
// TODO: 1.16 Use the vanilla BlockTag once mojang adds it
|
||||||
|
public interface Climbable {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.minelittlepony.unicopia.ducks;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public interface PickedItemSupplier {
|
||||||
|
ItemStack getPickedStack();
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ import net.minecraft.entity.data.TrackedData;
|
||||||
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
||||||
import net.minecraft.entity.mob.AmbientEntity;
|
import net.minecraft.entity.mob.AmbientEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.predicate.entity.EntityPredicates;
|
||||||
import net.minecraft.sound.SoundEvent;
|
import net.minecraft.sound.SoundEvent;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -123,10 +124,9 @@ public class ButterflyEntity extends AmbientEntity {
|
||||||
if (player.isSprinting() || player.isHandSwinging || player.forwardSpeed > 0 || player.sidewaysSpeed > 0) {
|
if (player.isSprinting() || player.isHandSwinging || player.forwardSpeed > 0 || player.sidewaysSpeed > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// TODO: IMob.VISIBLE_MOB_SELECTOR
|
} else if (!EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR.test(e)) {
|
||||||
}/* else if (!IMob.VISIBLE_MOB_SELECTOR.test(e)) {
|
|
||||||
return false;
|
return false;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
return e.getVelocity().x != 0 || e.getVelocity().z != 0;
|
return e.getVelocity().x != 0 || e.getVelocity().z != 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.minelittlepony.unicopia.entity;
|
package com.minelittlepony.unicopia.entity;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.EquinePredicates;
|
import com.minelittlepony.unicopia.EquinePredicates;
|
||||||
|
import com.minelittlepony.unicopia.ducks.PickedItemSupplier;
|
||||||
import com.minelittlepony.unicopia.item.UItems;
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
|
|
||||||
import net.minecraft.container.Container;
|
import net.minecraft.container.Container;
|
||||||
|
@ -13,6 +14,7 @@ import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
||||||
import net.minecraft.entity.mob.MobEntity;
|
import net.minecraft.entity.mob.MobEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
import net.minecraft.sound.BlockSoundGroup;
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
|
@ -24,7 +26,7 @@ import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.GameRules;
|
import net.minecraft.world.GameRules;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class SpellbookEntity extends MobEntity implements NameableContainerFactory, IMagicals {
|
public class SpellbookEntity extends MobEntity implements NameableContainerFactory, IMagicals, PickedItemSupplier {
|
||||||
|
|
||||||
private static final TrackedData<Boolean> OPENED = DataTracker.registerData(SpellbookEntity.class, TrackedDataHandlerRegistry.BOOLEAN);
|
private static final TrackedData<Boolean> OPENED = DataTracker.registerData(SpellbookEntity.class, TrackedDataHandlerRegistry.BOOLEAN);
|
||||||
private static final TrackedData<Boolean> ALTERED = DataTracker.registerData(SpellbookEntity.class, TrackedDataHandlerRegistry.BOOLEAN);
|
private static final TrackedData<Boolean> ALTERED = DataTracker.registerData(SpellbookEntity.class, TrackedDataHandlerRegistry.BOOLEAN);
|
||||||
|
@ -47,6 +49,11 @@ public class SpellbookEntity extends MobEntity implements NameableContainerFacto
|
||||||
dataTracker.startTracking(ALTERED, false);
|
dataTracker.startTracking(ALTERED, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getPickedStack() {
|
||||||
|
return new ItemStack(UItems.spellbook);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPushable() {
|
public boolean isPushable() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -192,10 +199,4 @@ public class SpellbookEntity extends MobEntity implements NameableContainerFacto
|
||||||
compound.putBoolean("force_open", state);
|
compound.putBoolean("force_open", state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: getPickStack
|
|
||||||
/*@Override
|
|
||||||
public ItemStack getPickStack(HitResult target) {
|
|
||||||
return new ItemStack(UItems.spellbook);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.EquinePredicates;
|
import com.minelittlepony.unicopia.EquinePredicates;
|
||||||
import com.minelittlepony.unicopia.Race;
|
import com.minelittlepony.unicopia.Race;
|
||||||
|
import com.minelittlepony.unicopia.ducks.PickedItemSupplier;
|
||||||
import com.minelittlepony.unicopia.item.UItems;
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
import com.minelittlepony.unicopia.magic.Affinity;
|
import com.minelittlepony.unicopia.magic.Affinity;
|
||||||
import com.minelittlepony.unicopia.magic.Castable;
|
import com.minelittlepony.unicopia.magic.Castable;
|
||||||
|
@ -43,7 +44,7 @@ import net.minecraft.world.GameRules;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.explosion.Explosion.DestructionType;
|
import net.minecraft.world.explosion.Explosion.DestructionType;
|
||||||
|
|
||||||
public class SpellcastEntity extends MobEntityWithAi implements IMagicals, Caster<LivingEntity>, InAnimate {
|
public class SpellcastEntity extends MobEntityWithAi implements IMagicals, Caster<LivingEntity>, InAnimate, PickedItemSupplier {
|
||||||
|
|
||||||
private LivingEntity owner = null;
|
private LivingEntity owner = null;
|
||||||
|
|
||||||
|
@ -132,11 +133,10 @@ public class SpellcastEntity extends MobEntityWithAi implements IMagicals, Caste
|
||||||
dataTracker.startTracking(AFFINITY, Affinity.NEUTRAL.ordinal());
|
dataTracker.startTracking(AFFINITY, Affinity.NEUTRAL.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: getPickedStack
|
@Override
|
||||||
/*@Override
|
public ItemStack getPickedStack() {
|
||||||
public ItemStack getPickedStack(HitResult target) {
|
|
||||||
return SpellRegistry.instance().enchantStack(new ItemStack(getItem()), getEffect().getName());
|
return SpellRegistry.instance().enchantStack(new ItemStack(getItem()), getEffect().getName());
|
||||||
}*/
|
}
|
||||||
|
|
||||||
protected Item getItem() {
|
protected Item getItem() {
|
||||||
return getAffinity() == Affinity.BAD ? UItems.curse : UItems.spell;
|
return getAffinity() == Affinity.BAD ? UItems.curse : UItems.spell;
|
||||||
|
|
|
@ -7,7 +7,6 @@ import com.minelittlepony.unicopia.ducks.IItemEntity;
|
||||||
import com.minelittlepony.unicopia.entity.ItemEntityCapabilities;
|
import com.minelittlepony.unicopia.entity.ItemEntityCapabilities;
|
||||||
import com.minelittlepony.unicopia.toxin.Toxic;
|
import com.minelittlepony.unicopia.toxin.Toxic;
|
||||||
import com.minelittlepony.unicopia.toxin.Toxicity;
|
import com.minelittlepony.unicopia.toxin.Toxicity;
|
||||||
|
|
||||||
import net.minecraft.client.item.TooltipContext;
|
import net.minecraft.client.item.TooltipContext;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.ItemEntity;
|
import net.minecraft.entity.ItemEntity;
|
||||||
|
@ -23,44 +22,6 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
public class AppleItem extends Item implements Toxic, ItemEntityCapabilities.TickableItem {
|
public class AppleItem extends Item implements Toxic, ItemEntityCapabilities.TickableItem {
|
||||||
|
|
||||||
// TODO: Move this to a datapack
|
|
||||||
/*private static final Pool<Object, Weighted<Supplier<ItemStack>>> TYPE_VARIANT_POOL = Pool.of(PlanksBlock.Type.OAK,
|
|
||||||
PlanksBlock.Type.OAK, new Weighted<Supplier<ItemStack>>()
|
|
||||||
.put(1, () -> new ItemStack(UItems.rotten_apple))
|
|
||||||
.put(2, () -> new ItemStack(UItems.green_apple))
|
|
||||||
.put(3, () -> new ItemStack(UItems.red_apple)),
|
|
||||||
PlanksBlock.Type.SPRUCE, new Weighted<Supplier<ItemStack>>()
|
|
||||||
.put(1, () -> new ItemStack(UItems.sour_apple))
|
|
||||||
.put(2, () -> new ItemStack(UItems.green_apple))
|
|
||||||
.put(3, () -> new ItemStack(UItems.sweet_apple))
|
|
||||||
.put(4, () -> new ItemStack(UItems.rotten_apple)),
|
|
||||||
PlanksBlock.Type.BIRCH, new Weighted<Supplier<ItemStack>>()
|
|
||||||
.put(1, () -> new ItemStack(UItems.rotten_apple))
|
|
||||||
.put(2, () -> new ItemStack(UItems.sweet_apple))
|
|
||||||
.put(5, () -> new ItemStack(UItems.green_apple)),
|
|
||||||
PlanksBlock.Type.JUNGLE, new Weighted<Supplier<ItemStack>>()
|
|
||||||
.put(5, () -> new ItemStack(UItems.green_apple))
|
|
||||||
.put(2, () -> new ItemStack(UItems.sweet_apple))
|
|
||||||
.put(1, () -> new ItemStack(UItems.sour_apple)),
|
|
||||||
PlanksBlock.Type.ACACIA, new Weighted<Supplier<ItemStack>>()
|
|
||||||
.put(1, () -> new ItemStack(UItems.rotten_apple))
|
|
||||||
.put(2, () -> new ItemStack(UItems.sweet_apple))
|
|
||||||
.put(5, () -> new ItemStack(UItems.green_apple)),
|
|
||||||
PlanksBlock.Type.DARK_OAK, new Weighted<Supplier<ItemStack>>()
|
|
||||||
.put(1, () -> new ItemStack(UItems.rotten_apple))
|
|
||||||
.put(2, () -> new ItemStack(UItems.sweet_apple))
|
|
||||||
.put(5, () -> new ItemStack(UItems.zap_apple)
|
|
||||||
)
|
|
||||||
);*/
|
|
||||||
|
|
||||||
public static ItemStack getRandomItemStack(Object variant) {
|
|
||||||
return new ItemStack(UItems.VanillaOverrides.red_apple);
|
|
||||||
/*return TYPE_VARIANT_POOL.getOptional(variant)
|
|
||||||
.flatMap(Weighted::get)
|
|
||||||
.map(Supplier::get)
|
|
||||||
.orElse(ItemStack.EMPTY);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
public AppleItem(FoodComponent components) {
|
public AppleItem(FoodComponent components) {
|
||||||
super(new Item.Settings()
|
super(new Item.Settings()
|
||||||
.group(ItemGroup.FOOD)
|
.group(ItemGroup.FOOD)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import javax.annotation.Nullable;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.toxin.ToxicItem;
|
import com.minelittlepony.unicopia.toxin.ToxicItem;
|
||||||
import com.minelittlepony.unicopia.toxin.Toxicity;
|
import com.minelittlepony.unicopia.toxin.Toxicity;
|
||||||
import com.minelittlepony.unicopia.util.collection.ReversableStateMapList;
|
import com.minelittlepony.unicopia.util.collection.ReversableBlockStateMap;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -16,25 +16,24 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
import net.minecraft.sound.SoundEvents;
|
import net.minecraft.sound.SoundEvents;
|
||||||
import net.minecraft.util.UseAction;
|
import net.minecraft.util.UseAction;
|
||||||
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class MossItem extends ToxicItem {
|
public class MossItem extends ToxicItem {
|
||||||
|
|
||||||
public static final ReversableStateMapList AFFECTED = new ReversableStateMapList();
|
public static final ReversableBlockStateMap AFFECTED = Util.make(new ReversableBlockStateMap(), a -> {
|
||||||
|
|
||||||
static {
|
|
||||||
// TODO: move to resourcepack
|
// TODO: move to resourcepack
|
||||||
AFFECTED.replaceBlock(Blocks.MOSSY_COBBLESTONE, Blocks.COBBLESTONE);
|
a.replaceBlock(Blocks.MOSSY_COBBLESTONE, Blocks.COBBLESTONE);
|
||||||
AFFECTED.replaceBlock(Blocks.MOSSY_COBBLESTONE_SLAB, Blocks.COBBLESTONE_SLAB);
|
a.replaceBlock(Blocks.MOSSY_COBBLESTONE_SLAB, Blocks.COBBLESTONE_SLAB);
|
||||||
AFFECTED.replaceBlock(Blocks.MOSSY_COBBLESTONE_STAIRS, Blocks.COBBLESTONE_STAIRS);
|
a.replaceBlock(Blocks.MOSSY_COBBLESTONE_STAIRS, Blocks.COBBLESTONE_STAIRS);
|
||||||
AFFECTED.replaceBlock(Blocks.MOSSY_COBBLESTONE_WALL, Blocks.COBBLESTONE_WALL);
|
a.replaceBlock(Blocks.MOSSY_COBBLESTONE_WALL, Blocks.COBBLESTONE_WALL);
|
||||||
AFFECTED.replaceBlock(Blocks.MOSSY_STONE_BRICK_SLAB, Blocks.STONE_BRICK_SLAB);
|
a.replaceBlock(Blocks.MOSSY_STONE_BRICK_SLAB, Blocks.STONE_BRICK_SLAB);
|
||||||
AFFECTED.replaceBlock(Blocks.MOSSY_STONE_BRICK_STAIRS, Blocks.STONE_BRICK_STAIRS);
|
a.replaceBlock(Blocks.MOSSY_STONE_BRICK_STAIRS, Blocks.STONE_BRICK_STAIRS);
|
||||||
AFFECTED.replaceBlock(Blocks.MOSSY_STONE_BRICK_WALL, Blocks.MOSSY_STONE_BRICK_WALL);
|
a.replaceBlock(Blocks.MOSSY_STONE_BRICK_WALL, Blocks.MOSSY_STONE_BRICK_WALL);
|
||||||
AFFECTED.replaceBlock(Blocks.MOSSY_STONE_BRICKS, Blocks.STONE_BRICKS);
|
a.replaceBlock(Blocks.MOSSY_STONE_BRICKS, Blocks.STONE_BRICKS);
|
||||||
AFFECTED.replaceBlock(Blocks.INFESTED_MOSSY_STONE_BRICKS, Blocks.INFESTED_STONE_BRICKS);
|
a.replaceBlock(Blocks.INFESTED_MOSSY_STONE_BRICKS, Blocks.INFESTED_STONE_BRICKS);
|
||||||
}
|
});
|
||||||
|
|
||||||
public MossItem(Item.Settings settings) {
|
public MossItem(Item.Settings settings) {
|
||||||
super(settings, 2, 1, UseAction.EAT, Toxicity.FAIR);
|
super(settings, 2, 1, UseAction.EAT, Toxicity.FAIR);
|
||||||
|
|
|
@ -13,7 +13,7 @@ import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
||||||
import com.minelittlepony.unicopia.util.PosHelper;
|
import com.minelittlepony.unicopia.util.PosHelper;
|
||||||
import com.minelittlepony.unicopia.util.VecHelper;
|
import com.minelittlepony.unicopia.util.VecHelper;
|
||||||
import com.minelittlepony.unicopia.util.collection.StateMapping;
|
import com.minelittlepony.unicopia.util.collection.StateMapping;
|
||||||
import com.minelittlepony.unicopia.util.collection.StateMapList;
|
import com.minelittlepony.unicopia.util.collection.BlockStateMap;
|
||||||
import com.minelittlepony.unicopia.util.shape.Shape;
|
import com.minelittlepony.unicopia.util.shape.Shape;
|
||||||
import com.minelittlepony.unicopia.util.shape.Sphere;
|
import com.minelittlepony.unicopia.util.shape.Sphere;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
public class FireSpell extends AbstractSpell.RangedAreaSpell implements Useable, DispenceableMagicEffect {
|
public class FireSpell extends AbstractSpell.RangedAreaSpell implements Useable, DispenceableMagicEffect {
|
||||||
|
|
||||||
public final StateMapList affected = new StateMapList();
|
public final BlockStateMap affected = new BlockStateMap();
|
||||||
|
|
||||||
private static final Shape visual_effect_region = new Sphere(false, 0.5);
|
private static final Shape visual_effect_region = new Sphere(false, 0.5);
|
||||||
private static final Shape effect_range = new Sphere(false, 4);
|
private static final Shape effect_range = new Sphere(false, 4);
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
||||||
import com.minelittlepony.unicopia.util.PosHelper;
|
import com.minelittlepony.unicopia.util.PosHelper;
|
||||||
import com.minelittlepony.unicopia.util.VecHelper;
|
import com.minelittlepony.unicopia.util.VecHelper;
|
||||||
import com.minelittlepony.unicopia.util.collection.StateMapping;
|
import com.minelittlepony.unicopia.util.collection.StateMapping;
|
||||||
import com.minelittlepony.unicopia.util.collection.StateMapList;
|
import com.minelittlepony.unicopia.util.collection.BlockStateMap;
|
||||||
import com.minelittlepony.unicopia.util.shape.Shape;
|
import com.minelittlepony.unicopia.util.shape.Shape;
|
||||||
import com.minelittlepony.unicopia.util.shape.Sphere;
|
import com.minelittlepony.unicopia.util.shape.Sphere;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
public class IceSpell extends AbstractSpell.RangedAreaSpell implements Useable, DispenceableMagicEffect {
|
public class IceSpell extends AbstractSpell.RangedAreaSpell implements Useable, DispenceableMagicEffect {
|
||||||
|
|
||||||
public final StateMapList affected = new StateMapList();
|
public final BlockStateMap affected = new BlockStateMap();
|
||||||
|
|
||||||
public IceSpell() {
|
public IceSpell() {
|
||||||
affected.add(StateMapping.build(
|
affected.add(StateMapping.build(
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.minelittlepony.unicopia.magic.CastResult;
|
||||||
import com.minelittlepony.unicopia.magic.Caster;
|
import com.minelittlepony.unicopia.magic.Caster;
|
||||||
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
import com.minelittlepony.unicopia.util.MagicalDamageSource;
|
||||||
import com.minelittlepony.unicopia.util.collection.StateMapping;
|
import com.minelittlepony.unicopia.util.collection.StateMapping;
|
||||||
import com.minelittlepony.unicopia.util.collection.StateMapList;
|
import com.minelittlepony.unicopia.util.collection.BlockStateMap;
|
||||||
import com.minelittlepony.unicopia.util.shape.Shape;
|
import com.minelittlepony.unicopia.util.shape.Shape;
|
||||||
import com.minelittlepony.unicopia.util.shape.Sphere;
|
import com.minelittlepony.unicopia.util.shape.Sphere;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
public class InfernoSpell extends FireSpell {
|
public class InfernoSpell extends FireSpell {
|
||||||
|
|
||||||
public final StateMapList hellFireAffected = new StateMapList();
|
public final BlockStateMap hellFireAffected = new BlockStateMap();
|
||||||
|
|
||||||
public InfernoSpell() {
|
public InfernoSpell() {
|
||||||
hellFireAffected.add(StateMapping.build(
|
hellFireAffected.add(StateMapping.build(
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.minelittlepony.unicopia.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
import net.minecraft.advancement.criterion.Criterion;
|
||||||
|
import net.minecraft.advancement.criterion.Criterions;
|
||||||
|
|
||||||
|
@Mixin(Criterions.class)
|
||||||
|
public interface CriterionsRegistry {
|
||||||
|
@Invoker
|
||||||
|
static <T extends Criterion<?>> T register(T object) {
|
||||||
|
throw new NullPointerException("mixin y u fail");
|
||||||
|
}
|
||||||
|
}
|
|
@ -67,4 +67,14 @@ public abstract class MixinLivingEntity extends Entity implements PonyContainer<
|
||||||
private static void clinit(CallbackInfo info) {
|
private static void clinit(CallbackInfo info) {
|
||||||
LivingEntityCapabilities.boostrap();
|
LivingEntityCapabilities.boostrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------- temporary
|
||||||
|
@Inject(method = "isClimbing()Z", at = @At("HEAD"), cancellable = true)
|
||||||
|
public void onIsClimbing(CallbackInfoReturnable<Boolean> info) {
|
||||||
|
LivingEntity self = (LivingEntity)(Object)this;
|
||||||
|
|
||||||
|
if (!self.isSpectator() && self.getBlockState().getBlock() instanceof com.minelittlepony.unicopia.ducks.Climbable) {
|
||||||
|
info.setReturnValue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.minelittlepony.unicopia.mixin.client;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
import net.minecraft.client.render.model.ModelLoader;
|
||||||
|
import net.minecraft.client.util.SpriteIdentifier;
|
||||||
|
|
||||||
|
@Mixin(ModelLoader.class)
|
||||||
|
public interface DefaultTexturesRegistry {
|
||||||
|
@Accessor("DEFAULT_TEXTURES")
|
||||||
|
static Set<SpriteIdentifier> getDefaultTextures() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.minelittlepony.unicopia.mixin.client;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.ducks.PickedItemSupplier;
|
||||||
|
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.SpawnEggItem;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.hit.EntityHitResult;
|
||||||
|
|
||||||
|
@Mixin(MinecraftClient.class)
|
||||||
|
public class MixinMinecraftClient {
|
||||||
|
@Redirect(method = "doItemPick()V", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/item/SpawnEggItem;forEntity(Lnet/minecraft/entity/EntityType;)Lnet/minecraft/item/SpawnEggItem;"))
|
||||||
|
private SpawnEggItem redirectSpawnEggForEntity(EntityType<?> type) {
|
||||||
|
|
||||||
|
MinecraftClient self = MinecraftClient.getInstance();
|
||||||
|
|
||||||
|
Entity entity = ((EntityHitResult)self.crosshairTarget).getEntity();
|
||||||
|
|
||||||
|
if (!(entity instanceof PickedItemSupplier)) {
|
||||||
|
return SpawnEggItem.forEntity(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack pickedStack = ((PickedItemSupplier) entity).getPickedStack();
|
||||||
|
|
||||||
|
PlayerInventory inventory = self.player.inventory;
|
||||||
|
|
||||||
|
int i = inventory.getSlotWithStack(pickedStack);
|
||||||
|
|
||||||
|
if (self.player.abilities.creativeMode) {
|
||||||
|
inventory.addPickBlock(pickedStack);
|
||||||
|
self.interactionManager.clickCreativeStack(self.player.getStackInHand(Hand.MAIN_HAND), 36 + inventory.selectedSlot);
|
||||||
|
} else if (i != -1) {
|
||||||
|
if (PlayerInventory.isValidHotbarIndex(i)) {
|
||||||
|
inventory.selectedSlot = i;
|
||||||
|
} else {
|
||||||
|
self.interactionManager.pickFromInventory(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,7 +14,7 @@ import net.minecraft.state.property.Property;
|
||||||
* A collection of block-state mappings.
|
* A collection of block-state mappings.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class StateMapList extends ArrayList<StateMapping> {
|
public class BlockStateMap extends ArrayList<StateMapping> {
|
||||||
private static final long serialVersionUID = 2602772651960588745L;
|
private static final long serialVersionUID = 2602772651960588745L;
|
||||||
|
|
||||||
public void removeBlock(Predicate<BlockState> mapper) {
|
public void removeBlock(Predicate<BlockState> mapper) {
|
|
@ -1,44 +0,0 @@
|
||||||
package com.minelittlepony.unicopia.util.collection;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class Pool<K, V> extends HashMap<K, V> {
|
|
||||||
private static final long serialVersionUID = -4794854344664655790L;
|
|
||||||
|
|
||||||
private final K defaultKey;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static <K, V> Pool<K, V> of(K def, Object...entries) {
|
|
||||||
Pool<K, V> result = new Pool<>(def);
|
|
||||||
|
|
||||||
for (int i = 0; i < entries.length - 1; i += 2) {
|
|
||||||
result.put((K)entries[i], (V)entries[i + 1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Pool(K defKey) {
|
|
||||||
defaultKey = defKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Pool<K, V> add(K key, V value) {
|
|
||||||
put(key, value);
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public V get(Object key) {
|
|
||||||
if (key == null || !containsKey(key)) {
|
|
||||||
key = defaultKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Optional<V> getOptional(K key) {
|
|
||||||
return Optional.ofNullable(get(key));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +1,11 @@
|
||||||
package com.minelittlepony.unicopia.util.collection;
|
package com.minelittlepony.unicopia.util.collection;
|
||||||
|
|
||||||
public class ReversableStateMapList extends StateMapList {
|
public class ReversableBlockStateMap extends BlockStateMap {
|
||||||
private static final long serialVersionUID = 6154365988455383098L;
|
private static final long serialVersionUID = 6154365988455383098L;
|
||||||
|
|
||||||
private final StateMapList inverse = new StateMapList();
|
private final BlockStateMap inverse = new BlockStateMap();
|
||||||
|
|
||||||
public StateMapList getInverse() {
|
public BlockStateMap getInverse() {
|
||||||
return inverse;
|
return inverse;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue