mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-13 16:54:06 +00:00
Basic infrastructure for Red String.
This commit is contained in:
1 parent
dfbfb9f7f4
commit
9e140aa677
16 files changed
+188
No files matched your search
@@ -70,6 +70,7 @@ import vazkii.botania.common.block.decor.stairs.prismarine.BlockPrismarineBrickS
|
||||
import vazkii.botania.common.block.decor.stairs.prismarine.BlockPrismarineStairs;
|
||||
import vazkii.botania.common.block.dispenser.BehaviourSeeds;
|
||||
import vazkii.botania.common.block.dispenser.BehaviourWand;
|
||||
import vazkii.botania.common.block.string.BlockRedStringContainer;
|
||||
import vazkii.botania.common.block.subtile.SubTileManastar;
|
||||
import vazkii.botania.common.block.subtile.SubTilePureDaisy;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileAgricarnation;
|
||||
@@ -128,6 +129,7 @@ import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
import vazkii.botania.common.block.tile.mana.TileRFGenerator;
|
||||
import vazkii.botania.common.block.tile.mana.TileSpreader;
|
||||
import vazkii.botania.common.block.tile.mana.TileTurntable;
|
||||
import vazkii.botania.common.block.tile.string.TileRedStringContainer;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
@@ -182,6 +184,7 @@ public final class ModBlocks {
|
||||
public static Block brewery;
|
||||
public static Block manaGlass;
|
||||
public static Block terraPlate;
|
||||
public static Block redStringContainer;
|
||||
|
||||
public static Block livingwoodStairs;
|
||||
public static Block livingwoodSlab;
|
||||
@@ -304,6 +307,7 @@ public final class ModBlocks {
|
||||
brewery = new BlockBrewery();
|
||||
manaGlass = new BlockManaGlass();
|
||||
terraPlate = new BlockTerraPlate();
|
||||
redStringContainer = new BlockRedStringContainer();
|
||||
|
||||
livingwoodStairs = new BlockLivingwoodStairs();
|
||||
livingwoodSlab = new BlockLivingwoodSlab(false);
|
||||
@@ -484,6 +488,7 @@ public final class ModBlocks {
|
||||
registerTile(TileRFGenerator.class, LibBlockNames.RF_GENERATOR);
|
||||
registerTile(TileBrewery.class, LibBlockNames.BREWERY);
|
||||
registerTile(TileTerraPlate.class, LibBlockNames.TERRA_PLATE);
|
||||
registerTile(TileRedStringContainer.class, LibBlockNames.RED_STRING_CONTAINER);
|
||||
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_PUREDAISY, SubTilePureDaisy.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_MANASTAR, SubTileManastar.class);
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Nov 14, 2014, 4:43:14 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block.string;
|
||||
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.block.BlockModContainer;
|
||||
import vazkii.botania.common.block.tile.mana.TileSpreader;
|
||||
import vazkii.botania.common.block.tile.string.TileRedString;
|
||||
|
||||
public abstract class BlockRedString extends BlockModContainer<TileRedString> {
|
||||
|
||||
IIcon senderIcon;
|
||||
IIcon sideIcon;
|
||||
|
||||
public BlockRedString(String name) {
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(10.0F);
|
||||
setStepSound(soundTypeStone);
|
||||
setBlockName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {
|
||||
int orientation = BlockPistonBase.determineOrientation(par1World, par2, par3, par4, par5EntityLivingBase);
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, orientation, 1 | 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
senderIcon = IconHelper.forName(par1IconRegister, "redStringSender");
|
||||
sideIcon = registerSideIcon(par1IconRegister);
|
||||
}
|
||||
|
||||
public IIcon registerSideIcon(IIconRegister register) {
|
||||
return IconHelper.forBlock(register, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return side == meta ? senderIcon : sideIcon;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Nov 14, 2014, 5:29:56 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block.string;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.common.block.tile.string.TileRedString;
|
||||
import vazkii.botania.common.block.tile.string.TileRedStringContainer;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockRedStringContainer extends BlockRedString {
|
||||
|
||||
public BlockRedStringContainer() {
|
||||
super(LibBlockNames.RED_STRING_CONTAINER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileRedString createNewTileEntity(World world, int meta) {
|
||||
return new TileRedStringContainer();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Nov 14, 2014, 5:04:22 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block.tile.string;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import vazkii.botania.api.wand.ITileBound;
|
||||
import vazkii.botania.common.block.tile.TileMod;
|
||||
|
||||
public abstract class TileRedString extends TileMod implements ITileBound {
|
||||
|
||||
private ChunkCoordinates binding;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(getBlockMetadata());
|
||||
int x = xCoord;
|
||||
int y = yCoord;
|
||||
int z = zCoord;
|
||||
int range = getRange();
|
||||
for(int i = 0; i < range; i++) {
|
||||
x += dir.offsetX;
|
||||
y += dir.offsetY;
|
||||
z += dir.offsetZ;
|
||||
if(worldObj.isAirBlock(x, y, z))
|
||||
continue;
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity(x, y, z);
|
||||
if(tile instanceof TileRedString)
|
||||
continue;
|
||||
|
||||
if(acceptBlock(x, y, z) && (binding == null || binding.posX != x || binding.posY != y || binding.posZ != z)) {
|
||||
binding = new ChunkCoordinates(x, y, z);
|
||||
onBound(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getRange() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public abstract boolean acceptBlock(int x, int y, int z);
|
||||
|
||||
public void onBound(int x, int y, int z) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates getBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Nov 14, 2014, 5:26:39 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block.tile.string;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileRedStringContainer extends TileRedString {
|
||||
|
||||
@Override
|
||||
public boolean acceptBlock(int x, int y, int z) {
|
||||
TileEntity tile = worldObj.getTileEntity(x, y, z);
|
||||
return tile != null && tile instanceof IInventory;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -110,6 +110,9 @@ public final class BotaniaCreativeTab extends CreativeTabs {
|
||||
addItem(ModItems.bloodPendant);
|
||||
addBlock(ModBlocks.pylon);
|
||||
addBlock(ModBlocks.pistonRelay);
|
||||
|
||||
addBlock(ModBlocks.redStringContainer);
|
||||
|
||||
addBlock(ModBlocks.shinyFlower);
|
||||
addBlock(ModBlocks.miniIsland);
|
||||
addBlock(ModBlocks.tinyPotato);
|
||||
|
||||
@@ -61,6 +61,7 @@ public final class LibBlockNames {
|
||||
public static final String BREWERY = "brewery";
|
||||
public static final String MANA_GLASS = "manaGlass";
|
||||
public static final String TERRA_PLATE = "terraPlate";
|
||||
public static final String RED_STRING_CONTAINER = "redStringContainer";
|
||||
|
||||
public static final String SUBTILE_PUREDAISY = "puredaisy";
|
||||
public static final String SUBTILE_MANASTAR = "manastar";
|
||||
|
||||
Reference in new issue
Block a user