Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
sjcl committed Feb 9, 2017
1 parent 13bd165 commit e1b3ec4
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 43 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/kamesuta/mc/signpic/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
import com.mojang.util.UUIDTypeAdapter;

import net.minecraft.init.Items;
import net.minecraft.tileentity.TileEntitySign;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
Expand Down Expand Up @@ -55,8 +57,7 @@ public void init(final @Nonnull FMLInitializationEvent event) {
super.init(event);

// Replace Sign Renderer
//TODO ItemSignPictureを何とかする
// ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySign.class, Client.renderer);
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySign.class, Client.renderer);

// Event Register
Client.handler.init();
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/kamesuta/mc/signpic/CoreHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@
import com.kamesuta.mc.signpic.http.ICommunicate;
import com.kamesuta.mc.signpic.http.ICommunicateCallback;
import com.kamesuta.mc.signpic.information.Informations;
import com.kamesuta.mc.signpic.render.CustomItemSignRenderer;
import com.kamesuta.mc.signpic.render.SignPicRender;
import com.kamesuta.mc.signpic.state.Progressable;
import com.kamesuta.mc.signpic.state.State;

import net.minecraft.client.resources.model.IBakedModel;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.MouseEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
Expand Down Expand Up @@ -123,15 +126,12 @@ public void onTick(final @Nonnull ClientTickEvent event) {
}
}

//TODO ItemSignPicureを何とかする
/*
@SubscribeEvent
public void onModelBakeEvent(final @Nonnull ModelBakeEvent event) {
final IBakedModel object = (IBakedModel) event.modelRegistry.getObject(CustomItemSignRenderer.modelResourceLocation);
final CustomItemSignRenderer atlas6 = new CustomItemSignRenderer(object);
event.modelRegistry.putObject(CustomItemSignRenderer.modelResourceLocation, atlas6);
}
*/

private boolean debugKey;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public static void init() {
} catch (final SecurityException e) {
Log.log.error("Could not hook TileEntitySign field included in GuiEditSign", e);
}
//TODO ItemSignPictureをなんとかする
// handlers.add(new AnvilHandler());
handlers.add(new AnvilHandler());
}

private boolean isPlaceMode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,26 @@
import com.kamesuta.mc.signpic.entry.content.Content;

import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.Attributes;
import net.minecraftforge.client.model.IFlexibleBakedModel;
import net.minecraftforge.client.model.IPerspectiveAwareModel;
import net.minecraftforge.client.model.ISmartItemModel;

@SuppressWarnings("deprecation")
public class CustomItemSignRenderer implements ISmartItemModel, IPerspectiveAwareModel {
public class CustomItemSignRenderer extends IFlexibleBakedModel.Wrapper implements ISmartItemModel, IPerspectiveAwareModel {
public static final @Nonnull ModelResourceLocation modelResourceLocation = new ModelResourceLocation("minecraft:sign", "inventory");
private final @Nonnull IBakedModel baseModel;
private @Nullable ItemStack itemStack;

@SuppressWarnings("deprecation")
public CustomItemSignRenderer(final @Nonnull IBakedModel model) {
super(model, Attributes.DEFAULT_BAKED_FORMAT);
this.baseModel = model;
}

Expand Down Expand Up @@ -123,45 +123,53 @@ else if (type==net.minecraft.client.renderer.block.model.ItemCameraTransforms.Tr

}

@Override
public boolean isGui3d() {
return false;
}

@Override
public boolean isBuiltInRenderer() {
return false;
}

@Override
public TextureAtlasSprite getTexture() {
return this.baseModel.getTexture();
}

@Override
public @Nullable List<BakedQuad> getFaceQuads(final @Nullable EnumFacing facing) {
return this.baseModel.getFaceQuads(facing);
}
// @Override
// public boolean isGui3d() {
// return super.isGui3d();
// // return false;
// }
//
// @Override
// public boolean isBuiltInRenderer() {
// return super.isBuiltInRenderer();
// // return false;
// }
//
// @Override
// public TextureAtlasSprite getTexture() {
// return super.getTexture();
// // return this.baseModel.getTexture();
// }
//
// @Override
// public @Nullable List<BakedQuad> getFaceQuads(final @Nullable EnumFacing facing) {
// return super.getFaceQuads(facing);
// // return this.baseModel.getFaceQuads(facing);
// }

@Override
public @Nullable List<BakedQuad> getGeneralQuads() {
// return super.getGeneralQuads();
return ImmutableList.of();
}

@Override
@Deprecated
public @Nullable ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}

@Override
@SuppressWarnings("deprecation")
public boolean isAmbientOcclusion() {
return this.baseModel.isAmbientOcclusion();
}

// @Override
// @Deprecated
// public @Nullable ItemCameraTransforms getItemCameraTransforms() {
// return super.getItemCameraTransforms();
// // return ItemCameraTransforms.DEFAULT;
// }
//
// @Override
// @SuppressWarnings("deprecation")
// public boolean isAmbientOcclusion() {
// return super.isAmbientOcclusion();
// // return this.baseModel.isAmbientOcclusion();
// }
//
// @Override
// public VertexFormat getFormat() {
// return Attributes.DEFAULT_BAKED_FORMAT;
// return super.getFormat();
// // return Attributes.DEFAULT_BAKED_FORMAT;
// }
}

0 comments on commit e1b3ec4

Please sign in to comment.