Implement an inverted MRS that requires an RS signal to function (#1022)

(cherry picked from commit ddb7542)
This commit is contained in:
Nicholas Ignoffo 2017-02-13 19:35:14 -08:00
parent 64bc427c1c
commit 72c321acb0
8 changed files with 38 additions and 10 deletions

View file

@ -60,7 +60,7 @@ public class BlockRitualController extends BlockEnum<EnumRitualController> imple
ItemStack heldItem = player.getHeldItem(hand); ItemStack heldItem = player.getHeldItem(hand);
TileEntity tile = world.getTileEntity(pos); TileEntity tile = world.getTileEntity(pos);
if (getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone) if (state.getValue(getProperty()) != EnumRitualController.IMPERFECT && tile instanceof TileMasterRitualStone)
{ {
if (heldItem.getItem() == ModItems.ACTIVATION_CRYSTAL) if (heldItem.getItem() == ModItems.ACTIVATION_CRYSTAL)
{ {
@ -73,13 +73,15 @@ public class BlockRitualController extends BlockEnum<EnumRitualController> imple
if (((TileMasterRitualStone) tile).activateRitual(heldItem, player, RitualRegistry.getRitualForId(key))) if (((TileMasterRitualStone) tile).activateRitual(heldItem, player, RitualRegistry.getRitualForId(key)))
{ {
((TileMasterRitualStone) tile).setDirection(direction); ((TileMasterRitualStone) tile).setDirection(direction);
if (state.getValue(getProperty()) == EnumRitualController.INVERTED)
((TileMasterRitualStone) tile).setInverted(true);
} }
} else } else
{ {
ChatUtil.sendNoSpamUnloc(player, "chat.bloodmagic.ritual.notValid"); ChatUtil.sendNoSpamUnloc(player, "chat.bloodmagic.ritual.notValid");
} }
} }
} else if (getMetaFromState(state) == 1 && tile instanceof TileImperfectRitualStone) } else if (state.getValue(getProperty()) == EnumRitualController.IMPERFECT && tile instanceof TileImperfectRitualStone)
{ {
IBlockState determinerState = world.getBlockState(pos.up()); IBlockState determinerState = world.getBlockState(pos.up());
@ -110,13 +112,15 @@ public class BlockRitualController extends BlockEnum<EnumRitualController> imple
} }
@Override @Override
public boolean hasTileEntity(IBlockState state) { public boolean hasTileEntity(IBlockState state)
{
return true; return true;
} }
@Override @Override
public TileEntity createTileEntity(World world, IBlockState state) { public TileEntity createTileEntity(World world, IBlockState state)
return state.getValue(getProperty()) == EnumRitualController.MASTER ? new TileMasterRitualStone() : new TileImperfectRitualStone(); {
return state.getValue(getProperty()) != EnumRitualController.IMPERFECT ? new TileMasterRitualStone() : new TileImperfectRitualStone();
} }
// IVariantProvider // IVariantProvider

View file

@ -7,7 +7,9 @@ import net.minecraft.util.IStringSerializable;
public enum EnumRitualController implements IStringSerializable public enum EnumRitualController implements IStringSerializable
{ {
MASTER, MASTER,
IMPERFECT; IMPERFECT,
INVERTED,
;
@Override @Override
public String toString() public String toString()

View file

@ -47,7 +47,9 @@ public class DataProviderRitualController implements IWailaDataProvider
{ {
if (accessor.getBlock() instanceof BlockRitualController) if (accessor.getBlock() instanceof BlockRitualController)
{ {
if (accessor.getBlock().getMetaFromState(accessor.getBlockState()) == 0 && accessor.getTileEntity() instanceof TileMasterRitualStone) int controllerMeta = accessor.getBlock().getMetaFromState(accessor.getBlockState());
if ((controllerMeta == 0 || controllerMeta == 2) && accessor.getTileEntity() instanceof TileMasterRitualStone)
{ {
TileMasterRitualStone mrs = (TileMasterRitualStone) accessor.getTileEntity(); TileMasterRitualStone mrs = (TileMasterRitualStone) accessor.getTileEntity();
@ -63,7 +65,7 @@ public class DataProviderRitualController implements IWailaDataProvider
} }
} }
if (accessor.getBlock().getMetaFromState(accessor.getBlockState()) == 1 && accessor.getTileEntity() instanceof TileImperfectRitualStone) if (controllerMeta == 1 && accessor.getTileEntity() instanceof TileImperfectRitualStone)
{ {
if (accessor.getWorld().isAirBlock(accessor.getPosition().up())) if (accessor.getWorld().isAirBlock(accessor.getPosition().up()))
{ {

View file

@ -150,6 +150,8 @@ public class ModRecipes
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.RITUAL_STONE, 4), "aba", "bcb", "aba", 'a', Blocks.OBSIDIAN, 'b', new ItemStack(ModItems.SLATE, 1, 1), 'c', OrbRegistry.getOrbStack(ModItems.ORB_APPRENTICE))); GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.RITUAL_STONE, 4), "aba", "bcb", "aba", 'a', Blocks.OBSIDIAN, 'b', new ItemStack(ModItems.SLATE, 1, 1), 'c', OrbRegistry.getOrbStack(ModItems.ORB_APPRENTICE)));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.RITUAL_CONTROLLER), "aba", "bcb", "aba", 'a', Blocks.OBSIDIAN, 'b', ModBlocks.RITUAL_STONE, 'c', OrbRegistry.getOrbStack(ModItems.ORB_MAGICIAN))); GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.RITUAL_CONTROLLER), "aba", "bcb", "aba", 'a', Blocks.OBSIDIAN, 'b', ModBlocks.RITUAL_STONE, 'c', OrbRegistry.getOrbStack(ModItems.ORB_MAGICIAN)));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.RITUAL_CONTROLLER, 1, 1), "aba", "bcb", "aba", 'a', Blocks.OBSIDIAN, 'b', "stone", 'c', OrbRegistry.getOrbStack(ModItems.ORB_WEAK))); GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.RITUAL_CONTROLLER, 1, 1), "aba", "bcb", "aba", 'a', Blocks.OBSIDIAN, 'b', "stone", 'c', OrbRegistry.getOrbStack(ModItems.ORB_WEAK)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.RITUAL_CONTROLLER, 1, 2), new ItemStack(ModBlocks.RITUAL_CONTROLLER), new ItemStack(Blocks.REDSTONE_TORCH), new ItemStack(ModItems.SLATE)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.RITUAL_CONTROLLER), new ItemStack(ModBlocks.RITUAL_CONTROLLER, 1, 2)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.BASE_ITEM_FILTER, 1, 0), "sgs", "gfg", "sgs", 'f', ItemComponent.getStack(ItemComponent.COMPONENT_FRAME_PART), 'g', "blockGlass", 's', "stickWood")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.BASE_ITEM_FILTER, 1, 0), "sgs", "gfg", "sgs", 'f', ItemComponent.getStack(ItemComponent.COMPONENT_FRAME_PART), 'g', "blockGlass", 's', "stickWood"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.BASE_ITEM_FILTER, 1, 1), "sgs", "gfg", "sgs", 'f', ItemComponent.getStack(ItemComponent.COMPONENT_FRAME_PART), 'g', "dyeYellow", 's', "stickWood")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.BASE_ITEM_FILTER, 1, 1), "sgs", "gfg", "sgs", 'f', ItemComponent.getStack(ItemComponent.COMPONENT_FRAME_PART), 'g', "dyeYellow", 's', "stickWood"));

View file

@ -46,6 +46,8 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
private Ritual currentRitual; private Ritual currentRitual;
@Setter @Setter
private EnumFacing direction = EnumFacing.NORTH; private EnumFacing direction = EnumFacing.NORTH;
@Setter
private boolean inverted;
private List<EnumDemonWillType> currentActiveWillConfig = new ArrayList<EnumDemonWillType>(); private List<EnumDemonWillType> currentActiveWillConfig = new ArrayList<EnumDemonWillType>();
@ -55,7 +57,7 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
if (getWorld().isRemote) if (getWorld().isRemote)
return; return;
if (getWorld().isBlockPowered(getPos()) && isActive()) if (isPowered() && isActive())
{ {
active = false; active = false;
redstoned = true; redstoned = true;
@ -63,7 +65,7 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
return; return;
} }
if (!isActive() && !getWorld().isBlockPowered(getPos()) && isRedstoned() && getCurrentRitual() != null) if (!isActive() && !isPowered() && isRedstoned() && getCurrentRitual() != null)
{ {
active = true; active = true;
ItemStack crystalStack = NBTHelper.checkNBT(new ItemStack(ModItems.ACTIVATION_CRYSTAL, 1, getCurrentRitual().getCrystalLevel())); ItemStack crystalStack = NBTHelper.checkNBT(new ItemStack(ModItems.ACTIVATION_CRYSTAL, 1, getCurrentRitual().getCrystalLevel()));
@ -405,4 +407,12 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
ChatUtil.sendNoSpam(player, new TextComponentTranslation("ritual.bloodmagic.willConfig.void")); ChatUtil.sendNoSpam(player, new TextComponentTranslation("ritual.bloodmagic.willConfig.void"));
} }
} }
public boolean isPowered()
{
if (inverted)
return !getWorld().isBlockPowered(getPos());
return getWorld().isBlockPowered(getPos());
}
} }

View file

@ -16,6 +16,11 @@
"textures": { "textures": {
"all": "bloodmagic:blocks/ImperfectRitualStone" "all": "bloodmagic:blocks/ImperfectRitualStone"
} }
},
"inverted": {
"textures": {
"all": "bloodmagic:blocks/MasterRitualStone_Inverted"
}
} }
} }
} }

View file

@ -198,6 +198,7 @@ tile.bloodmagic.fluid.lifeEssence.name=Life Essence
tile.bloodmagic.stone.ritual.master.name=Master Ritual Stone tile.bloodmagic.stone.ritual.master.name=Master Ritual Stone
tile.bloodmagic.stone.ritual.imperfect.name=Imperfect Ritual Stone tile.bloodmagic.stone.ritual.imperfect.name=Imperfect Ritual Stone
tile.bloodmagic.stone.ritual.inverted.name=Inverted Master Ritual Stone
tile.bloodmagic.altar.name=Blood Altar tile.bloodmagic.altar.name=Blood Altar
tile.bloodmagic.alchemyArray.name=&r&fAlchemy Array tile.bloodmagic.alchemyArray.name=&r&fAlchemy Array
@ -511,6 +512,8 @@ tooltip.bloodmagic.livingArmour.upgrade.meleeDecrease=Dulled Blade
tooltip.bloodmagic.livingArmour.upgrade.digSlowdown=Weakened Pick tooltip.bloodmagic.livingArmour.upgrade.digSlowdown=Weakened Pick
tooltip.bloodmagic.livingArmour.upgrade.stormTrooper=Storm Trooper tooltip.bloodmagic.livingArmour.upgrade.stormTrooper=Storm Trooper
tooltip.bloodmagic.livingArmour.upgrade.slowHeal=Diseased tooltip.bloodmagic.livingArmour.upgrade.slowHeal=Diseased
tooltip.bloodmagic.livingArmour.upgrade.disoriented=Disoriented
tooltip.bloodmagic.livingArmour.upgrade.level=%s (Level %d) tooltip.bloodmagic.livingArmour.upgrade.level=%s (Level %d)
tooltip.bloodmagic.livingArmour.upgrade.progress=%s (%d/100) tooltip.bloodmagic.livingArmour.upgrade.progress=%s (%d/100)
tooltip.bloodmagic.livingArmour.upgrade.points=&6Upgrade points: %s / %s tooltip.bloodmagic.livingArmour.upgrade.points=&6Upgrade points: %s / %s

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B