Its all broke, mcmultipart support
This commit is contained in:
parent
f255137753
commit
471a945de6
18 changed files with 83 additions and 73 deletions
|
@ -80,7 +80,7 @@ if (ENV.BUILD_NUMBER) {
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.9-12.16.0.1766-1.9"
|
version = "1.9-12.16.0.1770-1.9"
|
||||||
mappings = "snapshot_20160316"
|
mappings = "snapshot_20160316"
|
||||||
replace "@MODVERSION@", project.version
|
replace "@MODVERSION@", project.version
|
||||||
// makeObfSourceJar = false
|
// makeObfSourceJar = false
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package techreborn.client.render.parts;
|
package techreborn.client.render.parts;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
@ -13,7 +14,7 @@ public class ClientPartLoader implements ICompatModule {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
// MinecraftForge.EVENT_BUS.register(new ClientPartModelBakery());
|
MinecraftForge.EVENT_BUS.register(new ClientPartModelBakery());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package techreborn.client.render.parts;
|
package techreborn.client.render.parts;
|
||||||
|
|
||||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||||
|
@ -19,7 +19,7 @@ public class ClientPartModelBakery {
|
||||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||||
public void onModelBake(ModelBakeEvent event){
|
public void onModelBake(ModelBakeEvent event){
|
||||||
for(EnumCableType type : EnumCableType.values()){
|
for(EnumCableType type : EnumCableType.values()){
|
||||||
event.modelRegistry.putObject(new ModelResourceLocation("techreborn:cable#type=" + type.getName().toLowerCase()), new RenderCablePart(type));
|
event.getModelRegistry().putObject(new ModelResourceLocation("techreborn:cable#type=" + type.getName().toLowerCase()), new RenderCablePart(type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package techreborn.client.render.parts;
|
package techreborn.client.render.parts;
|
||||||
|
|
||||||
import mcmultipart.client.multipart.ISmartMultipartModel;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.block.model.BlockFaceUV;
|
import net.minecraft.client.renderer.block.model.BlockFaceUV;
|
||||||
import net.minecraft.client.renderer.block.model.BlockPartFace;
|
import net.minecraft.client.renderer.block.model.BlockPartFace;
|
||||||
import net.minecraft.client.renderer.block.model.FaceBakery;
|
import net.minecraft.client.renderer.block.model.FaceBakery;
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelRotation;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.client.resources.model.IBakedModel;
|
|
||||||
import net.minecraft.client.resources.model.ModelRotation;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
import org.lwjgl.util.vector.Vector3f;
|
import org.lwjgl.util.vector.Vector3f;
|
||||||
|
@ -19,10 +19,9 @@ import techreborn.parts.CableMultipart;
|
||||||
import techreborn.parts.EnumCableType;
|
import techreborn.parts.EnumCableType;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class RenderCablePart implements ISmartMultipartModel {
|
public class RenderCablePart implements IBakedModel {
|
||||||
|
|
||||||
private FaceBakery faceBakery = new FaceBakery();
|
private FaceBakery faceBakery = new FaceBakery();
|
||||||
|
|
||||||
|
@ -30,23 +29,11 @@ public class RenderCablePart implements ISmartMultipartModel {
|
||||||
|
|
||||||
EnumCableType type;
|
EnumCableType type;
|
||||||
|
|
||||||
IExtendedBlockState state;
|
|
||||||
|
|
||||||
public RenderCablePart(IExtendedBlockState state, EnumCableType type) {
|
|
||||||
this(type);
|
|
||||||
this.state = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RenderCablePart(EnumCableType type) {
|
public RenderCablePart(EnumCableType type) {
|
||||||
texture = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(type.textureName);
|
texture = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(type.textureName);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBakedModel handlePartState(IBlockState state) {
|
|
||||||
return new RenderCablePart((IExtendedBlockState) state, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addCubeToList(Vecs3dCube cube, ArrayList<BakedQuad> list, BlockPartFace face, ModelRotation modelRotation, TextureAtlasSprite cubeTexture) {
|
public void addCubeToList(Vecs3dCube cube, ArrayList<BakedQuad> list, BlockPartFace face, ModelRotation modelRotation, TextureAtlasSprite cubeTexture) {
|
||||||
list.add(faceBakery.makeBakedQuad(new Vector3f((float) cube.getMinX(), (float) cube.getMinY(), (float) cube.getMinZ()), new Vector3f((float) cube.getMaxX(), (float) cube.getMinY(), (float) cube.getMaxZ()), face, cubeTexture, EnumFacing.DOWN, modelRotation, null, true, true));//down
|
list.add(faceBakery.makeBakedQuad(new Vector3f((float) cube.getMinX(), (float) cube.getMinY(), (float) cube.getMinZ()), new Vector3f((float) cube.getMaxX(), (float) cube.getMinY(), (float) cube.getMaxZ()), face, cubeTexture, EnumFacing.DOWN, modelRotation, null, true, true));//down
|
||||||
list.add(faceBakery.makeBakedQuad(new Vector3f((float) cube.getMinX(), (float) cube.getMaxY(), (float) cube.getMinZ()), new Vector3f((float) cube.getMaxX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture, EnumFacing.UP, modelRotation, null, true, true));//up
|
list.add(faceBakery.makeBakedQuad(new Vector3f((float) cube.getMinX(), (float) cube.getMaxY(), (float) cube.getMinZ()), new Vector3f((float) cube.getMaxX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture, EnumFacing.UP, modelRotation, null, true, true));//up
|
||||||
|
@ -57,17 +44,13 @@ public class RenderCablePart implements ISmartMultipartModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) {
|
public List<BakedQuad> getQuads(IBlockState blockState, EnumFacing side, long rand) {
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<BakedQuad> getGeneralQuads() {
|
|
||||||
ArrayList<BakedQuad> list = new ArrayList<BakedQuad>();
|
ArrayList<BakedQuad> list = new ArrayList<BakedQuad>();
|
||||||
BlockFaceUV uv = new BlockFaceUV(new float[]{0.0F, 0.0F, 16.0F, 16.0F}, 0);
|
BlockFaceUV uv = new BlockFaceUV(new float[]{0.0F, 0.0F, 16.0F, 16.0F}, 0);
|
||||||
BlockPartFace face = new BlockPartFace(null, 0, "", uv);
|
BlockPartFace face = new BlockPartFace(null, 0, "", uv);
|
||||||
double thickness = type.cableThickness;
|
double thickness = type.cableThickness;
|
||||||
double lastThickness = 16 - thickness;
|
double lastThickness = 16 - thickness;
|
||||||
|
IExtendedBlockState state = (IExtendedBlockState) blockState;
|
||||||
addCubeToList(new Vecs3dCube(thickness, thickness, thickness, lastThickness, lastThickness, lastThickness), list, face, ModelRotation.X0_Y0, texture);
|
addCubeToList(new Vecs3dCube(thickness, thickness, thickness, lastThickness, lastThickness, lastThickness), list, face, ModelRotation.X0_Y0, texture);
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
if (state.getValue(CableMultipart.UP)) {
|
if (state.getValue(CableMultipart.UP)) {
|
||||||
|
@ -116,4 +99,9 @@ public class RenderCablePart implements ISmartMultipartModel {
|
||||||
public ItemCameraTransforms getItemCameraTransforms() {
|
public ItemCameraTransforms getItemCameraTransforms() {
|
||||||
return ItemCameraTransforms.DEFAULT;
|
return ItemCameraTransforms.DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemOverrideList getOverrides() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import techreborn.client.render.parts.ClientPartLoader;
|
import techreborn.client.render.parts.ClientPartLoader;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.parts.StandalonePartCompact;
|
import techreborn.parts.StandalonePartCompact;
|
||||||
|
import techreborn.parts.TechRebornParts;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ public class CompatManager {
|
||||||
// registerCompact(RecipesBiomesOPlenty.class, "BiomesOPlenty");
|
// registerCompact(RecipesBiomesOPlenty.class, "BiomesOPlenty");
|
||||||
// registerCompact(RecipesBuildcraft.class, "BuildCraft|Builders");
|
// registerCompact(RecipesBuildcraft.class, "BuildCraft|Builders");
|
||||||
// registerCompact(RecipesThaumcraft.class, "Thaumcraft");
|
// registerCompact(RecipesThaumcraft.class, "Thaumcraft");
|
||||||
// registerCompact(TechRebornParts.class, "mcmultipart");
|
registerCompact(TechRebornParts.class, "mcmultipart");
|
||||||
registerCompact(ClientPartLoader.class, "mcmultipart", "@client");
|
registerCompact(ClientPartLoader.class, "mcmultipart", "@client");
|
||||||
registerCompact(StandalonePartCompact.class, "!mcmultipart");
|
registerCompact(StandalonePartCompact.class, "!mcmultipart");
|
||||||
//registerCompact(WailaMcMultiPartCompact.class, "mcmultipart", "Waila");
|
//registerCompact(WailaMcMultiPartCompact.class, "mcmultipart", "Waila");
|
||||||
|
|
|
@ -4,7 +4,7 @@ import mcmultipart.MCMultiPartMod;
|
||||||
import mcmultipart.microblock.IMicroblock;
|
import mcmultipart.microblock.IMicroblock;
|
||||||
import mcmultipart.multipart.ICollidableMultipart;
|
import mcmultipart.multipart.ICollidableMultipart;
|
||||||
import mcmultipart.multipart.IMultipartContainer;
|
import mcmultipart.multipart.IMultipartContainer;
|
||||||
import mcmultipart.multipart.IOccludingPart;
|
import mcmultipart.multipart.INormallyOccludingPart;
|
||||||
import mcmultipart.multipart.ISlottedPart;
|
import mcmultipart.multipart.ISlottedPart;
|
||||||
import mcmultipart.multipart.Multipart;
|
import mcmultipart.multipart.Multipart;
|
||||||
import mcmultipart.multipart.MultipartHelper;
|
import mcmultipart.multipart.MultipartHelper;
|
||||||
|
@ -16,20 +16,20 @@ import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyBool;
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
import net.minecraft.block.state.BlockState;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import net.minecraft.util.BlockPos;
|
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumParticleTypes;
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
import net.minecraft.util.EnumWorldBlockLayer;
|
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
|
@ -38,8 +38,8 @@ import net.minecraftforge.common.property.Properties;
|
||||||
import reborncore.api.power.IEnergyInterfaceTile;
|
import reborncore.api.power.IEnergyInterfaceTile;
|
||||||
import reborncore.common.misc.Functions;
|
import reborncore.common.misc.Functions;
|
||||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||||
|
import reborncore.common.util.WorldUtils;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.parts.walia.IPartWaliaProvider;
|
|
||||||
import techreborn.power.TRPowerNet;
|
import techreborn.power.TRPowerNet;
|
||||||
import techreborn.utils.damageSources.ElectrialShockSource;
|
import techreborn.utils.damageSources.ElectrialShockSource;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ import java.util.Map;
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 02/03/2016.
|
* Created by modmuss50 on 02/03/2016.
|
||||||
*/
|
*/
|
||||||
public abstract class CableMultipart extends Multipart implements IOccludingPart, ISlottedPart, ITickable, ICableType, ICollidableMultipart, IPartWaliaProvider {
|
public abstract class CableMultipart extends Multipart implements INormallyOccludingPart, ISlottedPart, ITickable, ICableType, ICollidableMultipart {
|
||||||
|
|
||||||
public Vecs3dCube[] boundingBoxes = new Vecs3dCube[14];
|
public Vecs3dCube[] boundingBoxes = new Vecs3dCube[14];
|
||||||
public float center = 0.6F;
|
public float center = 0.6F;
|
||||||
|
@ -110,7 +110,7 @@ public abstract class CableMultipart extends Multipart implements IOccludingPart
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollisionBoxes(AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) {
|
public void addCollisionBoxes(AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) {
|
||||||
super.addCollisionBoxes(mask, list, collidingEntity);
|
|
||||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||||
if (connectedSides.containsKey(dir) && mask.intersectsWith(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB()))
|
if (connectedSides.containsKey(dir) && mask.intersectsWith(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB()))
|
||||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||||
|
@ -118,6 +118,7 @@ public abstract class CableMultipart extends Multipart implements IOccludingPart
|
||||||
if (mask.intersectsWith(boundingBoxes[6].toAABB())) {
|
if (mask.intersectsWith(boundingBoxes[6].toAABB())) {
|
||||||
list.add(boundingBoxes[6].toAABB());
|
list.add(boundingBoxes[6].toAABB());
|
||||||
}
|
}
|
||||||
|
super.addCollisionBoxes(mask, list, collidingEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -168,7 +169,7 @@ public abstract class CableMultipart extends Multipart implements IOccludingPart
|
||||||
checkConnectedSides();
|
checkConnectedSides();
|
||||||
for (EnumFacing direction : EnumFacing.VALUES) {
|
for (EnumFacing direction : EnumFacing.VALUES) {
|
||||||
BlockPos blockPos = getPos().offset(direction);
|
BlockPos blockPos = getPos().offset(direction);
|
||||||
getWorld().markBlockForUpdate(blockPos);
|
WorldUtils.updateBlock(getWorld(), blockPos);
|
||||||
CableMultipart part = getPartFromWorld(getWorld(), blockPos, direction);
|
CableMultipart part = getPartFromWorld(getWorld(), blockPos, direction);
|
||||||
if (part != null) {
|
if (part != null) {
|
||||||
part.checkConnectedSides();
|
part.checkConnectedSides();
|
||||||
|
@ -229,9 +230,10 @@ public abstract class CableMultipart extends Multipart implements IOccludingPart
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!OcclusionHelper.occlusionTest(getContainer().getParts(), this, boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB())) {
|
//TODO 1.9 boken
|
||||||
return false;
|
// if (!OcclusionHelper.occlusionTest(this, boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB())) {
|
||||||
}
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir.getOpposite());
|
CableMultipart cableMultipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir.getOpposite());
|
||||||
|
|
||||||
|
@ -291,7 +293,7 @@ public abstract class CableMultipart extends Multipart implements IOccludingPart
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState createBlockState() {
|
public BlockStateContainer createBlockState() {
|
||||||
return new ExtendedBlockState(MCMultiPartMod.multipart,
|
return new ExtendedBlockState(MCMultiPartMod.multipart,
|
||||||
new IProperty[]{
|
new IProperty[]{
|
||||||
TYPE
|
TYPE
|
||||||
|
@ -306,10 +308,10 @@ public abstract class CableMultipart extends Multipart implements IOccludingPart
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public String getModelPath() {
|
// public String getModelPath() {
|
||||||
return "techreborn:cable";
|
// return "techreborn:cable";
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getHardness(PartMOP hit) {
|
public float getHardness(PartMOP hit) {
|
||||||
|
@ -335,7 +337,8 @@ public abstract class CableMultipart extends Multipart implements IOccludingPart
|
||||||
entity.attackEntityFrom(new ElectrialShockSource(), 1F);
|
entity.attackEntityFrom(new ElectrialShockSource(), 1F);
|
||||||
}
|
}
|
||||||
if(ConfigTechReborn.UninsulatedElectocutionSound){
|
if(ConfigTechReborn.UninsulatedElectocutionSound){
|
||||||
getWorld().playSoundAtEntity(entity, "techreborn:cable_shock", 0.6F, 1F);
|
//TODO 1.9 nope
|
||||||
|
// getWorld().playSoundAtEntity(entity, "techreborn:cable_shock", 0.6F, 1F);
|
||||||
}
|
}
|
||||||
if(ConfigTechReborn.UninsulatedElectocutionParticle){
|
if(ConfigTechReborn.UninsulatedElectocutionParticle){
|
||||||
getWorld().spawnParticle(EnumParticleTypes.CRIT, entity.posX, entity.posY, entity.posZ, 0, 0, 0);
|
getWorld().spawnParticle(EnumParticleTypes.CRIT, entity.posX, entity.posY, entity.posZ, 0, 0, 0);
|
||||||
|
@ -412,16 +415,22 @@ public abstract class CableMultipart extends Multipart implements IOccludingPart
|
||||||
network = null;
|
network = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public void addInfo(List<String> info) {
|
||||||
|
// info.add(EnumChatFormatting.GREEN + "EU Transfer: " + EnumChatFormatting.LIGHT_PURPLE + getCableType().transferRate);
|
||||||
|
// if (getCableType().canKill) {
|
||||||
|
// info.add(EnumChatFormatting.RED + "Damages entity's!");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInfo(List<String> info) {
|
public ResourceLocation getModelPath() {
|
||||||
info.add(EnumChatFormatting.GREEN + "EU Transfer: " + EnumChatFormatting.LIGHT_PURPLE + getCableType().transferRate);
|
return new ResourceLocation("techreborn:cable");
|
||||||
if (getCableType().canKill) {
|
|
||||||
info.add(EnumChatFormatting.RED + "Damages entity's!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRenderInLayer(EnumWorldBlockLayer layer) {
|
public boolean canRenderInLayer(BlockRenderLayer layer) {
|
||||||
return layer == EnumWorldBlockLayer.CUTOUT;
|
return layer == BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,32 +2,40 @@ package techreborn.parts;
|
||||||
|
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
|
import techreborn.parts.types.CopperCable;
|
||||||
|
import techreborn.parts.types.GlassFiberCable;
|
||||||
|
import techreborn.parts.types.GoldCable;
|
||||||
|
import techreborn.parts.types.HVCable;
|
||||||
|
import techreborn.parts.types.InsulatedCopperCable;
|
||||||
|
import techreborn.parts.types.InsulatedGoldCable;
|
||||||
|
import techreborn.parts.types.InsulatedHVCable;
|
||||||
|
import techreborn.parts.types.TinCable;
|
||||||
|
|
||||||
public enum EnumCableType implements IStringSerializable {
|
public enum EnumCableType implements IStringSerializable {
|
||||||
COPPER("copper", "techreborn:blocks/cables/copper_cable", 128, 12.0, true, EnumPowerTier.LOW),
|
COPPER("copper", "techreborn:blocks/cables/copper_cable", 128, 12.0, true, EnumPowerTier.LOW, CopperCable.class),
|
||||||
TIN("tin", "techreborn:blocks/cables/tin_cable", 32, 12.0, true, EnumPowerTier.MEDIUM),
|
TIN("tin", "techreborn:blocks/cables/tin_cable", 32, 12.0, true, EnumPowerTier.MEDIUM, TinCable.class),
|
||||||
GOLD("gold", "techreborn:blocks/cables/gold_cable", 512, 12.0, true, EnumPowerTier.MEDIUM),
|
GOLD("gold", "techreborn:blocks/cables/gold_cable", 512, 12.0, true, EnumPowerTier.MEDIUM, GoldCable.class),
|
||||||
HV("hv", "techreborn:blocks/cables/hv_cable", 2048, 12.0, true, EnumPowerTier.HIGH),
|
HV("hv", "techreborn:blocks/cables/hv_cable", 2048, 12.0, true, EnumPowerTier.HIGH, HVCable.class),
|
||||||
GLASSFIBER("glassfiber", "techreborn:blocks/cables/glass_fiber_cable", 8192, 12.0, false, EnumPowerTier.HIGH),
|
GLASSFIBER("glassfiber", "techreborn:blocks/cables/glass_fiber_cable", 8192, 12.0, false, EnumPowerTier.HIGH, GlassFiberCable.class),
|
||||||
ICOPPER("insulatedcopper", "techreborn:blocks/cables/copper_insulated_cable", 128, 10.0, false, EnumPowerTier.LOW),
|
ICOPPER("insulatedcopper", "techreborn:blocks/cables/copper_insulated_cable", 128, 10.0, false, EnumPowerTier.LOW, InsulatedCopperCable.class),
|
||||||
IGOLD("insulatedgold", "techreborn:blocks/cables/gold_insulated_cable", 512, 10.0, false, EnumPowerTier.HIGH),
|
IGOLD("insulatedgold", "techreborn:blocks/cables/gold_insulated_cable", 512, 10.0, false, EnumPowerTier.HIGH, InsulatedGoldCable.class),
|
||||||
IHV("insulatedhv", "techreborn:blocks/cables/hv_insulated_cable", 2048, 10.0, false, EnumPowerTier.HIGH);
|
IHV("insulatedhv", "techreborn:blocks/cables/hv_insulated_cable", 2048, 10.0, false, EnumPowerTier.HIGH, InsulatedHVCable.class);
|
||||||
|
|
||||||
private String friendlyName;
|
private String friendlyName;
|
||||||
public String textureName = "minecraft:blocks/iron_block";
|
public String textureName = "minecraft:blocks/iron_block";
|
||||||
public int transferRate = 128;
|
public int transferRate = 128;
|
||||||
public double cableThickness = 3.0;
|
public double cableThickness = 3.0;
|
||||||
public boolean canKill = false;
|
public boolean canKill = false;
|
||||||
//public Class<? extends CableMultipart> cableClass;
|
public Class<? extends CableMultipart> cableClass;
|
||||||
public EnumPowerTier tier;
|
public EnumPowerTier tier;
|
||||||
|
|
||||||
EnumCableType(String friendlyName, String textureName, int transferRate, double cableThickness, boolean canKill, EnumPowerTier tier) {
|
EnumCableType(String friendlyName, String textureName, int transferRate, double cableThickness, boolean canKill, EnumPowerTier tier, Class<? extends CableMultipart> cableClass) {
|
||||||
this.friendlyName = friendlyName;
|
this.friendlyName = friendlyName;
|
||||||
this.textureName = textureName;
|
this.textureName = textureName;
|
||||||
this.transferRate = transferRate;
|
this.transferRate = transferRate;
|
||||||
this.cableThickness = cableThickness / 2;
|
this.cableThickness = cableThickness / 2;
|
||||||
this.canKill = canKill;
|
this.canKill = canKill;
|
||||||
// this.cableClass = cableClass;
|
this.cableClass = cableClass;
|
||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,16 +3,18 @@ package techreborn.parts;
|
||||||
import mcmultipart.item.ItemMultiPart;
|
import mcmultipart.item.ItemMultiPart;
|
||||||
import mcmultipart.multipart.IMultipart;
|
import mcmultipart.multipart.IMultipart;
|
||||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.BlockPos;
|
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import reborncore.RebornCore;
|
import reborncore.RebornCore;
|
||||||
import techreborn.client.TechRebornCreativeTab;
|
import techreborn.client.TechRebornCreativeTab;
|
||||||
import techreborn.lib.ModInfo;
|
import techreborn.lib.ModInfo;
|
||||||
|
@ -34,7 +36,7 @@ public class ItemCables extends ItemMultiPart implements ITexturedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IMultipart createPart(World world, BlockPos pos, EnumFacing side, Vec3 hit, ItemStack stack, EntityPlayer player) {
|
public IMultipart createPart(World world, BlockPos pos, EnumFacing side, Vec3d hit, ItemStack stack, EntityPlayer player) {
|
||||||
try {
|
try {
|
||||||
return TechRebornParts.multipartHashMap.get(EnumCableType.values()[stack.getItemDamage()]).newInstance();
|
return TechRebornParts.multipartHashMap.get(EnumCableType.values()[stack.getItemDamage()]).newInstance();
|
||||||
} catch (InstantiationException | IllegalAccessException e) {
|
} catch (InstantiationException | IllegalAccessException e) {
|
||||||
|
@ -73,6 +75,7 @@ public class ItemCables extends ItemMultiPart implements ITexturedItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||||
}
|
}
|
||||||
|
@ -80,10 +83,10 @@ public class ItemCables extends ItemMultiPart implements ITexturedItem {
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||||
EnumCableType type = EnumCableType.values()[stack.getItemDamage()];
|
EnumCableType type = EnumCableType.values()[stack.getItemDamage()];
|
||||||
tooltip.add(EnumChatFormatting.GREEN + "EU Transfer: " + EnumChatFormatting.LIGHT_PURPLE + type.transferRate);
|
tooltip.add(TextFormatting.GREEN + "EU Transfer: " + TextFormatting.LIGHT_PURPLE + type.transferRate);
|
||||||
if (type.canKill) {
|
if (type.canKill) {
|
||||||
tooltip.add(EnumChatFormatting.RED + "Damages entity's!");
|
tooltip.add(TextFormatting.RED + "Damages entity's!");
|
||||||
}
|
}
|
||||||
tooltip.add(EnumChatFormatting.GREEN + "Tier: " + EnumChatFormatting.LIGHT_PURPLE + type.tier);
|
tooltip.add(TextFormatting.GREEN + "Tier: " + TextFormatting.LIGHT_PURPLE + type.tier);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue