Commit 199feec2 authored by mrAppleXZ's avatar mrAppleXZ 💾

Code Storage now use the new ASM, recipes work

parent 0bde2132
......@@ -46,7 +46,7 @@ public class TESRCodeStorage extends PXLFastTESR<TileCodeStorage>
//top
GlStateManager.pushMatrix();
String state = te.anim.getState();
String state = te.anim.getElement("head").getState();
if(!state.equals("closed"))
{
resetTrans(te);
......@@ -66,7 +66,7 @@ public class TESRCodeStorage extends PXLFastTESR<TileCodeStorage>
if(degrees >= 90)
{
degrees = 90;
te.anim.changeState(state.equals("opening") ? "opened" : "closed");
te.anim.changeState("head", state.equals("opening") ? "opened" : "closed");
te.anim_data.startedOpeningAnim = false;
}
GlStateManager.rotate(state.equals("opening") ? degrees : 90 - degrees, 1, 0, 0);
......
package ru.pearx.purmag.common.blocks.multiblock;
import net.minecraft.block.BlockAnvil;
import net.minecraft.block.BlockLever;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import ru.pearx.lib.collections.CollectionUtils;
import ru.pearx.libmc.common.blocks.BlockMultiblockPart;
import ru.pearx.libmc.common.blocks.controllers.AxisController;
import ru.pearx.libmc.common.structure.blockarray.BlockArray;
import ru.pearx.libmc.common.structure.blockarray.BlockArrayEntry;
import ru.pearx.purmag.common.Utils;
import ru.pearx.purmag.common.blocks.BlockRegistry;
import ru.pearx.purmag.common.blocks.BlockRopeCoil;
import ru.pearx.purmag.common.items.ItemRegistry;
import ru.pearx.purmag.common.tiles.TileStoneCrusher;
/*
......@@ -26,4 +43,43 @@ public class BlockStoneCrusher extends BlockMultiblockPart
{
return new TileStoneCrusher();
}
public static class Multiblock extends PMMultiblock
{
public BlockPos lever = new BlockPos(2, 0, 0);
public BlockPos handle = new BlockPos(1, 0, 1);
public Multiblock()
{
setTier(0);
setMasterPos(new BlockPos(1, 0, 0));
setMasterState(BlockRegistry.stone_crusher.getDefaultState());
setItemModel(new ModelResourceLocation(Utils.gRL("stone_crusher"), "normal"));
setRegistryName(Utils.gRL("stone_crusher"));
BlockArray arr = new BlockArray();
BlockArrayEntry rope = new BlockArrayEntry(BlockRegistry.rope_coil.getDefaultState().withProperty(AxisController.AXIS, EnumFacing.Axis.Z), new ItemStack(ItemRegistry.rope_coil));
BlockArrayEntry rope_cog = new BlockArrayEntry(BlockRegistry.rope_coil.getDefaultState().withProperty(AxisController.AXIS, EnumFacing.Axis.Z).withProperty(BlockRopeCoil.TYPE, BlockRopeCoil.Type.COG), new ItemStack(ItemRegistry.rope_coil, 1, 1));
arr.getCheckers().add((BlockArrayEntry entr, IBlockState state, IBlockState worldState, World w, BlockPos pos, Rotation rot) ->
{
for(IProperty<?> prop : state.getPropertyKeys())
{
if(prop == BlockAnvil.DAMAGE || prop == BlockRopeCoil.TYPE)
return state.getValue(prop).equals(worldState.getValue(prop));
}
return true;
});
arr.getMap().putAll(CollectionUtils.createMap(BlockPos.class, BlockArrayEntry.class,
new BlockPos(0, 0, 0), new BlockArrayEntry(Blocks.ANVIL, new ItemStack(Blocks.ANVIL)),
new BlockPos(0, 2, 0), rope,
new BlockPos(1, 2, 0), rope,
new BlockPos(1, 0, 0), rope_cog,
lever, new BlockArrayEntry(Blocks.LEVER.getDefaultState().withProperty(BlockLever.FACING, BlockLever.EnumOrientation.UP_X).withProperty(BlockLever.POWERED, true), new ItemStack(Blocks.LEVER)),
handle, new BlockArrayEntry(Blocks.LEVER.getDefaultState().withProperty(BlockLever.FACING, BlockLever.EnumOrientation.SOUTH), new ItemStack(Blocks.LEVER))
));
setStructure(arr);
}
}
}
package ru.pearx.purmag.common.blocks.multiblock;
import net.minecraft.block.BlockAnvil;
import net.minecraft.block.BlockLever;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import ru.pearx.lib.collections.CollectionUtils;
import ru.pearx.libmc.common.blocks.controllers.AxisController;
import ru.pearx.libmc.common.structure.blockarray.BlockArray;
import ru.pearx.libmc.common.structure.blockarray.BlockArrayEntry;
import ru.pearx.libmc.common.structure.multiblock.Multiblock;
import ru.pearx.purmag.common.Utils;
import ru.pearx.purmag.common.blocks.BlockRegistry;
import ru.pearx.purmag.common.blocks.BlockRopeCoil;
import ru.pearx.purmag.common.items.ItemRegistry;
/*
* Created by mrAppleXZ on 14.11.17 15:49.
*/
public final class MultiblockRegistry
{
public static PMMultiblock STONE_CRUSHER;
public static BlockStoneCrusher.Multiblock STONE_CRUSHER;
public static void setup()
{
{
BlockArray arr = new BlockArray();
BlockArrayEntry rope = new BlockArrayEntry(BlockRegistry.rope_coil.getDefaultState().withProperty(AxisController.AXIS, EnumFacing.Axis.Z), new ItemStack(ItemRegistry.rope_coil));
BlockArrayEntry rope_cog = new BlockArrayEntry(BlockRegistry.rope_coil.getDefaultState().withProperty(AxisController.AXIS, EnumFacing.Axis.Z).withProperty(BlockRopeCoil.TYPE, BlockRopeCoil.Type.COG), new ItemStack(ItemRegistry.rope_coil, 1, 1));
arr.getCheckers().add((BlockArrayEntry entr, IBlockState state, IBlockState worldState, World w, BlockPos pos, Rotation rot) ->
{
for(IProperty<?> prop : state.getPropertyKeys())
{
if(prop == BlockAnvil.DAMAGE || prop == BlockRopeCoil.TYPE)
return state.getValue(prop).equals(worldState.getValue(prop));
}
return true;
});
arr.getMap().putAll(CollectionUtils.createMap(BlockPos.class, BlockArrayEntry.class,
new BlockPos(0, 0, 0), new BlockArrayEntry(Blocks.ANVIL, new ItemStack(Blocks.ANVIL)),
new BlockPos(0, 2, 0), rope,
new BlockPos(1, 2, 0), rope,
new BlockPos(1, 0, 0), rope_cog,
new BlockPos(2, 0, 0), new BlockArrayEntry(Blocks.LEVER.getDefaultState().withProperty(BlockLever.FACING, BlockLever.EnumOrientation.UP_X).withProperty(BlockLever.POWERED, true), new ItemStack(Blocks.LEVER)),
new BlockPos(1, 0, 1), new BlockArrayEntry(Blocks.LEVER.getDefaultState().withProperty(BlockLever.FACING, BlockLever.EnumOrientation.SOUTH), new ItemStack(Blocks.LEVER))
));
Multiblock.REGISTRY.register(STONE_CRUSHER = new PMMultiblock(0, arr, new BlockPos(1, 0, 0), BlockRegistry.stone_crusher.getDefaultState(), new ModelResourceLocation(Utils.gRL("stone_crusher"), "normal"), Utils.gRL("stone_crusher")));
}
Multiblock.REGISTRY.register(STONE_CRUSHER = new BlockStoneCrusher.Multiblock());
}
}
......@@ -24,18 +24,6 @@ public class PMMultiblock extends Multiblock
{
private int tier;
public PMMultiblock(int requiredTier, BlockArray structure, BlockPos masterPos, IBlockState masterState, ModelResourceLocation itemModel, ResourceLocation regName)
{
super(structure, masterPos, masterState, itemModel, PMCreativeTab.INSTANCE);
setTier(requiredTier);
setRegistryName(regName);
}
public PMMultiblock()
{
super();
}
public int getTier()
{
return tier;
......
......@@ -19,8 +19,8 @@ import ru.pearx.purmag.common.compat.jei.magibench.MagibenchRecipeCategory;
import ru.pearx.purmag.common.compat.jei.magibench.MagibenchShapedRecipeWrapper;
import ru.pearx.purmag.common.compat.jei.magibench.MagibenchShapelessRecipeWrapper;
import ru.pearx.purmag.common.magibench.MagibenchRegistry;
import ru.pearx.purmag.common.recipes.recipes.MagibenchRecipe;
import ru.pearx.purmag.common.recipes.recipes.MagibenchShapelessRecipe;
import ru.pearx.purmag.common.recipes.magibench.MagibenchRecipe;
import ru.pearx.purmag.common.recipes.magibench.MagibenchShapelessRecipe;
import java.util.ArrayList;
import java.util.List;
......
......@@ -15,7 +15,7 @@ import ru.pearx.purmag.PurMag;
import ru.pearx.purmag.common.CapabilityRegistry;
import ru.pearx.purmag.common.Utils;
import ru.pearx.purmag.common.magibench.MagibenchRegistry;
import ru.pearx.purmag.common.recipes.recipes.AbstractMagibenchRecipe;
import ru.pearx.purmag.common.recipes.magibench.AbstractMagibenchRecipe;
import javax.annotation.Nullable;
import java.util.Arrays;
......
......@@ -2,7 +2,7 @@ package ru.pearx.purmag.common.compat.jei.magibench;
import mezz.jei.api.recipe.IStackHelper;
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
import ru.pearx.purmag.common.recipes.recipes.MagibenchRecipe;
import ru.pearx.purmag.common.recipes.magibench.MagibenchRecipe;
/*
* Created by mrAppleXZ on 01.11.17 22:40.
......
package ru.pearx.purmag.common.compat.jei.magibench;
import mezz.jei.api.recipe.IStackHelper;
import ru.pearx.purmag.common.recipes.recipes.MagibenchShapelessRecipe;
import ru.pearx.purmag.common.recipes.magibench.MagibenchShapelessRecipe;
/*
* Created by mrAppleXZ on 02.11.17 17:33.
......
......@@ -265,7 +265,7 @@ public class IfRegistry
{false, true, true, true, false},
})),
0));
attachEntry("exploration", new IfEntryLocation("flame_crystal", 3, 4));
attachEntry("exploration", new IfEntryLocation("flame_crystal", 3, 5));
registerEntry(new IfEntry(
"rock_crystal", 0,
......
......@@ -15,8 +15,8 @@ import ru.pearx.purmag.PurMag;
import ru.pearx.purmag.common.Utils;
import ru.pearx.purmag.common.items.ItemRegistry;
import ru.pearx.purmag.common.recipes.ingredients.IngredientNBT;
import ru.pearx.purmag.common.recipes.recipes.MagibenchRecipe;
import ru.pearx.purmag.common.recipes.recipes.MagibenchShapelessRecipe;
import ru.pearx.purmag.common.recipes.magibench.MagibenchRecipe;
import ru.pearx.purmag.common.recipes.magibench.MagibenchShapelessRecipe;
import ru.pearx.purmag.common.sip.SipUtils;
/*
......
package ru.pearx.purmag.common.recipes.crushing;
/*
* Created by mrAppleXZ on 17.12.17 22:14.
*/
public class CrushingRecipe
{
}
package ru.pearx.purmag.common.recipes.crushing;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.Ingredient;
/*
* Created by mrAppleXZ on 15.02.18 13:27.
*/
public interface ICrushingRecipe
{
Ingredient getInput();
ItemStack getOutput();
default boolean isInputMatches(ItemStack stack)
{
return getInput().apply(stack);
}
default ItemStack newOutput()
{
return getOutput().copy();
}
}
package ru.pearx.purmag.common.recipes.recipes;
package ru.pearx.purmag.common.recipes.magibench;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.crafting.IRecipe;
......
package ru.pearx.purmag.common.recipes.recipes;
package ru.pearx.purmag.common.recipes.magibench;
import net.minecraft.block.Block;
import net.minecraft.inventory.InventoryCrafting;
......
package ru.pearx.purmag.common.recipes.recipes;
package ru.pearx.purmag.common.recipes.magibench;
import net.minecraft.block.Block;
import net.minecraft.inventory.InventoryCrafting;
......
......@@ -15,6 +15,7 @@ import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.ItemStackHandler;
import ru.pearx.lib.HashingUtils;
import ru.pearx.libmc.common.PXLCapabilities;
import ru.pearx.libmc.common.animation.AnimationElement;
import ru.pearx.libmc.common.animation.AnimationStateManager;
import ru.pearx.libmc.common.tiles.TileSyncable;
import ru.pearx.purmag.common.SoundRegistry;
......@@ -63,7 +64,7 @@ public class TileCodeStorage extends TileSyncable
}
};
public AnimationStateManager anim = new AnimationStateManager(this, "closed", "closed", "closing", "opened", "opening");
public AnimationStateManager anim = new AnimationStateManager(this, new AnimationElement("head", "closed", "closed", "closing", "opened", "opening"));
@SideOnly(Side.CLIENT)
public ClientAnimData anim_data;
......@@ -136,9 +137,9 @@ public class TileCodeStorage extends TileSyncable
if(!world.isRemote)
getWorld().playSound(null, getPos(), SoundRegistry.CODE_STORAGE_OPEN, SoundCategory.BLOCKS, 1, 1);
if(opened)
anim.changeState("opening");
anim.changeState("head", "opening");
else
anim.changeState("closing");
anim.changeState("head", "closing");
}
this.opened = opened;
}
......
package ru.pearx.purmag.common.tiles;
import net.minecraft.util.math.BlockPos;
import ru.pearx.libmc.common.structure.multiblock.IMultiblockPart;
import ru.pearx.libmc.common.structure.multiblock.events.MultiblockActivatedEvent;
import ru.pearx.libmc.common.tiles.TileMultiblockMaster;
import ru.pearx.purmag.common.blocks.multiblock.MultiblockRegistry;
/*
* Created by mrAppleXZ on 16.11.17 20:31.
*/
public class TileStoneCrusher extends TileMultiblockMaster
{
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment