-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #392 from Nxer/temp
sync from main
- Loading branch information
Showing
75 changed files
with
23,433 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/main/java/com/Nxer/TwistSpaceTechnology/client/Audio/Sound.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.Nxer.TwistSpaceTechnology.client.Audio; | ||
|
||
import net.minecraft.client.audio.PositionedSoundRecord; | ||
import net.minecraft.util.ResourceLocation; | ||
|
||
public class Sound extends PositionedSoundRecord { | ||
|
||
public Sound(ResourceLocation soundResource, float volume, float pitch, boolean repeat, float xPosition, | ||
float yPosition, float zPosition) { | ||
super(soundResource, volume, pitch, xPosition, yPosition, zPosition); | ||
this.repeat = repeat; | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
src/main/java/com/Nxer/TwistSpaceTechnology/client/render/ItemRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package com.Nxer.TwistSpaceTechnology.client.render; | ||
|
||
import static com.Nxer.TwistSpaceTechnology.common.block.BasicBlocks.BlockPowerChair; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraftforge.client.IItemRenderer; | ||
import net.minecraftforge.client.model.IModelCustom; | ||
|
||
import org.lwjgl.opengl.GL11; | ||
|
||
import com.Nxer.TwistSpaceTechnology.common.block.blockClass.ItemBlockPowerChair; | ||
|
||
public class ItemRenderer implements IItemRenderer { | ||
|
||
protected IModelCustom models; | ||
protected ResourceLocation textures; | ||
|
||
public ItemRenderer(final IModelCustom models, final ResourceLocation textures) { | ||
this.models = models; | ||
this.textures = textures; | ||
} | ||
|
||
@Override | ||
public boolean handleRenderType(ItemStack item, ItemRenderType type) { | ||
if (item.getItem() != ItemBlockPowerChair.getItemFromBlock(BlockPowerChair)) { | ||
return false; | ||
} | ||
return switch (type) { | ||
case ENTITY, EQUIPPED, EQUIPPED_FIRST_PERSON, INVENTORY -> true; | ||
default -> false; | ||
}; | ||
} | ||
|
||
@Override | ||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) { | ||
if (item.getItem() == ItemBlockPowerChair.getItemFromBlock(BlockPowerChair)) { | ||
final ResourceLocation texture = this.textures; | ||
final IModelCustom model = this.models; | ||
switch (type) { | ||
case ENTITY -> { | ||
GL11.glScaled(0.05, 0.05, 0.05); | ||
GL11.glTranslated(0.0, 1.0, 1.0); | ||
} | ||
case EQUIPPED -> { | ||
GL11.glScaled(0.05, 0.05, 0.05); | ||
GL11.glTranslated(1.0, 0.8, 1.5); | ||
GL11.glRotated(90, 0, 1, 0); | ||
} | ||
case EQUIPPED_FIRST_PERSON -> { | ||
GL11.glScaled(0.05, 0.05, 0.05); | ||
GL11.glTranslated(-8.0, 8.0, 8.0); | ||
GL11.glRotated(90, 0, 1, 0); | ||
} | ||
case INVENTORY -> { | ||
GL11.glTranslated(-0.1, -0.8, 0); | ||
GL11.glScaled(0.05, 0.05, 0.05); | ||
GL11.glRotated(180, 0, 1, 0); | ||
} | ||
default -> {} | ||
} | ||
GL11.glPushMatrix(); | ||
GL11.glEnable(GL11.GL_TEXTURE_2D); | ||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); | ||
Minecraft.getMinecraft().renderEngine.bindTexture(texture); | ||
model.renderAll(); | ||
GL11.glPopMatrix(); | ||
} | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
src/main/java/com/Nxer/TwistSpaceTechnology/client/render/TileEntityRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.Nxer.TwistSpaceTechnology.client.render; | ||
|
||
import net.minecraft.client.renderer.OpenGlHelper; | ||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraftforge.client.model.IModelCustom; | ||
|
||
import org.lwjgl.opengl.GL11; | ||
|
||
import com.Nxer.TwistSpaceTechnology.common.tile.TilePowerChair; | ||
|
||
import cpw.mods.fml.client.registry.ClientRegistry; | ||
|
||
public class TileEntityRenderer extends TileEntitySpecialRenderer { | ||
|
||
private final IModelCustom Renderer; | ||
private final ResourceLocation textures; | ||
|
||
public TileEntityRenderer(final IModelCustom Renderer, final ResourceLocation textures) { | ||
this.Renderer = Renderer; | ||
this.textures = textures; | ||
ClientRegistry.bindTileEntitySpecialRenderer(TilePowerChair.class, this); | ||
} | ||
|
||
private void getTileEntityFacing(TilePowerChair tile, double x, double y, double z) { | ||
switch (tile.getMeta()) { | ||
case 1 -> { | ||
GL11.glTranslated(x + 0.8, y, z + 0.5); | ||
GL11.glRotated(-90, 0, 1, 0); | ||
} | ||
case 2 -> { | ||
GL11.glTranslated(x + 0.5, y, z + 0.2); | ||
GL11.glRotated(0, 0, 1, 0); | ||
} | ||
case 3 -> { | ||
GL11.glTranslated(x + 0.5, y, z + 0.8); | ||
GL11.glRotated(180, 0, 1, 0); | ||
} | ||
case 0 -> { | ||
GL11.glTranslated(x + 0.2, y, z + 0.5); | ||
GL11.glRotated(90, 0, 1, 0); | ||
} | ||
} | ||
|
||
} | ||
|
||
@Override | ||
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) { | ||
if (!(tile instanceof TilePowerChair)) return; | ||
GL11.glPushMatrix(); | ||
getTileEntityFacing((TilePowerChair) tile, x, y, z); | ||
GL11.glDisable(GL11.GL_LIGHTING); | ||
GL11.glDisable(GL11.GL_CULL_FACE); | ||
GL11.glEnable(GL11.GL_BLEND); | ||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); | ||
this.bindTexture(textures); | ||
GL11.glScaled(0.07, 0.07, 0.07); | ||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); | ||
Renderer.renderAll(); | ||
GL11.glDisable(GL11.GL_BLEND); | ||
GL11.glDepthMask(true); | ||
GL11.glEnable(GL11.GL_CULL_FACE); | ||
GL11.glEnable(GL11.GL_LIGHTING); | ||
GL11.glPopMatrix(); | ||
} | ||
} |
Oops, something went wrong.