everything and anything all of the time
This commit is contained in:
parent
d36b54e467
commit
e4df9322bc
|
|
@ -41,7 +41,7 @@ dependencies {
|
|||
}
|
||||
forge "net.minecraftforge:forge:${project.forge_version}"
|
||||
|
||||
modImplementation "com.github.Mysticpasta1:mcef-forge:214395775d"
|
||||
modImplementation "com.github.Mysticpasta1:mcef-forge:0be185605d"
|
||||
modImplementation "curse.maven:cloth_config_forge-348521:3546623"
|
||||
// Uncomment the following line to enable the deprecated Fabric API modules.
|
||||
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
|
||||
|
|
|
|||
|
|
@ -43,15 +43,13 @@ import net.montoyo.wd.net.Messages;
|
|||
import net.montoyo.wd.net.client.CMessageCloseGui;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class BlockKeyboardLeft extends WDBlockContainer {
|
||||
public class BlockKeyboardLeft extends BlockPeripheral {
|
||||
|
||||
public static final EnumProperty<DefaultPeripheral> type = EnumProperty.create("type", DefaultPeripheral.class);
|
||||
public static final DirectionProperty facing = DirectionProperty.create("facing", Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST);
|
||||
private static final Property<?>[] properties = new Property<?>[] { type, facing };
|
||||
|
||||
public BlockKeyboardLeft() {
|
||||
super(Properties.of(Material.STONE).strength(1.5f, 10.f));
|
||||
// setName("peripheral");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.BaseEntityBlock;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
|
|
@ -36,7 +37,9 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
|||
import net.montoyo.wd.core.DefaultPeripheral;
|
||||
import net.montoyo.wd.core.IPeripheral;
|
||||
import net.montoyo.wd.entity.TileEntityKeyboard;
|
||||
import net.montoyo.wd.entity.TileEntityScreen;
|
||||
import net.montoyo.wd.init.BlockInit;
|
||||
import net.montoyo.wd.init.TileInit;
|
||||
import net.montoyo.wd.item.ItemLinker;
|
||||
import net.montoyo.wd.utilities.BlockSide;
|
||||
import net.montoyo.wd.utilities.Vector3i;
|
||||
|
|
@ -55,9 +58,6 @@ public class BlockKeyboardRight extends Block implements IPeripheral {
|
|||
public BlockKeyboardRight() {
|
||||
super(Properties.of(Material.STONE)
|
||||
.strength(1.5f, 10.f));
|
||||
|
||||
//("keyboard")
|
||||
//fullBlock = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -77,12 +77,12 @@ public class BlockKeyboardRight extends Block implements IPeripheral {
|
|||
|
||||
private TileEntityKeyboard getTileEntity(Level world, BlockPos pos) {
|
||||
for (Direction nf : Direction.Plane.HORIZONTAL) {
|
||||
BlockPos np = pos.above(nf.getNormal().getX()); //TODO is X correct?
|
||||
BlockPos np = pos.offset(nf.getNormal());
|
||||
BlockState ns = world.getBlockState(np);
|
||||
|
||||
if (ns.getBlock() instanceof BlockPeripheral && ns.getValue(BlockPeripheral.type) == DefaultPeripheral.KEYBOARD) {
|
||||
BlockEntity te = world.getBlockEntity(np);
|
||||
if (te != null && te instanceof TileEntityKeyboard)
|
||||
if(ns.getBlock() instanceof BlockPeripheral && ns.getValue(BlockPeripheral.type) == DefaultPeripheral.KEYBOARD) {
|
||||
BlockEntity te = world.getBlockEntity(pos);
|
||||
if (te instanceof TileEntityKeyboard)
|
||||
return (TileEntityKeyboard) te;
|
||||
|
||||
break;
|
||||
|
|
@ -100,7 +100,7 @@ public class BlockKeyboardRight extends Block implements IPeripheral {
|
|||
|
||||
public static boolean checkNeighborhood(Level world, BlockPos bp, BlockPos ignore) {
|
||||
for (Direction neighbor : Direction.Plane.HORIZONTAL) {
|
||||
BlockPos np = bp.above(neighbor.getNormal().getX()); //TODO is X correct?
|
||||
BlockPos np = bp.offset(neighbor.getNormal());
|
||||
|
||||
if (ignore == null || !np.equals(ignore)) {
|
||||
BlockState state = world.getBlockState(np);
|
||||
|
|
@ -118,7 +118,7 @@ public class BlockKeyboardRight extends Block implements IPeripheral {
|
|||
|
||||
public void removeLeftPiece(Level world, BlockPos pos, boolean dropItem) {
|
||||
for (Direction nf : Direction.Plane.HORIZONTAL) {
|
||||
BlockPos np = pos.above(nf.getNormal().getX()); //TODO is X correct?
|
||||
BlockPos np = pos.offset(nf.getNormal());
|
||||
BlockState ns = world.getBlockState(np);
|
||||
|
||||
if (ns.getBlock() instanceof BlockPeripheral && ns.getValue(BlockPeripheral.type) == DefaultPeripheral.KEYBOARD) {
|
||||
|
|
@ -205,5 +205,4 @@ public class BlockKeyboardRight extends Block implements IPeripheral {
|
|||
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.RenderShape;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
|
|
@ -33,6 +34,7 @@ import net.minecraft.world.phys.shapes.CollisionContext;
|
|||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
import net.montoyo.mcef.utilities.Log;
|
||||
import net.montoyo.wd.core.DefaultPeripheral;
|
||||
import net.montoyo.wd.entity.TileEntityInterfaceBase;
|
||||
import net.montoyo.wd.entity.TileEntityKeyboard;
|
||||
|
|
@ -98,7 +100,7 @@ public class BlockPeripheral extends WDBlockContainer {
|
|||
// }
|
||||
|
||||
|
||||
/*@Nullable
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
|
||||
BlockEntityType.BlockEntitySupplier<? extends BlockEntity> cls = state.getValue(type).getTEClass();
|
||||
|
|
@ -112,7 +114,7 @@ public class BlockPeripheral extends WDBlockContainer {
|
|||
}
|
||||
|
||||
return null;
|
||||
} */
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderShape getRenderShape(BlockState state) {
|
||||
|
|
|
|||
|
|
@ -43,14 +43,13 @@ import net.montoyo.wd.net.Messages;
|
|||
import net.montoyo.wd.net.client.CMessageCloseGui;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class BlockRCTRL extends WDBlockContainer {
|
||||
public class BlockRCTRL extends BlockPeripheral {
|
||||
|
||||
public static final EnumProperty<DefaultPeripheral> type = BlockPeripheral.type;
|
||||
public static final DirectionProperty facing = DirectionProperty.create("facing", Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST);
|
||||
private static final Property<?>[] properties = new Property<?>[] {facing};
|
||||
private static final Property<?>[] properties = new Property<?>[] {type, facing};
|
||||
|
||||
public BlockRCTRL() {
|
||||
super(Properties.of(Material.STONE).strength(1.5f, 10.f));
|
||||
// setName("peripheral");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -43,14 +43,13 @@ import net.montoyo.wd.net.Messages;
|
|||
import net.montoyo.wd.net.client.CMessageCloseGui;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class BlockRedCTRL extends WDBlockContainer {
|
||||
public class BlockRedCTRL extends BlockPeripheral {
|
||||
|
||||
public static final EnumProperty<DefaultPeripheral> type = BlockPeripheral.type;
|
||||
public static final DirectionProperty facing = DirectionProperty.create("facing", Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST);
|
||||
private static final Property<?>[] properties = new Property<?>[] {facing};
|
||||
private static final Property<?>[] properties = new Property<?>[] {type, facing};
|
||||
|
||||
public BlockRedCTRL() {
|
||||
super(Properties.of(Material.STONE).strength(1.5f, 10.f));
|
||||
// setName("peripheral");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -43,14 +43,13 @@ import net.montoyo.wd.net.Messages;
|
|||
import net.montoyo.wd.net.client.CMessageCloseGui;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class BlockServer extends WDBlockContainer {
|
||||
public class BlockServer extends BlockPeripheral {
|
||||
|
||||
public static final EnumProperty<DefaultPeripheral> type = BlockPeripheral.type;
|
||||
public static final DirectionProperty facing = DirectionProperty.create("facing", Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST);
|
||||
private static final Property<?>[] properties = new Property<?>[] {facing};
|
||||
private static final Property<?>[] properties = new Property<?>[] {type, facing};
|
||||
|
||||
public BlockServer() {
|
||||
super(Properties.of(Material.STONE).strength(1.5f, 10.f));
|
||||
// setName("peripheral");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -6,10 +6,11 @@ package net.montoyo.wd.block;
|
|||
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.BaseEntityBlock;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.montoyo.wd.WebDisplays;
|
||||
|
||||
public abstract class WDBlockContainer extends Block {
|
||||
public abstract class WDBlockContainer extends BaseEntityBlock {
|
||||
|
||||
protected static BlockItem itemBlock;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ import net.minecraft.client.multiplayer.ClientAdvancements;
|
|||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.client.resources.model.ModelBakery;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.NonNullList;
|
||||
|
|
@ -23,6 +25,7 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.packs.resources.PreparableReloadListener;
|
||||
import net.minecraft.server.packs.resources.ReloadableResourceManager;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraft.server.packs.resources.ResourceManagerReloadListener;
|
||||
|
|
@ -42,6 +45,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
|||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.model.IModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
|
@ -137,6 +141,12 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer
|
|||
@SubscribeEvent
|
||||
public static void onClientSetup(FMLClientSetupEvent event) {
|
||||
BlockEntityRenderers.register(TileInit.SCREEN_BLOCK_ENTITY.get(), new ScreenRenderer.ScreenRendererProvider());
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onModelRegistryEvent(ModelRegistryEvent event) {
|
||||
ModelLoaderRegistry.registerLoader(ScreenModelLoader.SCREEN_LOADER, new ScreenModelLoader());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
package net.montoyo.wd.client.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
|
@ -172,7 +173,7 @@ public class GuiScreenConfig extends WDScreen {
|
|||
updateMyRights();
|
||||
updateRotationStr();
|
||||
|
||||
minecraft.getSoundManager().play(SimpleSoundInstance.forUI( WebDisplays.INSTANCE.soundScreenCfg, 1.0f, 1.0f));
|
||||
Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI( WebDisplays.INSTANCE.soundScreenCfg, 1.0f, 1.0f));
|
||||
}
|
||||
|
||||
private void updateRotationStr() {
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ public class GuiServer extends WDScreen {
|
|||
if(keyCode == GLFW.GLFW_KEY_L && ctrl)
|
||||
lines.clear();
|
||||
else if(keyCode == GLFW.GLFW_KEY_V && ctrl) {
|
||||
prompt += minecraft.keyboardHandler.getClipboard();
|
||||
prompt += Minecraft.getInstance().keyboardHandler.getClipboard();
|
||||
|
||||
if(prompt.length() > MAX_LINE_LEN)
|
||||
prompt = prompt.substring(0, MAX_LINE_LEN);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
package net.montoyo.wd.client.gui.controls;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
|
@ -83,13 +84,15 @@ public class CheckBox extends BasicControl {
|
|||
public void draw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
||||
if(visible) {
|
||||
// GlStateManager.disableAlpha();
|
||||
|
||||
bindTexture(checked ? texChecked : texUnchecked);
|
||||
blend(true);
|
||||
poseStack.pushPose();
|
||||
RenderSystem.setShaderTexture(2, checked ? texChecked : texUnchecked);
|
||||
RenderSystem.bindTexture(2);
|
||||
RenderSystem.enableBlend();
|
||||
fillTexturedRect(poseStack, x, y, WIDTH, HEIGHT, 0.0, 0.0, 1.0, 1.0);
|
||||
blend(false);
|
||||
bindTexture(null);
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.bindTexture(-1);
|
||||
|
||||
poseStack.popPose();
|
||||
boolean inside = (!disabled && mouseX >= x && mouseX <= x + WIDTH + 2 + labelW && mouseY >= y && mouseY < y + HEIGHT);
|
||||
font.draw(poseStack, label, x + WIDTH + 2, y + 4, inside ? 0xFF0080FF : COLOR_WHITE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,8 +141,8 @@ public abstract class Container extends BasicControl {
|
|||
mouseX -= x + paddingX;
|
||||
mouseY -= y + paddingY;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated((double) (x + paddingX), (double) (y + paddingY), 0.0);
|
||||
poseStack.pushPose();
|
||||
poseStack.translate(x + paddingX, y + paddingY, 0.0);
|
||||
|
||||
if(disabled) {
|
||||
for(Control ctrl : childs)
|
||||
|
|
@ -152,7 +152,7 @@ public abstract class Container extends BasicControl {
|
|||
ctrl.draw(poseStack, mouseX, mouseY, ptt);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
poseStack.popPose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ public class ControlGroup extends Container {
|
|||
super.draw(poseStack, mouseX, mouseY, ptt);
|
||||
|
||||
if(visible) {
|
||||
poseStack.pushPose();
|
||||
RenderSystem.setShaderColor(0.5f, 0.5f, 0.5f, 1.f);
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.enableBlend();
|
||||
|
|
@ -157,8 +158,9 @@ public class ControlGroup extends Container {
|
|||
vBuffer.vertex(x2 - 1.0, y1, 0.0).endVertex();
|
||||
tessellator.end();
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.enableTexture();
|
||||
poseStack.popPose();
|
||||
|
||||
if(labelW != 0)
|
||||
font.drawShadow(poseStack, label, x + 10 + ((int) bp), y, labelColor, labelShadowed);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
package net.montoyo.wd.client.gui.controls;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
||||
|
|
@ -45,12 +46,15 @@ public class Icon extends BasicControl {
|
|||
@Override
|
||||
public void draw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
||||
if(texture != null) {
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
bindTexture(texture);
|
||||
blend(true);
|
||||
poseStack.pushPose();
|
||||
RenderSystem.enableTexture();
|
||||
RenderSystem.setShaderTexture(1, texture);
|
||||
RenderSystem.bindTexture(1);
|
||||
RenderSystem.enableBlend();
|
||||
fillTexturedRect(poseStack, x, y, width, height, u1, v1, u2, v2);
|
||||
blend(false);
|
||||
bindTexture(null);
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.bindTexture(-1);
|
||||
poseStack.popPose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,8 +107,9 @@ public class List extends BasicControl {
|
|||
|
||||
private void renderToFBO() {
|
||||
PoseStack poseStack = beginFramebuffer(fbo, width, height);
|
||||
poseStack.pushPose();
|
||||
fillRect(0, 0, width, height, COLOR_BLACK);
|
||||
glColor4f(1.f, 1.f, 1.f, 1.f);
|
||||
RenderSystem.setShaderColor(1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
int offset = 4 - getYOffset();
|
||||
for(int i = 0; i < content.size(); i++) {
|
||||
|
|
@ -125,6 +126,7 @@ public class List extends BasicControl {
|
|||
|
||||
drawBorder(poseStack, 0, 0, width, height, 0xFF808080);
|
||||
endFramebuffer(poseStack, fbo);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -113,8 +113,9 @@ public class TextField extends Control {
|
|||
old = field.getValue();
|
||||
else
|
||||
old = null;
|
||||
|
||||
field.setValue(field.getValue().substring(0, field.getValue().length() - 1));
|
||||
|
||||
if(field.getValue().length() > 0)
|
||||
field.setValue(field.getValue().substring(0, field.getValue().length() - 1));
|
||||
|
||||
if(enabled && field.isFocused() && !field.getValue().equals(old)) {
|
||||
for(TextChangeListener tcl : listeners)
|
||||
|
|
|
|||
|
|
@ -6,8 +6,9 @@ package net.montoyo.wd.client.renderers;
|
|||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraftforge.client.model.data.IDynamicBakedModel;
|
||||
|
||||
public interface IModelBaker extends BakedModel {
|
||||
public interface IModelBaker extends IDynamicBakedModel{
|
||||
|
||||
void loadTextures(TextureAtlas texMap);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,22 +10,26 @@ import net.minecraft.client.renderer.block.model.ItemOverrides;
|
|||
import net.minecraft.client.renderer.block.model.ItemTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.resources.model.ModelState;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||
import net.minecraft.world.level.block.state.properties.IntegerProperty;
|
||||
import net.montoyo.wd.block.BlockScreen;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraftforge.client.model.data.IDynamicBakedModel;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.montoyo.wd.utilities.BlockSide;
|
||||
import net.montoyo.wd.utilities.Vector3f;
|
||||
import net.montoyo.wd.utilities.Vector3i;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class ScreenBaker implements IModelBaker {
|
||||
|
||||
|
|
@ -33,6 +37,17 @@ public class ScreenBaker implements IModelBaker {
|
|||
private final TextureAtlasSprite[] texs = new TextureAtlasSprite[16];
|
||||
private final BlockSide[] blockSides = BlockSide.values();
|
||||
private final Direction[] blockFacings = Direction.values();
|
||||
private final ModelState modelState;
|
||||
private final Function<net.minecraft.client.resources.model.Material, TextureAtlasSprite> spriteGetter;
|
||||
private final ItemOverrides overrides;
|
||||
private final ItemTransforms itemTransforms;
|
||||
|
||||
public ScreenBaker(ModelState modelState, Function<net.minecraft.client.resources.model.Material, TextureAtlasSprite> spriteGetter, ItemOverrides overrides, ItemTransforms itemTransforms) {
|
||||
this.modelState = modelState;
|
||||
this.spriteGetter = spriteGetter;
|
||||
this.overrides = overrides;
|
||||
this.itemTransforms = itemTransforms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTextures(TextureAtlas texMap) {
|
||||
|
|
@ -91,8 +106,9 @@ public class ScreenBaker implements IModelBaker {
|
|||
return new BakedQuad(data, 0xFFFFFFFF, blockFacings[side.ordinal()], tex, true);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@org.jetbrains.annotations.Nullable BlockState state, @org.jetbrains.annotations.Nullable Direction side, @NotNull Random random, @NotNull IModelData iModelData) {
|
||||
if(side == null)
|
||||
return noQuads;
|
||||
BlockState bs = state;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package net.montoyo.wd.client.renderers;
|
||||
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrides;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.resources.model.*;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.model.IModelConfiguration;
|
||||
import net.minecraftforge.client.model.IModelLoader;
|
||||
import net.minecraftforge.client.model.geometry.IModelGeometry;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class ScreenModelLoader implements IModelLoader<ScreenModelLoader.ScreenModelGeometry> {
|
||||
|
||||
public static final ResourceLocation SCREEN_LOADER = new ResourceLocation("webdisplays", "screen_loader");
|
||||
|
||||
public static final ResourceLocation SCREEN_SIDE = new ResourceLocation("webdisplays", "block/screen");
|
||||
|
||||
public static final Material MATERIAL_SIDE = ForgeHooksClient.getBlockMaterial(SCREEN_SIDE);
|
||||
|
||||
@Override
|
||||
public void onResourceManagerReload(ResourceManager resourceManager) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScreenModelGeometry read(JsonDeserializationContext deserializationContext, JsonObject modelContents) {
|
||||
return new ScreenModelGeometry();
|
||||
}
|
||||
|
||||
|
||||
public static class ScreenModelGeometry implements IModelGeometry<ScreenModelGeometry> {
|
||||
@Override
|
||||
public BakedModel bake(IModelConfiguration owner, ModelBakery modelBakery, Function<net.minecraft.client.resources.model.Material, TextureAtlasSprite> spriteGetter, ModelState modelState, ItemOverrides itemOverrides, ResourceLocation resourceLocation) {
|
||||
return new ScreenBaker(modelState, spriteGetter, itemOverrides, owner.getCameraTransforms());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Collection<net.minecraft.client.resources.model.Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, UnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
|
||||
return List.of(MATERIAL_SIDE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -123,15 +123,13 @@ public class ScreenRenderer implements BlockEntityRenderer<TileEntityScreen> {
|
|||
Tesselator tesselator = Tesselator.getInstance();
|
||||
BufferBuilder builder = tesselator.getBuilder();
|
||||
//TODO: Use tesselator
|
||||
RenderSystem.setShaderTexture(0, scr.browser.getTextureID());
|
||||
RenderSystem._setShaderTexture(0, scr.browser.getTextureID());
|
||||
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX);
|
||||
|
||||
builder.vertex(poseStack.last().pose(),-sw, -sh, 0.505f).color(1.f, 1.f, 1.f, 1.f).uv(0.f, 1.f).endVertex();
|
||||
builder.vertex(poseStack.last().pose(), sw, -sh, 0.505f).color(1.f, 1.f, 1.f, 1.f).uv(1.f, 1.f).endVertex();
|
||||
builder.vertex(poseStack.last().pose(), sw, sh, 0.505f).color(1.f, 1.f, 1.f, 1.f).uv(1.f, 0.f).endVertex();
|
||||
builder.vertex(poseStack.last().pose(),-sw, sh, 0.505f).color(1.f, 1.f, 1.f, 1.f).uv(0.f, 0.f).endVertex();
|
||||
tesselator.end();//Minecraft does shit with mah texture otherwise...
|
||||
RenderSystem.bindTexture(0);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,27 +5,19 @@
|
|||
package net.montoyo.wd.entity;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.animal.Ocelot;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.montoyo.wd.WebDisplays;
|
||||
import net.montoyo.wd.block.BlockKeyboardRight;
|
||||
import net.montoyo.wd.block.BlockPeripheral;
|
||||
import net.montoyo.wd.core.DefaultPeripheral;
|
||||
import net.montoyo.wd.core.ScreenRights;
|
||||
import net.montoyo.wd.data.KeyboardData;
|
||||
import net.montoyo.wd.init.TileInit;
|
||||
import net.montoyo.wd.utilities.BlockSide;
|
||||
import net.montoyo.wd.utilities.Util;
|
||||
|
||||
public class TileEntityKeyboard extends TileEntityPeripheralBase {
|
||||
|
|
|
|||
35
src/main/java/net/montoyo/wd/mixins/MainMixin.java
Normal file
35
src/main/java/net/montoyo/wd/mixins/MainMixin.java
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package net.montoyo.wd.mixins;
|
||||
|
||||
import net.minecraft.client.main.Main;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.lwjgl.system.Configuration;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
@Mixin(value = Main.class, remap = false)
|
||||
public class MainMixin {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private static Logger LOGGER;
|
||||
|
||||
@Inject(method = "main", at = @At("HEAD"))
|
||||
private static void generations_initRenderdoc(CallbackInfo ci) {
|
||||
if (true) {
|
||||
Configuration.DEBUG_STREAM.set(System.err);
|
||||
Configuration.DEBUG.set(true);
|
||||
LOGGER.warn("Enabled LWJGL Debugging");
|
||||
if (Files.exists(Paths.get("C:/Program Files/RenderDoc/renderdoc.dll"))) {
|
||||
System.load("C:/Program Files/RenderDoc/renderdoc.dll");
|
||||
LOGGER.warn("Loaded Render Debugging");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
"package": "net.montoyo.wd.mixins",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"MainMixin"
|
||||
],
|
||||
"client": [
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user