mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
Merge branch 'rulang3' of https://github.com/RayzerHan/Nuclear-Tech-Rulang into rulang3
This commit is contained in:
commit
fb38aaacf1
@ -1021,6 +1021,8 @@ public class ModBlocks {
|
||||
public static Block machine_radgen;
|
||||
|
||||
public static Block machine_satlinker;
|
||||
public static Block machine_satlink;
|
||||
|
||||
public static Block machine_keyforge;
|
||||
|
||||
public static Block machine_armor_table;
|
||||
@ -1938,6 +1940,7 @@ public class ModBlocks {
|
||||
machine_transformer = new MachineTransformer(Material.iron).setBlockName("machine_transformer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_transformer_iron");
|
||||
|
||||
machine_satlinker = new MachineSatLinker(Material.iron).setBlockName("machine_satlinker").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":machine_satlinker_side");
|
||||
machine_satlink = new MachineSatLink().setBlockName("machine_satlink").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_keyforge = new MachineKeyForge(Material.iron).setBlockName("machine_keyforge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab).setBlockTextureName(RefStrings.MODID + ":machine_keyforge_side");
|
||||
machine_armor_table = new BlockArmorTable(Material.iron).setBlockName("machine_armor_table").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab);
|
||||
machine_weapon_table = new BlockWeaponTable().setBlockName("machine_weapon_table").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab);
|
||||
@ -3292,6 +3295,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(teleanchor, teleanchor.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(field_disturber, field_disturber.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_satlinker, machine_satlinker.getUnlocalizedName());
|
||||
register(machine_satlink);
|
||||
GameRegistry.registerBlock(machine_keyforge, machine_keyforge.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_armor_table, machine_armor_table.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_weapon_table, machine_weapon_table.getUnlocalizedName());
|
||||
|
||||
84
src/main/java/com/hbm/blocks/machine/MachineSatLink.java
Normal file
84
src/main/java/com/hbm/blocks/machine/MachineSatLink.java
Normal file
@ -0,0 +1,84 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.items.ISatChip;
|
||||
import com.hbm.main.NTMSounds;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineSatLink;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
|
||||
public class MachineSatLink extends BlockDummyable implements ILookOverlay {
|
||||
|
||||
public MachineSatLink() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
if(meta >= 12) return new TileEntityMachineSatLink();
|
||||
if(meta >= 6) return new TileEntityProxyCombo();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public int[] getDimensions() { return new int[] {6, 0, 1, 0, 1, 0}; }
|
||||
@Override public int getOffset() { return 0; }
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
if(!world.isRemote && !player.isSneaking()) {
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ISatChip) {
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos == null) return false;
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if(!(te instanceof TileEntityMachineSatLink)) return false;
|
||||
|
||||
TileEntityMachineSatLink link = (TileEntityMachineSatLink) te;
|
||||
|
||||
link.freq = ISatChip.getFreqS(player.getHeldItem());
|
||||
player.addChatComponentMessage(new ChatComponentText("Set frequency to " + link.freq).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)));
|
||||
world.playSoundAtEntity(player, NTMSounds.TECH_BLEEP, 1F, 1F);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
if(pos == null) return;
|
||||
|
||||
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
if(!(te instanceof TileEntityMachineSatLink)) return;
|
||||
|
||||
TileEntityMachineSatLink link = (TileEntityMachineSatLink) te;
|
||||
|
||||
List<String> text = new ArrayList();
|
||||
text.add("Freq: " + link.freq);
|
||||
text.add("Connected: " + (link.connected ? (EnumChatFormatting.GREEN + "Yes") : (EnumChatFormatting.RED + "No")));
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
}
|
||||
@ -301,6 +301,7 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineRadarNT.class, new RenderRadar());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineRadarLarge.class, new RenderRadarLarge());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineRadarScreen.class, new RenderRadarScreen());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineSatLink.class, new RenderSatLink());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityReactorResearch.class, new RenderSmallReactor());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTesla.class, new RenderTesla());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBarrel.class, new RenderFluidBarrel());
|
||||
|
||||
@ -272,6 +272,7 @@ public class ResourceManager {
|
||||
public static final IModelCustom radar = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/radar.obj")).noSmooth().asVBO();
|
||||
public static final IModelCustom radar_large = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/radar_large.obj")).noSmooth().asVBO();
|
||||
public static final IModelCustom radar_screen = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/radar_screen.obj")).noSmooth().asVBO();
|
||||
public static final IModelCustom satlink = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/satlink.obj")).noSmooth().asVBO();
|
||||
|
||||
//Forcefield
|
||||
public static final IModelCustom forcefield_top = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/forcefield_top.obj"));
|
||||
@ -747,6 +748,7 @@ public class ResourceManager {
|
||||
public static final ResourceLocation radar_dish_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/radar_dish.png");
|
||||
public static final ResourceLocation radar_large_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/radar_large.png");
|
||||
public static final ResourceLocation radar_screen_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/radar_screen.png");
|
||||
public static final ResourceLocation satlink_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/satlink.png");
|
||||
|
||||
//Forcefield
|
||||
public static final ResourceLocation forcefield_base_tex = new ResourceLocation(RefStrings.MODID, "textures/models/forcefield_base.png");
|
||||
|
||||
77
src/main/java/com/hbm/render/tileentity/RenderSatLink.java
Normal file
77
src/main/java/com/hbm/render/tileentity/RenderSatLink.java
Normal file
@ -0,0 +1,77 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.item.ItemRenderBase;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineSatLink;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class RenderSatLink extends TileEntitySpecialRenderer implements IItemRendererProvider {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float interp) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glRotatef(180, 0F, 1F, 0F);
|
||||
|
||||
TileEntityMachineSatLink link = (TileEntityMachineSatLink) tile;
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(tile.getBlockMetadata() - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
|
||||
|
||||
GL11.glTranslated((dir.offsetX + rot.offsetX) * 0.5, 0, (dir.offsetZ + rot.offsetZ) * 0.5);
|
||||
|
||||
float r = link.prevRot + (link.rot - link.prevRot) * interp;
|
||||
float l = link.prevLift + (link.lift - link.prevLift) * interp;
|
||||
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.satlink_tex);
|
||||
ResourceManager.satlink.renderPart("Base");
|
||||
GL11.glRotated(r, 0, 1, 0);
|
||||
ResourceManager.satlink.renderPart("Rotor");
|
||||
GL11.glTranslated(0, 7.375, 0);
|
||||
GL11.glRotated(l, 0, 0, 1);
|
||||
GL11.glTranslated(0, -7.375, 0);
|
||||
ResourceManager.satlink.renderPart("Dish");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemForRenderer() {
|
||||
return Item.getItemFromBlock(ModBlocks.machine_satlink);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemRenderer getRenderer() {
|
||||
return new ItemRenderBase( ) {
|
||||
public void renderInventory() {
|
||||
GL11.glTranslated(0, -5, 0);
|
||||
GL11.glScaled(3.5, 3.5, 3.5);
|
||||
}
|
||||
public void renderCommonWithStack(ItemStack item) {
|
||||
GL11.glScaled(0.5, 0.5, 0.5);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
bindTexture(ResourceManager.satlink_tex);
|
||||
ResourceManager.satlink.renderPart("Base");
|
||||
GL11.glRotated(15, 0, 1, 0);
|
||||
ResourceManager.satlink.renderPart("Rotor");
|
||||
GL11.glTranslated(0, 7.375, 0);
|
||||
GL11.glRotated(-45, 0, 0, 1);
|
||||
GL11.glTranslated(0, -7.375, 0);
|
||||
ResourceManager.satlink.renderPart("Dish");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}};
|
||||
}
|
||||
}
|
||||
@ -133,6 +133,7 @@ public class TileMappings {
|
||||
put(TileEntityMachineRadarScreen.class, "tileentity_radar_screen");
|
||||
put(TileEntityBroadcaster.class, "tileentity_pink_cloud_broadcaster");
|
||||
put(TileEntityMachineSatLinker.class, "tileentity_satlinker");
|
||||
put(TileEntityMachineSatLink.class, "tileentity_satlink");
|
||||
put(TileEntityReactorResearch.class, "tileentity_small_reactor");
|
||||
put(TileEntityVaultDoorMigration.class, "tileentity_vault_door");
|
||||
put(TileEntityRadiobox.class, "tileentity_radio_broadcaster");
|
||||
|
||||
@ -0,0 +1,120 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.saveddata.SatelliteSavedData;
|
||||
import com.hbm.tileentity.TileEntityTickingBase;
|
||||
|
||||
import api.hbm.redstoneoverradio.IRORInteractive;
|
||||
import api.hbm.redstoneoverradio.IRORValueProvider;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineSatLink extends TileEntityTickingBase implements IRORValueProvider, IRORInteractive {
|
||||
|
||||
public boolean connected;
|
||||
public int freq;
|
||||
|
||||
public float rot = INACTIVE_ROT;
|
||||
public float prevRot = INACTIVE_ROT;
|
||||
public float lift = INACTIVE_LIFT;
|
||||
public float prevLift = INACTIVE_LIFT;
|
||||
|
||||
public static final float SPEED = 0.25F;
|
||||
public static final float ACTIVE_ROT = -15F;
|
||||
public static final float ACTIVE_LIFT = -45F;
|
||||
public static final float INACTIVE_ROT = 0F;
|
||||
public static final float INACTIVE_LIFT = -85F;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
this.connected = false;
|
||||
|
||||
if(worldObj.getHeightValue(xCoord, zCoord) <= yCoord) {
|
||||
|
||||
SatelliteSavedData dat = SatelliteSavedData.getData(worldObj);
|
||||
this.connected = dat.isFreqTaken(freq);
|
||||
}
|
||||
|
||||
this.networkPackNT(150);
|
||||
|
||||
} else {
|
||||
|
||||
this.prevRot = this.rot;
|
||||
this.prevLift = this.lift;
|
||||
|
||||
float targetR = this.connected ? ACTIVE_ROT : INACTIVE_ROT;
|
||||
float targetL = this.connected ? ACTIVE_LIFT : INACTIVE_LIFT;
|
||||
|
||||
if(Math.abs(rot - targetR) <= SPEED) rot = targetR;
|
||||
else if(rot < targetR) rot += SPEED;
|
||||
else if(rot > targetR) rot -= SPEED;
|
||||
|
||||
if(Math.abs(lift - targetL) <= SPEED) lift = targetL;
|
||||
else if(lift < targetL) lift += SPEED;
|
||||
else if(lift > targetL) lift -= SPEED;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
super.serialize(buf);
|
||||
buf.writeBoolean(connected);
|
||||
buf.writeInt(freq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
super.deserialize(buf);
|
||||
this.connected = buf.readBoolean();
|
||||
this.freq = buf.readInt();
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
|
||||
if(bb == null) {
|
||||
bb = AxisAlignedBB.getBoundingBox(
|
||||
xCoord - 2,
|
||||
yCoord,
|
||||
zCoord - 2,
|
||||
xCoord + 3,
|
||||
yCoord + 10,
|
||||
zCoord + 3
|
||||
);
|
||||
}
|
||||
|
||||
return bb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFunctionInfo() {
|
||||
return new String[] {
|
||||
PREFIX_VALUE + "connected",
|
||||
PREFIX_VALUE + "freq",
|
||||
PREFIX_VALUE + "rx",
|
||||
PREFIX_FUNCTION + "setfreq" + NAME_SEPARATOR + "freq",
|
||||
PREFIX_FUNCTION + "tx" + NAME_SEPARATOR + "payload"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String provideRORValue(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String runRORFunction(String name, String[] params) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
1520
src/main/resources/assets/hbm/models/machines/satlink.obj
Normal file
1520
src/main/resources/assets/hbm/models/machines/satlink.obj
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
Loading…
x
Reference in New Issue
Block a user